Closed Krzmbrzl closed 5 years ago
I think this is more of a bug fix than an enhancement. Though it doesn't really matter ^^
Have both!
I'm hesitant to merge this since comment_token
can include multi-line comments, which may contain newlines. This would lead to those newlines not being considered for line numbers in errors and potentially misleading the user. A quick fix would be to simpy allow single-line comments, but I think the way the preprocessor handles those newlines can probably be improved.
How about something like this?
`
newline -> String = nl:"\r\n" {lineNumber++} / nl:"\n" {lineNumber++}
`
That way lines would get counted no matter where they occur.
And for error reporting you just use the lineNumber
variable
I adapted the preprocessor grammar in order to allow optional comments after preprocessor instructions.
Fix #24 and #30.