File size: 1,188 Bytes
c6cb4e0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Fix the following issue:

## Separator DSL methods produce incorrect lookahead / possible tokens

When a rule uses the separator variants of the repetition DSL methods (`MANY_SEP` / `AT_LEAST_ONE_SEP`), the computation of the possible next tokens / lookahead paths gives wrong results.

For example, given a rule along the lines of:

```ts
this.RULE("list", () => {
    this.MANY_SEP({
        SEP: Comma,
        DEF: () => { this.CONSUME(Identifier) }
    })
})
```

After consuming an `Identifier`, the set of possible following tokens should include the separator (`Comma`) as one of the options (since the repetition may continue), in addition to whatever can follow the rule. In practice the separator is missing / not produced correctly by the path computation, which then breaks downstream features that rely on it (syntactic content assist, lookahead, etc.).

The non-separator variants (`MANY` / `AT_LEAST_ONE`) behave correctly for the same shape of grammar — the problem is specific to the `*_SEP` DSL methods.

Could the path / lookahead computation be fixed so that separator repetition methods produce the same kind of correct results as their non-separator counterparts?