KoffeinFlummi / armake2

Successor to armake written in Rust
GNU General Public License v2.0
50 stars 17 forks source link

Fix comment pre-processor #36

Closed Krzmbrzl closed 5 years ago

Krzmbrzl commented 5 years ago

I adapted the preprocessor grammar in order to allow optional comments after preprocessor instructions.

Fix #24 and #30.

Krzmbrzl commented 5 years ago

I think this is more of a bug fix than an enhancement. Though it doesn't really matter ^^

jonpas commented 5 years ago

Have both!

KoffeinFlummi commented 5 years ago

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.

Krzmbrzl commented 5 years ago

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