diff options
| author | Dejan Budimir <unknown> | 2020-04-21 22:11:01 +1000 |
|---|---|---|
| committer | Dejan Budimir <unknown> | 2020-04-21 22:11:01 +1000 |
| commit | 7ba1c94e850603d2a70f1a52e737cc8f83cffbee (patch) | |
| tree | 33d7b6076c4ce797083d08186f674eed41bea8e5 /lexers/LexAsm.cxx | |
| parent | 5dfc62a244a8ca24efb9ce9cb51c1098e908a9a8 (diff) | |
| download | scintilla-mirror-7ba1c94e850603d2a70f1a52e737cc8f83cffbee.tar.gz | |
Backport: Feature [feature-requests:1346]. Add lexer.as.comment.character property to
change comment character.
Backport of changeset 8155:b89853508137.
Diffstat (limited to 'lexers/LexAsm.cxx')
| -rw-r--r-- | lexers/LexAsm.cxx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lexers/LexAsm.cxx b/lexers/LexAsm.cxx index 9bc775ceb..7f9c7d50b 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); |
