mewmew / uc

A compiler for the µC language.
58 stars 5 forks source link

gocc/lexer: Handle line comments not ending with new line #44

Closed mewmew closed 8 years ago

mewmew commented 8 years ago

The previous "solution" to handling line comments ending with EOF, turned out to fall apart for real use cases. Commit 1488a8a9ba45f5c002b7fb21309df55503769026 removes the special case for handling line comments ending with new line.

However, with commit 1488a8a9ba45f5c002b7fb21309df55503769026, comments ending with EOF were incorrectly labeled as invalid. The hand-written lexer is capable of handling such line comments, but for now a solution to the Gocc lexer is needed.

mewmew commented 8 years ago

An alternative solution would be to insert trailing new line characters for files not ending with new line. This approach has been implemented in commit 0bc2ab7727545d83387b018158a70e9d3539d662. Perhaps we will find a better solution in the future, but this works. Closing the issue for now.