diff options
author | nyamatongwe <unknown> | 2010-05-02 22:47:15 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2010-05-02 22:47:15 +0000 |
commit | f6b10abb146ce7a9b59b4428b1eb405ac88aa80e (patch) | |
tree | 89ebf66887df764fba312a0e610344457a57e98f | |
parent | f73b5ae0e7a2b461bdb59f72f2803645b48b0d7e (diff) | |
download | scintilla-mirror-f6b10abb146ce7a9b59b4428b1eb405ac88aa80e.tar.gz |
Simplest changes from Feature Request #2992689 Lexer for xBase dialects.
Removes unused lexical states.
Removes treament of "'" as comment indicator for folding.
-rw-r--r-- | include/SciLexer.h | 5 | ||||
-rw-r--r-- | include/Scintilla.iface | 7 | ||||
-rw-r--r-- | src/LexFlagship.cxx | 29 |
3 files changed, 9 insertions, 32 deletions
diff --git a/include/SciLexer.h b/include/SciLexer.h index 523cdd6d3..da3771ec2 100644 --- a/include/SciLexer.h +++ b/include/SciLexer.h @@ -1082,11 +1082,6 @@ #define SCE_FS_DATE 16 #define SCE_FS_STRINGEOL 17 #define SCE_FS_CONSTANT 18 -#define SCE_FS_ASM 19 -#define SCE_FS_LABEL 20 -#define SCE_FS_ERROR 21 -#define SCE_FS_HEXNUMBER 22 -#define SCE_FS_BINNUMBER 23 #define SCE_CSOUND_DEFAULT 0 #define SCE_CSOUND_COMMENT 1 #define SCE_CSOUND_NUMBER 2 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 96f1494c5..04766d78a 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -3389,7 +3389,7 @@ val SCE_ST_ASSIGN=14 val SCE_ST_CHARACTER=15 val SCE_ST_SPEC_SEL=16 # Lexical states for SCLEX_FLAGSHIP (clipper) -lex FlagShip=SCLEX_FLAGSHIP SCE_B_ +lex FlagShip=SCLEX_FLAGSHIP SCE_FS_ val SCE_FS_DEFAULT=0 val SCE_FS_COMMENT=1 val SCE_FS_COMMENTLINE=2 @@ -3409,11 +3409,6 @@ val SCE_FS_IDENTIFIER=15 val SCE_FS_DATE=16 val SCE_FS_STRINGEOL=17 val SCE_FS_CONSTANT=18 -val SCE_FS_ASM=19 -val SCE_FS_LABEL=20 -val SCE_FS_ERROR=21 -val SCE_FS_HEXNUMBER=22 -val SCE_FS_BINNUMBER=23 # Lexical states for SCLEX_CSOUND lex Csound=SCLEX_CSOUND SCE_CSOUND_ val SCE_CSOUND_DEFAULT=0 diff --git a/src/LexFlagship.cxx b/src/LexFlagship.cxx index baf2941a8..ec0e44c07 100644 --- a/src/LexFlagship.cxx +++ b/src/LexFlagship.cxx @@ -1,6 +1,6 @@ // Scintilla source code edit control /** @file LexFlagShip.cxx - ** Lexer for FlagShip + ** Lexer for FlagShip ** (Syntactically compatible to other XBase dialects, like dBase, Clipper, Fox etc.) **/ // Copyright 2005 by Randy Butler @@ -26,10 +26,6 @@ using namespace Scintilla; #endif -static bool IsFlagShipComment(Accessor &styler, int pos, int len) { - return len>0 && styler[pos]=='\''; -} - static inline bool IsTypeCharacter(int ch) { return ch == '%' || ch == '&' || ch == '@' || ch == '!' || ch == '#' || ch == '$'; } @@ -54,7 +50,6 @@ static inline bool IsADateCharacter(const int ch) { static void ColouriseFlagShipDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { - //bool FSScriptSyntax = true; WordList &keywords = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; @@ -179,30 +174,26 @@ static void FoldFlagShipDoc(unsigned int startPos, int length, int, // Backtrack to previous line in case need to fix its fold status int lineCurrent = styler.GetLine(startPos); - if (startPos > 0) { - if (lineCurrent > 0) { - lineCurrent--; - startPos = styler.LineStart(lineCurrent); - } + if (startPos > 0 && lineCurrent > 0) { + lineCurrent--; + startPos = styler.LineStart(lineCurrent); } int spaceFlags = 0; - int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsFlagShipComment); + int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags); char chNext = styler[startPos]; for (int i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); - if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == endPos)) { + if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == endPos-1)) { int lev = indentCurrent; - int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsFlagShipComment); + int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags); if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { - // Only non whitespace lines can be headers if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) { lev |= SC_FOLDLEVELHEADERFLAG; } else if (indentNext & SC_FOLDLEVELWHITEFLAG) { - // Line after is blank so check the next - maybe should continue further? int spaceFlags2 = 0; - int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsFlagShipComment); + int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2); if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) { lev |= SC_FOLDLEVELHEADERFLAG; } @@ -215,7 +206,6 @@ static void FoldFlagShipDoc(unsigned int startPos, int length, int, } } - static const char * const FSWordListDesc[] = { "Keywords", "functions", @@ -225,6 +215,3 @@ static const char * const FSWordListDesc[] = { }; LexerModule lmFlagShip(SCLEX_FLAGSHIP, ColouriseFlagShipDoc, "flagship", FoldFlagShipDoc, FSWordListDesc); - - - |