Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backtracking for scanner? #7

Open
awalterschulze opened this issue Oct 26, 2015 · 0 comments
Open

backtracking for scanner? #7

awalterschulze opened this issue Oct 26, 2015 · 0 comments

Comments

@awalterschulze
Copy link
Collaborator

Given three tokens

a : 'a'
asb : 'a' { 'a' } 'b'
c : 'c'

and the input string

aac

The generated lexer will return an illegal token.
Instead of the expect three tokens [a,a,c]

Reading input char 0 'a' the lexer goes into an accept state for token a.
Next it receives char 1 'a' so the lexer goes into a reject state with the hope of receiving a 'b' at some point.
Instead the next char 2 'c' sends the automaton into a unrecoverable reject state, resulting in a reject token.

I realise that this will require gocc to implement a backtracking scanner, but the current implementation can result in some very unintuitive debugging for the user.
Maybe something like this could be added to documentation if it is not there already?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant