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

Lookahead tokens don't understand optional prefixes #4

Open
MichaelRFairhurst opened this issue Oct 12, 2017 · 2 comments
Open

Lookahead tokens don't understand optional prefixes #4

MichaelRFairhurst opened this issue Oct 12, 2017 · 2 comments

Comments

@MichaelRFairhurst
Copy link

%lookahead flag x;

prog: optionallyPrefixed<+x>;
optionallyPrefixed: prefix? usesLookahead ;
usesLookahead: [x] y | z;

This reported that x was unused in optionallyPrefixed, until I changed that production to

optionallyPrefixed: usesLookahead | prefix usesLookahead ;

@inspirer
Copy link
Owner

Yes, template instantiation happens before EBNF expansion, and this is rather non-trivial to combine in one step. I'll add better error reporting though. Another input that does not seem to trigger any errors, while it should, is when optionallyPrefixed starts with a nullable nonterminal.

@MichaelRFairhurst
Copy link
Author

Ah, hadn't thought about epsilon. Great catch! And totally, the workaround is easy if it reports an error.

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

2 participants