Skip to content

Commit cf26e29

Browse files
committed
Fix linenumbering offset in asm contexts
1 parent 3843846 commit cf26e29

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

src/arch/zx48k/translator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -907,9 +907,9 @@ def visit_ITALIC(self, node):
907907
# -----------------------------------------------------------------------------------------------------
908908
def visit_ASM(self, node):
909909
EOL = '\n'
910-
self.ic_inline(f'#line {node.lineno} "{node.filename}"')
910+
self.ic_inline(f'#line {node.lineno + 1} "{node.filename}"')
911911
self.ic_inline(node.asm)
912-
self.ic_inline(f'#line {node.lineno + 1 + len(node.asm.split(EOL))} "{node.filename}"')
912+
self.ic_inline(f'#line {node.lineno + len(node.asm.split(EOL))} "{node.filename}"')
913913

914914
# endregion
915915

tests/functional/test_cmdline.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ no_zxnext.asm:29: error: Syntax error. Unexpected token 'C' [C]
3737
define_val.bas:4: error: "MACRO should be VALUE"
3838

3939
>>> process_file('tap_include_asm_error.bas', ['-q', '-S'])
40-
extra_chars.bas:2: error: illegal character '`'
41-
extra_chars.bas:3: error: illegal character '#'
42-
40+
extra_chars.bas:3: error: illegal character '`'
41+
extra_chars.bas:4: error: illegal character '#'
4342

tests/functional/test_errmsg.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,6 @@ doloop2.bas:4: warning: [W150] Variable 'a' is never used
195195
line_number_after_macro.bas:8: warning: Using default implicit type 'float' for 'a'
196196
line_number_after_macro.bas:11: error: Syntax Error. Unexpected token '+' <PLUS>
197197
>>> process_file('tap_asm_error_line.bas', ['-S', '-q'])
198-
tap_asm_error_line.bas:2: error: Syntax error. Unexpected token '10' [INTEGER]
199-
tap_asm_error_line.bas:6: error: Syntax error. Unexpected token '10' [INTEGER]
198+
tap_asm_error_line.bas:3: error: Syntax error. Unexpected token '10' [INTEGER]
199+
tap_asm_error_line.bas:7: error: Syntax error. Unexpected token '10' [INTEGER]
200200

0 commit comments

Comments
 (0)