summaryrefslogtreecommitdiff
path: root/lexer.l
diff options
context:
space:
mode:
authorBobby Bingham <koorogi@koorogi.info>2017-01-18 19:40:18 -0600
committerBobby Bingham <koorogi@koorogi.info>2017-01-18 19:40:18 -0600
commit6c6b91f9a6bc5ae203e99ac7abb3a70215488a6f (patch)
treea60ee21b204363128001cf323e5914745a630afd /lexer.l
parent1e0d0202e614f398f491624c84ae9a8309fa2f96 (diff)
nqasm: support unary operators in immediate expressions
Diffstat (limited to 'lexer.l')
-rw-r--r--lexer.l6
1 files changed, 5 insertions, 1 deletions
diff --git a/lexer.l b/lexer.l
index 053ac4e..324c3da 100644
--- a/lexer.l
+++ b/lexer.l
@@ -76,7 +76,11 @@ HEX [0-9a-f]
<args>\. { return T_DOT; }
<args>@ { return T_DEREF; }
-<args>[-+]?{DEC}+ { return intlit(yytext, 10, &yylval.lval); }
+<args>\+ { return T_OPERATOR_ADD; }
+<args>- { return T_OPERATOR_SUB; }
+<args>! { return T_OPERATOR_NOT; }
+<args>~ { return T_OPERATOR_INV; }
+<args>{DEC}+ { return intlit(yytext, 10, &yylval.lval); }
<args>0x{HEX}+ { return intlit(yytext+2, 16, &yylval.lval); }
<args>{SP}*,{SP}* { return T_COMMA; }