Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def is_number(*p):
containing NUMBER or numeric CONSTANTS
"""
try:
return all(i.token == 'NUMBER' or is_const(i) for i in p)
return all(i.token == 'NUMBER' or (i.token == 'ID' and i.class_ == CLASS.const) for i in p)
except Exception:
pass

Expand Down
4 changes: 2 additions & 2 deletions src/arch/zx48k/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,9 +907,9 @@ def visit_ITALIC(self, node):
# -----------------------------------------------------------------------------------------------------
def visit_ASM(self, node):
EOL = '\n'
self.ic_inline(f'#line {node.lineno} "{node.filename}"')
self.ic_inline(f'#line {node.lineno + 1} "{node.filename}"')
self.ic_inline(node.asm)
self.ic_inline(f'#line {node.lineno + 1 + len(node.asm.split(EOL))} "{node.filename}"')
self.ic_inline(f'#line {node.lineno + len(node.asm.split(EOL))} "{node.filename}"')

# endregion

Expand Down
56 changes: 56 additions & 0 deletions tests/functional/for_const_crash.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
org 32768
__START_PROGRAM:
di
push ix
push iy
exx
push hl
exx
ld hl, 0
add hl, sp
ld (__CALL_BACK__), hl
ei
jp __MAIN_PROGRAM__
ZXBASIC_USER_DATA:
; Defines USER DATA Length in bytes
ZXBASIC_USER_DATA_LEN EQU ZXBASIC_USER_DATA_END - ZXBASIC_USER_DATA
.__LABEL__.ZXBASIC_USER_DATA_LEN EQU ZXBASIC_USER_DATA_LEN
.__LABEL__.ZXBASIC_USER_DATA EQU ZXBASIC_USER_DATA
_dw1:
DEFB 00, 00
ZXBASIC_USER_DATA_END:
__MAIN_PROGRAM__:
ld hl, 8192
ld (_dw1), hl
jp __LABEL0
__LABEL3:
__LABEL4:
ld hl, (_dw1)
ld de, 32
add hl, de
ld (_dw1), hl
__LABEL0:
ld hl, 8255
ld de, (_dw1)
or a
sbc hl, de
jp nc, __LABEL3
__LABEL2:
ld hl, 0
ld b, h
ld c, l
__END_PROGRAM:
di
ld hl, (__CALL_BACK__)
ld sp, hl
exx
pop hl
exx
pop iy
pop ix
ei
ret
__CALL_BACK__:
DEFW 0
;; --- end of user code ---
END
8 changes: 8 additions & 0 deletions tests/functional/for_const_crash.bas
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

const tablaSprites as Uinteger=8192


DIM dw1 as Uinteger
for dw1=tablaSprites to tablaSprites+63 step 32
next

5 changes: 2 additions & 3 deletions tests/functional/test_cmdline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ no_zxnext.asm:29: error: Syntax error. Unexpected token 'C' [C]
define_val.bas:4: error: "MACRO should be VALUE"

>>> process_file('tap_include_asm_error.bas', ['-q', '-S'])
extra_chars.bas:2: error: illegal character '`'
extra_chars.bas:3: error: illegal character '#'

extra_chars.bas:3: error: illegal character '`'
extra_chars.bas:4: error: illegal character '#'

4 changes: 2 additions & 2 deletions tests/functional/test_errmsg.txt
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,6 @@ doloop2.bas:4: warning: [W150] Variable 'a' is never used
line_number_after_macro.bas:8: warning: Using default implicit type 'float' for 'a'
line_number_after_macro.bas:11: error: Syntax Error. Unexpected token '+' <PLUS>
>>> process_file('tap_asm_error_line.bas', ['-S', '-q'])
tap_asm_error_line.bas:2: error: Syntax error. Unexpected token '10' [INTEGER]
tap_asm_error_line.bas:6: error: Syntax error. Unexpected token '10' [INTEGER]
tap_asm_error_line.bas:3: error: Syntax error. Unexpected token '10' [INTEGER]
tap_asm_error_line.bas:7: error: Syntax error. Unexpected token '10' [INTEGER]