From 0f2b8b243b0fd4d70b24e5ba2bfd7d14279d6af0 Mon Sep 17 00:00:00 2001 From: Bobby Bingham Date: Thu, 19 Jan 2017 19:44:43 -0600 Subject: nqasm: allow spaces around operators in expressions --- lexer.l | 16 ++++++++-------- 1 file 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] \. { return T_DOT; } @ { return T_DEREF; } -\+ { return T_OPERATOR_ADD; } -- { return T_OPERATOR_SUB; } -\* { return T_OPERATOR_MUL; } -\/ { return T_OPERATOR_DIV; } -! { return T_OPERATOR_NOT; } -~ { return T_OPERATOR_INV; } -\( { return T_LPAREN; } -\) { return T_RPAREN; } +{SP}*\+{SP}* { return T_OPERATOR_ADD; } +{SP}*-{SP}* { return T_OPERATOR_SUB; } +{SP}*\*{SP}* { return T_OPERATOR_MUL; } +{SP}*\/{SP}* { return T_OPERATOR_DIV; } +!{SP}* { return T_OPERATOR_NOT; } +~{SP}* { return T_OPERATOR_INV; } +\({SP}* { return T_LPAREN; } +{SP}*\) { return T_RPAREN; } {DEC}+ { return intlit(yytext, 10, &yylval.lval); } 0x{HEX}+ { return intlit(yytext+2, 16, &yylval.lval); } {SP}*,{SP}* { return T_COMMA; } -- cgit v1.2.3