Skip to content

Commit

Permalink
Merge pull request #591 from boriel/bugfix/asm_negative_parenthesis_expr
Browse files Browse the repository at this point in the history
fix: fix assembler expr parsing for -(expr)
  • Loading branch information
boriel authored Nov 28, 2021
2 parents cf504fb + e25ef4a commit 2794fd2
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/parsetab/tabs.dbm.bak
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'zxbpp', (0, 76970)
'asmparse', (77312, 269087)
'zxnext_asmparse', (346624, 299111)
'zxbparser', (646144, 708977)
'asmparse', (77312, 270618)
'zxnext_asmparse', (348160, 300642)
'zxbparser', (649216, 708977)
Binary file modified src/parsetab/tabs.dbm.dat
Binary file not shown.
6 changes: 3 additions & 3 deletions src/parsetab/tabs.dbm.dir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'zxbpp', (0, 76970)
'asmparse', (77312, 269087)
'zxnext_asmparse', (346624, 299111)
'zxbparser', (646144, 708977)
'asmparse', (77312, 270618)
'zxnext_asmparse', (348160, 300642)
'zxbparser', (649216, 708977)
2 changes: 2 additions & 0 deletions src/zxbasm/asmparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,8 @@ def p_mem_indir(p):
def p_expr_uminus(p):
"""expr : MINUS expr %prec UMINUS
| PLUS expr %prec UMINUS
| MINUS pexpr %prec UMINUS
| PLUS pexpr %prec UMINUS
"""
p[0] = Expr.makenode(Container(p[1], p.lineno(1)), p[2])

Expand Down
4 changes: 4 additions & 0 deletions tests/functional/neg_par.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ld a, -(5)
ld a, 0-(5)
ld a, +(5)
ld a, 0+(5)
1 change: 1 addition & 0 deletions tests/functional/neg_par.bin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
>�>�>>

0 comments on commit 2794fd2

Please sign in to comment.