diff options
Diffstat (limited to 'src/lib/core/parser.ts')
| -rw-r--r-- | src/lib/core/parser.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/core/parser.ts b/src/lib/core/parser.ts index d608eca..27133b2 100644 --- a/src/lib/core/parser.ts +++ b/src/lib/core/parser.ts @@ -199,6 +199,16 @@ export type _Parse<Ctx extends ParserCtx> = Ctx["remainingTokens"] extends [ }> : Ctx & Error<`Expected nextToken to be a name or close paren at ${Head["type"]}`> + : Ctx["lastToken"] extends Token + ? // case where we ended with a name + _Parse<{ + lastToken: null; + remainingTokens: []; + stack: PushChildToLastElementOfStack< + Ctx["stack"], + ResolveNodeFromToken<Ctx["lastToken"]> + >; + }> : Ctx["stack"][0]; export type Parse<Raw extends readonly Token[]> = _Parse<{ |
