From cf26e290d5a8d64fbc77cb59392f752043c73304 Mon Sep 17 00:00:00 2001 From: Jose Rodriguez Date: Tue, 12 Jan 2021 22:39:27 +0100 Subject: [PATCH] Fix linenumbering offset in asm contexts --- src/arch/zx48k/translator.py | 4 ++-- tests/functional/test_cmdline.txt | 5 ++--- tests/functional/test_errmsg.txt | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/arch/zx48k/translator.py b/src/arch/zx48k/translator.py index 3618924d0..e3bace884 100644 --- a/src/arch/zx48k/translator.py +++ b/src/arch/zx48k/translator.py @@ -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 diff --git a/tests/functional/test_cmdline.txt b/tests/functional/test_cmdline.txt index 1f3f384b0..63b876782 100644 --- a/tests/functional/test_cmdline.txt +++ b/tests/functional/test_cmdline.txt @@ -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 '#' diff --git a/tests/functional/test_errmsg.txt b/tests/functional/test_errmsg.txt index 9de6b5c7a..4cce2e371 100644 --- a/tests/functional/test_errmsg.txt +++ b/tests/functional/test_errmsg.txt @@ -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 '+' >>> 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]