diff options
author | Joe Mueller <unknown> | 2015-02-09 14:48:58 -0800 |
---|---|---|
committer | Joe Mueller <unknown> | 2015-02-09 14:48:58 -0800 |
commit | 1e2d91b4dff41076f01d8c3f5515e3ea930c8977 (patch) | |
tree | a387f8d5295d6130f3c7d48ea9f7090ff7358528 /lexers/LexVerilog.cxx | |
parent | 2e4572c276d0b07fe25437b7264eed90991aab80 (diff) | |
download | scintilla-mirror-1e2d91b4dff41076f01d8c3f5515e3ea930c8977.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); |