ARM9 / bass

fork of byuu's bass assembler
170 stars 50 forks source link

Validate scope, macro, define, variable and constant names #10

Closed undisbeliever closed 7 years ago

undisbeliever commented 8 years ago

This commit adds name validation to scope, macro, define, variable and constant names.

I wrote it because of a bug in bass where a typo involving a colon at the end of a line can swallow instructions.

For example; in the following code, the current version of bass will swallow the bra instruction and create an empty file with no errors or warnings.

arch snes.cpu
origin 0

Loop:
    bra   Loop:

After implementing this commit, we get the following warning:

warning: Invalid name: bra Loop
bass_test.asm:5:1: bra Loop:

The validator emits a warning instead of an error because of bad code that may exist in existing code-bases.