kach / nearley

📜🔜🌲 Simple, fast, powerful parser toolkit for JavaScript.
https://nearley.js.org
MIT License
3.57k stars 231 forks source link

simple grammar gets nearley stuck in infinite loop #555

Open bandaloo opened 3 years ago

bandaloo commented 3 years ago

From my understanding, nearley getting stuck in an infinite loop despite the grammar being malformed is considered a bug based on this previous issue: https://github.com/kach/nearley/issues/167

This is the grammar:

Main -> ___:* "foo" {% id %}

___ -> (" " | "\n"):*

I discovered this when moving the * ebnf operator out from Main and into the ___ rule but forgot to do it in both places.

bandaloo commented 3 years ago

I should mention I passed in parser.feed("foo");.