From 8fd0fabbef65fee9e128547d68eef6bdbe3485e4 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Thu, 20 Jan 2011 12:08:06 +1100 Subject: Allow words to include '.' with lexer.sql.allow.dotted.word. Feature #3103129. From b548204bb. --- lexers/LexSQL.cxx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'lexers/LexSQL.cxx') 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 { 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)); -- cgit v1.2.3