diff --git a/packages/compiler/src/compiler/grammar.ts b/packages/compiler/src/compiler/grammar.ts index 88dba5d..5332e61 100644 --- a/packages/compiler/src/compiler/grammar.ts +++ b/packages/compiler/src/compiler/grammar.ts @@ -441,11 +441,6 @@ export class SyndicateParser { valuePattern(level: number, ... extraStops: Pattern[]): Pattern { return withoutSpace(alt( - scope(o => { - o.type = 'PCapture'; - o.inner = { type: 'PDiscard' }; - return bind(o, 'binder', this.pCaptureBinder); - }), scope(o => map(this.pDiscard, _ => o.type = 'PDiscard')), this.pArray(level), this.pDict(level), @@ -475,6 +470,11 @@ export class SyndicateParser { return succeed(o); } }), + scope(o => { + o.type = 'PCapture'; + o.inner = { type: 'PDiscard' }; + return bind(o, 'binder', this.pCaptureBinder); + }), map(this.expr(... extraStops), e => ({ type: 'PConstant', value: e })) )); }