asoffer / Icarus

An experimental general-purpose programming language
Apache License 2.0
9 stars 2 forks source link

Tab characters fail the parse, cryptically #62

Closed perimosocordiae closed 3 years ago

perimosocordiae commented 3 years ago

The error message presented when a source file contains a tab character \t is a bit cryptic:

Error in examples/repro.ic:
Encountered unprintable character with integral value '9' encountered in source.

Ideally, tabs would be treated like regular whitespace. Barring that, we should have a better error message that (a) points to the location in the source, and (b) attempts to display the unprintable character in a more human-friendly way (ala man ascii).

Finally, the same error is output for every instance of a tab character in the source, which can be pretty overwhelming for a large file.

asoffer commented 3 years ago

Parsing tab characters as normal whitespace seems more than reasonable. Feel free to spelunk in frontend/lex/lex.cc, probably starting looking at NextToken.

If not, I'll get to this in a few weeks.