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

Underscores in tokens break parser (but not lexer). #14

Closed
jimsynz opened this issue Sep 6, 2012 · 2 comments
Closed

Underscores in tokens break parser (but not lexer). #14

jimsynz opened this issue Sep 6, 2012 · 2 comments
Assignees

Comments

@jimsynz
Copy link
Contributor

jimsynz commented Sep 6, 2012

I'm working on a ruby runtime for the Handlebars.js templating language. I ran into an issue where the parser erroneously raises a string not in language exception when tokens contain underscores.

Changing the following rule:

rule /{{/, :default do                                                                       
  push_state :expression
  [ :EXPRESSION_START ]
end

to

rule /{{/, :default do                                                                       
  push_state :expression
  [ :EXPRESSIONSTART ]
end

Allows the parser to succeed.

I have prepared examples of working and non-working lexers, parsers and specs for your enjoyment at jamesotron/FlavourSaver on the broken_parser and working_parser branches. In both branches if you run the specs you will find that the lexer output passes but the parser will change behaviour.

Thanks for RLTK, it's an awesome library!

@ghost ghost assigned chriswailes Sep 6, 2012
chriswailes added a commit that referenced this issue Sep 20, 2012
…et pruning used underscores to extend the non-terminal names and then splitting on all underscores instead of just the underscores it added.
@chriswailes
Copy link
Owner

Fixed in the latest patch.

@jimsynz
Copy link
Contributor Author

jimsynz commented Sep 20, 2012

Great! Thanks Chris!

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