The syntax for extension ranges is:
extensions a to max [options];
or
extensions a, b to c, d to max [options];
When there are comma separated ranges, the options apply to all the ranges, not just the last one. The current parse tree attaches the options to the last of the range rather than all the ranges.
Also the parser.Range
struct includes the Options, which is also used for reserved ranges. These do not have options.
I think the current code:
type Extensions struct {
Pos lexer.Position
Extensions []*Range `"extensions" @@ { "," @@ }`
}
type Range struct {
Start int `@Int`
End *int ` [ "to" ( @Int`
Max bool ` | @"max" ) ]`
Options Options `[ "[" @@ { "," @@ } "]" ]`
}
should be
type Extensions struct {
Pos lexer.Position
Extensions []*Range `"extensions" @@ { "," @@ }`
Options Options `[ "[" @@ { "," @@ } "]" ]`
}
type Range struct {
Start int `@Int`
End *int ` [ "to" ( @Int`
Max bool ` | @"max" ) ]`
}