diff options
| author | Joe Mueller <devnull@localhost> | 2015-02-09 14:48:58 -0800 |
|---|---|---|
| committer | Joe Mueller <devnull@localhost> | 2015-02-09 14:48:58 -0800 |
| commit | 39ffe8274124f4b385fa8c7bba1e2605b0adeef7 (patch) | |
| tree | bcdd863c9b50e24edabad6a4e750e9d89627b243 /lexers/LexVerilog.cxx | |
| parent | 3bc8aa826c28d91b5e5cf248234a0db09f7b07a6 (diff) | |
| download | scintilla-mirror-39ffe8274124f4b385fa8c7bba1e2605b0adeef7.tar.gz | |
add support for escaped identifiers
Diffstat (limited to 'lexers/LexVerilog.cxx')
| -rw-r--r-- | lexers/LexVerilog.cxx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lexers/LexVerilog.cxx b/lexers/LexVerilog.cxx index 05922d22d..97fbaffa8 100644 --- a/lexers/LexVerilog.cxx +++ b/lexers/LexVerilog.cxx @@ -439,6 +439,7 @@ void SCI_METHOD LexerVerilog::Lex(unsigned int startPos, int length, int initSty int activitySet = preproc.IsInactive() ? activeFlag : 0; int lineEndNext = styler.LineEnd(curLine); + bool isEscapedId = false; // true when parsing an escaped Identifier for (; sc.More(); sc.Forward()) { if (sc.atLineStart) { @@ -461,6 +462,7 @@ void SCI_METHOD LexerVerilog::Lex(unsigned int startPos, int length, int initSty vlls.Add(curLine, preproc); // Update the line state, so it can be seen by next line styler.SetLineState(curLine, lineState); + isEscapedId = false; // EOL terminates an escaped Identifier } // Handle line continuation generically. @@ -508,7 +510,8 @@ void SCI_METHOD LexerVerilog::Lex(unsigned int startPos, int length, int initSty } break; case SCE_V_IDENTIFIER: - if (!IsAWordChar(sc.ch) || (sc.ch == '.')) { + if ((!isEscapedId &&(!IsAWordChar(sc.ch) || (sc.ch == '.'))) || + (isEscapedId && isspacechar(sc.ch))) { char s[100]; lineState &= 0xff00; sc.GetCurrent(s, sizeof(s)); @@ -589,6 +592,7 @@ void SCI_METHOD LexerVerilog::Lex(unsigned int startPos, int length, int initSty vlls.Add(curLine, preproc); // Update the line state, so it can be seen by next line styler.SetLineState(curLine, lineState); + isEscapedId = false; // EOL terminates an escaped Identifier } // Determine if a new state should be entered. @@ -721,12 +725,20 @@ void SCI_METHOD LexerVerilog::Lex(unsigned int startPos, int length, int initSty } } } + } else if (sc.ch == '\\') { + // escaped identifier, everything is ok up to whitespace + isEscapedId = true; + sc.SetState(SCE_V_IDENTIFIER|activitySet); } else if (isoperator(static_cast<char>(sc.ch)) || sc.ch == '@' || sc.ch == '#') { sc.SetState(SCE_V_OPERATOR|activitySet); if (sc.ch == '.') lineState = kwDot; if (sc.ch == ';') lineState = kwOther; } } + if (isEscapedId && isspacechar(sc.ch)) { + isEscapedId = false; + sc.SetState(SCE_V_DEFAULT|activitySet); + } } if (definitionsChanged) { styler.ChangeLexerState(startPos, startPos + length); |
