diff options
-rw-r--r-- | lexer.l | 5 | ||||
-rw-r--r-- | parser.y | 5 |
2 files changed, 6 insertions, 4 deletions
@@ -55,7 +55,10 @@ EOI [ \t\n#] <inst>nop/{EOI} { BEGIN(args); return T_NOP; } {SP}*{COMMENT}?\n { BEGIN(INITIAL); return T_EOL; } -{SP}*{COMMENT} { BEGIN(INITIAL); return T_SPACE; } +{SP}*{COMMENT} { BEGIN(INITIAL); return T_EOL; } {SP}+ { return T_SPACE; } +<INITIAL><<EOF>> { return 0; } +<<EOF>> { BEGIN(INITIAL); return T_EOL; } + %% @@ -69,7 +69,7 @@ void yyerror(const char *msg) %type <inst> inst %% -input: %empty +input: line | input line ; @@ -151,6 +151,5 @@ inst: T_ADD ; eol: T_EOL - | T_SPACE END - | END + | T_SPACE T_EOL ; |