Confirm that parser has fully parsed input

(Navid Noorshams) #1

Hello everyone,

I am currently developing a plugin, using sslr. while trying to perfect to grammar, I noticed that when passing an invalid input, e.g an unterminated string, it takes all input until (excluding) the token that indicates the beginning of the unterminated string and skips parsing this remain. Thus, a valid ast is being generated only employing subset of the lexed tokens. So I was wondering: Is there any way to confirm that there’s no token left to parse anymore after a an AST has been generated from the input? As of now, I merely compare the amount of lexed tokens in total with the toIndex() plus 1 at the root-node of the generated ast. If this isn’t equal, I assume parsing didn’t employ all token.

Thank you very much for your support in this matter.