commit 5b531b1c26d67d468fcc6c72b3cedc5453221eac
parent fac68a28be2a0744ab2b516a89c00a44c5564cee
Author: William Casarin <jb55@jb55.com>
Date: Sun, 22 Oct 2017 01:22:20 -0700
fun: I can paste most bips now
ha
Diffstat:
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/lexer.l b/lexer.l
@@ -14,7 +14,9 @@
%%
[ \t] ; // ignore all whitespace
-\n {return T_NEWLINE;}
+\n {return T_NEWLINE;}
+
+\<[^\>]+\> { yylval.str = yytext; return T_EXAMPLE; }
[oO][pP]_ {}
diff --git a/parser.y b/parser.y
@@ -16,12 +16,14 @@ void yyerror(const char* s);
%union {
enum opcode opcode;
+ const char* str;
}
%token T_OP
-%token T_NEWLINE T_QUIT
+%token T_NEWLINE T_QUIT T_EXAMPLE
%type<opcode> T_OP
+%type<str> T_EXAMPLE
%start script
@@ -33,6 +35,7 @@ script:
line: T_NEWLINE
| T_OP { printf("%s\n", op_name($1)); }
+ | T_EXAMPLE { printf("ex:%s\n", $1); }
/* opcode: */
/* | T_OP { op_add($$); } */