Parser - abstract resetForNewParse in prep for error handling

This commit is contained in:
2026-03-02 23:08:00 -06:00
parent f778507f39
commit bd3453c9b0

View File

@@ -70,14 +70,18 @@ export class Parser extends BehaviorSubject<Executable<CommandData>> {
})
return
} finally {
this.parseCandidate = undefined
this.inputForCandidate = []
this.resetForNewParse()
}
}
throw new InternalParseError('Encountered invalid token.')
}
private resetForNewParse() {
this.parseCandidate = undefined
this.inputForCandidate = []
}
private isKeyword(token: LexToken): token is (LexInput & {literal: undefined}) {
return token.type === 'input' && !token.literal
}