From f8c8abef5246cd06f3eb2613627c725bde6a4c52 Mon Sep 17 00:00:00 2001 From: Neil Date: Fri, 14 Mar 2014 08:04:34 +1100 Subject: Assembler lexer variant As(SCLEX_AS) for Unix assembly code which uses '#' for comments and ';' to separate statements. From nkmathew. --- lexers/LexAsm.cxx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'lexers') diff --git a/lexers/LexAsm.cxx b/lexers/LexAsm.cxx index b327ce5f2..37a4efe35 100644 --- a/lexers/LexAsm.cxx +++ b/lexers/LexAsm.cxx @@ -150,8 +150,10 @@ class LexerAsm : public ILexer { WordList directives4foldend; OptionsAsm options; OptionSetAsm osAsm; + int commentChar; public: - LexerAsm() { + LexerAsm(int commentChar_) { + commentChar = commentChar_; } virtual ~LexerAsm() { } @@ -183,7 +185,11 @@ public: } static ILexer *LexerFactoryAsm() { - return new LexerAsm(); + return new LexerAsm(';'); + } + + static ILexer *LexerFactoryAs() { + return new LexerAsm('#'); } }; @@ -342,7 +348,7 @@ void SCI_METHOD LexerAsm::Lex(unsigned int startPos, int length, int initStyle, // Determine if a new state should be entered. if (sc.state == SCE_ASM_DEFAULT) { - if (sc.ch == ';'){ + if (sc.ch == commentChar){ 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); @@ -457,4 +463,5 @@ void SCI_METHOD LexerAsm::Fold(unsigned int startPos, int length, int initStyle, } LexerModule lmAsm(SCLEX_ASM, LexerAsm::LexerFactoryAsm, "asm", asmWordListDesc); +LexerModule lmAs(SCLEX_AS, LexerAsm::LexerFactoryAs, "as", asmWordListDesc); -- cgit v1.2.3