-
Notifications
You must be signed in to change notification settings - Fork 65
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
Please more examples ... #243
Comments
I'm imagining an example for each type, showing a matching input and a non-matching input. For example:
Example: |
Strongly speaking, |
Let's decide if these are single rules or full grammars, I guess. Either works for me as long as we're consistent. |
My vote for single rules with an explanation that examples just for rules, to see them in action you should pretend that actual grammar is grammar = rule .*;
rule = <whatever>; Links to live examples (or even embedded examples) also would be useful, but that the task for a web-site. |
I like the live playground idea, and since the docs are web-only now, that should work. We could have one large grammar that has a rule for each section, with each rule in the allowedStartRules. Maybe let's try that, and see what it feels like in practice before we finalize the |
The foo = 'foo'i; and input
The rule itself will match the beginning of this string, but to show this in action we should append keyword = 'keyword'; is enough (spoiler: it isn't, the right way to do that is to check that after a keyword there is a delimiter symbol or not an identifier symbol: keyword = 'keyword' !identifierPart; ) I think more about supporting GET parameters in the https://peggyjs.org/online to embed a grammar and adding that links to a docs. I don't think that this should be a hard to implement. |
Can you take a look at https://raw.githack.com/hildjj/peggy/examples/docs/documentation.html please, and see what you think before I finish? Go down to "Parsing Expression Types", and look at the first two. |
These two examples are very simple. The inline try-test is nice, but not really required. I would like to see examples for the '&/! expression */+/?' and '&{predicate}'. |
Please refresh the link above and see what you think? I have now agreed with @Mingun about just matching the beginning, and have started returning |
This will show up with the next release. I don't want to cherry-pick it onto the docs branch because the tooling needed to build it is only available after the next release. |
In the meantime, you can use https://raw.githack.com/peggyjs/peggy/main/docs/documentation.html |
I looked at the examples and understood. They are very short, but now I understand how I can use e.g. predicates. I hadn't used that yet. Thank you. |
Please provide more simple examples regarding to the documentation. The section 'Parsing Expression Types' could be better if the are some simple examples to get into the usage of the expression.
Thank you.
The text was updated successfully, but these errors were encountered: