diff options
-rw-r--r-- | doc/ScintillaHistory.html | 4 | ||||
-rw-r--r-- | lexers/LexAsm.cxx | 10 |
2 files changed, 13 insertions, 1 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index a585f0751..413d13ee4 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -578,6 +578,10 @@ <a href="https://sourceforge.net/p/scintilla/feature-requests/1344/">Feature #1344</a>. </li> <li> + Assembler lexers asm and as can change comment character with lexer.as.comment.character property. + <a href="https://sourceforge.net/p/scintilla/feature-requests/1314/">Feature #1314</a>. + </li> + <li> Fix brace styling in Batch lexer so that brace matching works. <a href="https://sourceforge.net/p/scintilla/bugs/1624/">Bug #1624</a>, <a href="https://sourceforge.net/p/scintilla/bugs/1906/">Bug #1906</a>, diff --git a/lexers/LexAsm.cxx b/lexers/LexAsm.cxx index 8c30087cd..4560f9751 100644 --- a/lexers/LexAsm.cxx +++ b/lexers/LexAsm.cxx @@ -80,6 +80,7 @@ struct OptionsAsm { std::string foldExplicitEnd; bool foldExplicitAnywhere; bool foldCompact; + std::string commentChar; OptionsAsm() { delimiter = ""; fold = false; @@ -90,6 +91,7 @@ struct OptionsAsm { foldExplicitEnd = ""; foldExplicitAnywhere = false; foldCompact = true; + commentChar = ""; } }; @@ -134,6 +136,9 @@ struct OptionSetAsm : public OptionSet<OptionsAsm> { DefineProperty("fold.compact", &OptionsAsm::foldCompact); + DefineProperty("lexer.as.comment.character", &OptionsAsm::commentChar, + "Overrides the default comment character (which is ';' for asm and '#' for as)."); + DefineWordListSets(asmWordListDesc); } }; @@ -245,6 +250,9 @@ Sci_Position SCI_METHOD LexerAsm::WordListSet(int n, const char *wl) { void SCI_METHOD LexerAsm::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { LexAccessor styler(pAccess); + const char commentCharacter = options.commentChar.empty() ? + commentChar : options.commentChar.front(); + // Do not leak onto next line if (initStyle == SCE_ASM_STRINGEOL) initStyle = SCE_ASM_DEFAULT; @@ -350,7 +358,7 @@ void SCI_METHOD LexerAsm::Lex(Sci_PositionU startPos, Sci_Position length, int i // Determine if a new state should be entered. if (sc.state == SCE_ASM_DEFAULT) { - if (sc.ch == commentChar){ + if (sc.ch == commentCharacter) { sc.SetState(SCE_ASM_COMMENT); } else if (IsASCII(sc.ch) && (isdigit(sc.ch) || (sc.ch == '.' && IsASCII(sc.chNext) && isdigit(sc.chNext)))) { sc.SetState(SCE_ASM_NUMBER); |