uli / dragonbasic

Dragon BASIC compiler for Game Boy Advance
Other
42 stars 7 forks source link

Invalid syntax produces an unhelpful "line 1: Unknown directive? '' error instead of indicating the line number where that error occurs. #25

Open supercom32 opened 6 years ago

supercom32 commented 6 years ago

Bug found under Dragon Basic (commit ID d2ce042366068083a5fe3089873a22221fffbc26)

When working in Dragon Basic I noted that sometimes if you make a mistake (such as using ":" instead of ";" to start a comment line), the compiler will throw an "line 1: Unknown directive?" error. This is fine in principle, but since the line number is not accurate there is no easy way to debug this. The only recourse a user has is to remove all the code from the offending file and slowly add code back until the compiler throws the error (indicating where more scrutiny should be given).

This issue appears to be very similar to issue 10 (https://github.com/uli/dragonbasic/issues/10) where a different kind of error produces an equally unhelpful line number for its error message.