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
|
return
|
||||||
} finally {
|
} finally {
|
||||||
this.parseCandidate = undefined
|
this.resetForNewParse()
|
||||||
this.inputForCandidate = []
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new InternalParseError('Encountered invalid token.')
|
throw new InternalParseError('Encountered invalid token.')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private resetForNewParse() {
|
||||||
|
this.parseCandidate = undefined
|
||||||
|
this.inputForCandidate = []
|
||||||
|
}
|
||||||
|
|
||||||
private isKeyword(token: LexToken): token is (LexInput & {literal: undefined}) {
|
private isKeyword(token: LexToken): token is (LexInput & {literal: undefined}) {
|
||||||
return token.type === 'input' && !token.literal
|
return token.type === 'input' && !token.literal
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user