play around with Scintilla and Lexilla

This commit is contained in:
2024-07-02 23:47:26 +08:00
parent d7c71f41b2
commit 727a2ec214
992 changed files with 281111 additions and 195 deletions

128
3rdparty/lexilla532/lexilla/test/README vendored Normal file
View File

@ -0,0 +1,128 @@
README for testing lexers with lexilla/test.
The TestLexers application is run to test the lexing and folding of a set of example
files and thus ensure that the lexers are working correctly.
Lexers are accessed through the Lexilla shared library which must be built first
in the lexilla/src directory.
TestLexers works on Windows, Linux, or macOS and requires a C++20 compiler.
MSVC 2019.4, GCC 9.0, Clang 9.0, and Apple Clang 11.0 are known to work.
MSVC is only available on Windows.
GCC and Clang work on Windows and Linux.
On macOS, only Apple Clang is available.
Lexilla requires some headers from Scintilla to build and expects a directory named
"scintilla" containing a copy of Scintilla 5+ to be a peer of the Lexilla top level
directory conventionally called "lexilla".
To use GCC run lexilla/test/makefile:
make test
To use Clang run lexilla/test/makefile:
make CLANG=1 test
On macOS, CLANG is set automatically so this can just be
make test
To use MSVC:
nmake -f testlexers.mak test
There is also a project file TestLexers.vcxproj that can be loaded into the Visual
C++ IDE.
Adding or Changing Tests
The lexilla/test/examples directory contains a set of tests located in a tree of
subdirectories.
Each directory contains example files along with control files called
SciTE.properties and expected result files with .styled and .folded suffixes.
If an unexpected result occurs then files with the additional suffix .new
(that is .styled.new or .folded.new) may be created.
Each file in the examples tree that does not have an extension of .properties, .styled,
.folded or .new is an example file that will be lexed and folded according to settings
found in SciTE.properties.
The results of the lex will be compared to the corresponding .styled file and if different
the result will be saved to a .styled.new file for checking.
So, if x.cxx is the example, its lexed form will be checked against x.cxx.styled and a
x.cxx.styled.new file may be created. The .styled.new and .styled files contain the text
of the original file along with style number changes in {} like:
{5}function{0} {11}first{10}(){0}
After checking that the .styled.new file is correct, it can be promoted to .styled and
committed to the repository.
The results of the fold will be compared to the corresponding .folded file and if different
the result will be saved to a .folded.new file for checking.
So, if x.cxx is the example, its folded form will be checked against x.cxx.folded and a
x.cxx.folded.new file may be created. The folded.new and .folded files contain the text
of the original file along with fold information to the left like:
2 400 0 + --[[ coding:UTF-8
0 402 0 | comment ]]
There are 4 columns before the file text representing the bits of the fold level:
[flags (0xF000), level (0x0FFF), other (0xFFFF0000), picture].
flags: may be 2 for header or 1 for whitespace.
level: hexadecimal level number starting at 0x400. 'negative' level numbers like 0x3FF
indicate errors in either the folder or in the input file, such as a C file that starts with #endif.
other: can be used as the folder wants. Often used to hold the level of the next line.
picture: gives a rough idea of the fold structure: '|' for level greater than 0x400,
'+' for header, ' ' otherwise.
After checking that the .folded.new file is correct, it can be promoted to .folded and
committed to the repository.
An interactive file comparison program like WinMerge (https://winmerge.org/) on
Windows or meld (https://meldmerge.org/) on Linux can help examine differences
between the .styled and .styled.new files or .folded and .folded.new files.
On Windows, the scripts/PromoteNew.bat script can be run to promote all .new result
files to their base names without .new.
Styling and folding tests are first performed on the file as a whole, then the file is lexed
and folded line-by-line. If there are differences between the whole file and line-by-line
then a message with 'per-line is different' for styling or 'per-line has different folds' will be
printed. Problems with line-by-line processing are often caused by local variables in the
lexer or folder that are incorrectly initialised. Sometimes extra state can be inferred, but it
may have to be stored between runs (possibly with SetLineState) or the code may have to
backtrack to a previous safe line - often something like a line that starts with a character
in the default style.
The SciTE.properties file is similar to properties files used for SciTE but are simpler.
The lexer to be run is defined with a lexer.{filepatterns} statement like:
lexer.*.d=d
Keywords may be defined with keywords settings like:
keywords.*.cxx;*.c=int char
keywords2.*.cxx=open
Substyles and substyle identifiers may be defined with settings like:
substyles.cpp.11=1
substylewords.11.1.*.cxx=map string vector
Other settings are treated as lexer or folder properties and forwarded to the lexer/folder:
lexer.cpp.track.preprocessor=1
fold=1
It is often necessary to set 'fold' in SciTE.properties to cause folding.
Properties can be set for a particular file with an "if $(=" or "match" expression like so:
if $(= $(FileNameExt);HeaderEOLFill_1.md)
lexer.markdown.header.eolfill=1
match Header*1.md
lexer.markdown.header.eolfill=1
More complex tests with additional configurations of keywords or properties can be performed
by creating another subdirectory with the different settings in a new SciTE.properties.
There is some support for running benchmarks on lexers and folders. The properties
testlexers.repeat.lex and testlexers.repeat.fold specify the number of times example
documents are lexed or folded. Set to a large number like testlexers.repeat.lex=10000
then run with a profiler.
A list of styles used in a lex can be displayed with testlexers.list.styles=1.

View File

@ -0,0 +1,329 @@
// Lexilla lexer library
/** @file TestDocument.cxx
** Lexer testing.
**/
// Copyright 2019 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <cassert>
#include <string>
#include <string_view>
#include <vector>
#include <algorithm>
#include <iostream>
#include "ILexer.h"
#include "TestDocument.h"
namespace {
const unsigned char UTF8BytesOfLead[256] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 00 - 0F
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 10 - 1F
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 20 - 2F
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 30 - 3F
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 40 - 4F
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 50 - 5F
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 60 - 6F
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 70 - 7F
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 80 - 8F
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 90 - 9F
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A0 - AF
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B0 - BF
1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // C0 - CF
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // D0 - DF
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // E0 - EF
4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // F0 - FF
};
int UnicodeFromUTF8(const unsigned char *us) noexcept {
assert(us);
switch (UTF8BytesOfLead[us[0]]) {
case 1:
return us[0];
case 2:
return ((us[0] & 0x1F) << 6) + (us[1] & 0x3F);
case 3:
return ((us[0] & 0xF) << 12) + ((us[1] & 0x3F) << 6) + (us[2] & 0x3F);
default:
return ((us[0] & 0x7) << 18) + ((us[1] & 0x3F) << 12) + ((us[2] & 0x3F) << 6) + (us[3] & 0x3F);
}
}
inline constexpr bool UTF8IsTrailByte(unsigned char ch) noexcept {
return (ch >= 0x80) && (ch < 0xc0);
}
constexpr unsigned char TrailByteValue(unsigned char c) {
// The top 2 bits are 0b10 to indicate a trail byte.
// The lower 6 bits contain the value.
return c & 0b0011'1111;
}
}
std::u32string UTF32FromUTF8(std::string_view svu8) {
std::u32string ret;
for (size_t i = 0; i < svu8.length();) {
unsigned char ch = svu8.at(i);
const unsigned int byteCount = UTF8BytesOfLead[ch];
unsigned int value = 0;
if (i + byteCount > svu8.length()) {
// Trying to read past end
ret.push_back(ch);
break;
}
i++;
switch (byteCount) {
case 1:
value = ch;
break;
case 2:
value = (ch & 0x1F) << 6;
ch = svu8.at(i++);
value += TrailByteValue(ch);
break;
case 3:
value = (ch & 0xF) << 12;
ch = svu8.at(i++);
value += TrailByteValue(ch) << 6;
ch = svu8.at(i++);
value += TrailByteValue(ch);
break;
default:
value = (ch & 0x7) << 18;
ch = svu8.at(i++);
value += TrailByteValue(ch) << 12;
ch = svu8.at(i++);
value += TrailByteValue(ch) << 6;
ch = svu8.at(i++);
value += TrailByteValue(ch);
break;
}
ret.push_back(value);
}
return ret;
}
void TestDocument::Set(std::string_view sv) {
text = sv;
textStyles.resize(text.size() + 1);
lineStarts.clear();
endStyled = 0;
lineStarts.push_back(0);
for (size_t pos = 0; pos < text.length(); pos++) {
if (text.at(pos) == '\n') {
lineStarts.push_back(pos + 1);
}
}
if (lineStarts.back() != Length()) {
lineStarts.push_back(Length());
}
lineStates.resize(lineStarts.size() + 1);
lineLevels.resize(lineStarts.size(), 0x400);
}
#if defined(_MSC_VER)
// IDocument interface does not specify noexcept so best to not add it to implementation
#pragma warning(disable: 26440)
#endif
Sci_Position TestDocument::MaxLine() const noexcept {
return lineStarts.size() - 1;
}
int SCI_METHOD TestDocument::Version() const {
return Scintilla::dvRelease4;
}
void SCI_METHOD TestDocument::SetErrorStatus(int) {
}
Sci_Position SCI_METHOD TestDocument::Length() const {
return text.length();
}
void SCI_METHOD TestDocument::GetCharRange(char *buffer, Sci_Position position, Sci_Position lengthRetrieve) const {
text.copy(buffer, lengthRetrieve, position);
}
char SCI_METHOD TestDocument::StyleAt(Sci_Position position) const {
if (position < 0) {
return 0;
}
return textStyles.at(position);
}
Sci_Position SCI_METHOD TestDocument::LineFromPosition(Sci_Position position) const {
if (position >= Length()) {
return MaxLine();
}
const std::vector<Sci_Position>::const_iterator it = std::lower_bound(lineStarts.begin(), lineStarts.end(), position);
Sci_Position line = it - lineStarts.begin();
if (*it > position)
line--;
return line;
}
Sci_Position SCI_METHOD TestDocument::LineStart(Sci_Position line) const {
if (line < 0) {
return 0;
}
if (line >= static_cast<Sci_Position>(lineStarts.size())) {
return Length();
}
return lineStarts.at(line);
}
int SCI_METHOD TestDocument::GetLevel(Sci_Position line) const {
return lineLevels.at(line);
}
int SCI_METHOD TestDocument::SetLevel(Sci_Position line, int level) {
if (line == static_cast<Sci_Position>(lineLevels.size())) {
return 0x400;
}
return lineLevels.at(line) = level;
}
int SCI_METHOD TestDocument::GetLineState(Sci_Position line) const {
return lineStates.at(line);
}
int SCI_METHOD TestDocument::SetLineState(Sci_Position line, int state) {
return lineStates.at(line) = state;
}
void SCI_METHOD TestDocument::StartStyling(Sci_Position position) {
endStyled = position;
}
bool SCI_METHOD TestDocument::SetStyleFor(Sci_Position length, char style) {
for (Sci_Position i = 0; i < length; i++) {
textStyles.at(endStyled) = style;
endStyled++;
}
return true;
}
bool SCI_METHOD TestDocument::SetStyles(Sci_Position length, const char *styles) {
assert(styles);
for (Sci_Position i = 0; i < length; i++) {
textStyles.at(endStyled) = styles[i];
endStyled++;
}
return true;
}
void SCI_METHOD TestDocument::DecorationSetCurrentIndicator(int) {
// Not implemented as no way to read decorations
}
void SCI_METHOD TestDocument::DecorationFillRange(Sci_Position, int, Sci_Position) {
// Not implemented as no way to read decorations
}
void SCI_METHOD TestDocument::ChangeLexerState(Sci_Position, Sci_Position) {
// Not implemented as no watcher to trigger
}
int SCI_METHOD TestDocument::CodePage() const {
// Always UTF-8 for now
return 65001;
}
bool SCI_METHOD TestDocument::IsDBCSLeadByte(char) const {
// Always UTF-8 for now
return false;
}
const char *SCI_METHOD TestDocument::BufferPointer() {
return text.c_str();
}
int SCI_METHOD TestDocument::GetLineIndentation(Sci_Position) {
// Never actually called - lexers use Accessor::IndentAmount
return 0;
}
Sci_Position SCI_METHOD TestDocument::LineEnd(Sci_Position line) const {
const Sci_Position maxLine = MaxLine();
if (line == maxLine || line == maxLine+1) {
return text.length();
}
assert(line < maxLine);
Sci_Position position = LineStart(line + 1);
position--; // Back over CR or LF
// When line terminator is CR+LF, may need to go back one more
if ((position > LineStart(line)) && (text.at(position - 1) == '\r')) {
position--;
}
return position;
}
Sci_Position SCI_METHOD TestDocument::GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const {
Sci_Position pos = positionStart;
if (characterOffset < 0) {
while (characterOffset < 0) {
if (pos <= 0) {
return -1;
}
unsigned char previousByte = text.at(pos - 1);
if (previousByte < 0x80) {
pos--;
characterOffset++;
} else {
while ((pos > 1) && UTF8IsTrailByte(previousByte)) {
pos--;
previousByte = text.at(pos - 1);
}
pos--;
// text[pos] is now a character start
characterOffset++;
}
}
return pos;
}
assert(characterOffset >= 0);
// TODO: invalid UTF-8
while (characterOffset > 0) {
Sci_Position width = 0;
GetCharacterAndWidth(pos, &width);
pos += width;
characterOffset--;
}
return pos;
}
int SCI_METHOD TestDocument::GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const {
// TODO: invalid UTF-8
if ((position < 0) || (position >= Length())) {
// Return NULs before document start and after document end
if (pWidth) {
*pWidth = 1;
}
return '\0';
}
const unsigned char leadByte = text.at(position);
if (leadByte < 0x80) {
if (pWidth) {
*pWidth = 1;
}
return leadByte;
}
const int widthCharBytes = UTF8BytesOfLead[leadByte];
unsigned char charBytes[] = { leadByte,0,0,0 };
for (int b = 1; b < widthCharBytes; b++) {
charBytes[b] = text.at(position + b);
}
if (pWidth) {
*pWidth = widthCharBytes;
}
return UnicodeFromUTF8(charBytes);
}

View File

@ -0,0 +1,58 @@
// Lexilla lexer library
/** @file TestDocument.h
** Lexer testing.
**/
// Copyright 2019 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef TESTDOCUMENT_H
#define TESTDOCUMENT_H
std::u32string UTF32FromUTF8(std::string_view svu8);
class TestDocument : public Scintilla::IDocument {
std::string text;
std::string textStyles;
std::vector<Sci_Position> lineStarts;
std::vector<int> lineStates;
std::vector<int> lineLevels;
Sci_Position endStyled=0;
public:
void Set(std::string_view sv);
TestDocument() = default;
// Deleted so TestDocument objects can not be copied.
TestDocument(const TestDocument&) = delete;
TestDocument(TestDocument&&) = delete;
TestDocument &operator=(const TestDocument&) = delete;
TestDocument &operator=(TestDocument&&) = delete;
virtual ~TestDocument() = default;
Sci_Position MaxLine() const noexcept;
int SCI_METHOD Version() const override;
void SCI_METHOD SetErrorStatus(int status) override;
Sci_Position SCI_METHOD Length() const override;
void SCI_METHOD GetCharRange(char *buffer, Sci_Position position, Sci_Position lengthRetrieve) const override;
char SCI_METHOD StyleAt(Sci_Position position) const override;
Sci_Position SCI_METHOD LineFromPosition(Sci_Position position) const override;
Sci_Position SCI_METHOD LineStart(Sci_Position line) const override;
int SCI_METHOD GetLevel(Sci_Position line) const override;
int SCI_METHOD SetLevel(Sci_Position line, int level) override;
int SCI_METHOD GetLineState(Sci_Position line) const override;
int SCI_METHOD SetLineState(Sci_Position line, int state) override;
void SCI_METHOD StartStyling(Sci_Position position) override;
bool SCI_METHOD SetStyleFor(Sci_Position length, char style) override;
bool SCI_METHOD SetStyles(Sci_Position length, const char *styles) override;
void SCI_METHOD DecorationSetCurrentIndicator(int indicator) override;
void SCI_METHOD DecorationFillRange(Sci_Position position, int value, Sci_Position fillLength) override;
void SCI_METHOD ChangeLexerState(Sci_Position start, Sci_Position end) override;
int SCI_METHOD CodePage() const override;
bool SCI_METHOD IsDBCSLeadByte(char ch) const override;
const char *SCI_METHOD BufferPointer() override;
int SCI_METHOD GetLineIndentation(Sci_Position line) override;
Sci_Position SCI_METHOD LineEnd(Sci_Position line) const override;
Sci_Position SCI_METHOD GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const override;
int SCI_METHOD GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const override;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,177 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<ProjectGuid>{2E0BBD6B-4BC8-4A6C-9DDA-199C27899335}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>lexillatest</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<CodeAnalysisRuleSet>..\..\..\..\..\..\..\Users\Neil\NeilRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<EnableClangTidyCodeAnalysis>true</EnableClangTidyCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<CodeAnalysisRuleSet>..\..\..\..\..\..\..\Users\Neil\NeilRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<CodeAnalysisRuleSet>..\..\..\..\..\..\..\Users\Neil\NeilRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>..\..\scintilla\include;..\include;..\access;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpplatest</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>..\..\scintilla\include;..\include;..\access;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpplatest</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>..\..\scintilla\include;..\include;..\access;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpplatest</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>..\..\scintilla\include;..\include;..\access;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpplatest</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="TestLexers.cxx" />
<ClCompile Include="TestDocument.cxx" />
<ClCompile Include="..\access\LexillaAccess.cxx" />
</ItemGroup>
<ItemGroup>
<None Include="..\bin\Lexilla.dll" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,54 @@
Text=0
*Strong Emphasis (bold) 1=1*
**Strong Emphasis (bold) 2=2**
_Emphasis (italic) 1=3_
__Emphasis (italic) 2=4__
= Heading level 1=5
== Heading level 2=6
=== Heading level 3=7
==== Heading level 4=8
===== Heading level 5=9
====== Heading level 6=10
* Unordered list item=11
. Ordered list item=12
> Block quote=13
https://14.com[Link=14]
----
Code block=15
----
++++
Passthrough block=16
++++
// Comment=17
////
Comment Block=18
////
+Literal=19+
....
Literal Block=20
....
:Attrib=21: Attrib Value=22
ifdef::Macro=23
ifeval::Macro=23
ifndef::Macro=23
endif::Macro=23
audio::Macro=23
include::Macro=23
image::Macro=23
video::Macro=23
asciimath:Macro=23
btn:Macro=23
image:Macro=23
kbd:Macro=23
latexmath:Macro=23
link:Macro=23
mailto:Macro=23
menu:Macro=23
pass:Macro=23
stem:Macro=23
xref:Macro=23
CAUTION:Macro=23
IMPORTANT:Macro=23
NOTE:Macro=23
TIP:Macro=23
WARNING:Macro=23

View File

@ -0,0 +1,55 @@
0 400 0 Text=0
0 400 0 *Strong Emphasis (bold) 1=1*
0 400 0 **Strong Emphasis (bold) 2=2**
0 400 0 _Emphasis (italic) 1=3_
0 400 0 __Emphasis (italic) 2=4__
0 400 0 = Heading level 1=5
0 400 0 == Heading level 2=6
0 400 0 === Heading level 3=7
0 400 0 ==== Heading level 4=8
0 400 0 ===== Heading level 5=9
0 400 0 ====== Heading level 6=10
0 400 0 * Unordered list item=11
0 400 0 . Ordered list item=12
0 400 0 > Block quote=13
0 400 0 https://14.com[Link=14]
0 400 0 ----
0 400 0 Code block=15
0 400 0 ----
0 400 0 ++++
0 400 0 Passthrough block=16
0 400 0 ++++
0 400 0 // Comment=17
0 400 0 ////
0 400 0 Comment Block=18
0 400 0 ////
0 400 0 +Literal=19+
0 400 0 ....
0 400 0 Literal Block=20
0 400 0 ....
0 400 0 :Attrib=21: Attrib Value=22
0 400 0 ifdef::Macro=23
0 400 0 ifeval::Macro=23
0 400 0 ifndef::Macro=23
0 400 0 endif::Macro=23
0 400 0 audio::Macro=23
0 400 0 include::Macro=23
0 400 0 image::Macro=23
0 400 0 video::Macro=23
0 400 0 asciimath:Macro=23
0 400 0 btn:Macro=23
0 400 0 image:Macro=23
0 400 0 kbd:Macro=23
0 400 0 latexmath:Macro=23
0 400 0 link:Macro=23
0 400 0 mailto:Macro=23
0 400 0 menu:Macro=23
0 400 0 pass:Macro=23
0 400 0 stem:Macro=23
0 400 0 xref:Macro=23
0 400 0 CAUTION:Macro=23
0 400 0 IMPORTANT:Macro=23
0 400 0 NOTE:Macro=23
0 400 0 TIP:Macro=23
0 400 0 WARNING:Macro=23
0 400 0

View File

@ -0,0 +1,54 @@
{0}Text=0
{1}*Strong Emphasis (bold) 1=1*{0}
{2}**Strong Emphasis (bold) 2=2**{0}
{3}_Emphasis (italic) 1=3_{0}
{4}__Emphasis (italic) 2=4__{0}
{5}= Heading level 1=5{0}
{6}== Heading level 2=6{0}
{7}=== Heading level 3=7{0}
{8}==== Heading level 4=8{0}
{9}===== Heading level 5=9{0}
{10}====== Heading level 6=10{0}
{11}*{0} Unordered list item=11
{12}.{0} Ordered list item=12
{13}> Block quote=13{0}
https://14.com[{14}Link=14{0}]
{15}----
Code block=15
----{0}
{16}++++
Passthrough block=16
++++{0}
{17}// Comment=17{0}
{18}////
Comment Block=18
////{0}
+{19}Literal=19{0}+
{20}....
Literal Block=20
....{0}
{21}:Attrib=21:{22} Attrib Value=22{0}
{23}ifdef{0}::Macro=23
{23}ifeval{0}::Macro=23
{23}ifndef{0}::Macro=23
{23}endif{0}::Macro=23
{23}audio{0}::Macro=23
{23}include{0}::Macro=23
{23}image{0}::Macro=23
{23}video{0}::Macro=23
{23}asciimat{0}h:Macro=23
{23}btn{0}:Macro=23
{23}image{0}:Macro=23
{23}kbd{0}:Macro=23
{23}latexmath{0}:Macro=23
{23}link{0}:Macro=23
{23}mailto{0}:Macro=23
{23}menu{0}:Macro=23
{23}pass{0}:Macro=23
{23}stem{0}:Macro=23
{23}xref{0}:Macro=23
{23}CAUTION{0}:Macro=23
{23}IMPORTANT{0}:Macro=23
{23}NOTE{0}:Macro=23
{23}TIP{0}:Macro=23
{23}WARNING{0}:Macro=23

View File

@ -0,0 +1,3 @@
code.page=65001
lexer.*.adoc=asciidoc
fold=1

View File

@ -0,0 +1,52 @@
; Enumerate all styles: 0 to 15 except for 11(comment block) which is not yet implemented.
; This is not a viable source file, it just illustrates the different states in isolation.
; comment=1
; Comment
; whitespace=0
; w
; number=2
11
; string=3
"String"
; operator=4
+
; identifier=5
identifier
; CPU instruction=6
add
; math Instruction=7
fadd
; register=8
ECX
; directive=9
section
; directive operand=10
rel
; comment block=11 is for future expansion
; character=12
'character'
; string EOL=13
"no line end
; extended instruction=14
movq
; comment directive=15
comment ~ A multiple-line
comment directive~
;end

View File

@ -0,0 +1,53 @@
0 400 0 ; Enumerate all styles: 0 to 15 except for 11(comment block) which is not yet implemented.
0 400 0 ; This is not a viable source file, it just illustrates the different states in isolation.
0 400 0
0 400 0 ; comment=1
0 400 0 ; Comment
0 400 0
0 400 0 ; whitespace=0
0 400 0 ; w
0 400 0
0 400 0 ; number=2
0 400 0 11
0 400 0
0 400 0 ; string=3
0 400 0 "String"
0 400 0
0 400 0 ; operator=4
0 400 0 +
0 400 0
0 400 0 ; identifier=5
0 400 0 identifier
0 400 0
0 400 0 ; CPU instruction=6
0 400 0 add
0 400 0
0 400 0 ; math Instruction=7
0 400 0 fadd
0 400 0
0 400 0 ; register=8
0 400 0 ECX
0 400 0
0 400 0 ; directive=9
0 400 0 section
0 400 0
0 400 0 ; directive operand=10
0 400 0 rel
0 400 0
0 400 0 ; comment block=11 is for future expansion
0 400 0
0 400 0 ; character=12
0 400 0 'character'
0 400 0
0 400 0 ; string EOL=13
0 400 0 "no line end
0 400 0
0 400 0 ; extended instruction=14
0 400 0 movq
0 400 0
0 400 0 ; comment directive=15
0 400 0 comment ~ A multiple-line
0 400 0 comment directive~
0 400 0
0 400 0 ;end
0 400 0

View File

@ -0,0 +1,52 @@
{1}; Enumerate all styles: 0 to 15 except for 11(comment block) which is not yet implemented.
; This is not a viable source file, it just illustrates the different states in isolation.
{0}
{1}; comment=1
; Comment
{0}
{1}; whitespace=0
{0} {1}; w
{0}
{1}; number=2
{2}11{0}
{1}; string=3
{3}"String"{0}
{1}; operator=4
{4}+{0}
{1}; identifier=5
{5}identifier{0}
{1}; CPU instruction=6
{6}add{0}
{1}; math Instruction=7
{7}fadd{0}
{1}; register=8
{8}ECX{0}
{1}; directive=9
{9}section{0}
{1}; directive operand=10
{10}rel{0}
{1}; comment block=11 is for future expansion
{0}
{1}; character=12
{12}'character'{0}
{1}; string EOL=13
{13}"no line end
{0}
{1}; extended instruction=14
{14}movq{0}
{1}; comment directive=15
{0} {9}comment{0} {15}~ A multiple-line
comment directive~{0}
{1};end

View File

@ -0,0 +1,9 @@
lexer.*.asm=asm
keywords.*.asm=add sub xor mov lea call
keywords2.*.asm=fadd
keywords3.*.asm=rsp rax rcx rdx r8 r9 ecx
keywords4.*.asm=db section alignb resq resqdb global extern equ .bss .text .data start comment
keywords5.*.asm=qword rel
keywords6.*.asm=movd movq

View File

@ -0,0 +1,21 @@
hello="hello, "
hello+=word
echo $hello
for ((i = 2; i > 0; i--)); do
echo postfix dec $i
done
for ((i = 2; i > 0; --i)); do
echo prefix dec $i
done
for ((i = 0; i < 2; i++)); do
echo postfix inc $i
done
for ((i = 0; i < 2; ++i)); do
echo prefix inc $i
done
# issue 215
for ((i = 0; i < 2; i++)); do
echo $((((1)) << i))
done

View File

@ -0,0 +1,22 @@
0 400 0 hello="hello, "
0 400 0 hello+=word
0 400 0 echo $hello
1 400 0
2 400 0 + for ((i = 2; i > 0; i--)); do
0 401 0 | echo postfix dec $i
0 401 0 | done
2 400 0 + for ((i = 2; i > 0; --i)); do
0 401 0 | echo prefix dec $i
0 401 0 | done
2 400 0 + for ((i = 0; i < 2; i++)); do
0 401 0 | echo postfix inc $i
0 401 0 | done
2 400 0 + for ((i = 0; i < 2; ++i)); do
0 401 0 | echo prefix inc $i
0 401 0 | done
1 400 0
0 400 0 # issue 215
2 400 0 + for ((i = 0; i < 2; i++)); do
0 401 0 | echo $((((1)) << i))
0 401 0 | done
0 400 0

View File

@ -0,0 +1,21 @@
{8}hello{7}={5}"hello, "{0}
{8}hello{7}+={8}word{0}
{4}echo{0} {9}$hello{0}
{4}for{0} {7}(({8}i{0} {7}={0} {3}2{7};{0} {8}i{0} {7}>{0} {3}0{7};{0} {8}i{7}--));{0} {4}do{0}
{4}echo{0} {8}postfix{0} {8}dec{0} {9}$i{0}
{4}done{0}
{4}for{0} {7}(({8}i{0} {7}={0} {3}2{7};{0} {8}i{0} {7}>{0} {3}0{7};{0} {7}--{8}i{7}));{0} {4}do{0}
{4}echo{0} {8}prefix{0} {8}dec{0} {9}$i{0}
{4}done{0}
{4}for{0} {7}(({8}i{0} {7}={0} {3}0{7};{0} {8}i{0} {7}<{0} {3}2{7};{0} {8}i{7}++));{0} {4}do{0}
{4}echo{0} {8}postfix{0} {8}inc{0} {9}$i{0}
{4}done{0}
{4}for{0} {7}(({8}i{0} {7}={0} {3}0{7};{0} {8}i{0} {7}<{0} {3}2{7};{0} {7}++{8}i{7}));{0} {4}do{0}
{4}echo{0} {8}prefix{0} {8}inc{0} {9}$i{0}
{4}done{0}
{2}# issue 215{0}
{4}for{0} {7}(({8}i{0} {7}={0} {3}0{7};{0} {8}i{0} {7}<{0} {3}2{7};{0} {8}i{7}++));{0} {4}do{0}
{4}echo{0} {7}$(((({3}1{7})){0} {7}<<{0} {8}i{7})){0}
{4}done{0}

View File

@ -0,0 +1,90 @@
# Lexing numeric literals
# From issue #199
# UUIDs
virsh start 61a6a312-86d3-458c-824a-fa0adc2bd22c
virsh start 61969312-86d3-458c-8249-fa0adc2bd22c
virsh restore /opt/61a6a312-86d3-458c-824a-fa0adc2bd22c-suspend
# Git items
git checkout 998d611b516b0e485803089ecd53fdf0ea707a8c
git log --no-walk 0e2ba9c
git log --no-walk rel-5-2-4-97-g7405d4e7
# Arithmetic and character ranges
declare -i a=1+1; echo $a
[[ $a == [0-9] ]] && echo 1
# Brace expansion
for i in {1..10..2}; do
echo $i
done
for a in {A..Z..2}; do
echo $a
done
# From Kein-Hong Man
#--------------------------------------------------------------------------
# Bash number formats
# (20070712)
# Octal lexing relaxed to allow hex digits to avoid flagging unnecessary
# and misleading number errors; radix-prefixed lexing behaviour is unchanged,
# as those cases are uncommon (to get strict lexing, define PEDANTIC_OCTAL).
# NOTE: Some people may want an entire non-number to be lexed in the normal
# style and not as part-number part-normal. If the user thinks there is a
# better case for the former, please lobby for it on the SF issue tracker.
0123 0567 # octal good
08 0789 077ABC # octal bad (disabled 20070712, now lexed as numbers)
066XYZ # octal bad
0xDEAD 0X1234 # hex good
0xABCMNO 0XGHI # hex bad
# extended "[base#]n" format where base is between 2-64
# digits range are 0-9a-zA-Z@_
# if base <= 36, then alphabets are case insensitive
# this style isn't likely in non-number code, so the lexer currently
# opts to colour the error in red -- send feedback if this is too
# intrusive; 'invalid octals' (but valid text) in red proved annoying...
2#10101 # binary
2#23456 # error (in red)
8#0123456789AB # error (in red)
16#abcDEF123
16#abcpqr # bad
64#xyzXYZ@_789 # full base-64
99#xyzXYZ@_789 # error (in red; invalid base)
111#xyzXYZ@_789 # error (in red; invalid base)
567+0123*0xBCD # with operators
(4#0123-3#012)
# 20070712:
# Octal lexing relaxed to avoid marking some number sequences as octal
# errors. This is because the elements or apps controlled by bash may
# have a different view of numbers, so we avoid flagging unnecessary
# (and misleading) number errors. Radix-prefixed number lexing is
# unchanged, as those cases are uncommon (no feedback on it yet.)
# In the following, red-flagged 'octals' should now be lexed as normal
# numbers, allowing hex digits.
# flightgear missing.sh
scriptversion=2004-09-07.08
# git t/t0000/basic.sh
P=087704a96baf1c2d1c869a8b084481e121c88b5b
# openssh config.guess
*:procnto*:*:* | *:QNX:[0123456789]*:*)
# with hex digits, the following will still be an invalid number
066XYZ

View File

@ -0,0 +1,91 @@
0 400 0 # Lexing numeric literals
1 400 0
0 400 0 # From issue #199
1 400 0
0 400 0 # UUIDs
1 400 0
0 400 0 virsh start 61a6a312-86d3-458c-824a-fa0adc2bd22c
0 400 0 virsh start 61969312-86d3-458c-8249-fa0adc2bd22c
0 400 0 virsh restore /opt/61a6a312-86d3-458c-824a-fa0adc2bd22c-suspend
1 400 0
0 400 0 # Git items
1 400 0
0 400 0 git checkout 998d611b516b0e485803089ecd53fdf0ea707a8c
1 400 0
0 400 0 git log --no-walk 0e2ba9c
0 400 0 git log --no-walk rel-5-2-4-97-g7405d4e7
1 400 0
0 400 0 # Arithmetic and character ranges
1 400 0
0 400 0 declare -i a=1+1; echo $a
0 400 0 [[ $a == [0-9] ]] && echo 1
1 400 0
0 400 0 # Brace expansion
1 400 0
2 400 0 + for i in {1..10..2}; do
0 401 0 | echo $i
0 401 0 | done
2 400 0 + for a in {A..Z..2}; do
0 401 0 | echo $a
0 401 0 | done
1 400 0
0 400 0 # From Kein-Hong Man
1 400 0
2 400 0 + #--------------------------------------------------------------------------
0 401 0 | # Bash number formats
0 401 0 | # (20070712)
0 401 0 | # Octal lexing relaxed to allow hex digits to avoid flagging unnecessary
0 401 0 | # and misleading number errors; radix-prefixed lexing behaviour is unchanged,
0 401 0 | # as those cases are uncommon (to get strict lexing, define PEDANTIC_OCTAL).
1 400 0
2 400 0 + # NOTE: Some people may want an entire non-number to be lexed in the normal
0 401 0 | # style and not as part-number part-normal. If the user thinks there is a
0 401 0 | # better case for the former, please lobby for it on the SF issue tracker.
1 400 0
0 400 0 0123 0567 # octal good
0 400 0 08 0789 077ABC # octal bad (disabled 20070712, now lexed as numbers)
0 400 0 066XYZ # octal bad
0 400 0 0xDEAD 0X1234 # hex good
0 400 0 0xABCMNO 0XGHI # hex bad
1 400 0
2 400 0 + # extended "[base#]n" format where base is between 2-64
0 401 0 | # digits range are 0-9a-zA-Z@_
0 401 0 | # if base <= 36, then alphabets are case insensitive
0 401 0 | # this style isn't likely in non-number code, so the lexer currently
0 401 0 | # opts to colour the error in red -- send feedback if this is too
0 401 0 | # intrusive; 'invalid octals' (but valid text) in red proved annoying...
1 400 0
0 400 0 2#10101 # binary
0 400 0 2#23456 # error (in red)
0 400 0 8#0123456789AB # error (in red)
0 400 0 16#abcDEF123
0 400 0 16#abcpqr # bad
0 400 0 64#xyzXYZ@_789 # full base-64
0 400 0 99#xyzXYZ@_789 # error (in red; invalid base)
0 400 0 111#xyzXYZ@_789 # error (in red; invalid base)
1 400 0
0 400 0 567+0123*0xBCD # with operators
0 400 0 (4#0123-3#012)
1 400 0
2 400 0 + # 20070712:
0 401 0 | # Octal lexing relaxed to avoid marking some number sequences as octal
0 401 0 | # errors. This is because the elements or apps controlled by bash may
0 401 0 | # have a different view of numbers, so we avoid flagging unnecessary
0 401 0 | # (and misleading) number errors. Radix-prefixed number lexing is
0 401 0 | # unchanged, as those cases are uncommon (no feedback on it yet.)
1 400 0
2 400 0 + # In the following, red-flagged 'octals' should now be lexed as normal
0 401 0 | # numbers, allowing hex digits.
1 400 0
0 400 0 # flightgear missing.sh
0 400 0 scriptversion=2004-09-07.08
1 400 0
0 400 0 # git t/t0000/basic.sh
0 400 0 P=087704a96baf1c2d1c869a8b084481e121c88b5b
1 400 0
0 400 0 # openssh config.guess
0 400 0 *:procnto*:*:* | *:QNX:[0123456789]*:*)
1 400 0
0 400 0 # with hex digits, the following will still be an invalid number
0 400 0 066XYZ
0 400 0

View File

@ -0,0 +1,90 @@
{2}# Lexing numeric literals{0}
{2}# From issue #199{0}
{2}# UUIDs{0}
{8}virsh{0} {8}start{0} {8}61a6a312-86d3-458c-824a-fa0adc2bd22c{0}
{8}virsh{0} {8}start{0} {8}61969312-86d3-458c-8249-fa0adc2bd22c{0}
{8}virsh{0} {8}restore{0} {7}/{8}opt{7}/{8}61a6a312-86d3-458c-824a-fa0adc2bd22c-suspend{0}
{2}# Git items{0}
{8}git{0} {8}checkout{0} {8}998d611b516b0e485803089ecd53fdf0ea707a8c{0}
{8}git{0} {8}log{0} {8}--no-walk{0} {8}0e2ba9c{0}
{8}git{0} {8}log{0} {8}--no-walk{0} {8}rel-5-2-4-97-g7405d4e7{0}
{2}# Arithmetic and character ranges{0}
{8}declare{0} {8}-i{0} {8}a{7}={3}1{7}+{3}1{7};{0} {4}echo{0} {9}$a{0}
{7}[[{0} {9}$a{0} {7}=={0} {7}[{8}0-9{7}]{0} {7}]]{0} {7}&&{0} {4}echo{0} {3}1{0}
{2}# Brace expansion{0}
{4}for{0} {8}i{0} {4}in{0} {7}{{3}1{7}..{3}10{7}..{3}2{7}};{0} {4}do{0}
{4}echo{0} {9}$i{0}
{4}done{0}
{4}for{0} {8}a{0} {4}in{0} {7}{{8}A{7}..{8}Z{7}..{3}2{7}};{0} {4}do{0}
{4}echo{0} {9}$a{0}
{4}done{0}
{2}# From Kein-Hong Man{0}
{2}#--------------------------------------------------------------------------{0}
{2}# Bash number formats{0}
{2}# (20070712){0}
{2}# Octal lexing relaxed to allow hex digits to avoid flagging unnecessary{0}
{2}# and misleading number errors; radix-prefixed lexing behaviour is unchanged,{0}
{2}# as those cases are uncommon (to get strict lexing, define PEDANTIC_OCTAL).{0}
{2}# NOTE: Some people may want an entire non-number to be lexed in the normal{0}
{2}# style and not as part-number part-normal. If the user thinks there is a{0}
{2}# better case for the former, please lobby for it on the SF issue tracker.{0}
{3}0123{0} {3}0567{0} {2}# octal good{0}
{3}08{0} {3}0789{0} {8}077ABC{0} {2}# octal bad (disabled 20070712, now lexed as numbers){0}
{8}066XYZ{0} {2}# octal bad{0}
{3}0xDEAD{0} {3}0X1234{0} {2}# hex good{0}
{8}0xABCMNO{0} {8}0XGHI{0} {2}# hex bad{0}
{2}# extended "[base#]n" format where base is between 2-64{0}
{2}# digits range are 0-9a-zA-Z@_{0}
{2}# if base <= 36, then alphabets are case insensitive{0}
{2}# this style isn't likely in non-number code, so the lexer currently{0}
{2}# opts to colour the error in red -- send feedback if this is too{0}
{2}# intrusive; 'invalid octals' (but valid text) in red proved annoying...{0}
{3}2#10101{0} {2}# binary{0}
{1}2#23456{0} {2}# error (in red){0}
{1}8#0123456789{8}AB{0} {2}# error (in red){0}
{3}16#abcDEF123{0}
{8}16#abcpqr{0} {2}# bad{0}
{3}64#xyzXYZ@_789{0} {2}# full base-64{0}
{1}99{8}#xyzXYZ{7}@{8}_789{0} {2}# error (in red; invalid base){0}
{1}111{8}#xyzXYZ{7}@{8}_789{0} {2}# error (in red; invalid base){0}
{3}567{7}+{3}0123{7}*{3}0xBCD{0} {2}# with operators{0}
{8}(4#0123-3#012){0}
{2}# 20070712:{0}
{2}# Octal lexing relaxed to avoid marking some number sequences as octal{0}
{2}# errors. This is because the elements or apps controlled by bash may{0}
{2}# have a different view of numbers, so we avoid flagging unnecessary{0}
{2}# (and misleading) number errors. Radix-prefixed number lexing is{0}
{2}# unchanged, as those cases are uncommon (no feedback on it yet.){0}
{2}# In the following, red-flagged 'octals' should now be lexed as normal{0}
{2}# numbers, allowing hex digits.{0}
{2}# flightgear missing.sh{0}
{8}scriptversion{7}={8}2004-09-07.08{0}
{2}# git t/t0000/basic.sh{0}
{8}P{7}={8}087704a96baf1c2d1c869a8b084481e121c88b5b{0}
{2}# openssh config.guess{0}
{7}*:{8}procnto{7}*:*:*{0} {7}|{0} {7}*:{8}QNX{7}:[{3}0123456789{7}]*:*){0}
{2}# with hex digits, the following will still be an invalid number{0}
{8}066XYZ{0}

View File

@ -0,0 +1,41 @@
-a
#
-b
#
declare -A optionSet=([--help]=0)
for option in {-h,--help,--version,--verbose,-,--}; do
case $option in
-h|--help)
optionSet[--help]=1
echo help: $option
;;
-*-version)
echo version: $option
;;
--)
echo stop
;;
-)
echo stdin
;;
-*[-a-zA-Z0-9])
echo other: $option
;;
esac
done
option=--help
[[ $option == *-h* ]] && echo $option=${optionSet[$option]}
for gcc in gcc{,-1{4..0..-1}}; do
echo $gcc
done
for gcc in gcc{,{-14..-10}}; do
echo $gcc
done
# Tilde-refix ~
~+/foo
~-/foo

View File

@ -0,0 +1,42 @@
0 400 0 -a
0 400 0 #
0 400 0 -b
0 400 0 #
1 400 0
0 400 0 declare -A optionSet=([--help]=0)
2 400 0 + for option in {-h,--help,--version,--verbose,-,--}; do
2 401 0 + case $option in
0 402 0 | -h|--help)
0 402 0 | optionSet[--help]=1
0 402 0 | echo help: $option
0 402 0 | ;;
0 402 0 | -*-version)
0 402 0 | echo version: $option
0 402 0 | ;;
0 402 0 | --)
0 402 0 | echo stop
0 402 0 | ;;
0 402 0 | -)
0 402 0 | echo stdin
0 402 0 | ;;
0 402 0 | -*[-a-zA-Z0-9])
0 402 0 | echo other: $option
0 402 0 | ;;
0 402 0 | esac
0 401 0 | done
1 400 0
0 400 0 option=--help
0 400 0 [[ $option == *-h* ]] && echo $option=${optionSet[$option]}
1 400 0
2 400 0 + for gcc in gcc{,-1{4..0..-1}}; do
0 401 0 | echo $gcc
0 401 0 | done
1 400 0
2 400 0 + for gcc in gcc{,{-14..-10}}; do
0 401 0 | echo $gcc
0 401 0 | done
1 400 0
0 400 0 # Tilde-refix ~
0 400 0 ~+/foo
0 400 0 ~-/foo
0 400 0

View File

@ -0,0 +1,41 @@
{8}-a{0}
{2}#{0}
{8}-b{0}
{2}#{0}
{8}declare{0} {8}-A{0} {8}optionSet{7}=([{8}--help{7}]={3}0{7}){0}
{4}for{0} {8}option{0} {4}in{0} {7}{{8}-h{7},{8}--help{7},{8}--version{7},{8}--verbose{7},{8}-{7},{8}--{7}};{0} {4}do{0}
{4}case{0} {9}$option{0} {4}in{0}
{8}-h{7}|{8}--help{7}){0}
{8}optionSet{7}[{8}--help{7}]={3}1{0}
{4}echo{0} {8}help{7}:{0} {9}$option{0}
{7};;{0}
{8}-{7}*{8}-version{7}){0}
{4}echo{0} {8}version{7}:{0} {9}$option{0}
{7};;{0}
{8}--{7}){0}
{4}echo{0} {8}stop{0}
{7};;{0}
{8}-{7}){0}
{4}echo{0} {8}stdin{0}
{7};;{0}
{8}-{7}*[{8}-a-zA-Z0-9{7}]){0}
{4}echo{0} {8}other{7}:{0} {9}$option{0}
{7};;{0}
{4}esac{0}
{4}done{0}
{8}option{7}={8}--help{0}
{7}[[{0} {9}$option{0} {7}=={0} {7}*{8}-h{7}*{0} {7}]]{0} {7}&&{0} {4}echo{0} {9}$option{7}={10}${optionSet[$option]}{0}
{4}for{0} {8}gcc{0} {4}in{0} {8}gcc{7}{,-{3}1{7}{{3}4{7}..{3}0{7}..-{3}1{7}}};{0} {4}do{0}
{4}echo{0} {9}$gcc{0}
{4}done{0}
{4}for{0} {8}gcc{0} {4}in{0} {8}gcc{7}{,{-{3}14{7}..-{3}10{7}}};{0} {4}do{0}
{4}echo{0} {9}$gcc{0}
{4}done{0}
{2}# Tilde-refix ~{0}
{7}~+/{8}foo{0}
{7}~-/{8}foo{0}

View File

@ -0,0 +1,24 @@
[[ $1 == -e* ]] && echo e
if [[ -d /usr/bin &&
-e /usr/bin/bash ]]; then
echo find bash
fi
if [[ -d /usr/bin && -e /usr/bin/bash ]]; then
echo find bash
fi
if [ -d /usr/bin && -e /usr/bin/bash ]; then
echo find bash
fi
if [ -d /usr/bin &&
-e /usr/bin/bash ]; then
echo find bash
fi
if [ -d /usr/bin && \
-e /usr/bin/bash ]; then
echo find bash
fi

View File

@ -0,0 +1,25 @@
0 400 0 [[ $1 == -e* ]] && echo e
1 400 0
2 400 0 + if [[ -d /usr/bin &&
0 401 0 | -e /usr/bin/bash ]]; then
0 401 0 | echo find bash
0 401 0 | fi
1 400 0
2 400 0 + if [[ -d /usr/bin && -e /usr/bin/bash ]]; then
0 401 0 | echo find bash
0 401 0 | fi
1 400 0
2 400 0 + if [ -d /usr/bin && -e /usr/bin/bash ]; then
0 401 0 | echo find bash
0 401 0 | fi
1 400 0
2 400 0 + if [ -d /usr/bin &&
0 401 0 | -e /usr/bin/bash ]; then
0 401 0 | echo find bash
0 401 0 | fi
1 400 0
2 400 0 + if [ -d /usr/bin && \
0 401 0 | -e /usr/bin/bash ]; then
0 401 0 | echo find bash
0 401 0 | fi
0 400 0

View File

@ -0,0 +1,24 @@
{7}[[{0} {9}$1{0} {7}=={0} {8}-e{7}*{0} {7}]]{0} {7}&&{0} {4}echo{0} {8}e{0}
{4}if{0} {7}[[{0} {4}-d{0} {7}/{8}usr{7}/{8}bin{0} {7}&&{0}
{4}-e{0} {7}/{8}usr{7}/{8}bin{7}/{8}bash{0} {7}]];{0} {4}then{0}
{4}echo{0} {8}find{0} {8}bash{0}
{4}fi{0}
{4}if{0} {7}[[{0} {4}-d{0} {7}/{8}usr{7}/{8}bin{0} {7}&&{0} {4}-e{0} {7}/{8}usr{7}/{8}bin{7}/{8}bash{0} {7}]];{0} {4}then{0}
{4}echo{0} {8}find{0} {8}bash{0}
{4}fi{0}
{4}if{0} {7}[{0} {4}-d{0} {7}/{8}usr{7}/{8}bin{0} {7}&&{0} {8}-e{0} {7}/{8}usr{7}/{8}bin{7}/{8}bash{0} {7}];{0} {4}then{0}
{4}echo{0} {8}find{0} {8}bash{0}
{4}fi{0}
{4}if{0} {7}[{0} {4}-d{0} {7}/{8}usr{7}/{8}bin{0} {7}&&{0}
{8}-e{0} {7}/{8}usr{7}/{8}bin{7}/{8}bash{0} {7}];{0} {4}then{0}
{4}echo{0} {8}find{0} {8}bash{0}
{4}fi{0}
{4}if{0} {7}[{0} {4}-d{0} {7}/{8}usr{7}/{8}bin{0} {7}&&{0} {7}\{0}
{8}-e{0} {7}/{8}usr{7}/{8}bin{7}/{8}bash{0} {7}];{0} {4}then{0}
{4}echo{0} {8}find{0} {8}bash{0}
{4}fi{0}

View File

@ -0,0 +1,61 @@
# Enumerate all styles: 0 to 13
# comment=2
# whitespace=0
# w
# error=1
0#0000
# number=3
123
# keyword=4
set
# double-quoted-string=5
"string"
# single-quoted-string=6
'str'
# operator=7
+
# identifier=8
identifier
# scalar=9
$scalar
$?Status
# parameter-expansion=10
${parameter}
# back-ticks=11
`ls`
# here-doc-delimiter=12, here-doc=13
<<EOF
Here-doc.
EOF
# other quoted types are mapped to current classes
# double-quoted-string=5
$"string"
$'str'
# back-ticks=11
`ls`
$`ls`
$(ls)
# Use substyles
# Substyled identifier=128
map
# Substyled scalar=129
$CWD

View File

@ -0,0 +1,62 @@
0 400 0 # Enumerate all styles: 0 to 13
1 400 0
0 400 0 # comment=2
1 400 0
2 400 0 + # whitespace=0
0 401 0 | # w
1 400 0
0 400 0 # error=1
0 400 0 0#0000
1 400 0
0 400 0 # number=3
0 400 0 123
1 400 0
0 400 0 # keyword=4
0 400 0 set
1 400 0
0 400 0 # double-quoted-string=5
0 400 0 "string"
1 400 0
0 400 0 # single-quoted-string=6
0 400 0 'str'
1 400 0
0 400 0 # operator=7
0 400 0 +
1 400 0
0 400 0 # identifier=8
0 400 0 identifier
1 400 0
0 400 0 # scalar=9
0 400 0 $scalar
0 400 0 $?Status
1 400 0
0 400 0 # parameter-expansion=10
0 400 0 ${parameter}
1 400 0
0 400 0 # back-ticks=11
0 400 0 `ls`
1 400 0
0 400 0 # here-doc-delimiter=12, here-doc=13
2 400 0 + <<EOF
0 401 0 | Here-doc.
0 401 0 | EOF
1 400 0
0 400 0 # other quoted types are mapped to current classes
1 400 0
0 400 0 # double-quoted-string=5
0 400 0 $"string"
0 400 0 $'str'
1 400 0
0 400 0 # back-ticks=11
0 400 0 `ls`
0 400 0 $`ls`
0 400 0 $(ls)
1 400 0
0 400 0 # Use substyles
1 400 0
0 400 0 # Substyled identifier=128
0 400 0 map
1 400 0
0 400 0 # Substyled scalar=129
0 400 0 $CWD
0 400 0

View File

@ -0,0 +1,61 @@
{2}# Enumerate all styles: 0 to 13{0}
{2}# comment=2{0}
{2}# whitespace=0{0}
{2}# w{0}
{2}# error=1{0}
{1}0#0000{0}
{2}# number=3{0}
{3}123{0}
{2}# keyword=4{0}
{4}set{0}
{2}# double-quoted-string=5{0}
{5}"string"{0}
{2}# single-quoted-string=6{0}
{6}'str'{0}
{2}# operator=7{0}
{7}+{0}
{2}# identifier=8{0}
{8}identifier{0}
{2}# scalar=9{0}
{9}$scalar{0}
{9}$?{8}Status{0}
{2}# parameter-expansion=10{0}
{10}${parameter}{0}
{2}# back-ticks=11{0}
{11}`ls`{0}
{2}# here-doc-delimiter=12, here-doc=13{0}
{12}<<EOF{13}
Here-doc.
{12}EOF{0}
{2}# other quoted types are mapped to current classes{0}
{2}# double-quoted-string=5{0}
{5}$"string"{0}
{5}$'str'{0}
{2}# back-ticks=11{0}
{11}`ls`{0}
${11}`ls`{0}
{11}$(ls){0}
{2}# Use substyles{0}
{2}# Substyled identifier=128{0}
{128}map{0}
{2}# Substyled scalar=129{0}
{129}$CWD{0}

View File

@ -0,0 +1,7 @@
echo '$'
echo "$"
echo "$"
echo "$"x""
echo x$'\t'y
echo "x$'\t'y"
echo "x\ty"

View File

@ -0,0 +1,8 @@
0 400 0 echo '$'
0 400 0 echo "$"
0 400 0 echo "$"
0 400 0 echo "$"x""
0 400 0 echo x$'\t'y
0 400 0 echo "x$'\t'y"
0 400 0 echo "x\ty"
0 400 0

View File

@ -0,0 +1,7 @@
{4}echo{0} {6}'$'{0}
{4}echo{0} {5}"$"{0}
{4}echo{0} {5}"$"{0}
{4}echo{0} {5}"$"{8}x{5}""{0}
{4}echo{0} {8}x{5}$'\t'{8}y{0}
{4}echo{0} {5}"x$'\t'y"{0}
{4}echo{0} {5}"x\ty"{0}

View File

@ -0,0 +1,7 @@
if [ -n "$eth" -o -n "$wlan" ]; then
fi
test $((1 + 1)) -eq 2 && echo yes
[ $((1 + 1)) -eq 2 ] && echo yes
ls -a --directory

View File

@ -0,0 +1,8 @@
2 400 0 + if [ -n "$eth" -o -n "$wlan" ]; then
0 401 0 | fi
1 400 0
0 400 0 test $((1 + 1)) -eq 2 && echo yes
0 400 0 [ $((1 + 1)) -eq 2 ] && echo yes
1 400 0
0 400 0 ls -a --directory
0 400 0

View File

@ -0,0 +1,7 @@
{4}if{0} {7}[{0} {4}-n{0} {5}"{9}$eth{5}"{0} {4}-o{0} {4}-n{0} {5}"{9}$wlan{5}"{0} {7}];{0} {4}then{0}
{4}fi{0}
{4}test{0} {7}$(({3}1{0} {7}+{0} {3}1{7})){0} {4}-eq{0} {3}2{0} {7}&&{0} {4}echo{0} {8}yes{0}
{7}[{0} {7}$(({3}1{0} {7}+{0} {3}1{7})){0} {4}-eq{0} {3}2{0} {7}]{0} {7}&&{0} {4}echo{0} {8}yes{0}
{8}ls{0} {8}-a{0} {8}--directory{0}

View File

@ -0,0 +1,11 @@
echo $*
echo $@
echo $?
echo $-
echo $$
echo $!
echo $_
echo $%
echo $<
ifeth=$(ls /sys/class/net | grep ^"$intf" | grep "$intf"$)

View File

@ -0,0 +1,12 @@
0 400 0 echo $*
0 400 0 echo $@
0 400 0 echo $?
0 400 0 echo $-
0 400 0 echo $$
0 400 0 echo $!
0 400 0 echo $_
0 400 0 echo $%
0 400 0 echo $<
1 400 0
0 400 0 ifeth=$(ls /sys/class/net | grep ^"$intf" | grep "$intf"$)
0 400 0

View File

@ -0,0 +1,11 @@
{4}echo{0} {9}$*{0}
{4}echo{0} {9}$@{0}
{4}echo{0} {9}$?{0}
{4}echo{0} {9}$-{0}
{4}echo{0} {9}$${0}
{4}echo{0} {9}$!{0}
{4}echo{0} {9}$_{0}
{4}echo{0} ${7}%{0}
{4}echo{0} ${7}<{0}
{8}ifeth{7}=$({8}ls{0} {7}/{8}sys{7}/{8}class{7}/{8}net{0} {7}|{0} {8}grep{0} {7}^{5}"{9}$intf{5}"{0} {7}|{0} {8}grep{0} {5}"{9}$intf{5}"{0}${7}){0}

View File

@ -0,0 +1,11 @@
echo $*
echo $@
echo $?
echo $-
echo $$
echo $!
echo $_
echo $%
echo $<
ifeth=$(ls /sys/class/net | grep ^"$intf" | grep "$intf"$)

View File

@ -0,0 +1,12 @@
0 400 0 echo $*
0 400 0 echo $@
0 400 0 echo $?
0 400 0 echo $-
0 400 0 echo $$
0 400 0 echo $!
0 400 0 echo $_
0 400 0 echo $%
0 400 0 echo $<
1 400 0
0 400 0 ifeth=$(ls /sys/class/net | grep ^"$intf" | grep "$intf"$)
0 400 0

View File

@ -0,0 +1,11 @@
{4}echo{0} {9}$*{0}
{4}echo{0} {9}$@{0}
{4}echo{0} {9}$?{0}
{4}echo{0} {9}$-{0}
{4}echo{0} {9}$${0}
{4}echo{0} {9}$!{0}
{4}echo{0} {9}$_{0}
{4}echo{0} {9}$%{0}
{4}echo{0} {9}$<{0}
{8}ifeth{7}=$({8}ls{0} {7}/{8}sys{7}/{8}class{7}/{8}net{0} {7}|{0} {8}grep{0} {7}^{5}"{9}$intf{5}"{0} {7}|{0} {8}grep{0} {5}"{9}$intf{5}"{0}${7}){0}

View File

@ -0,0 +1,81 @@
# Nested elements and other complex cases
# String with backtick inclusion
"x`ls`"
# Nested string
"x`ls "*.c"`"
# Not terminated at first "
"x`ls" # "`" #
# String with command inclusion
"x$(ls)"
# Nested command
$(ls -la$(ls *.c))
# Check strings and backticks in command
echo $('ls' "." `ls` $'.' $".")
# $( not terminated by ) if contains unterminated string
$('x) # ') #
$("x) # ") #
$(`x) # `) # Bash doesn't like this
$($'x) # ') #
$($"x) # ") #
# Parameter expansion
var=abcdef
sub=abc
rep='& '
echo ${var/$sub/"${rep}}"} #
# issue 216
option="no[foo]"
option=${option%%[<{().[]*}
echo $option
# '$' in variable
echo $$PID
echo $var${var}
# Here-doc with internal elements
cat <<EOF
$scalar
${var}
$((1+2))
$(pwd)
`pwd`
EOF
# Quoted delimiter treats here-doc as simple string
cat <<"EOF"
$scalar
${var}
$((1+2))
$(pwd)
`pwd`
EOF
# Escaped same as quoted
cat <<\EOF
$scalar
EOF
# Nesting
echo "$((1 + 2))" #
echo "$[1 + 2]" #
# Multiple nesting levels
$(ls -la$(ls $(c) $'*.c' ` $(${s})`))
# Multi-line
$(ls |
more)
$(
`x`
"x"
`ls`
$'x'
$"x"
)
#end -- checks termination of previous

View File

@ -0,0 +1,82 @@
0 400 0 # Nested elements and other complex cases
1 400 0
0 400 0 # String with backtick inclusion
0 400 0 "x`ls`"
0 400 0 # Nested string
0 400 0 "x`ls "*.c"`"
0 400 0 # Not terminated at first "
0 400 0 "x`ls" # "`" #
1 400 0
0 400 0 # String with command inclusion
0 400 0 "x$(ls)"
1 400 0
0 400 0 # Nested command
0 400 0 $(ls -la$(ls *.c))
1 400 0
0 400 0 # Check strings and backticks in command
0 400 0 echo $('ls' "." `ls` $'.' $".")
1 400 0
0 400 0 # $( not terminated by ) if contains unterminated string
0 400 0 $('x) # ') #
0 400 0 $("x) # ") #
0 400 0 $(`x) # `) # Bash doesn't like this
0 400 0 $($'x) # ') #
0 400 0 $($"x) # ") #
1 400 0
0 400 0 # Parameter expansion
0 400 0 var=abcdef
0 400 0 sub=abc
0 400 0 rep='& '
0 400 0 echo ${var/$sub/"${rep}}"} #
0 400 0 # issue 216
0 400 0 option="no[foo]"
0 400 0 option=${option%%[<{().[]*}
0 400 0 echo $option
1 400 0
0 400 0 # '$' in variable
0 400 0 echo $$PID
0 400 0 echo $var${var}
1 400 0
0 400 0 # Here-doc with internal elements
2 400 0 + cat <<EOF
0 401 0 | $scalar
0 401 0 | ${var}
0 401 0 | $((1+2))
0 401 0 | $(pwd)
0 401 0 | `pwd`
0 401 0 | EOF
1 400 0
0 400 0 # Quoted delimiter treats here-doc as simple string
2 400 0 + cat <<"EOF"
0 401 0 | $scalar
0 401 0 | ${var}
0 401 0 | $((1+2))
0 401 0 | $(pwd)
0 401 0 | `pwd`
0 401 0 | EOF
1 400 0
0 400 0 # Escaped same as quoted
2 400 0 + cat <<\EOF
0 401 0 | $scalar
0 401 0 | EOF
1 400 0
0 400 0 # Nesting
0 400 0 echo "$((1 + 2))" #
0 400 0 echo "$[1 + 2]" #
1 400 0
0 400 0 # Multiple nesting levels
0 400 0 $(ls -la$(ls $(c) $'*.c' ` $(${s})`))
1 400 0
0 400 0 # Multi-line
0 400 0 $(ls |
0 400 0 more)
1 400 0
0 400 0 $(
0 400 0 `x`
0 400 0 "x"
0 400 0 `ls`
0 400 0 $'x'
0 400 0 $"x"
0 400 0 )
0 400 0 #end -- checks termination of previous
0 400 0

View File

@ -0,0 +1,81 @@
{2}# Nested elements and other complex cases{0}
{2}# String with backtick inclusion{0}
{5}"x`ls`"{0}
{2}# Nested string{0}
{5}"x`ls "*.c"`"{0}
{2}# Not terminated at first "{0}
{5}"x`ls" # "`"{0} {2}#{0}
{2}# String with command inclusion{0}
{5}"x$(ls)"{0}
{2}# Nested command{0}
{11}$(ls -la$(ls *.c)){0}
{2}# Check strings and backticks in command{0}
{4}echo{0} {11}$('ls' "." `ls` $'.' $"."){0}
{2}# $( not terminated by ) if contains unterminated string{0}
{11}$('x) # '){0} {2}#{0}
{11}$("x) # "){0} {2}#{0}
{11}$(`x) # `){0} {2}# Bash doesn't like this{0}
{11}$($'x) # '){0} {2}#{0}
{11}$($"x) # "){0} {2}#{0}
{2}# Parameter expansion{0}
{8}var{7}={8}abcdef{0}
{8}sub{7}={8}abc{0}
{8}rep{7}={6}'& '{0}
{4}echo{0} {10}${var/$sub/"${rep}}"}{0} {2}#{0}
{2}# issue 216{0}
{8}option{7}={5}"no[foo]"{0}
{8}option{7}={10}${option%%[<{().[]*}{0}
{4}echo{0} {9}$option{0}
{2}# '$' in variable{0}
{4}echo{0} {9}$${8}PID{0}
{4}echo{0} {9}$var{10}${var}{0}
{2}# Here-doc with internal elements{0}
{4}cat{0} {12}<<EOF{13}
$scalar
${var}
$((1+2))
$(pwd)
`pwd`
{12}EOF{0}
{2}# Quoted delimiter treats here-doc as simple string{0}
{4}cat{0} {12}<<"EOF"{13}
$scalar
${var}
$((1+2))
$(pwd)
`pwd`
{12}EOF{0}
{2}# Escaped same as quoted{0}
{4}cat{0} {12}<<\EOF{13}
$scalar
{12}EOF{0}
{2}# Nesting{0}
{4}echo{0} {5}"$((1 + 2))"{0} {2}#{0}
{4}echo{0} {5}"$[1 + 2]"{0} {2}#{0}
{2}# Multiple nesting levels{0}
{11}$(ls -la$(ls $(c) $'*.c' ` $(${s})`)){0}
{2}# Multi-line{0}
{11}$(ls |
more){0}
{11}$(
`x`
"x"
`ls`
$'x'
$"x"
){0}
{2}#end -- checks termination of previous{0}

View File

@ -0,0 +1,26 @@
# Use lexer.bash.command.substitution=2 to style command substitution
# so that both the scope of the command and the internal structure are visible.
# Nested command
$(ls -la$(ls *.c))
# Check strings and backticks in command
echo $('ls' "." `ls` $'.' $".")
PROJECT_DIR=$(rlwrap -S "Enter source path: " -e '' -i -o cat)
# Multiple nesting levels
$(ls -la$(ls $(c) $'*.c' ` $(${s})`))
# Multi-line
$(ls |
more)
$(
`x`
"x"
`ls`
$'x'
$"x"
)
#end -- checks termination of previous

View File

@ -0,0 +1,27 @@
2 400 0 + # Use lexer.bash.command.substitution=2 to style command substitution
0 401 0 | # so that both the scope of the command and the internal structure are visible.
1 400 0
0 400 0 # Nested command
0 400 0 $(ls -la$(ls *.c))
1 400 0
0 400 0 # Check strings and backticks in command
0 400 0 echo $('ls' "." `ls` $'.' $".")
1 400 0
0 400 0 PROJECT_DIR=$(rlwrap -S "Enter source path: " -e '' -i -o cat)
1 400 0
0 400 0 # Multiple nesting levels
0 400 0 $(ls -la$(ls $(c) $'*.c' ` $(${s})`))
1 400 0
0 400 0 # Multi-line
0 400 0 $(ls |
0 400 0 more)
1 400 0
0 400 0 $(
0 400 0 `x`
0 400 0 "x"
0 400 0 `ls`
0 400 0 $'x'
0 400 0 $"x"
0 400 0 )
0 400 0 #end -- checks termination of previous
0 400 0

View File

@ -0,0 +1,26 @@
{2}# Use lexer.bash.command.substitution=2 to style command substitution{0}
{2}# so that both the scope of the command and the internal structure are visible.{0}
{2}# Nested command{0}
{71}$({72}ls{64} {72}-la{71}$({72}ls{64} {71}*.{72}c{71})){0}
{2}# Check strings and backticks in command{0}
{4}echo{0} {71}$({70}'ls'{64} {69}"."{64} {75}`ls`{64} {69}$'.'{64} {69}$"."{71}){0}
{8}PROJECT_DIR{7}={71}$({72}rlwrap{64} {72}-S{64} {69}"Enter source path: "{64} {72}-e{64} {70}''{64} {72}-i{64} {72}-o{64} {72}cat{71}){0}
{2}# Multiple nesting levels{0}
{71}$({72}ls{64} {72}-la{71}$({72}ls{64} {71}$({72}c{71}){64} {69}$'*.c'{64} {75}` $(${s})`{71})){0}
{2}# Multi-line{0}
{71}$({72}ls{64} {71}|{64}
{72}more{71}){0}
{71}$({64}
{75}`x`{64}
{69}"x"{64}
{75}`ls`{64}
{69}$'x'{64}
{69}$"x"{64}
{71}){0}
{2}#end -- checks termination of previous{0}

View File

@ -0,0 +1,77 @@
# Nested elements and other complex cases
# String with backtick inclusion
"x`ls`"
# Nested string
"x`ls "*.c"`"
# Not terminated at first "
"x`ls" # "`" #
# String with command inclusion
"x$(ls)"
# Nested command
$(ls -la$(ls *.c))
# Check strings and backticks in command
echo $('ls' "." `ls` $'.' $".")
# $( not terminated by ) if contains unterminated string
$('x) # ') #
$("x) # ") #
$(`x) # `) # Bash doesn't like this
$($'x) # ') #
$($"x) # ") #
# Parameter expansion
var=abcdef
sub=abc
rep='& '
echo ${var/$sub/"${rep}}"} #
# '$' in variable
echo $$PID
echo $var${var}
# Here-doc with internal elements
cat <<EOF
$scalar
${var}
$((1+2))
$(pwd)
`pwd`
EOF
# Quoted delimiter treats here-doc as simple string
cat <<"EOF"
$scalar
${var}
$((1+2))
$(pwd)
`pwd`
EOF
# Escaped same as quoted
cat <<\EOF
$scalar
EOF
# Nesting
echo "$((1 + 2))" #
echo "$[1 + 2]" #
# Multiple nesting levels
$(ls -la$(ls $(c) $'*.c' ` $(${s})`))
# Multi-line
$(ls |
more)
$(
`x`
"x"
`ls`
$'x'
$"x"
)
#end -- checks termination of previous

View File

@ -0,0 +1,78 @@
0 400 0 # Nested elements and other complex cases
1 400 0
0 400 0 # String with backtick inclusion
0 400 0 "x`ls`"
0 400 0 # Nested string
0 400 0 "x`ls "*.c"`"
0 400 0 # Not terminated at first "
0 400 0 "x`ls" # "`" #
1 400 0
0 400 0 # String with command inclusion
0 400 0 "x$(ls)"
1 400 0
0 400 0 # Nested command
0 400 0 $(ls -la$(ls *.c))
1 400 0
0 400 0 # Check strings and backticks in command
0 400 0 echo $('ls' "." `ls` $'.' $".")
1 400 0
0 400 0 # $( not terminated by ) if contains unterminated string
0 400 0 $('x) # ') #
0 400 0 $("x) # ") #
0 400 0 $(`x) # `) # Bash doesn't like this
0 400 0 $($'x) # ') #
0 400 0 $($"x) # ") #
1 400 0
0 400 0 # Parameter expansion
0 400 0 var=abcdef
0 400 0 sub=abc
0 400 0 rep='& '
0 400 0 echo ${var/$sub/"${rep}}"} #
1 400 0
0 400 0 # '$' in variable
0 400 0 echo $$PID
0 400 0 echo $var${var}
1 400 0
0 400 0 # Here-doc with internal elements
2 400 0 + cat <<EOF
0 401 0 | $scalar
0 401 0 | ${var}
0 401 0 | $((1+2))
0 401 0 | $(pwd)
0 401 0 | `pwd`
0 401 0 | EOF
1 400 0
0 400 0 # Quoted delimiter treats here-doc as simple string
2 400 0 + cat <<"EOF"
0 401 0 | $scalar
0 401 0 | ${var}
0 401 0 | $((1+2))
0 401 0 | $(pwd)
0 401 0 | `pwd`
0 401 0 | EOF
1 400 0
0 400 0 # Escaped same as quoted
2 400 0 + cat <<\EOF
0 401 0 | $scalar
0 401 0 | EOF
1 400 0
0 400 0 # Nesting
0 400 0 echo "$((1 + 2))" #
0 400 0 echo "$[1 + 2]" #
1 400 0
0 400 0 # Multiple nesting levels
0 400 0 $(ls -la$(ls $(c) $'*.c' ` $(${s})`))
1 400 0
0 400 0 # Multi-line
0 400 0 $(ls |
0 400 0 more)
1 400 0
0 400 0 $(
0 400 0 `x`
0 400 0 "x"
0 400 0 `ls`
0 400 0 $'x'
0 400 0 $"x"
0 400 0 )
0 400 0 #end -- checks termination of previous
0 400 0

View File

@ -0,0 +1,77 @@
{2}# Nested elements and other complex cases{0}
{2}# String with backtick inclusion{0}
{5}"x{11}`ls`{5}"{0}
{2}# Nested string{0}
{5}"x{11}`ls {5}"*.c"{11}`{5}"{0}
{2}# Not terminated at first "{0}
{5}"x{11}`ls{5}" # "{11}`{5}"{0} {2}#{0}
{2}# String with command inclusion{0}
{5}"x{7}$({8}ls{7}){5}"{0}
{2}# Nested command{0}
{7}$({8}ls{0} {8}-la{7}$({8}ls{0} {7}*.{8}c{7})){0}
{2}# Check strings and backticks in command{0}
{4}echo{0} {7}$({6}'ls'{0} {5}"."{0} {11}`ls`{0} {5}$'.'{0} {5}$"."{7}){0}
{2}# $( not terminated by ) if contains unterminated string{0}
{7}$({6}'x) # '{7}){0} {2}#{0}
{7}$({5}"x) # "{7}){0} {2}#{0}
{7}$({11}`x) # `{7}){0} {2}# Bash doesn't like this{0}
{7}$({5}$'x) # '{7}){0} {2}#{0}
{7}$({5}$"x) # "{7}){0} {2}#{0}
{2}# Parameter expansion{0}
{8}var{7}={8}abcdef{0}
{8}sub{7}={8}abc{0}
{8}rep{7}={6}'& '{0}
{4}echo{0} {10}${var/{9}$sub{10}/{5}"{10}${rep}{5}}"{10}}{0} {2}#{0}
{2}# '$' in variable{0}
{4}echo{0} {9}$${8}PID{0}
{4}echo{0} {9}$var{10}${var}{0}
{2}# Here-doc with internal elements{0}
{4}cat{0} {12}<<EOF{13}
{9}$scalar{13}
{10}${var}{13}
{7}$(({3}1{7}+{3}2{7})){13}
{7}$({4}pwd{7}){13}
{11}`pwd`{13}
{12}EOF{0}
{2}# Quoted delimiter treats here-doc as simple string{0}
{4}cat{0} {12}<<"EOF"{13}
$scalar
${var}
$((1+2))
$(pwd)
`pwd`
{12}EOF{0}
{2}# Escaped same as quoted{0}
{4}cat{0} {12}<<\EOF{13}
$scalar
{12}EOF{0}
{2}# Nesting{0}
{4}echo{0} {5}"{7}$(({3}1{0} {7}+{0} {3}2{7})){5}"{0} {2}#{0}
{4}echo{0} {5}"{7}$[{3}1{0} {7}+{0} {3}2{7}]{5}"{0} {2}#{0}
{2}# Multiple nesting levels{0}
{7}$({8}ls{0} {8}-la{7}$({8}ls{0} {7}$({8}c{7}){0} {5}$'*.c'{0} {11}` {7}$({10}${s}{7}){11}`{7})){0}
{2}# Multi-line{0}
{7}$({8}ls{0} {7}|{0}
{8}more{7}){0}
{7}$({0}
{11}`x`{0}
{5}"x"{0}
{11}`ls`{0}
{5}$'x'{0}
{5}$"x"{0}
{7}){0}
{2}#end -- checks termination of previous{0}

View File

@ -0,0 +1,41 @@
lexer.*.bsh;*.zsh=bash
fold=1
fold.comment=1
keywords.*.bsh;*.zsh=case cat do done echo else esac exit export fi find for if in print pwd set setopt then while
# Can use substyles for identifiers and scalars
substyles.bash.8=1
substylewords.8.1.*.bsh=map
substyles.bash.9=1
substylewords.9.1.*.bsh=CWD
lexer.bash.styling.inside.string=0
lexer.bash.styling.inside.backticks=0
lexer.bash.styling.inside.parameter=0
lexer.bash.styling.inside.heredoc=0
lexer.bash.command.substitution=0
match Issue180.bsh
lexer.bash.styling.inside.string=1
match Issue182.bsh
lexer.bash.styling.inside.string=1
match Issue184.bsh
lexer.bash.styling.inside.string=1
lexer.bash.command.substitution=1
match Issue184Copy.bsh
lexer.bash.styling.inside.string=1
lexer.bash.command.substitution=1
lexer.bash.special.parameter=*@#?-$!%<
match NestedStyledInside.bsh
lexer.bash.styling.inside.string=1
lexer.bash.styling.inside.backticks=1
lexer.bash.styling.inside.parameter=1
lexer.bash.styling.inside.heredoc=1
lexer.bash.command.substitution=1
match NestedRich.bsh
lexer.bash.command.substitution=2

View File

@ -0,0 +1,15 @@
# Tests for line continuation.
# Issue #195.
#backslash1\
echo 1
#backslash2\\
echo 2
if [ 1 ]; then
backslash1=A\
fi
backslash2=B\\
fi
echo $backslash1, $backslash2

View File

@ -0,0 +1,16 @@
2 400 0 + # Tests for line continuation.
0 401 0 | # Issue #195.
1 400 0
0 400 0 #backslash1\
0 400 0 echo 1
0 400 0 #backslash2\\
0 400 0 echo 2
1 400 0
2 400 0 + if [ 1 ]; then
0 401 0 | backslash1=A\
0 401 0 | fi
0 401 0 | backslash2=B\\
0 401 0 | fi
1 400 0
0 400 0 echo $backslash1, $backslash2
0 400 0

View File

@ -0,0 +1,15 @@
{2}# Tests for line continuation.{0}
{2}# Issue #195.{0}
{2}#backslash1\{0}
{4}echo{0} {3}1{0}
{2}#backslash2\\{0}
{4}echo{0} {3}2{0}
{4}if{0} {7}[{0} {3}1{0} {7}];{0} {4}then{0}
{8}backslash1{7}={8}A{7}\{0}
{8}fi{0}
{8}backslash2{7}={8}B\\{0}
{4}fi{0}
{4}echo{0} {9}$backslash1{7},{0} {9}$backslash2{0}

View File

@ -0,0 +1,51 @@
#!/bin/zsh
# Tests for zsh extensions
# Can be executed by zsh with reasonable results
# Some of these were implemented by commit [87286d] for Scintilla bug #1794
# https://zsh.sourceforge.io/Doc/Release/Expansion.html
# Where # does not start a comment
## Formatting base
print $(( [#8] y = 33 ))
print $(( [##8] 32767 ))
# Formatting base and grouping
print $(( [#16_4] 65536 ** 2 ))
## Character values
print $(( ##T+0 ))
print $(( ##^G+0 ))
# Failure: does not work when - included for bindkey syntax. \M-\C-x means Meta+Ctrl+x.
print $(( ##\M-\C-x+0 ))
# Value of first character of variable in expression
var=Tree
print $(( #var+0 ))
## Extended glob
setopt extended_glob
# # is similar to *, ## similar to +
echo [A-Za-z]#.bsh
echo [A-Za-z]##.bsh
# 13 character file names
echo **/[a-zA-Z.](#c13)
# 13-15 character file names
echo **/[a-zA-Z.](#c13,15)
## Glob flag
# i=case-insensitive
echo (#i)a*
# b=back-references
foo="a_string_with_a_message"
if [[ $foo = (a|an)_(#b)(*) ]]; then
print ${foo[$mbegin[1],$mend[1]]}
fi

View File

@ -0,0 +1,52 @@
2 400 0 + #!/bin/zsh
0 401 0 | # Tests for zsh extensions
0 401 0 | # Can be executed by zsh with reasonable results
0 401 0 | # Some of these were implemented by commit [87286d] for Scintilla bug #1794
0 401 0 | # https://zsh.sourceforge.io/Doc/Release/Expansion.html
1 400 0
0 400 0 # Where # does not start a comment
1 400 0
1 400 0
0 400 0 ## Formatting base
0 400 0 print $(( [#8] y = 33 ))
0 400 0 print $(( [##8] 32767 ))
1 400 0
0 400 0 # Formatting base and grouping
0 400 0 print $(( [#16_4] 65536 ** 2 ))
1 400 0
1 400 0
0 400 0 ## Character values
0 400 0 print $(( ##T+0 ))
0 400 0 print $(( ##^G+0 ))
0 400 0 # Failure: does not work when - included for bindkey syntax. \M-\C-x means Meta+Ctrl+x.
0 400 0 print $(( ##\M-\C-x+0 ))
1 400 0
0 400 0 # Value of first character of variable in expression
0 400 0 var=Tree
0 400 0 print $(( #var+0 ))
1 400 0
1 400 0
0 400 0 ## Extended glob
0 400 0 setopt extended_glob
1 400 0
0 400 0 # # is similar to *, ## similar to +
0 400 0 echo [A-Za-z]#.bsh
0 400 0 echo [A-Za-z]##.bsh
1 400 0
0 400 0 # 13 character file names
0 400 0 echo **/[a-zA-Z.](#c13)
0 400 0 # 13-15 character file names
0 400 0 echo **/[a-zA-Z.](#c13,15)
1 400 0
1 400 0
0 400 0 ## Glob flag
1 400 0
0 400 0 # i=case-insensitive
0 400 0 echo (#i)a*
1 400 0
0 400 0 # b=back-references
0 400 0 foo="a_string_with_a_message"
2 400 0 + if [[ $foo = (a|an)_(#b)(*) ]]; then
0 401 0 | print ${foo[$mbegin[1],$mend[1]]}
0 401 0 | fi
0 400 0

View File

@ -0,0 +1,51 @@
{2}#!/bin/zsh{0}
{2}# Tests for zsh extensions{0}
{2}# Can be executed by zsh with reasonable results{0}
{2}# Some of these were implemented by commit [87286d] for Scintilla bug #1794{0}
{2}# https://zsh.sourceforge.io/Doc/Release/Expansion.html{0}
{2}# Where # does not start a comment{0}
{2}## Formatting base{0}
{4}print{0} {7}$(({0} {7}[{8}#8{7}]{0} {8}y{0} {7}={0} {3}33{0} {7})){0}
{4}print{0} {7}$(({0} {7}[{8}##8{7}]{0} {3}32767{0} {7})){0}
{2}# Formatting base and grouping{0}
{4}print{0} {7}$(({0} {7}[{8}#16_4{7}]{0} {3}65536{0} {7}**{0} {3}2{0} {7})){0}
{2}## Character values{0}
{4}print{0} {7}$(({0} {8}##T{7}+{3}0{0} {7})){0}
{4}print{0} {7}$(({0} {8}##^G{7}+{3}0{0} {7})){0}
{2}# Failure: does not work when - included for bindkey syntax. \M-\C-x means Meta+Ctrl+x.{0}
{4}print{0} {7}$(({0} {8}##\M{7}-{8}\C{7}-{8}x{7}+{3}0{0} {7})){0}
{2}# Value of first character of variable in expression{0}
{8}var{7}={8}Tree{0}
{4}print{0} {7}$(({0} {8}#var{7}+{3}0{0} {7})){0}
{2}## Extended glob{0}
{4}setopt{0} {8}extended_glob{0}
{2}# # is similar to *, ## similar to +{0}
{4}echo{0} {7}[{8}A-Za-z{7}]{8}#.bsh{0}
{4}echo{0} {7}[{8}A-Za-z{7}]{8}##.bsh{0}
{2}# 13 character file names{0}
{4}echo{0} {7}**/[{8}a-zA-Z.{7}]{8}(#c13){0}
{2}# 13-15 character file names{0}
{4}echo{0} {7}**/[{8}a-zA-Z.{7}]{8}(#c13,15){0}
{2}## Glob flag{0}
{2}# i=case-insensitive{0}
{4}echo{0} {8}(#i)a{7}*{0}
{2}# b=back-references{0}
{8}foo{7}={5}"a_string_with_a_message"{0}
{4}if{0} {7}[[{0} {9}$foo{0} {7}={0} {7}({8}a{7}|{8}an{7}){8}_(#b){7}(*){0} {7}]];{0} {4}then{0}
{4}print{0} {10}${foo[$mbegin[1],$mend[1]]}{0}
{4}fi{0}

View File

@ -0,0 +1,52 @@
#!/usr/bin/env bash
set -e
# -----------------------------------------------------------------------------
# Voluptatem dolore magnam eius quisquam eius dolor labore. Porro dolor amet ut.
# Numquam labore amet modi. Dolorem velit numquam porro est quiquia ipsum quisquam.
# Magnam consectetur est voluptatem aliquam adipisci. Sed dolorem quaerat quiquia.
# -----------------------------------------------------------------------------
export PYTHONPATH="scripts:$PYTHONPATH"
if [[ -z "$1" ]]; then
PROJECT_DIR=$(rlwrap -S "Enter source path: " -e '' -i -o cat)
PROJECT_PATH="$(pwd)/$PROJECT_DIR"
else
PROJECT_PATH="$(pwd)/${1}"
fi
OUT_FILE=${PROJECT_PATH}/testing.txt
(cat<<EOF
Last run $(date +'%Y-%m-%d') at $(date +'%H:%M:%S.%2N')
EOF
) > $OUT_FILE
# Issue 188, keyword before redirection operator
pwd>>$OUT_FILE
find "$PROJECT_PATH/src" -maxdepth 1 -type f |\
while read -r f; do
{
python3 -c "print();print('='*50)";\
echo `basename "$f"` | tr -d 'x';\
python3 -c "print('='*50)";\
python3 "$f";\
} >> $OUT_FILE
done
# Issue 137, should be shift but here-doc was detected
echo $(( x << END ))
pwd
END
# Issue 194, failed to understand character escaping so string unterminated
echo "foo `echo foo \\" bar` bar"
echo "xinput set-prop bla \"blub\" `grep bla $WRITE_APPENDIX/var/lib/path.txt | cut -d \\" -f 4`" >/some_file.sh
# Issue 194, $ before end of backticks is literal
echo `echo \$`
echo `echo \$bar\$`
echo `echo $`
echo `echo $bar$`
INVALID_NUMBER=0#0000

View File

@ -0,0 +1,53 @@
0 400 0 #!/usr/bin/env bash
0 400 0 set -e
2 400 0 + # -----------------------------------------------------------------------------
0 401 0 | # Voluptatem dolore magnam eius quisquam eius dolor labore. Porro dolor amet ut.
0 401 0 | # Numquam labore amet modi. Dolorem velit numquam porro est quiquia ipsum quisquam.
0 401 0 | # Magnam consectetur est voluptatem aliquam adipisci. Sed dolorem quaerat quiquia.
0 401 0 | # -----------------------------------------------------------------------------
0 400 0 export PYTHONPATH="scripts:$PYTHONPATH"
1 400 0
2 400 0 + if [[ -z "$1" ]]; then
0 401 0 | PROJECT_DIR=$(rlwrap -S "Enter source path: " -e '' -i -o cat)
0 401 0 | PROJECT_PATH="$(pwd)/$PROJECT_DIR"
0 401 0 | else
0 401 0 | PROJECT_PATH="$(pwd)/${1}"
0 401 0 | fi
1 400 0
0 400 0 OUT_FILE=${PROJECT_PATH}/testing.txt
1 400 0
2 400 0 + (cat<<EOF
0 401 0 | Last run $(date +'%Y-%m-%d') at $(date +'%H:%M:%S.%2N')
0 401 0 | EOF
0 400 0 ) > $OUT_FILE
1 400 0
0 400 0 # Issue 188, keyword before redirection operator
0 400 0 pwd>>$OUT_FILE
1 400 0
0 400 0 find "$PROJECT_PATH/src" -maxdepth 1 -type f |\
2 400 0 + while read -r f; do
2 401 0 + {
0 402 0 | python3 -c "print();print('='*50)";\
0 402 0 | echo `basename "$f"` | tr -d 'x';\
0 402 0 | python3 -c "print('='*50)";\
0 402 0 | python3 "$f";\
0 402 0 | } >> $OUT_FILE
0 401 0 | done
1 400 0
0 400 0 # Issue 137, should be shift but here-doc was detected
0 400 0 echo $(( x << END ))
0 400 0 pwd
0 400 0 END
1 400 0
0 400 0 # Issue 194, failed to understand character escaping so string unterminated
0 400 0 echo "foo `echo foo \\" bar` bar"
0 400 0 echo "xinput set-prop bla \"blub\" `grep bla $WRITE_APPENDIX/var/lib/path.txt | cut -d \\" -f 4`" >/some_file.sh
1 400 0
0 400 0 # Issue 194, $ before end of backticks is literal
0 400 0 echo `echo \$`
0 400 0 echo `echo \$bar\$`
0 400 0 echo `echo $`
0 400 0 echo `echo $bar$`
1 400 0
0 400 0 INVALID_NUMBER=0#0000
0 400 0

View File

@ -0,0 +1,52 @@
{2}#!/usr/bin/env bash{0}
{4}set{0} {8}-e{0}
{2}# -----------------------------------------------------------------------------{0}
{2}# Voluptatem dolore magnam eius quisquam eius dolor labore. Porro dolor amet ut.{0}
{2}# Numquam labore amet modi. Dolorem velit numquam porro est quiquia ipsum quisquam.{0}
{2}# Magnam consectetur est voluptatem aliquam adipisci. Sed dolorem quaerat quiquia.{0}
{2}# -----------------------------------------------------------------------------{0}
{4}export{0} {8}PYTHONPATH{7}={5}"scripts:$PYTHONPATH"{0}
{4}if{0} {7}[[{0} {4}-z{0} {5}"$1"{0} {7}]];{0} {4}then{0}
{8}PROJECT_DIR{7}={11}$(rlwrap -S "Enter source path: " -e '' -i -o cat){0}
{8}PROJECT_PATH{7}={5}"$(pwd)/$PROJECT_DIR"{0}
{4}else{0}
{8}PROJECT_PATH{7}={5}"$(pwd)/${1}"{0}
{4}fi{0}
{8}OUT_FILE{7}={10}${PROJECT_PATH}{7}/{8}testing.txt{0}
{7}({4}cat{12}<<EOF{13}
Last run $(date +'%Y-%m-%d') at $(date +'%H:%M:%S.%2N')
{12}EOF{0}
{7}){0} {7}>{0} {9}$OUT_FILE{0}
{2}# Issue 188, keyword before redirection operator{0}
{4}pwd{7}>>{9}$OUT_FILE{0}
{4}find{0} {5}"$PROJECT_PATH/src"{0} {8}-maxdepth{0} {3}1{0} {8}-type{0} {8}f{0} {7}|\{0}
{4}while{0} {8}read{0} {8}-r{0} {8}f{7};{0} {4}do{0}
{7}{{0}
{8}python3{0} {8}-c{0} {5}"print();print('='*50)"{7};\{0}
{4}echo{0} {11}`basename "$f"`{0} {7}|{0} {8}tr{0} {8}-d{0} {6}'x'{7};\{0}
{8}python3{0} {8}-c{0} {5}"print('='*50)"{7};\{0}
{8}python3{0} {5}"$f"{7};\{0}
{7}}{0} {7}>>{0} {9}$OUT_FILE{0}
{4}done{0}
{2}# Issue 137, should be shift but here-doc was detected{0}
{4}echo{0} {7}$(({0} {8}x{0} {7}<<{0} {8}END{0} {7})){0}
{4}pwd{0}
{8}END{0}
{2}# Issue 194, failed to understand character escaping so string unterminated{0}
{4}echo{0} {5}"foo `echo foo \\" bar` bar"{0}
{4}echo{0} {5}"xinput set-prop bla \"blub\" `grep bla $WRITE_APPENDIX/var/lib/path.txt | cut -d \\" -f 4`"{0} {7}>/{8}some_file.sh{0}
{2}# Issue 194, $ before end of backticks is literal{0}
{4}echo{0} {11}`echo \$`{0}
{4}echo{0} {11}`echo \$bar\$`{0}
{4}echo{0} {11}`echo $`{0}
{4}echo{0} {11}`echo $bar$`{0}
{8}INVALID_NUMBER{7}={1}0#0000{0}

View File

@ -0,0 +1,39 @@
rem remark and comment bug
findstr /c:"rem this" "file"
findstr /c:":: this" "file"
:: SingleQuoted command string
for /f %%A in ('rem this') do echo %%A
:: DoubleQuoted string
for /f %%A in ("rem this") do echo %%A
:: BackQuote command string
for /f "usebackq" %%A in (`rem this`) do echo %%A
:: Test the handling of quotes ' and " and escape ^
:: Comment
:: With quotes
":: Text
"":: Comment
':: Text
'':: Comment
:: Mixing quotes - likely incorrect as lexer tries ' and " separately, leaving an active quote
"'":: Text
:: With escapes
^:: Text
^":: Comment
^"":: Text
^""":: Comment
^^":: Text
^^"":: Comment
^^""":: Text
:: With preceding command
mkdir archive ":: Text
mkdir archive "":: Comment
mkdir archive ^":: Comment
mkdir archive ^"":: Text

View File

@ -0,0 +1,40 @@
0 400 0 rem remark and comment bug
0 400 0
0 400 0 findstr /c:"rem this" "file"
0 400 0 findstr /c:":: this" "file"
0 400 0
0 400 0 :: SingleQuoted command string
0 400 0 for /f %%A in ('rem this') do echo %%A
0 400 0
0 400 0 :: DoubleQuoted string
0 400 0 for /f %%A in ("rem this") do echo %%A
0 400 0
0 400 0 :: BackQuote command string
0 400 0 for /f "usebackq" %%A in (`rem this`) do echo %%A
0 400 0
0 400 0 :: Test the handling of quotes ' and " and escape ^
0 400 0 :: Comment
0 400 0
0 400 0 :: With quotes
0 400 0 ":: Text
0 400 0 "":: Comment
0 400 0 ':: Text
0 400 0 '':: Comment
0 400 0 :: Mixing quotes - likely incorrect as lexer tries ' and " separately, leaving an active quote
0 400 0 "'":: Text
0 400 0
0 400 0 :: With escapes
0 400 0 ^:: Text
0 400 0 ^":: Comment
0 400 0 ^"":: Text
0 400 0 ^""":: Comment
0 400 0 ^^":: Text
0 400 0 ^^"":: Comment
0 400 0 ^^""":: Text
0 400 0
0 400 0 :: With preceding command
0 400 0 mkdir archive ":: Text
0 400 0 mkdir archive "":: Comment
0 400 0 mkdir archive ^":: Comment
0 400 0 mkdir archive ^"":: Text
0 400 0

View File

@ -0,0 +1,39 @@
{1}rem remark and comment bug
{0}
{5}findstr{0} /c:"rem this" "file"
{5}findstr{0} /c:":: this" "file"
{1}:: SingleQuoted command string
{2}for{0} /f {6}%%A{2} in{0} ('rem this'){2} do echo{0} {6}%%A{0}
{1}:: DoubleQuoted string
{2}for{0} /f {6}%%A{2} in{0} ("rem this"){2} do echo{0} {6}%%A{0}
{1}:: BackQuote command string
{2}for{0} /f "usebackq" {6}%%A{2} in{0} (`rem this`){2} do echo{0} {6}%%A{0}
{1}:: Test the handling of quotes ' and " and escape ^
:: Comment
{0}
{1}:: With quotes
{0}":: Text
""{1}:: Comment
{0}':: Text
''{1}:: Comment
:: Mixing quotes - likely incorrect as lexer tries ' and " separately, leaving an active quote
{0}"'":: Text
{1}:: With escapes
{5}^::{0} Text
{5}^{0}"{1}:: Comment
{5}^{0}"":: Text
{5}^{0}"""{1}:: Comment
{5}^^{0}":: Text
{5}^^{0}""{1}:: Comment
{5}^^{0}""":: Text
{1}:: With preceding command
{5}mkdir{0} archive ":: Text
{5}mkdir{0} archive ""{1}:: Comment
{5}mkdir{0} archive ^"{1}:: Comment
{5}mkdir{0} archive ^"":: Text

View File

@ -0,0 +1,26 @@
rem Keywords with colon
rem with spacing
call file.bat arg1
call "file.bat" arg1
call :label arg1
goto :label
goto :eof
goto label
echo: %var%
echo: text
echo text
rem no spacing
call:label arg1
goto:label
goto:eof
echo:%var%
echo:text
(call)
(echo:)
(goto)
rem call internal commands
call echo text
call set "a=b"

View File

@ -0,0 +1,27 @@
0 400 0 rem Keywords with colon
0 400 0
0 400 0 rem with spacing
0 400 0 call file.bat arg1
0 400 0 call "file.bat" arg1
0 400 0 call :label arg1
0 400 0 goto :label
0 400 0 goto :eof
0 400 0 goto label
0 400 0 echo: %var%
0 400 0 echo: text
0 400 0 echo text
0 400 0
0 400 0 rem no spacing
0 400 0 call:label arg1
0 400 0 goto:label
0 400 0 goto:eof
0 400 0 echo:%var%
0 400 0 echo:text
0 400 0 (call)
0 400 0 (echo:)
0 400 0 (goto)
0 400 0
0 400 0 rem call internal commands
0 400 0 call echo text
0 400 0 call set "a=b"
0 400 0

View File

@ -0,0 +1,26 @@
{1}rem Keywords with colon
{0}
{1}rem with spacing
{2}call{5} file.bat{0} arg1
{2}call{0} "file.bat" arg1
{2}call{0} :label arg1
{2}goto{0} :label
{2}goto{0} :eof
{2}goto{0} label
{2}echo{0}: {6}%var%{0}
{2}echo{0}: text
{2}echo{0} text
{1}rem no spacing
{2}call{0}:label arg1
{2}goto{0}:label
{2}goto{0}:eof
{2}echo{0}:{6}%var%{0}
{2}echo{0}:text
({2}call{0})
({2}echo{0}:)
({2}goto{0})
{1}rem call internal commands
{2}call echo{0} text
{2}call set{0} "a=b"

View File

@ -0,0 +1,3 @@
lexer.*.bat=batch
keywords.*.bat=call defined do echo else errorlevel exist exit for goto if in not set

View File

@ -0,0 +1,63 @@
rem comment=1
rem 'echo' is word=2, 'a' is default=0
echo a
rem label=3
:START
rem '@' is hide=4
@echo b
rem 'gcc' is external command=5
gcc --version
rem '%PATH%' is variable=6
echo %PATH%
echo %ProgramFiles(x86)%
rem operator=7 '='
@set Q=A
::comment=1
:: Bug 1624: this construct produced inconsistent brackets in the past
if ERRORLEVEL 2 goto END
@if exist a (
echo exists
) else (
echo not
)
FOR /L %%G IN (2,1,4) DO (echo %%G)
:: Bug 1997: keywords not recognized when preceded by '('
IF NOT DEFINED var (SET var=1)
:: Bug 2065: keywords not recognized when followed by ')'
@if exist a ( exit)
:: Bug: with \r or \n, 'command' is seen as continuation
echo word ^
1
command
:: Bug argument and variable expansion
echo %~dp0123
echo %%-~012
echo %%~%%~-abcd
FOR /F %%I in ("C:\Test\temp.txt") do echo %%~dI
:: Bug ending of argument and variable expansion
echo %~dp0\123
echo "%~dp0123"
echo "%%-~012"
echo "%%~%%~-abcd"
FOR /F %%I in ("C:\Test\temp.txt") do echo "%%~dI"
:: Bug escaped %
echo %%0
echo %%%0
echo %%%%~-abcd
:TEST that after label style works
:: Bug 2304: "::" comments not recognised when second command on line
Set /A xxx=%xxx%+1 & :: Increment
Set /A xxx=%xxx%+1 & ::Increment
Set /A xxx=%xxx%+1 & rem Increment
:END

View File

@ -0,0 +1,64 @@
0 400 0 rem comment=1
0 400 0 rem 'echo' is word=2, 'a' is default=0
0 400 0 echo a
0 400 0 rem label=3
0 400 0 :START
0 400 0 rem '@' is hide=4
0 400 0 @echo b
0 400 0 rem 'gcc' is external command=5
0 400 0 gcc --version
0 400 0 rem '%PATH%' is variable=6
0 400 0 echo %PATH%
0 400 0 echo %ProgramFiles(x86)%
0 400 0 rem operator=7 '='
0 400 0 @set Q=A
0 400 0
0 400 0 ::comment=1
0 400 0
0 400 0 :: Bug 1624: this construct produced inconsistent brackets in the past
0 400 0 if ERRORLEVEL 2 goto END
0 400 0 @if exist a (
0 400 0 echo exists
0 400 0 ) else (
0 400 0 echo not
0 400 0 )
0 400 0
0 400 0 FOR /L %%G IN (2,1,4) DO (echo %%G)
0 400 0
0 400 0 :: Bug 1997: keywords not recognized when preceded by '('
0 400 0 IF NOT DEFINED var (SET var=1)
0 400 0
0 400 0 :: Bug 2065: keywords not recognized when followed by ')'
0 400 0 @if exist a ( exit)
0 400 0
0 400 0 :: Bug: with \r or \n, 'command' is seen as continuation
0 400 0 echo word ^
0 400 0 1
0 400 0 command
0 400 0
0 400 0 :: Bug argument and variable expansion
0 400 0 echo %~dp0123
0 400 0 echo %%-~012
0 400 0 echo %%~%%~-abcd
0 400 0 FOR /F %%I in ("C:\Test\temp.txt") do echo %%~dI
0 400 0
0 400 0 :: Bug ending of argument and variable expansion
0 400 0 echo %~dp0\123
0 400 0 echo "%~dp0123"
0 400 0 echo "%%-~012"
0 400 0 echo "%%~%%~-abcd"
0 400 0 FOR /F %%I in ("C:\Test\temp.txt") do echo "%%~dI"
0 400 0
0 400 0 :: Bug escaped %
0 400 0 echo %%0
0 400 0 echo %%%0
0 400 0 echo %%%%~-abcd
0 400 0
0 400 0 :TEST that after label style works
0 400 0 :: Bug 2304: "::" comments not recognised when second command on line
0 400 0 Set /A xxx=%xxx%+1 & :: Increment
0 400 0 Set /A xxx=%xxx%+1 & ::Increment
0 400 0 Set /A xxx=%xxx%+1 & rem Increment
0 400 0
0 400 0 :END
0 400 0

View File

@ -0,0 +1,63 @@
{1}rem comment=1
rem 'echo' is word=2, 'a' is default=0
{2}echo{0} a
{1}rem label=3
{3}:START
{1}rem '@' is hide=4
{4}@{2}echo{0} b
{1}rem 'gcc' is external command=5
{5}gcc{0} --version
{1}rem '%PATH%' is variable=6
{2}echo{0} {6}%PATH%{0}
{2}echo{0} {6}%ProgramFiles(x86)%{0}
{1}rem operator=7 '='
{4}@{2}set{0} Q{7}={0}A
{1}::comment=1
{0}
{1}:: Bug 1624: this construct produced inconsistent brackets in the past
{2}if ERRORLEVEL{0} 2{2} goto{0} END
{4}@{2}if exist{0} a (
{2}echo{0} exists
){2} else{0} (
{2}echo{0} not
)
{2}FOR{0} /L {6}%%G{2} IN{0} (2,1,4){2} DO{0} ({2}echo{0} {6}%%G{0})
{1}:: Bug 1997: keywords not recognized when preceded by '('
{2}IF NOT DEFINED{0} var ({2}SET{0} var{7}={0}1)
{1}:: Bug 2065: keywords not recognized when followed by ')'
{4}@{2}if exist{0} a ({2} exit{0})
{1}:: Bug: with \r or \n, 'command' is seen as continuation
{2}echo{0} word ^
1
{5}command{0}
{1}:: Bug argument and variable expansion
{2}echo{0} {6}%~dp0{0}123
{2}echo{0} {6}%%-{0}~012
{2}echo{0} %%~{6}%%~-abcd{0}
{2}FOR{0} /F {6}%%I{2} in{0} ("C:\Test\temp.txt"){2} do echo{0} {6}%%~dI{0}
{1}:: Bug ending of argument and variable expansion
{2}echo{0} {6}%~dp0{0}\123
{2}echo{0} "{6}%~dp0{0}123"
{2}echo{0} "{6}%%-{0}~012"
{2}echo{0} "%%~{6}%%~-abcd{0}"
{2}FOR{0} /F {6}%%I{2} in{0} ("C:\Test\temp.txt"){2} do echo{0} "{6}%%~dI{0}"
{1}:: Bug escaped %
{2}echo{0} {6}%%0{0}
{2}echo{0} %%{6}%0{0}
{2}echo{0} %%{6}%%~-abcd{0}
{3}:TEST{8} that after label style works
{1}:: Bug 2304: "::" comments not recognised when second command on line
{2}Set{0} /A xxx{7}={6}%xxx%{7}+{0}1 {7}&{0} {1}:: Increment
{2}Set{0} /A xxx{7}={6}%xxx%{7}+{0}1 {7}&{0} {1}::Increment
{2}Set{0} /A xxx{7}={6}%xxx%{7}+{0}1 {7}&{0} {1}rem Increment
{0}
{3}:END

View File

@ -0,0 +1,49 @@
(* Enumerate all styles: 0 to 15 *)
(* comment=12 *)
(* whitespace=0 *)
(* w *)
(* identifier=1 *)
ident
(* tagname=2 *)
`ident
(* keyword=3 *)
and
(* keyword2=4 *)
None
(* keyword3=5 *)
char
(* linenum=6 *)
#12
(* operator=7 *)
*
(* number=8 *)
12
(* char=9 *)
'a'
(* white=10 *)
(* this state can not be reached in caml mode, only SML mode but that stops other states *)
(* SML mode is triggered by "andalso" being in the keywords *)
"\ \x"
(* string=11 *)
"string"
(* comment1=13 *)
(* (* comment 1 *) *)
(* comment2=14 *)
(* (* (* comment 2 *) *) *)
(* comment3=15 *)
(* (* (* (* comment 1 *) *) *) *)

View File

@ -0,0 +1,50 @@
0 400 0 (* Enumerate all styles: 0 to 15 *)
0 400 0 (* comment=12 *)
0 400 0
0 400 0 (* whitespace=0 *)
0 400 0 (* w *)
0 400 0
0 400 0 (* identifier=1 *)
0 400 0 ident
0 400 0
0 400 0 (* tagname=2 *)
0 400 0 `ident
0 400 0
0 400 0 (* keyword=3 *)
0 400 0 and
0 400 0
0 400 0 (* keyword2=4 *)
0 400 0 None
0 400 0
0 400 0 (* keyword3=5 *)
0 400 0 char
0 400 0
0 400 0 (* linenum=6 *)
0 400 0 #12
0 400 0
0 400 0 (* operator=7 *)
0 400 0 *
0 400 0
0 400 0 (* number=8 *)
0 400 0 12
0 400 0
0 400 0 (* char=9 *)
0 400 0 'a'
0 400 0
0 400 0 (* white=10 *)
0 400 0 (* this state can not be reached in caml mode, only SML mode but that stops other states *)
0 400 0 (* SML mode is triggered by "andalso" being in the keywords *)
0 400 0 "\ \x"
0 400 0
0 400 0 (* string=11 *)
0 400 0 "string"
0 400 0
0 400 0 (* comment1=13 *)
0 400 0 (* (* comment 1 *) *)
0 400 0
0 400 0 (* comment2=14 *)
0 400 0 (* (* (* comment 2 *) *) *)
0 400 0
0 400 0 (* comment3=15 *)
0 400 0 (* (* (* (* comment 1 *) *) *) *)
0 400 0

View File

@ -0,0 +1,49 @@
{12}(* Enumerate all styles: 0 to 15 *){0}
{12}(* comment=12 *){0}
{12}(* whitespace=0 *){0}
{12}(* w *){0}
{12}(* identifier=1 *){0}
{1}ident{0}
{12}(* tagname=2 *){0}
{2}`ident{0}
{12}(* keyword=3 *){0}
{3}and{0}
{12}(* keyword2=4 *){0}
{4}None{0}
{12}(* keyword3=5 *){0}
{5}char{0}
{12}(* linenum=6 *){0}
{6}#12{0}
{12}(* operator=7 *){0}
{7}*{0}
{12}(* number=8 *){0}
{8}12{0}
{12}(* char=9 *){0}
{9}'a'{0}
{12}(* white=10 *){0}
{12}(* this state can not be reached in caml mode, only SML mode but that stops other states *){0}
{12}(* SML mode is triggered by "andalso" being in the keywords *){0}
{11}"\ \x"{0}
{12}(* string=11 *){0}
{11}"string"{0}
{12}(* comment1=13 *){0}
{12}(* {13}(* comment 1 *){12} *){0}
{12}(* comment2=14 *){0}
{12}(* {13}(* {14}(* comment 2 *){13} *){12} *){0}
{12}(* comment3=15 *){0}
{12}(* {13}(* {14}(* {15}(* comment 1 *){14} *){13} *){12} *){0}

View File

@ -0,0 +1,4 @@
lexer.*.ml=caml
keywords.*.ml=and xandalso
keywords2.*.ml=None
keywords3.*.ml=char

View File

@ -0,0 +1,25 @@
if(MSVC80)
# 1
elseif(MSVC90)
# 2
elseif(APPLE)
# 3
else()
# 4
endif()
if(MSVC80)
# 1
elseif(MSVC90)
# 2
endif()
if(MSVC80)
# 1
else()
# 2
endif()
if(MSVC80)
# 1
endif()

View File

@ -0,0 +1,26 @@
2 400 401 + if(MSVC80)
0 401 401 | # 1
0 401 401 | elseif(MSVC90)
0 401 401 | # 2
0 401 401 | elseif(APPLE)
0 401 401 | # 3
0 401 401 | else()
0 401 401 | # 4
0 401 400 | endif()
0 400 400
2 400 401 + if(MSVC80)
0 401 401 | # 1
0 401 401 | elseif(MSVC90)
0 401 401 | # 2
0 401 400 | endif()
0 400 400
2 400 401 + if(MSVC80)
0 401 401 | # 1
0 401 401 | else()
0 401 401 | # 2
0 401 400 | endif()
0 400 400
2 400 401 + if(MSVC80)
0 401 401 | # 1
0 401 400 | endif()
0 400 400

View File

@ -0,0 +1,25 @@
{11}if{0}({6}MSVC80{0})
{1}# 1{0}
{11}elseif{0}({6}MSVC90{0})
{1}# 2{0}
{11}elseif{0}({6}APPLE{0})
{1}# 3{0}
{11}else{0}()
{1}# 4{0}
{11}endif{0}()
{11}if{0}({6}MSVC80{0})
{1}# 1{0}
{11}elseif{0}({6}MSVC90{0})
{1}# 2{0}
{11}endif{0}()
{11}if{0}({6}MSVC80{0})
{1}# 1{0}
{11}else{0}()
{1}# 2{0}
{11}endif{0}()
{11}if{0}({6}MSVC80{0})
{1}# 1{0}
{11}endif{0}()

View File

@ -0,0 +1,25 @@
if(MSVC80)
# 1
elseif(MSVC90)
# 2
elseif(APPLE)
# 3
else()
# 4
endif()
if(MSVC80)
# 1
elseif(MSVC90)
# 2
endif()
if(MSVC80)
# 1
else()
# 2
endif()
if(MSVC80)
# 1
endif()

View File

@ -0,0 +1,26 @@
2 400 401 + if(MSVC80)
0 401 400 | # 1
2 400 401 + elseif(MSVC90)
0 401 400 | # 2
2 400 401 + elseif(APPLE)
0 401 400 | # 3
2 400 401 + else()
0 401 401 | # 4
0 401 400 | endif()
0 400 400
2 400 401 + if(MSVC80)
0 401 400 | # 1
2 400 401 + elseif(MSVC90)
0 401 401 | # 2
0 401 400 | endif()
0 400 400
2 400 401 + if(MSVC80)
0 401 400 | # 1
2 400 401 + else()
0 401 401 | # 2
0 401 400 | endif()
0 400 400
2 400 401 + if(MSVC80)
0 401 401 | # 1
0 401 400 | endif()
0 400 400

View File

@ -0,0 +1,25 @@
{11}if{0}({6}MSVC80{0})
{1}# 1{0}
{11}elseif{0}({6}MSVC90{0})
{1}# 2{0}
{11}elseif{0}({6}APPLE{0})
{1}# 3{0}
{11}else{0}()
{1}# 4{0}
{11}endif{0}()
{11}if{0}({6}MSVC80{0})
{1}# 1{0}
{11}elseif{0}({6}MSVC90{0})
{1}# 2{0}
{11}endif{0}()
{11}if{0}({6}MSVC80{0})
{1}# 1{0}
{11}else{0}()
{1}# 2{0}
{11}endif{0}()
{11}if{0}({6}MSVC80{0})
{1}# 1{0}
{11}endif{0}()

View File

@ -0,0 +1,7 @@
lexer.*.cmake=cmake
keywords2.*.cmake=MSVC80 MSVC90 APPLE
fold=1
fold.at.else=0
match Bug77_1.cmake
fold.at.else=1

View File

@ -0,0 +1,10 @@
* Fix string style to not continue to next line
DISPLAY MESSAGE BOX
"The following process must be applied to Earnings, Deduct
- "ions and Company Contributions separately."
LP61A DISPLAY MESSAGE BOX
lp61b "S*** strives to continually develop and improve its pr
LP61B - "oducts and services to deliver more value to our custo
LP61B - "mers."

View File

@ -0,0 +1,11 @@
0 400 0 * Fix string style to not continue to next line
0 400 0
0 400 0 DISPLAY MESSAGE BOX
0 400 0 "The following process must be applied to Earnings, Deduct
0 400 0 - "ions and Company Contributions separately."
0 400 0
0 400 0 LP61A DISPLAY MESSAGE BOX
0 400 0 lp61b "S*** strives to continually develop and improve its pr
0 400 0 LP61B - "oducts and services to deliver more value to our custo
0 400 0 LP61B - "mers."
0 400 0

View File

@ -0,0 +1,10 @@
{0} {2}* Fix string style to not continue to next line{0}
{11}DISPLAY{0} {11}MESSAGE{0} {11}BOX{0}
{6}"The following process must be applied to Earnings, Deduct{0}
{10}-{0} {6}"ions and Company Contributions separately."{0}
{11}LP61A{0} {11}DISPLAY{0} {11}MESSAGE{0} {11}BOX{0}
{11}lp61b{0} {6}"S*** strives to continually develop and improve its pr{0}
{11}LP61B{0} {10}-{0} {6}"oducts and services to deliver more value to our custo{0}
{11}LP61B{0} {10}-{0} {6}"mers."{0}

View File

@ -0,0 +1,7 @@
* Keywords starting with V to be identified and styled
* in list keywords2
VARIANCE
* in list keywords3
VARYING

View File

@ -0,0 +1,8 @@
0 400 0 * Keywords starting with V to be identified and styled
0 400 0
0 400 0 * in list keywords2
0 400 0 VARIANCE
0 400 0
0 400 0 * in list keywords3
0 400 0 VARYING
0 400 0

View File

@ -0,0 +1,7 @@
{0} {2}* Keywords starting with V to be identified and styled{0}
{2}* in list keywords2{0}
{16}VARIANCE{0}
{2}* in list keywords3{0}
{8}VARYING{0}

View File

@ -0,0 +1,9 @@
* Comment preceded by 6 characters to be styled
* Include / to be styled as a comment
* Comment colored in green
ABCDE * Comment colored in green
ABCDEF* Comment NOT colored in green
/ Comment NOT colored in green
ABCDE / Comment NOT colored in green
ABCDEF/ Comment NOT colored in green

View File

@ -0,0 +1,10 @@
0 400 0 * Comment preceded by 6 characters to be styled
0 400 0 * Include / to be styled as a comment
0 400 0
0 400 0 * Comment colored in green
0 400 0 ABCDE * Comment colored in green
0 400 0 ABCDEF* Comment NOT colored in green
0 400 0 / Comment NOT colored in green
0 400 0 ABCDE / Comment NOT colored in green
0 400 0 ABCDEF/ Comment NOT colored in green
0 400 0

View File

@ -0,0 +1,9 @@
{0} {2}* Comment preceded by 6 characters to be styled{0}
{2}* Include / to be styled as a comment{0}
{2}* Comment colored in green{0}
{11}ABCDE{0} {2}* Comment colored in green{0}
{11}ABCDEF{2}* Comment NOT colored in green{0}
{2}/ Comment NOT colored in green{0}
{11}ABCDE{0} {2}/ Comment NOT colored in green{0}
{11}ABCDEF{2}/ Comment NOT colored in green{0}

View File

@ -0,0 +1,35 @@
* Enumerate all styles: 0, 2 to 11, 16
* SCE_C_COMMENTLINE=2
* SCE_C_DEFAULT=0
* SCE_C_IDENTIFIER=11
identifier
* SCE_C_NUMBER=4
4
* SCE_C_WORD=5
data
* SCE_C_WORD2=16
cancel
* SCE_C_UUID=8
remarks
* SCE_C_COMMENTDOC=3 not implemented
** at line start
* SCE_C_STRING=6
"string"
* SCE_C_CHARACTER=7
'c'
* SCE_C_PREPROCESSOR=9
?preprocessor
* SCE_C_OPERATOR=10
+

View File

@ -0,0 +1,36 @@
0 400 0 * Enumerate all styles: 0, 2 to 11, 16
0 400 0 * SCE_C_COMMENTLINE=2
0 400 0
0 400 0 * SCE_C_DEFAULT=0
0 400 0
0 400 0
0 400 0 * SCE_C_IDENTIFIER=11
0 400 0 identifier
0 400 0
0 400 0 * SCE_C_NUMBER=4
0 400 0 4
0 400 0
0 400 0 * SCE_C_WORD=5
0 400 0 data
0 400 0
0 400 0 * SCE_C_WORD2=16
0 400 0 cancel
0 400 0
0 400 0 * SCE_C_UUID=8
0 400 0 remarks
0 400 0
0 400 0 * SCE_C_COMMENTDOC=3 not implemented
0 400 0 ** at line start
0 400 0
0 400 0 * SCE_C_STRING=6
0 400 0 "string"
0 400 0
0 400 0 * SCE_C_CHARACTER=7
0 400 0 'c'
0 400 0
0 400 0 * SCE_C_PREPROCESSOR=9
0 400 0 ?preprocessor
0 400 0
0 400 0 * SCE_C_OPERATOR=10
0 400 0 +
0 400 0

View File

@ -0,0 +1,35 @@
{0} {2}* Enumerate all styles: 0, 2 to 11, 16{0}
{2}* SCE_C_COMMENTLINE=2{0}
{2}* SCE_C_DEFAULT=0{0}
{2}* SCE_C_IDENTIFIER=11{0}
{11}identifier{0}
{2}* SCE_C_NUMBER=4{0}
{4}4{0}
{2}* SCE_C_WORD=5{0}
{5}data{0}
{2}* SCE_C_WORD2=16{0}
{16}cancel{0}
{2}* SCE_C_UUID=8{0}
{8}remarks{0}
{2}* SCE_C_COMMENTDOC=3 not implemented{0}
{3}** at line start{0}
{2}* SCE_C_STRING=6{0}
{6}"string"{0}
{2}* SCE_C_CHARACTER=7{0}
{7}'c'{0}
{2}* SCE_C_PREPROCESSOR=9{0}
{9}?preprocessor{0}
{2}* SCE_C_OPERATOR=10{0}
{10}+{0}

View File

@ -0,0 +1,4 @@
lexer.*.cob=COBOL
keywords.*.cob=data
keywords2.*.cob=cancel variance
keywords3.*.cob=remarks varying

View File

@ -0,0 +1,9 @@
// coding: utf-8
// All three following symbols should highlight as keywords
cheese
käse
сыр
// Lookalikes with ASCII so should not highlight:
сыp
cыp

View File

@ -0,0 +1,10 @@
0 400 400 // coding: utf-8
0 400 400 // All three following symbols should highlight as keywords
0 400 400 cheese
0 400 400 käse
0 400 400 сыр
1 400 400
0 400 400 // Lookalikes with ASCII so should not highlight:
0 400 400 сыp
0 400 400 cыp
1 400 400

View File

@ -0,0 +1,9 @@
{2}// coding: utf-8
// All three following symbols should highlight as keywords
{5}cheese{0}
{5}käse{0}
{5}сыр{0}
{2}// Lookalikes with ASCII so should not highlight:
{11}сыp{0}
{11}cыp{0}

View File

@ -0,0 +1,11 @@
// SCE_C_WORD2 (16)
second
// SCE_C_IDENTIFIER (11)
Second
// SCE_C_IDENTIFIER (11)
upper
// SCE_C_WORD2 (16)
Upper

View File

@ -0,0 +1,12 @@
0 400 400 // SCE_C_WORD2 (16)
0 400 400 second
1 400 400
0 400 400 // SCE_C_IDENTIFIER (11)
0 400 400 Second
1 400 400
0 400 400 // SCE_C_IDENTIFIER (11)
0 400 400 upper
1 400 400
0 400 400 // SCE_C_WORD2 (16)
0 400 400 Upper
1 400 400

View File

@ -0,0 +1,11 @@
{2}// SCE_C_WORD2 (16)
{16}second{0}
{2}// SCE_C_IDENTIFIER (11)
{11}Second{0}
{2}// SCE_C_IDENTIFIER (11)
{11}upper{0}
{2}// SCE_C_WORD2 (16)
{16}Upper{0}

View File

@ -0,0 +1,31 @@
// Test JavaScript template expressions for issue 94
// Basic
var basic = `${identifier}`;
// Nested
var nested = ` ${ ` ${ 1 } ` } `;
// With escapes
var xxx = {
'1': `\`\u0020\${a${1 + 1}b}`,
'2': `\${a${ `b${1 + 2}c`.charCodeAt(2) }d}`,
'3': `\${a${ `b${ `c${ JSON.stringify({
'4': {},
}) }d` }e` }f}`,
};
// Original request
fetchOptions.body = `
{
"accountNumber" : "248796",
"customerType" : "Shipper",
"destinationCity" : "${order.destination.city}",
"destinationState" : "${order.destination.stateProvince}",
"destinationZip" : ${order.destination.postalCode},
"paymentType" : "Prepaid",
"shipmentInfo" :
{
"items" : [ { "shipmentClass" : "50", "shipmentWeight" : "${order.totalWeight.toString()}" } ]
}
}`;

Some files were not shown because too many files have changed in this diff Show More