fmease / lushui

The reference compiler of the Lushui programming language
Apache License 2.0
7 stars 0 forks source link

Parsing issues around line breaks #37

Open fmease opened 4 years ago

fmease commented 4 years ago

Relates to #15 in the sense that we should rewrite our trivia (line breaks, whitespace, indentation) system.

Right now, in some cases, there is a difference between three consecutive line breaks and the sequence line break, comment, line break. The parser does not treat them equal in some cases. This is because the lexer merges several true line breaks in a row into one but does not when there is a comment in between. In the parser, I could just start replacing code consuming a "single" line break (according to the lexer) with loops consuming as many as possible. I don't like this.

fmease commented 2 years ago

This is very likely still an issue with the new indentation system.

fmease commented 2 years ago

This is very likely still an issue with the new indentation system.

Indeed. Example:

module x ;;; culprit
@hello module y

Output:

error[E010]: found `@`, but expected terminator or keyword `of`
 --> /home/fmease/programming/main_projects/lushui/bugs/comment-not-treated-as-line-break.lushui:2:1
  |
2 | @hello module y
  | ^ unexpected token
  |