Parser - abstract resetForNewParse in prep for error handling
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user