fmease / lushui

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

In some cases, incorrect unbalanced bracket diagnostics are reported #113

Open fmease opened 2 years ago

fmease commented 2 years ago

Given the code ((])), the lexer/parser should only complain about one unbalanced bracket, namely the ]. In reality though, it also complains about the right-most closing round bracket since the bracket stack is not implemented properly.

Current output:

error[E010]: found `(`, but expected declaration
 --> ${DIRECTORY}/x.lushui:1:1
  |
1 | ((]))
  | ^ unexpected token
  |

error[E001]: unbalanced square bracket
 --> ${DIRECTORY}/x.lushui:1:3
  |
1 | ((]))
  |   ^ has no matching opening square bracket
  |

error[E001]: unbalanced round bracket
 --> ${DIRECTORY}/x.lushui:1:5
  |
1 | ((]))
  |     ^ has no matching opening round bracket
  |