diff --git a/language/common_res.h b/language/common_res.h index 0065d417e..836f41fef 100644 --- a/language/common_res.h +++ b/language/common_res.h @@ -1250,7 +1250,7 @@ #define IDS_LEX_STR_63345 63345 #define IDS_LEX_STR_63346 63346 #define IDS_LEX_STR_Obj 63347 -#define IDS_LEX_STR_Key 63348 +#define IDS_LEX_STR_Key 63348 #define IDS_LEX_STR_HotKey 63349 #define IDS_LEX_STR_HotStrg 63350 #define IDS_LEX_STR_HotStrgOp 63351 @@ -1290,7 +1290,7 @@ #define IDS_LEX_STR_63385 63385 #define IDS_LEX_STR_63386 63386 #define IDS_LEX_STR_63387 63387 -#define IDS_LEX_STR_StrgEOL 63388 +#define IDS_LEX_STR_StrgEOL 63388 #define IDS_LEX_STD_CH_SAVED 63389 #define IDS_LEX_STD_CH_MODIFIED 63390 #define IDS_LEX_STD_CH_REV_TO_ORG 63391 @@ -1307,6 +1307,7 @@ #define IDS_LEX_STR_InOut 63402 #define IDS_LEX_STR_PortConn 63403 #define IDS_LEX_STR_SysTasks 63404 +#define IDS_LEX_STR_AfterLabel 63405 #define IDS_LEX_CSV_COL_0 63490 diff --git a/language/np3_de_de/lexer_de_de.rc b/language/np3_de_de/lexer_de_de.rc index 8b19a2d88..a387bd40b 100644 --- a/language/np3_de_de/lexer_de_de.rc +++ b/language/np3_de_de/lexer_de_de.rc @@ -513,6 +513,7 @@ BEGIN IDS_LEX_STR_InOut "InOut" IDS_LEX_STR_PortConn "Port Connection" IDS_LEX_STR_SysTasks "System Tasks" + IDS_LEX_STR_AfterLabel "After Label" END STRINGTABLE diff --git a/language/np3_en_us/lexer_en_us.rc b/language/np3_en_us/lexer_en_us.rc index 33e598c04..d7c40912b 100644 --- a/language/np3_en_us/lexer_en_us.rc +++ b/language/np3_en_us/lexer_en_us.rc @@ -513,6 +513,7 @@ BEGIN IDS_LEX_STR_InOut "InOut" IDS_LEX_STR_PortConn "Port Connection" IDS_LEX_STR_SysTasks "System Tasks" + IDS_LEX_STR_AfterLabel "After Label" END STRINGTABLE diff --git a/lexilla/doc/LexillaHistory.html b/lexilla/doc/LexillaHistory.html index 17f1678ac..891da15fb 100644 --- a/lexilla/doc/LexillaHistory.html +++ b/lexilla/doc/LexillaHistory.html @@ -585,6 +585,31 @@

Releases

+

+ Release 5.2.5 +

+

Release 5.2.4

diff --git a/lexilla/include/LexicalStyles.iface b/lexilla/include/LexicalStyles.iface index ba6f6d191..67ad8d199 100644 --- a/lexilla/include/LexicalStyles.iface +++ b/lexilla/include/LexicalStyles.iface @@ -602,6 +602,7 @@ val SCE_BAT_HIDE=4 val SCE_BAT_COMMAND=5 val SCE_BAT_IDENTIFIER=6 val SCE_BAT_OPERATOR=7 +val SCE_BAT_AFTER_LABEL=8 # Lexical states for SCLEX_TCMD lex TCMD=SCLEX_TCMD SCE_TCMD_ val SCE_TCMD_DEFAULT=0 diff --git a/lexilla/include/SciLexer.h b/lexilla/include/SciLexer.h index 6617f2b05..cd2811da1 100644 --- a/lexilla/include/SciLexer.h +++ b/lexilla/include/SciLexer.h @@ -550,6 +550,7 @@ #define SCE_BAT_COMMAND 5 #define SCE_BAT_IDENTIFIER 6 #define SCE_BAT_OPERATOR 7 +#define SCE_BAT_AFTER_LABEL 8 #define SCE_TCMD_DEFAULT 0 #define SCE_TCMD_COMMENT 1 #define SCE_TCMD_WORD 2 diff --git a/lexilla/lexers/LexBash.cxx b/lexilla/lexers/LexBash.cxx index 70042e1c9..0999abe13 100644 --- a/lexilla/lexers/LexBash.cxx +++ b/lexilla/lexers/LexBash.cxx @@ -6,11 +6,11 @@ // Adapted from LexPerl by Kein-Hong Man 2004 // The License.txt file describes the conditions under which this software may be distributed. -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include @@ -35,6 +35,8 @@ using namespace Scintilla; using namespace Lexilla; +namespace { + #define HERE_DELIM_MAX 256 // define this if you want 'invalid octals' to be marked as errors @@ -50,27 +52,36 @@ using namespace Lexilla; #endif // state constants for parts of a bash command segment -#define BASH_CMD_BODY 0 -#define BASH_CMD_START 1 -#define BASH_CMD_WORD 2 -#define BASH_CMD_TEST 3 -#define BASH_CMD_ARITH 4 -#define BASH_CMD_DELIM 5 +enum class CmdState { + Body, + Start, + Word, + Test, + Arithmetic, + Delimiter, +}; + +enum class TestExprType { + Test, // test + DoubleBracket, // [[]] + SingleBracket, // [] +}; // state constants for nested delimiter pairs, used by -// SCE_SH_STRING and SCE_SH_BACKTICKS processing -#define BASH_DELIM_LITERAL 0 -#define BASH_DELIM_STRING 1 -#define BASH_DELIM_CSTRING 2 -#define BASH_DELIM_LSTRING 3 -#define BASH_DELIM_COMMAND 4 -#define BASH_DELIM_BACKTICK 5 +// SCE_SH_STRING, SCE_SH_PARAM and SCE_SH_BACKTICKS processing +enum class QuoteStyle { + Literal, // '' + CString, // $'' + String, // "" + LString, // $"" + Backtick, // ``, $`` + Parameter, // ${} + Command, // $() +}; -#define BASH_DELIM_STACK_MAX 7 +#define BASH_QUOTE_STACK_MAX 7 -namespace { - -inline int translateBashDigit(int ch) { +constexpr int translateBashDigit(int ch) noexcept { if (ch >= '0' && ch <= '9') { return ch - '0'; } else if (ch >= 'a' && ch <= 'z') { @@ -85,7 +96,7 @@ inline int translateBashDigit(int ch) { return BASH_BASE_ERROR; } -inline int getBashNumberBase(char *s) { +int getBashNumberBase(char *s) noexcept { int i = 0; int base = 0; while (*s) { @@ -98,7 +109,7 @@ inline int getBashNumberBase(char *s) { return base; } -int opposite(int ch) { +constexpr int opposite(int ch) noexcept { if (ch == '(') return ')'; if (ch == '[') return ']'; if (ch == '{') return '}'; @@ -109,7 +120,8 @@ int opposite(int ch) { int GlobScan(StyleContext &sc) { // forward scan for zsh globs, disambiguate versus bash arrays // complex expressions may still fail, e.g. unbalanced () '' "" etc - int c, sLen = 0; + int c; + int sLen = 0; int pCount = 0; int hash = 0; while ((c = sc.GetRelativeCharacter(++sLen)) != 0) { @@ -133,10 +145,10 @@ int GlobScan(StyleContext &sc) { } bool IsCommentLine(Sci_Position line, LexAccessor &styler) { - Sci_Position pos = styler.LineStart(line); - Sci_Position eol_pos = styler.LineStart(line + 1) - 1; + const Sci_Position pos = styler.LineStart(line); + const Sci_Position eol_pos = styler.LineStart(line + 1) - 1; for (Sci_Position i = pos; i < eol_pos; i++) { - char ch = styler[i]; + const char ch = styler[i]; if (ch == '#') return true; else if (ch != ' ' && ch != '\t') @@ -159,7 +171,7 @@ struct OptionsBash { const char * const bashWordListDesc[] = { "Keywords", - 0 + nullptr }; struct OptionSetBash : public OptionSet { @@ -176,7 +188,7 @@ struct OptionSetBash : public OptionSet { const char styleSubable[] = { SCE_SH_IDENTIFIER, SCE_SH_SCALAR, 0 }; -LexicalClass lexicalClasses[] = { +const LexicalClass lexicalClasses[] = { // Lexer Bash SCLEX_BASH SCE_SH_: 0, "SCE_SH_DEFAULT", "default", "White space", 1, "SCE_SH_ERROR", "error", "Error", @@ -196,7 +208,7 @@ LexicalClass lexicalClasses[] = { } -class LexerBash : public DefaultLexer { +class LexerBash final : public DefaultLexer { WordList keywords; OptionsBash options; OptionSetBash osBash; @@ -207,8 +219,6 @@ public: DefaultLexer("bash", SCLEX_BASH, lexicalClasses, ELEMENTS(lexicalClasses)), subStyles(styleSubable, 0x80, 0x40, 0) { } - virtual ~LexerBash() { - } void SCI_METHOD Release() override { delete this; } @@ -236,7 +246,7 @@ public: void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void * SCI_METHOD PrivateCall(int, void *) override { - return 0; + return nullptr; } int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) override { @@ -281,7 +291,7 @@ Sci_Position SCI_METHOD LexerBash::PropertySet(const char *key, const char *val) } Sci_Position SCI_METHOD LexerBash::WordListSet(int n, const char *wl) { - WordList *wordListN = 0; + WordList *wordListN = nullptr; switch (n) { case 0: wordListN = &keywords; @@ -297,22 +307,24 @@ Sci_Position SCI_METHOD LexerBash::WordListSet(int n, const char *wl) { } void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { - WordList cmdDelimiter, bashStruct, bashStruct_in; + WordList cmdDelimiter; + WordList bashStruct; + WordList bashStruct_in; cmdDelimiter.Set("| || |& & && ; ;; ( ) { }"); bashStruct.Set("if elif fi while until else then do done esac eval"); bashStruct_in.Set("for case select"); - CharacterSet setWordStart(CharacterSet::setAlpha, "_"); + const CharacterSet setWordStart(CharacterSet::setAlpha, "_"); // note that [+-] are often parts of identifiers in shell scripts - CharacterSet setWord(CharacterSet::setAlphaNum, "._+-"); + const CharacterSet setWord(CharacterSet::setAlphaNum, "._+-"); CharacterSet setMetaCharacter(CharacterSet::setNone, "|&;()<> \t\r\n"); setMetaCharacter.Add(0); - CharacterSet setBashOperator(CharacterSet::setNone, "^&%()-+=|{}[]:;>,*/,*/(ch); Delimiter[DelimiterLength] = '\0'; } - ~HereDocCls() { - } }; HereDocCls HereDoc; @@ -360,32 +370,31 @@ void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int Open(u); } }; - QuoteCls Quote; class QuoteStackCls { // Class to manage quote pairs that nest public: int Count; int Up, Down; - int Style; + QuoteStyle Style; int Depth; // levels pushed - int CountStack[BASH_DELIM_STACK_MAX]; - int UpStack [BASH_DELIM_STACK_MAX]; - int StyleStack[BASH_DELIM_STACK_MAX]; + int CountStack[BASH_QUOTE_STACK_MAX]; + int UpStack [BASH_QUOTE_STACK_MAX]; + QuoteStyle StyleStack[BASH_QUOTE_STACK_MAX]; QuoteStackCls() { Count = 0; Up = '\0'; Down = '\0'; - Style = 0; + Style = QuoteStyle::Literal; Depth = 0; } - void Start(int u, int s) { + void Start(int u, QuoteStyle s) { Count = 1; Up = u; Down = opposite(Up); Style = s; } - void Push(int u, int s) { - if (Depth >= BASH_DELIM_STACK_MAX) + void Push(int u, QuoteStyle s) { + if (Depth >= BASH_QUOTE_STACK_MAX) return; CountStack[Depth] = Count; UpStack [Depth] = Up; @@ -405,8 +414,6 @@ void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int Style = StyleStack[Depth]; Down = opposite(Up); } - ~QuoteStackCls() { - } }; QuoteStackCls QuoteStack; @@ -415,9 +422,9 @@ void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int int numBase = 0; int digit; - Sci_PositionU endPos = startPos + length; - int cmdState = BASH_CMD_START; - int testExprType = 0; + const Sci_PositionU endPos = startPos + length; + CmdState cmdState = CmdState::Start; + TestExprType testExprType = TestExprType::Test; LexAccessor styler(pAccess); // Always backtracks to the start of a line that is not a continuation @@ -427,7 +434,7 @@ void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int ln--; for (;;) { startPos = styler.LineStart(ln); - if (ln == 0 || styler.GetLineState(ln) == BASH_CMD_START) + if (ln == 0 || styler.GetLineState(ln) == static_cast(CmdState::Start)) break; ln--; } @@ -447,33 +454,33 @@ void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int || sc.state == SCE_SH_COMMENTLINE || sc.state == SCE_SH_PARAM) { // force backtrack while retaining cmdState - styler.SetLineState(ln, BASH_CMD_BODY); + styler.SetLineState(ln, static_cast(CmdState::Body)); } else { if (ln > 0) { if ((sc.GetRelative(-3) == '\\' && sc.GetRelative(-2) == '\r' && sc.chPrev == '\n') || sc.GetRelative(-2) == '\\') { // handle '\' line continuation // retain last line's state } else - cmdState = BASH_CMD_START; + cmdState = CmdState::Start; } - styler.SetLineState(ln, cmdState); + styler.SetLineState(ln, static_cast(cmdState)); } } // controls change of cmdState at the end of a non-whitespace element - // states BODY|TEST|ARITH persist until the end of a command segment - // state WORD persist, but ends with 'in' or 'do' construct keywords - int cmdStateNew = BASH_CMD_BODY; - if (cmdState == BASH_CMD_TEST || cmdState == BASH_CMD_ARITH || cmdState == BASH_CMD_WORD) + // states Body|Test|Arithmetic persist until the end of a command segment + // state Word persist, but ends with 'in' or 'do' construct keywords + CmdState cmdStateNew = CmdState::Body; + if (cmdState == CmdState::Test || cmdState == CmdState::Arithmetic || cmdState == CmdState::Word) cmdStateNew = cmdState; - int stylePrev = sc.state; + const int stylePrev = sc.state; // Determine if the current state should terminate. switch (sc.state) { case SCE_SH_OPERATOR: sc.SetState(SCE_SH_DEFAULT); - if (cmdState == BASH_CMD_DELIM) // if command delimiter, start new command - cmdStateNew = BASH_CMD_START; + if (cmdState == CmdState::Delimiter) // if command delimiter, start new command + cmdStateNew = CmdState::Start; else if (sc.chPrev == '\\') // propagate command state if line continued cmdStateNew = cmdState; break; @@ -484,20 +491,20 @@ void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int char s2[10]; sc.GetCurrent(s, sizeof(s)); int identifierStyle = SCE_SH_IDENTIFIER; - int subStyle = classifierIdentifiers.ValueFor(s); + const int subStyle = classifierIdentifiers.ValueFor(s); if (subStyle >= 0) { identifierStyle = subStyle; } // allow keywords ending in a whitespace or command delimiter s2[0] = static_cast(sc.ch); s2[1] = '\0'; - bool keywordEnds = IsASpace(sc.ch) || cmdDelimiter.InList(s2); + const bool keywordEnds = IsASpace(sc.ch) || cmdDelimiter.InList(s2); // 'in' or 'do' may be construct keywords - if (cmdState == BASH_CMD_WORD) { + if (cmdState == CmdState::Word) { if (strcmp(s, "in") == 0 && keywordEnds) - cmdStateNew = BASH_CMD_BODY; + cmdStateNew = CmdState::Body; else if (strcmp(s, "do") == 0 && keywordEnds) - cmdStateNew = BASH_CMD_START; + cmdStateNew = CmdState::Start; else sc.ChangeState(identifierStyle); sc.SetState(SCE_SH_DEFAULT); @@ -505,33 +512,33 @@ void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int } // a 'test' keyword starts a test expression if (strcmp(s, "test") == 0) { - if (cmdState == BASH_CMD_START && keywordEnds) { - cmdStateNew = BASH_CMD_TEST; - testExprType = 0; + if (cmdState == CmdState::Start && keywordEnds) { + cmdStateNew = CmdState::Test; + testExprType = TestExprType::Test; } else sc.ChangeState(identifierStyle); } // detect bash construct keywords else if (bashStruct.InList(s)) { - if (cmdState == BASH_CMD_START && keywordEnds) - cmdStateNew = BASH_CMD_START; + if (cmdState == CmdState::Start && keywordEnds) + cmdStateNew = CmdState::Start; else sc.ChangeState(identifierStyle); } // 'for'|'case'|'select' needs 'in'|'do' to be highlighted later else if (bashStruct_in.InList(s)) { - if (cmdState == BASH_CMD_START && keywordEnds) - cmdStateNew = BASH_CMD_WORD; + if (cmdState == CmdState::Start && keywordEnds) + cmdStateNew = CmdState::Word; else sc.ChangeState(identifierStyle); } // disambiguate option items and file test operators else if (s[0] == '-') { - if (cmdState != BASH_CMD_TEST) + if (cmdState != CmdState::Test) sc.ChangeState(identifierStyle); } // disambiguate keywords and identifiers - else if (cmdState != BASH_CMD_START + else if (cmdState != CmdState::Start || !(keywords.InList(s) && keywordEnds)) { sc.ChangeState(identifierStyle); } @@ -540,10 +547,10 @@ void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int break; case SCE_SH_IDENTIFIER: if (sc.chPrev == '\\' || !setWord.Contains(sc.ch) || - (cmdState == BASH_CMD_ARITH && !setWordStart.Contains(sc.ch))) { + (cmdState == CmdState::Arithmetic && !setWordStart.Contains(sc.ch))) { char s[500]; sc.GetCurrent(s, sizeof(s)); - int subStyle = classifierIdentifiers.ValueFor(s); + const int subStyle = classifierIdentifiers.ValueFor(s); if (subStyle >= 0) { sc.ChangeState(subStyle); } @@ -627,7 +634,7 @@ void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int HereDoc.Quoted = true; HereDoc.State = 1; } else if (setHereDoc.Contains(sc.chNext) || - (sc.chNext == '=' && cmdState != BASH_CMD_ARITH)) { + (sc.chNext == '=' && cmdState != CmdState::Arithmetic)) { // an unquoted here-doc delimiter, no special handling HereDoc.State = 1; } else if (sc.chNext == '<') { // HERE string <<< @@ -636,7 +643,7 @@ void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int } else if (IsASpace(sc.chNext)) { // eat whitespace } else if (setLeftShift.Contains(sc.chNext) || - (sc.chNext == '=' && cmdState == BASH_CMD_ARITH)) { + (sc.chNext == '=' && cmdState == CmdState::Arithmetic)) { // left shift <<$var or <<= cases sc.ChangeState(SCE_SH_OPERATOR); sc.ForwardSetState(SCE_SH_DEFAULT); @@ -707,7 +714,7 @@ void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int if (!setParam.Contains(sc.ch)) { char s[500]; sc.GetCurrent(s, sizeof(s)); - int subStyle = classifierScalars.ValueFor(&s[1]); // skip the $ + const int subStyle = classifierScalars.ValueFor(&s[1]); // skip the $ if (subStyle >= 0) { sc.ChangeState(subStyle); } @@ -720,9 +727,10 @@ void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int } break; case SCE_SH_STRING: // delimited styles, can nest + case SCE_SH_PARAM: // ${parameter} case SCE_SH_BACKTICKS: if (sc.ch == '\\' && QuoteStack.Up != '\\') { - if (QuoteStack.Style != BASH_DELIM_LITERAL) + if (QuoteStack.Style != QuoteStyle::Literal) sc.Forward(); } else if (sc.ch == QuoteStack.Down) { QuoteStack.Count--; @@ -735,57 +743,46 @@ void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int } else if (sc.ch == QuoteStack.Up) { QuoteStack.Count++; } else { - if (QuoteStack.Style == BASH_DELIM_STRING || - QuoteStack.Style == BASH_DELIM_LSTRING + if (QuoteStack.Style == QuoteStyle::String || + QuoteStack.Style == QuoteStyle::LString ) { // do nesting for "string", $"locale-string" if (sc.ch == '`') { - QuoteStack.Push(sc.ch, BASH_DELIM_BACKTICK); + QuoteStack.Push(sc.ch, QuoteStyle::Backtick); } else if (sc.ch == '$' && sc.chNext == '(') { sc.Forward(); - QuoteStack.Push(sc.ch, BASH_DELIM_COMMAND); + QuoteStack.Push(sc.ch, QuoteStyle::Command); } - } else if (QuoteStack.Style == BASH_DELIM_COMMAND || - QuoteStack.Style == BASH_DELIM_BACKTICK - ) { // do nesting for $(command), `command` + } else if (QuoteStack.Style == QuoteStyle::Command || + QuoteStack.Style == QuoteStyle::Parameter || + QuoteStack.Style == QuoteStyle::Backtick + ) { // do nesting for $(command), `command`, ${parameter} if (sc.ch == '\'') { - QuoteStack.Push(sc.ch, BASH_DELIM_LITERAL); + QuoteStack.Push(sc.ch, QuoteStyle::Literal); } else if (sc.ch == '\"') { - QuoteStack.Push(sc.ch, BASH_DELIM_STRING); + QuoteStack.Push(sc.ch, QuoteStyle::String); } else if (sc.ch == '`') { - QuoteStack.Push(sc.ch, BASH_DELIM_BACKTICK); + QuoteStack.Push(sc.ch, QuoteStyle::Backtick); } else if (sc.ch == '$') { if (sc.chNext == '\'') { sc.Forward(); - QuoteStack.Push(sc.ch, BASH_DELIM_CSTRING); + QuoteStack.Push(sc.ch, QuoteStyle::CString); } else if (sc.chNext == '\"') { sc.Forward(); - QuoteStack.Push(sc.ch, BASH_DELIM_LSTRING); + QuoteStack.Push(sc.ch, QuoteStyle::LString); + } else if (sc.chNext == '{') { + sc.Forward(); + QuoteStack.Push(sc.ch, QuoteStyle::Parameter); } else if (sc.chNext == '(') { sc.Forward(); - QuoteStack.Push(sc.ch, BASH_DELIM_COMMAND); + QuoteStack.Push(sc.ch, QuoteStyle::Command); } } } } break; - case SCE_SH_PARAM: // ${parameter} - if (sc.ch == '\\' && Quote.Up != '\\') { - sc.Forward(); - } else if (sc.ch == Quote.Down) { - Quote.Count--; - if (Quote.Count == 0) { - sc.ForwardSetState(SCE_SH_DEFAULT); - } - } else if (sc.ch == Quote.Up) { - Quote.Count++; - } - break; case SCE_SH_CHARACTER: // singly-quoted strings - if (sc.ch == Quote.Down) { - Quote.Count--; - if (Quote.Count == 0) { - sc.ForwardSetState(SCE_SH_DEFAULT); - } + if (sc.ch == '\'') { + sc.ForwardSetState(SCE_SH_DEFAULT); } break; } @@ -851,7 +848,7 @@ void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int sc.SetState(SCE_SH_WORD); } // handle some zsh features within arithmetic expressions only - if (cmdState == BASH_CMD_ARITH) { + if (cmdState == CmdState::Arithmetic) { if (sc.chPrev == '[') { // [#8] [##8] output digit setting sc.SetState(SCE_SH_WORD); if (sc.chNext == '#') { @@ -869,13 +866,12 @@ void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int } } else if (sc.ch == '\"') { sc.SetState(SCE_SH_STRING); - QuoteStack.Start(sc.ch, BASH_DELIM_STRING); + QuoteStack.Start(sc.ch, QuoteStyle::String); } else if (sc.ch == '\'') { sc.SetState(SCE_SH_CHARACTER); - Quote.Start(sc.ch); } else if (sc.ch == '`') { sc.SetState(SCE_SH_BACKTICKS); - QuoteStack.Start(sc.ch, BASH_DELIM_BACKTICK); + QuoteStack.Start(sc.ch, QuoteStyle::Backtick); } else if (sc.ch == '$') { if (sc.Match("$((")) { sc.SetState(SCE_SH_OPERATOR); // handle '((' later @@ -885,19 +881,19 @@ void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int sc.Forward(); if (sc.ch == '{') { sc.ChangeState(SCE_SH_PARAM); - Quote.Start(sc.ch); + QuoteStack.Start(sc.ch, QuoteStyle::Parameter); } else if (sc.ch == '\'') { sc.ChangeState(SCE_SH_STRING); - QuoteStack.Start(sc.ch, BASH_DELIM_CSTRING); + QuoteStack.Start(sc.ch, QuoteStyle::CString); } else if (sc.ch == '"') { sc.ChangeState(SCE_SH_STRING); - QuoteStack.Start(sc.ch, BASH_DELIM_LSTRING); + QuoteStack.Start(sc.ch, QuoteStyle::LString); } else if (sc.ch == '(') { sc.ChangeState(SCE_SH_BACKTICKS); - QuoteStack.Start(sc.ch, BASH_DELIM_COMMAND); + QuoteStack.Start(sc.ch, QuoteStyle::Command); } else if (sc.ch == '`') { // $` seen in a configure script, valid? sc.ChangeState(SCE_SH_BACKTICKS); - QuoteStack.Start(sc.ch, BASH_DELIM_BACKTICK); + QuoteStack.Start(sc.ch, QuoteStyle::Backtick); } else { continue; // scalar has no delimiter pair } @@ -921,8 +917,8 @@ void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int bool isCmdDelim = false; sc.SetState(SCE_SH_OPERATOR); // globs have no whitespace, do not appear in arithmetic expressions - if (cmdState != BASH_CMD_ARITH && sc.ch == '(' && sc.chNext != '(') { - int i = GlobScan(sc); + if (cmdState != CmdState::Arithmetic && sc.ch == '(' && sc.chNext != '(') { + const int i = GlobScan(sc); if (i > 1) { sc.SetState(SCE_SH_IDENTIFIER); sc.Forward(i); @@ -930,31 +926,31 @@ void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int } } // handle opening delimiters for test/arithmetic expressions - ((,[[,[ - if (cmdState == BASH_CMD_START - || cmdState == BASH_CMD_BODY) { + if (cmdState == CmdState::Start + || cmdState == CmdState::Body) { if (sc.Match('(', '(')) { - cmdState = BASH_CMD_ARITH; + cmdState = CmdState::Arithmetic; sc.Forward(); } else if (sc.Match('[', '[') && IsASpace(sc.GetRelative(2))) { - cmdState = BASH_CMD_TEST; - testExprType = 1; + cmdState = CmdState::Test; + testExprType = TestExprType::DoubleBracket; sc.Forward(); } else if (sc.ch == '[' && IsASpace(sc.chNext)) { - cmdState = BASH_CMD_TEST; - testExprType = 2; + cmdState = CmdState::Test; + testExprType = TestExprType::SingleBracket; } } // special state -- for ((x;y;z)) in ... looping - if (cmdState == BASH_CMD_WORD && sc.Match('(', '(')) { - cmdState = BASH_CMD_ARITH; + if (cmdState == CmdState::Word && sc.Match('(', '(')) { + cmdState = CmdState::Arithmetic; sc.Forward(); continue; } - // handle command delimiters in command START|BODY|WORD state, also TEST if 'test' - if (cmdState == BASH_CMD_START - || cmdState == BASH_CMD_BODY - || cmdState == BASH_CMD_WORD - || (cmdState == BASH_CMD_TEST && testExprType == 0)) { + // handle command delimiters in command Start|Body|Word state, also Test if 'test' + if (cmdState == CmdState::Start + || cmdState == CmdState::Body + || cmdState == CmdState::Word + || (cmdState == CmdState::Test && testExprType == TestExprType::Test)) { s[0] = static_cast(sc.ch); if (setBashOperator.Contains(sc.chNext)) { s[1] = static_cast(sc.chNext); @@ -968,20 +964,20 @@ void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int isCmdDelim = cmdDelimiter.InList(s); } if (isCmdDelim) { - cmdState = BASH_CMD_DELIM; + cmdState = CmdState::Delimiter; continue; } } // handle closing delimiters for test/arithmetic expressions - )),]],] - if (cmdState == BASH_CMD_ARITH && sc.Match(')', ')')) { - cmdState = BASH_CMD_BODY; + if (cmdState == CmdState::Arithmetic && sc.Match(')', ')')) { + cmdState = CmdState::Body; sc.Forward(); - } else if (cmdState == BASH_CMD_TEST && IsASpace(sc.chPrev)) { - if (sc.Match(']', ']') && testExprType == 1) { + } else if (cmdState == CmdState::Test && IsASpace(sc.chPrev)) { + if (sc.Match(']', ']') && testExprType == TestExprType::DoubleBracket) { sc.Forward(); - cmdState = BASH_CMD_BODY; - } else if (sc.ch == ']' && testExprType == 2) { - cmdState = BASH_CMD_BODY; + cmdState = CmdState::Body; + } else if (sc.ch == ']' && testExprType == TestExprType::SingleBracket) { + cmdState = CmdState::Body; } } } @@ -1000,22 +996,22 @@ void SCI_METHOD LexerBash::Fold(Sci_PositionU startPos, Sci_Position length, int LexAccessor styler(pAccess); - Sci_PositionU endPos = startPos + length; + const Sci_PositionU endPos = startPos + length; int visibleChars = 0; int skipHereCh = 0; Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; - int styleNext = styler.StyleAt(startPos); + int styleNext = styler.StyleIndexAt(startPos); char word[8] = { '\0' }; // we're not interested in long words anyway unsigned int wordlen = 0; for (Sci_PositionU i = startPos; i < endPos; i++) { - char ch = chNext; + const char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); - int style = styleNext; - styleNext = styler.StyleAt(i + 1); - bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); + const int style = styleNext; + styleNext = styler.StyleIndexAt(i + 1); + const bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); // Comment folding if (options.foldComment && atEOL && IsCommentLine(lineCurrent, styler)) { @@ -1079,7 +1075,7 @@ void SCI_METHOD LexerBash::Fold(Sci_PositionU startPos, Sci_Position length, int visibleChars++; } // Fill in the real level of the next line, keeping the current flags as they will be filled in later - int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; + const int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } diff --git a/lexilla/lexers/LexBatch.cxx b/lexilla/lexers/LexBatch.cxx index afd8c041d..225465cf0 100644 --- a/lexilla/lexers/LexBatch.cxx +++ b/lexilla/lexers/LexBatch.cxx @@ -5,12 +5,12 @@ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include @@ -79,7 +79,7 @@ bool textQuoted(const char *lineBuffer, Sci_PositionU endPos) { const size_t strLength = strlen(strQuotes); for (size_t i = 0; i < strLength; i++) { const char *pQuote = strchr(strBuffer, strQuotes[i]); - while (pQuote != NULL) + while (pQuote) { if (!IsEscaped(strBuffer, pQuote - strBuffer)) { CurrentStatus = !CurrentStatus; @@ -159,7 +159,17 @@ void ColouriseBatchDoc( styler.ColourTo(endPos, SCE_BAT_COMMENT); } else { // Colorize Real Label - styler.ColourTo(endPos, SCE_BAT_LABEL); + // :[\t ]*[^\t &+:<>|]+ + const char *startLabelName = lineBuffer + offset + 1; + const size_t whitespaceLength = strspn(startLabelName, "\t "); + // Set of label-terminating characters determined experimentally + const char *endLabel = strpbrk(startLabelName + whitespaceLength, "\t &+:<>|"); + if (endLabel) { + styler.ColourTo(startLine + offset + endLabel - startLabelName, SCE_BAT_LABEL); + styler.ColourTo(endPos, SCE_BAT_AFTER_LABEL); // New style + } else { + styler.ColourTo(endPos, SCE_BAT_LABEL); + } } stopLineProcessing=true; // Check for Drive Change (Drive Change is internal command) - return if found @@ -630,9 +640,9 @@ void ColouriseBatchDoc( const char *const batchWordListDesc[] = { "Internal Commands", "External Commands", - 0 + nullptr }; } -LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc, "batch", 0, batchWordListDesc); +LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc, "batch", nullptr, batchWordListDesc); diff --git a/lexilla/lexers/LexCPP.cxx b/lexilla/lexers/LexCPP.cxx index 27a641eb2..c88d3e957 100644 --- a/lexilla/lexers/LexCPP.cxx +++ b/lexilla/lexers/LexCPP.cxx @@ -162,7 +162,7 @@ void highlightTaskMarker(StyleContext &sc, LexAccessor &styler, class EscapeSequence { const CharacterSet setHexDigits = CharacterSet(CharacterSet::setDigits, "ABCDEFabcdef"); - const CharacterSet setOctDigits = CharacterSet(CharacterSet::setNone, "01234567"); + const CharacterSet setOctDigits = CharacterSet("01234567"); const CharacterSet setNoneNumeric; const CharacterSet *escapeSetValid = nullptr; int digitsLeft = 0; @@ -537,11 +537,11 @@ public: explicit LexerCPP(bool caseSensitive_) : caseSensitive(caseSensitive_), setWord(CharacterSet::setAlphaNum, "._", true), - setNegationOp(CharacterSet::setNone, "!"), - setAddOp(CharacterSet::setNone, "+-"), - setMultOp(CharacterSet::setNone, "*/%"), - setRelOp(CharacterSet::setNone, "=!<>"), - setLogicalOp(CharacterSet::setNone, "|&"), + setNegationOp("!"), + setAddOp("+-"), + setMultOp("*/%"), + setRelOp("=!<>"), + setLogicalOp("|&"), subStyles(styleSubable, 0x80, 0x40, inactiveFlag) { } // Deleted so LexerCPP objects can not be copied. @@ -769,14 +769,14 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i const StyleContext::Transform transform = caseSensitive ? StyleContext::Transform::none : StyleContext::Transform::lower; - const CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-"); - const CharacterSet setCouldBePostOp(CharacterSet::setNone, "+-"); + const CharacterSet setOKBeforeRE("([{=,:;!%^&*|?~+-"); + const CharacterSet setCouldBePostOp("+-"); const CharacterSet setDoxygen(CharacterSet::setAlpha, "$@\\&<>#{}[]"); setWordStart = CharacterSet(CharacterSet::setAlpha, "_", true); - const CharacterSet setInvalidRawFirst(CharacterSet::setNone, " )\\\t\v\f\n"); + const CharacterSet setInvalidRawFirst(" )\\\t\v\f\n"); if (options.identifiersAllowDollars) { setWordStart.Add('$'); diff --git a/lexilla/lexers/LexLua.cxx b/lexilla/lexers/LexLua.cxx index fc9cef97d..44a4f3451 100644 --- a/lexilla/lexers/LexLua.cxx +++ b/lexilla/lexers/LexLua.cxx @@ -65,9 +65,9 @@ static void ColouriseLuaDoc( // Not exactly following number definition (several dots are seen as OK, etc.) // but probably enough in most cases. [pP] is for hex floats. CharacterSet setNumber(CharacterSet::setDigits, ".-+abcdefpABCDEFP"); - CharacterSet setExponent(CharacterSet::setNone, "eEpP"); - CharacterSet setLuaOperator(CharacterSet::setNone, "*/-+()={}~[];<>,.^%:#&|"); - CharacterSet setEscapeSkip(CharacterSet::setNone, "\"'\\"); + CharacterSet setExponent("eEpP"); + CharacterSet setLuaOperator("*/-+()={}~[];<>,.^%:#&|"); + CharacterSet setEscapeSkip("\"'\\"); Sci_Position currentLine = styler.GetLine(startPos); // Initialize long string [[ ... ]] or block comment --[[ ... ]], diff --git a/lexilla/lexers/LexVB.cxx b/lexilla/lexers/LexVB.cxx index 10d3f03e3..3e027e5dd 100644 --- a/lexilla/lexers/LexVB.cxx +++ b/lexilla/lexers/LexVB.cxx @@ -72,6 +72,10 @@ static void ColouriseVBDoc(Sci_PositionU startPos, Sci_Position length, int init int visibleChars = 0; int fileNbDigits = 0; + // property lexer.vb.strings.multiline + // Set to 1 to allow strings to continue over line ends. + bool allowMultilineStr = styler.GetPropertyInt("lexer.vb.strings.multiline", 0) != 0; + // Do not leak onto next line if (initStyle == SCE_B_STRINGEOL || initStyle == SCE_B_COMMENT || initStyle == SCE_B_PREPROCESSOR) { initStyle = SCE_B_DEFAULT; @@ -134,7 +138,7 @@ static void ColouriseVBDoc(Sci_PositionU startPos, Sci_Position length, int init } sc.ForwardSetState(SCE_B_DEFAULT); } - } else if (sc.atLineEnd) { + } else if (sc.atLineEnd && !allowMultilineStr) { visibleChars = 0; sc.ChangeState(SCE_B_STRINGEOL); sc.ForwardSetState(SCE_B_DEFAULT); diff --git a/lexilla/lexlib/CharacterSet.h b/lexilla/lexlib/CharacterSet.h index cc197ac64..848dc1d44 100644 --- a/lexilla/lexlib/CharacterSet.h +++ b/lexilla/lexlib/CharacterSet.h @@ -33,6 +33,9 @@ public: if (base & setDigits) AddString("0123456789"); } + CharacterSetArray(const char *initialSet, bool valueAfter_=false) noexcept : + CharacterSetArray(setNone, initialSet, valueAfter_) { + } // For compatibility with previous version but should not be used in new code. CharacterSetArray(setBase base, const char *initialSet, [[maybe_unused]]int size_, bool valueAfter_=false) noexcept : CharacterSetArray(base, initialSet, valueAfter_) { diff --git a/lexilla/lexlib/DefaultLexer.cxx b/lexilla/lexlib/DefaultLexer.cxx index 991dc34f7..d84062d9a 100644 --- a/lexilla/lexlib/DefaultLexer.cxx +++ b/lexilla/lexlib/DefaultLexer.cxx @@ -35,8 +35,7 @@ DefaultLexer::DefaultLexer(const char *languageName_, int language_, nClasses(nClasses_) { } -DefaultLexer::~DefaultLexer() { -} +DefaultLexer::~DefaultLexer() = default; void SCI_METHOD DefaultLexer::Release() { delete this; diff --git a/lexilla/lexlib/LexerModule.cxx b/lexilla/lexlib/LexerModule.cxx index 4b550f6bb..9846676a1 100644 --- a/lexilla/lexlib/LexerModule.cxx +++ b/lexilla/lexlib/LexerModule.cxx @@ -116,7 +116,7 @@ void LexerModule::Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initS startPos = newStartPos; initStyle = 0; if (startPos > 0) { - initStyle = styler.StyleAt(startPos - 1); + initStyle = styler.StyleIndexAt(startPos - 1); } } fnFolder(startPos, lengthDoc, initStyle, keywordlists, styler); diff --git a/lexilla/lexlib/PropSetSimple.cxx b/lexilla/lexlib/PropSetSimple.cxx index b6c4166f4..09648fddc 100644 --- a/lexilla/lexlib/PropSetSimple.cxx +++ b/lexilla/lexlib/PropSetSimple.cxx @@ -22,7 +22,7 @@ using namespace Lexilla; namespace { -typedef std::map> mapss; +using mapss = std::map>; mapss *PropsFromPointer(void *impl) noexcept { return static_cast(impl); @@ -45,7 +45,7 @@ bool PropSetSimple::Set(std::string_view key, std::string_view val) { mapss *props = PropsFromPointer(impl); if (!props) return false; - mapss::iterator it = props->find(key); + mapss::iterator const it = props->find(key); if (it != props->end()) { if (val == it->second) return false; @@ -59,7 +59,7 @@ bool PropSetSimple::Set(std::string_view key, std::string_view val) { const char *PropSetSimple::Get(std::string_view key) const { mapss *props = PropsFromPointer(impl); if (props) { - mapss::const_iterator keyPos = props->find(key); + mapss::const_iterator const keyPos = props->find(key); if (keyPos != props->end()) { return keyPos->second.c_str(); } diff --git a/lexilla/lexlib/WordList.cxx b/lexilla/lexlib/WordList.cxx index 2d95aa660..5cab08142 100644 --- a/lexilla/lexlib/WordList.cxx +++ b/lexilla/lexlib/WordList.cxx @@ -134,7 +134,7 @@ bool WordList::Set(const char *s) { len = lenTemp; std::fill(starts, std::end(starts), -1); for (int l = static_cast(len - 1); l >= 0; l--) { - unsigned char indexChar = words[l][0]; + unsigned char const indexChar = words[l][0]; starts[indexChar] = l; } return true; diff --git a/lexilla/scripts/LexillaData.py b/lexilla/scripts/LexillaData.py index 0a519613e..4b1cc8b84 100644 --- a/lexilla/scripts/LexillaData.py +++ b/lexilla/scripts/LexillaData.py @@ -49,17 +49,17 @@ def FindModules(lexFile): partLine = "" with lexFile.open(encoding=neutralEncoding) as f: lineNum = 0 - for l in f.readlines(): + for line in f.readlines(): lineNum += 1 - l = l.rstrip() - if partLine or l.startswith("LexerModule"): - if ")" in l: - l = partLine + l - original = l - l = l.replace("(", " ") - l = l.replace(")", " ") - l = l.replace(",", " ") - parts = l.split() + line = line.rstrip() + if partLine or line.startswith("LexerModule"): + if ")" in line: + line = partLine + line + original = line + line = line.replace("(", " ") + line = line.replace(")", " ") + line = line.replace(",", " ") + parts = line.split() lexerName = parts[4] if not (lexerName.startswith('"') and lexerName.endswith('"')): print(f"{lexFile}:{lineNum}: Bad LexerModule statement:\n{original}") @@ -68,7 +68,7 @@ def FindModules(lexFile): modules.append([parts[1], parts[2], lexerName]) partLine = "" else: - partLine = partLine + l + partLine = partLine + line return modules def FindLexersInXcode(xCodeProject): @@ -114,11 +114,11 @@ knownIrregularProperties = [ def FindProperties(lexFile): properties = {} with open(lexFile, encoding=neutralEncoding) as f: - for l in f.readlines(): - if ("GetProperty" in l or "DefineProperty" in l) and "\"" in l: - l = l.strip() - if not l.startswith("//"): # Drop comments - propertyName = l.split("\"")[1] + for s in f.readlines(): + if ("GetProperty" in s or "DefineProperty" in s) and "\"" in s: + s = s.strip() + if not s.startswith("//"): # Drop comments + propertyName = s.split("\"")[1] if propertyName.lower() == propertyName: # Only allow lower case property names if propertyName in knownIrregularProperties or \ @@ -131,36 +131,36 @@ def FindPropertyDocumentation(lexFile): documents = {} with lexFile.open(encoding=neutralEncoding) as f: name = "" - for l in f.readlines(): - l = l.strip() - if "// property " in l: - propertyName = l.split()[2] + for line in f.readlines(): + line = line.strip() + if "// property " in line: + propertyName = line.split()[2] if propertyName.lower() == propertyName: # Only allow lower case property names name = propertyName documents[name] = "" - elif "DefineProperty" in l and "\"" in l: - propertyName = l.split("\"")[1] + elif "DefineProperty" in line and "\"" in line: + propertyName = line.split("\"")[1] if propertyName.lower() == propertyName: # Only allow lower case property names name = propertyName documents[name] = "" elif name: - if l.startswith("//"): + if line.startswith("//"): if documents[name]: documents[name] += " " - documents[name] += l[2:].strip() - elif l.startswith("\""): - l = l[1:].strip() - if l.endswith(";"): - l = l[:-1].strip() - if l.endswith(")"): - l = l[:-1].strip() - if l.endswith("\""): - l = l[:-1] + documents[name] += line[2:].strip() + elif line.startswith("\""): + line = line[1:].strip() + if line.endswith(";"): + line = line[:-1].strip() + if line.endswith(")"): + line = line[:-1].strip() + if line.endswith("\""): + line = line[:-1] # Fix escaped double quotes - l = l.replace("\\\"", "\"") - documents[name] += l + line = line.replace("\\\"", "\"") + documents[name] += line else: name = "" for name in list(documents.keys()): @@ -172,15 +172,15 @@ def FindCredits(historyFile): credits = [] stage = 0 with historyFile.open(encoding="utf-8") as f: - for l in f.readlines(): - l = l.strip() - if stage == 0 and l == "": + for line in f.readlines(): + line = line.strip() + if stage == 0 and line == "
": stage = 1 - elif stage == 1 and l == "
": + elif stage == 1 and line == "": stage = 2 - if stage == 1 and l.startswith(""): - credit = l[4:-5] - if ""): + credit = line[4:-5] + if "") name = end.split("<")[0] @@ -195,19 +195,19 @@ def FindCredits(historyFile): def ciKey(a): return str(a).lower() -def SortListInsensitive(l): - l.sort(key=ciKey) +def SortListInsensitive(list): + list.sort(key=ciKey) class LexillaData: def __init__(self, scintillaRoot): # Discover version information self.version = (scintillaRoot / "version.txt").read_text().strip() - self.versionDotted = self.version[0] + '.' + self.version[1] + '.' + \ - self.version[2] + self.versionDotted = self.version[0:-2] + '.' + self.version[-2] + '.' + \ + self.version[-1] self.versionCommad = self.versionDotted.replace(".", ", ") + ', 0' with (scintillaRoot / "doc" / "Lexilla.html").open() as f: - self.dateModified = [l for l in f.readlines() if "Date.Modified" in l]\ + self.dateModified = [d for d in f.readlines() if "Date.Modified" in d]\ [0].split('\"')[3] # 20130602 # Lexilla.html diff --git a/lexilla/scripts/LexillaGen.cmd b/lexilla/scripts/LexillaGen.cmd index 0a3e63bbb..b9cb2aaae 100644 --- a/lexilla/scripts/LexillaGen.cmd +++ b/lexilla/scripts/LexillaGen.cmd @@ -10,9 +10,9 @@ pushd %_THISDIR_% set _EXITCODE_=0 -set _PYTHON_EXE=d:\DEV\Python_Embed_311_x64\python.exe +::set _PYTHON_EXE=d:\DEV\Python_Embed_311_x64\python.exe rem call :RESOLVE_PATH _PYTHON_EXE "%_THISDIR_%..\..\..\..\_python_emb\python.exe" -rem set _PYTHON_EXE=python.exe +set _PYTHON_EXE=python.exe set _CMD_="%_PYTHON_EXE%" "%~dpn0.py" echo.Calling: %_CMD_% diff --git a/lexilla/scripts/LexillaGen.py b/lexilla/scripts/LexillaGen.py index eb7e718ca..48331a0c1 100644 --- a/lexilla/scripts/LexillaGen.py +++ b/lexilla/scripts/LexillaGen.py @@ -106,7 +106,7 @@ def RegenerateAll(rootDirectory): # Discover version information version = (lexillaDir / "version.txt").read_text().strip() - versionDotted = version[0] + '.' + version[1] + '.' + version[2] + versionDotted = version[0:-2] + '.' + version[-2] + '.' + version[-1] versionCommad = versionDotted.replace(".", ", ") + ', 0' rcPath = srcDir / "LexillaVersion.rc" @@ -117,7 +117,7 @@ def RegenerateAll(rootDirectory): UpdateLineInFile(docDir / "LexillaDownload.html", " Release", " Release " + versionDotted) ReplaceREInFile(docDir / "LexillaDownload.html", - r"/www.scintilla.org/([a-zA-Z]+)\d\d\d", + r"/www.scintilla.org/([a-zA-Z]+)\d{3,5}", r"/www.scintilla.org/\g<1>" + version, 0) diff --git a/src/StyleLexers/styleLexBAT.c b/src/StyleLexers/styleLexBAT.c index 8c0720101..92c381264 100644 --- a/src/StyleLexers/styleLexBAT.c +++ b/src/StyleLexers/styleLexBAT.c @@ -30,6 +30,7 @@ EDITLEXER lexBAT = { {SCE_BAT_OPERATOR}, IDS_LEX_STR_Operator, L"Operator", L"fore:#B000B0", L"" }, { {MULTI_STYLE(SCE_BAT_COMMAND,SCE_BAT_HIDE,0,0)}, IDS_LEX_STR_Cmd, L"Command", L"bold", L"" }, { {SCE_BAT_LABEL}, IDS_LEX_STR_Label, L"Label", L"fore:#C80000; back:#F4F4F4; eolfilled", L"" }, + { {SCE_BAT_AFTER_LABEL}, IDS_LEX_STR_AfterLabel, L"After Label", L"fore:#00ACAC;", L"" }, EDITLEXER_SENTINEL } };