1
Fork 0

Make the parser’s ‘expected <foo>, found <bar>’ errors more accurate

As an example of what this changes, the following code:

    let x: [int ..4];

Currently spits out ‘expected `]`, found `..`’. However, a comma would also be
valid there, as would a number of other tokens. This change adjusts the parser
to produce more accurate errors, so that that example now produces ‘expected one
of `(`, `+`, `,`, `::`, or `]`, found `..`’.
This commit is contained in:
P1start 2014-12-03 22:47:53 +13:00
parent 3a325c666d
commit 108bca53f0
29 changed files with 155 additions and 95 deletions

View file

@ -8,4 +8,4 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
type v = [int * 3]; //~ ERROR expected `]`, found `*`
type v = [int * 3]; //~ ERROR expected one of `(`, `+`, `,`, `::`, or `]`, found `*`