summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby Bingham <koorogi@koorogi.info>2017-01-19 19:44:43 -0600
committerBobby Bingham <koorogi@koorogi.info>2017-01-19 19:44:43 -0600
commit0f2b8b243b0fd4d70b24e5ba2bfd7d14279d6af0 (patch)
tree62956ba467cc625c9fda46acb0eaa2168019462a
parent48b3e4525e4cc2730e53de9b926223d9da94d063 (diff)
nqasm: allow spaces around operators in expressions
-rw-r--r--lexer.l16
1 files changed, 8 insertions, 8 deletions
diff --git a/lexer.l b/lexer.l
index 4a593fe..c51cb40 100644
--- a/lexer.l
+++ b/lexer.l
@@ -76,14 +76,14 @@ HEX [0-9a-f]
<args>\. { return T_DOT; }
<args>@ { return T_DEREF; }
-<args>\+ { return T_OPERATOR_ADD; }
-<args>- { return T_OPERATOR_SUB; }
-<args>\* { return T_OPERATOR_MUL; }
-<args>\/ { return T_OPERATOR_DIV; }
-<args>! { return T_OPERATOR_NOT; }
-<args>~ { return T_OPERATOR_INV; }
-<args>\( { return T_LPAREN; }
-<args>\) { return T_RPAREN; }
+<args>{SP}*\+{SP}* { return T_OPERATOR_ADD; }
+<args>{SP}*-{SP}* { return T_OPERATOR_SUB; }
+<args>{SP}*\*{SP}* { return T_OPERATOR_MUL; }
+<args>{SP}*\/{SP}* { return T_OPERATOR_DIV; }
+<args>!{SP}* { return T_OPERATOR_NOT; }
+<args>~{SP}* { return T_OPERATOR_INV; }
+<args>\({SP}* { return T_LPAREN; }
+<args>{SP}*\) { return T_RPAREN; }
<args>{DEC}+ { return intlit(yytext, 10, &yylval.lval); }
<args>0x{HEX}+ { return intlit(yytext+2, 16, &yylval.lval); }
<args>{SP}*,{SP}* { return T_COMMA; }