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

Identifiers starting with 'of' in the 'each' value variable break the lexer #85

Open
valpackett opened this issue Jun 3, 2021 · 0 comments

Comments

@valpackett
Copy link

This was reported against my eslint pug plugin:
valpackett/eslint-plugin-pug#10

in the value variable position, an identifier like offers and in fact anything that matches of.+ (i.e. not of itself) seems to explode:

> const lex = require('pug-lexer')
> lex('each x in of')
[{"type":"each","loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":13}},"val":"x","key":null,"code":"of"},{"type":"eos","loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":13}}}]
> lex('each x in ofX')
Uncaught Error: Pug:1:14
  > 1| each x in ofX
--------------------^

The value variable for each must either be a valid identifier (e.g. `item`) or a pair of identifiers in square brackets (e.g. `[key, value]`).
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