Print debug line when label is invalid

This commit is contained in:
Elliot Nunn 2019-10-07 14:49:41 +08:00
parent 809afce45b
commit 147ac8c8d1
1 changed files with 1 additions and 1 deletions

View File

@ -26,7 +26,7 @@ def assemble(asm):
elif line.endswith(':'): # check labels
if not re.match(r'^\w+:$', line):
raise SyntaxError('invalid label %r' % line[:-1])
raise SyntaxError('invalid label\n %d: %s' % (lineno + 1, clean_asm[lineno].lstrip()))
else: # compile instructions!
cur_labels = {lab: lab_offset - offset for (lab, lab_offset) in labels.items()}