aboutsummaryrefslogtreecommitdiff
path: root/asm.peg
diff options
context:
space:
mode:
Diffstat (limited to 'asm.peg')
-rw-r--r--asm.peg11
1 files changed, 10 insertions, 1 deletions
diff --git a/asm.peg b/asm.peg
index e8cd805..1392fdd 100644
--- a/asm.peg
+++ b/asm.peg
@@ -4,7 +4,10 @@ line =
| eol { yy->v.kind = ASM_BLANK; }
| . { yy->v.kind = ASM_SYNTAX_ERROR; }
-ws = [ \t]+
+ws =
+ [ \t]+
+ | "/*" (! "*/" . )* "*/" # XXX multiline comments break our line numbers.
+
eol = ws? "\n"
stmt =
@@ -70,6 +73,7 @@ instr =
| i:lea { $$ = i; }
| i:mul { $$ = i; }
| i:imul { $$ = i; }
+ | i:neg { $$ = i; }
| i:movsx { $$ = i; }
| i:movzx { $$ = i; }
| i:mov { $$ = i; }
@@ -161,6 +165,11 @@ mul = "mul" (
| args:r-opargs { args.instr.variant += 4 ; $$ = args; }
) { $$.instr.kind = ASM_MUL; }
+neg = "neg" (
+ args:m-opargs { $$ = args; }
+ | args:r-opargs { args.instr.variant += 4 ; $$ = args; }
+) { $$.instr.kind = ASM_NEG; }
+
imul = "imul" (
(
'w'? ws s:m ws? ',' ws? d:r16 { $$ = INSTR2(8, s, d); }