Skip to content

Commit 08c03bf

Browse files
authored
Merge pull request #932 from boriel-basic/fix/crash_on_print_bool
Fix/crash on print bool
2 parents ee81cce + 49142e9 commit 08c03bf

8 files changed

Lines changed: 1101 additions & 5 deletions

File tree

src/arch/z80/visitor/translator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,7 @@ def visit_PRINT(self, node):
794794

795795
self.ic_fparam(i.type_, i.t)
796796
label = {
797+
"bool": RuntimeLabel.PRINTU8,
797798
"i8": RuntimeLabel.PRINTI8,
798799
"u8": RuntimeLabel.PRINTU8,
799800
"i16": RuntimeLabel.PRINTI16,

src/arch/z80/visitor/translator_inst_visitor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def ic_exchg(self) -> None:
106106
self.emit("exchg")
107107

108108
def ic_fparam(self, type_: TYPE | symbols.BASICTYPE, t) -> None:
109-
self.emit("fparam" + self.TSUFFIX(type_), t)
109+
self.emit(f"fparam{self._no_bool(type_)}", t)
110110

111111
def ic_fpload(self, type_: TYPE | symbols.BASICTYPE, t, offset) -> None:
112112
self.emit("fpload" + self.TSUFFIX(type_), t, offset)

src/parsetab/tabs.dbm.bak

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
'zxbpp', (0, 67003)
22
'asmparse', (67072, 233956)
33
'zxnext_asmparse', (301056, 259034)
4-
'zxbparser', (560128, 641187)
4+
'zxbparser', (560128, 641214)

src/parsetab/tabs.dbm.dat

27 Bytes
Binary file not shown.

src/parsetab/tabs.dbm.dir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
'zxbpp', (0, 67003)
22
'asmparse', (67072, 233956)
33
'zxnext_asmparse', (301056, 259034)
4-
'zxbparser', (560128, 641187)
4+
'zxbparser', (560128, 641214)

src/zxbc/zxbparser.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1983,9 +1983,15 @@ def p_print_sentence(p):
19831983
PRINT_IS_USED = True
19841984

19851985

1986+
def p_print_elem_expr(p):
1987+
"""print_elem : expr"""
1988+
p[0] = p[1]
1989+
if p[1] is not None and p[1].type_ == TYPE.boolean:
1990+
p[0] = make_typecast(TYPE.ubyte, p[1], p.lineno(1))
1991+
1992+
19861993
def p_print_list_expr(p):
1987-
"""print_elem : expr
1988-
| print_at
1994+
"""print_elem : print_at
19891995
| print_tab
19901996
| attr
19911997
| BOLD expr

0 commit comments

Comments
 (0)