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

Add a small syntax cheatsheet #587

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

abitrolly
Copy link

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

  • "if" - match if literally
  • "if"i - match if case-insensitive
  • . - match any symbol except newline
  • [^] - match anything including newline
  • [a-zA-Z] - match symbols in range
  • [^a-zA-Z] - match symbols not in range
  • :+ - match previous construction one or more time
  • :* - match zero times or more
  • :? - zero time or one time

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
Copy link
Owner

kach commented Aug 26, 2021

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

@abitrolly
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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

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

Successfully merging this pull request may close these issues.

2 participants