diff options
author | Jad Altahan <xviyy@aol.com> | 2019-01-30 11:35:01 +1100 |
---|---|---|
committer | Jad Altahan <xviyy@aol.com> | 2019-01-30 11:35:01 +1100 |
commit | 86900d9f6c64e0598e5b217a1d393e55cb53602b (patch) | |
tree | 8ff373d973fcc7025b02bf24d0aee94aa387cac0 /lexers/LexNim.cxx | |
parent | 850cfb235e8e92c5b180c94f81d599f88e8cef01 (diff) | |
download | scintilla-mirror-86900d9f6c64e0598e5b217a1d393e55cb53602b.tar.gz |
Feature [feature-requests:#1261]. Enhance the styling of backticks in Nim
Diffstat (limited to 'lexers/LexNim.cxx')
-rw-r--r-- | lexers/LexNim.cxx | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/lexers/LexNim.cxx b/lexers/LexNim.cxx index 228666b32..fec9159ef 100644 --- a/lexers/LexNim.cxx +++ b/lexers/LexNim.cxx @@ -454,6 +454,18 @@ void SCI_METHOD LexerNim::Lex(Sci_PositionU startPos, Sci_Position length, sc.ForwardSetState(SCE_NIM_DEFAULT); } break; + case SCE_NIM_FUNCNAME: + if (sc.ch == '`') { + funcNameExists = false; + sc.ForwardSetState(SCE_NIM_DEFAULT); + } else if (sc.atLineEnd) { + // Prevent leaking the style to the next line if not closed + funcNameExists = false; + + sc.ChangeState(SCE_NIM_STRINGEOL); + sc.ForwardSetState(SCE_NIM_DEFAULT); + } + break; case SCE_NIM_COMMENT: if (sc.Match(']', '#')) { if (commentNestLevel > 0) { @@ -527,7 +539,10 @@ void SCI_METHOD LexerNim::Lex(Sci_PositionU startPos, Sci_Position length, } break; case SCE_NIM_BACKTICKS: - if (sc.ch == '`' || sc.atLineEnd) { + if (sc.ch == '`' ) { + sc.ForwardSetState(SCE_NIM_DEFAULT); + } else if (sc.atLineEnd) { + sc.ChangeState(SCE_NIM_STRINGEOL); sc.ForwardSetState(SCE_NIM_DEFAULT); } break; @@ -631,10 +646,10 @@ void SCI_METHOD LexerNim::Lex(Sci_PositionU startPos, Sci_Position length, } // Operator definition else if (sc.ch == '`') { - sc.SetState(SCE_NIM_BACKTICKS); - if (funcNameExists) { - funcNameExists = false; + sc.SetState(SCE_NIM_FUNCNAME); + } else { + sc.SetState(SCE_NIM_BACKTICKS); } } // Keyword |