Bug in macros
VladisM opened this issue · 1 comments
VladisM commented
There is something terrible wrong with labels in macros. Trying to compile this code
#macro jump
OR R0 R0 R0
label:
OR R0 R0 R0
BZ R0 label
#endmacro
OR R1 R1 R1
$jump
And horrible things will happen:
$ m2-assembler test.asm
Traceback (most recent call last):
File "/opt/MARK_II_tools/bin/m2-assembler", line 773, in <module>
main()
File "/opt/MARK_II_tools/bin/m2-assembler", line 759, in main
a.pass0()
File "/opt/MARK_II_tools/bin/m2-assembler", line 56, in pass0
self.t.parse(self.mainFileName)
File "/opt/MARK_II_tools/src/assembler/tokenizer.py", line 127, in parse
self.load_file(p)
File "/opt/MARK_II_tools/src/assembler/tokenizer.py", line 286, in load_file
macro_item.invoke(self.parser_buffer, given_args, line_counter, file_name)
File "/opt/MARK_II_tools/src/assembler/tokenizer.py", line 96, in invoke
found_arg, value_arg = self.find_arg_value(given_args, line_token)
File "/opt/MARK_II_tools/src/assembler/tokenizer.py", line 66, in find_arg_value
return found, given_args[counter]
IndexError: list index out of range
There is something terribly wrong in tokenizer.py.
VladisM commented
fixed