djrieger / mjplusplus

A compiler for the MiniJava language
http://djrieger.github.io/mjplusplus/doc/doxygen/html/
6 stars 1 forks source link

Improve reporting of multiple parser errors #17

Open djrieger opened 9 years ago

djrieger commented 9 years ago

With d7edc350b989478ad660658dc44120db7d65da11 I implemented the reporting of multiple parser errors. Everything seems to be running smoothly, all tests pass.

Some reports are quite nice and make sense:

parser_incorrect/Max_incorrect_1.mj
at line 5, column 19, parsing "(": expected identifier
    public Shifter(boolean logicShift = false) {
                  ^
at line 5, column 39, parsing "=": expected Statement
    public Shifter(boolean logicShift = false) {
                                      ^
Error during compilation.

But others such as these need to be corrected/improved:

parser_incorrect/incorrect_5.mj
at line 20, column 15, parsing "=": expected "("
 public int i = 100;
              ^
at line 20, column 15, parsing "=": expected Type
 public int i = 100;
              ^
Error during compilation.
djrieger commented 9 years ago

Nailed down to these cases:

parser_incorrect/EOFBeforeClassEnd.mj
at line 2, column 16, parsing "=": expected "("
  public int a = 5;
               ^
at line 2, column 16, parsing "=": expected Type
  public int a = 5;
               ^

parser_incorrect/WrongLocalVariableDecl.mj
at line 12, column 1, parsing "}": expected "("
}
^
at line 12, column 1, parsing "}": expected Type
}
^