kach / nearley

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

Add a small syntax cheatsheet #587

Open abitrolly opened 3 years ago

abitrolly commented 3 years ago

I grouped all Nearley matching constructs in one block to make them easier to find and compare with other languages.

As I am editing this from the GitHub, I can not preview and format it to proper HTML, but I hope it makes documentation already a bit more useful. The completely undocumented thing was [^] and . behavior from #348 and #400.

kach commented 3 years ago

Can you also include the constructs for tokens matched by custom lexers?

abitrolly commented 3 years ago

Can you also include the constructs for tokens matched by custom lexers?

I wish I could, but for now I am not sure what are those custom lexers, and what constructs they produce. Still trying to build my first Nearly parser.

abitrolly commented 3 years ago

I've found that there are .md files that I should edit instead of .html. Fixed now.

As a side note, have you considered telling GitHub to serve content from the docs/ folder?

https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site

That would make it a little bit more intuitive for new users..

abitrolly commented 3 years ago

Preview https://abitrolly.github.io/nearley/docs/grammar.html#matching-rules