no-context / moo

Optimised tokenizer/lexer generator! 🐄 Uses /y for performance. Moo.
BSD 3-Clause "New" or "Revised" License
817 stars 65 forks source link

README has misleading documentation for states? #97

Closed JoshuaGrams closed 5 years ago

JoshuaGrams commented 5 years ago

"It's also nice to let states inherit rules from other states" but push replaces the entire regex, it doesn't add to it. Also "pop returns to a previous state, by removing one or more states from the stack" but I don't see any code path to do more than a single pop.

Am I missing something? I don't have a need or use-case for either of those things, but the docs preferably shouldn't confuse people by claiming features that aren't present or mis-describing ones that are...

nathan commented 5 years ago

Yeah, that sounds more like a description of this feature which hasn't been merged yet and has little to do with push/pop. I guess @tjvr meant you can inherit all rules and change the transition behavior, so there are implicitly main-pop-to-main and main-pop-to-lit states?

This line exists so in the future we can support pop: 2 or pop: 'aStateName', but the README should probably reflect the present state of affairs. The only currently permitted values are 1, true, and some strings/valueOf-objects if you want to be pedantic about it.

tjvr commented 5 years ago

I rewrote the readme for states in #100; hopefully that clears things up.e

Thanks for your question! :smiley: