From: khamidou Date: Tue, 18 Jan 2011 08:04:43 +0000 (+0100) Subject: added support for comments in as X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=f69135f23ab569ec1d343f8a9100277cbc8975cb;p=miniforth.git added support for comments in as --- diff --git a/aslexer.l b/aslexer.l index 37f1e6b..d03f84a 100644 --- a/aslexer.l +++ b/aslexer.l @@ -3,9 +3,18 @@ #include "tokens.h" %} +%s in_comment %% <> { return -1; } + + +; BEGIN(in_comment); +\n BEGIN(INITIAL); +[^\n]+ // eat comment +; // eat the lone ';' + + "push" { return T_PUSH; } "pop" { return T_POP; } "nop" { return T_NOP; } @@ -13,11 +22,11 @@ "inc" { return T_INC; } "dec" { return T_DEC; } "call" { return T_CALL; } +"ret" { return T_RET; } "jmp" { return T_JMP; } [ \t\n]+ /* ignore whitespace */ [0-9]+ { return NUMBER; } -; { return COMMA; } [a-zA-Z][a-zA-Z0-9]*: { return T_LABEL; } [a-zA-Z][a-zA-Z0-9]* { return WORD; }