diff options
author | nyamatongwe <unknown> | 2011-01-20 12:08:06 +1100 |
---|---|---|
committer | nyamatongwe <unknown> | 2011-01-20 12:08:06 +1100 |
commit | 8fd0fabbef65fee9e128547d68eef6bdbe3485e4 (patch) | |
tree | 569970e841c9375fd882e0998620bf2bfef3a165 /lexers/LexSQL.cxx | |
parent | 005d7dcdc7adef49c64472ec382b4a6b4de45376 (diff) | |
download | scintilla-mirror-8fd0fabbef65fee9e128547d68eef6bdbe3485e4.tar.gz |
Allow words to include '.' with lexer.sql.allow.dotted.word. Feature #3103129.
From b548204bb.
Diffstat (limited to 'lexers/LexSQL.cxx')
-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)); |