diff options
author | nyamatongwe <devnull@localhost> | 2011-01-20 12:08:06 +1100 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2011-01-20 12:08:06 +1100 |
commit | a129d2b80c29932e6794de2d6097e0c64ca9312e (patch) | |
tree | f12b561e109530f20ead359039ba8c44030c1114 | |
parent | 75c94da2a7603e83cc89b76c9c4105537f9e148d (diff) | |
download | scintilla-mirror-a129d2b80c29932e6794de2d6097e0c64ca9312e.tar.gz |
Allow words to include '.' with lexer.sql.allow.dotted.word. Feature #3103129.
From b548204bb.
-rw-r--r-- | lexers/LexSQL.cxx | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lexers/LexSQL.cxx b/lexers/LexSQL.cxx index 6567b817a..6a07c5231 100644 --- a/lexers/LexSQL.cxx +++ b/lexers/LexSQL.cxx @@ -38,8 +38,11 @@ using namespace Scintilla; #endif -static inline bool IsAWordChar(int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '_'); +static inline bool IsAWordChar(int ch, bool sqlAllowDottedWord) { + if (!sqlAllowDottedWord) + return (ch < 0x80) && (isalnum(ch) || ch == '_'); + else + return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch=='.'); } static inline bool IsAWordStart(int ch) { @@ -173,6 +176,7 @@ struct OptionsSQL { bool sqlBackticksIdentifier; bool sqlNumbersignComment; bool sqlBackslashEscapes; + bool sqlAllowDottedWord; OptionsSQL() { fold = false; foldAtElse = false; @@ -183,6 +187,7 @@ struct OptionsSQL { sqlBackticksIdentifier = false; sqlNumbersignComment = false; sqlBackslashEscapes = false; + sqlAllowDottedWord = false; } }; @@ -222,6 +227,10 @@ struct OptionSetSQL : public OptionSet<OptionsSQL> { DefineProperty("sql.backslash.escapes", &OptionsSQL::sqlBackslashEscapes, "Enables backslash as an escape character in SQL."); + DefineProperty("lexer.sql.allow.dotted.word", &OptionsSQL::sqlAllowDottedWord, + "Set to 1 to colourise recognized words with dots " + "(recommended for Oracle PL/SQL objects)."); + DefineWordListSets(sqlWordListDesc); } }; @@ -351,7 +360,7 @@ void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle, } break; case SCE_SQL_IDENTIFIER: - if (!IsAWordChar(sc.ch)) { + if (!IsAWordChar(sc.ch, options.sqlAllowDottedWord)) { int nextState = SCE_SQL_DEFAULT; char s[1000]; sc.GetCurrentLowered(s, sizeof(s)); |