From 6c6b91f9a6bc5ae203e99ac7abb3a70215488a6f Mon Sep 17 00:00:00 2001 From: Bobby Bingham Date: Wed, 18 Jan 2017 19:40:18 -0600 Subject: nqasm: support unary operators in immediate expressions --- lexer.l | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lexer.l') 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] \. { return T_DOT; } @ { return T_DEREF; } -[-+]?{DEC}+ { return intlit(yytext, 10, &yylval.lval); } +\+ { return T_OPERATOR_ADD; } +- { return T_OPERATOR_SUB; } +! { return T_OPERATOR_NOT; } +~ { return T_OPERATOR_INV; } +{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