commit b901950f62fddac2af08ac11a72b6469f61bb316
parent e5ff2e7d454efa06dfa926cca107f302e93c7256
Author: William Casarin <jb55@jb55.com>
Date: Wed, 20 Dec 2017 13:49:46 -0800
parser: implement comments
Diffstat:
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/lexer.l b/lexer.l
@@ -20,6 +20,7 @@
\[[^\]]+\] { yylval.str = yytext; return T_EXAMPLE; }
+#[^\n]* { return T_COMMENT; }
[oO][pP]_ {}
diff --git a/parser.y b/parser.y
@@ -24,6 +24,7 @@ void yyerror(const char* s);
%token T_VAL
%token T_DATA
%token T_STR
+%token T_COMMENT
%token T_ERR
%token T_NEWLINE T_QUIT T_EXAMPLE
@@ -44,6 +45,7 @@ script:
;
line: T_NEWLINE
+ | T_COMMENT
| T_INT { script_push_int(&g_reader_stack, $1); }
| T_VAL { stack_push_val(&g_reader_stack, $1); }
| T_OP { stack_push_op(&g_reader_stack, $1); }