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

Updating grammarSource documentation #382

Merged
merged 2 commits into from
Mar 19, 2023

Conversation

AndrewRayCode
Copy link
Contributor

When reading grammarSource, I was pretty confused. This PR does a few things:

  • Removes the passive by monkeys language from grammarSource
  • Removed this sentence, which I don't think has any meaning: "parsers in network applications might use the socket and so on."
  • Adds a useful example of what a grammarSource is, because I originally thought it was supposed to be a duplicate of the source code
  • Cleans up the duplicative description of grammarSource in Locations

I don't think it's unreasonable to say the documentation needs a rewrite. The original Peg.js documentation leaves a lot to be desired. This is my first attempt at making a confusing documentation entry more approachable.

@hildjj
Copy link
Contributor

hildjj commented Mar 15, 2023

Will review tomorrow. There are likely lots of doc changes needed, including splitting things up into multiple pages.

Mingun
Mingun previously approved these changes Mar 15, 2023
@hildjj
Copy link
Contributor

hildjj commented Mar 15, 2023

This looks good to me. Can also you please add yourself to the AUTHORS file if you're not already in there?

@AndrewRayCode
Copy link
Contributor Author

AndrewRayCode commented Mar 19, 2023

Done. Also I just realized the name of this flag is confusing, or am I missing something? grammarSource - this makes me think it's the source of the .pegjs file, rather than the input/lexemes being parsed. Is this the right flag name?

Edit: I think my confusion is because grammarSource is reused between parse and generate. It should probably have a different name for parse?

@hildjj
Copy link
Contributor

hildjj commented Mar 19, 2023

It has the same name for those two things because it's the same generated code. It's confusing, I'll grant you, but the grammar you write is input into the grammar at src/parser.pegjs.

@hildjj hildjj merged commit 66d73f6 into peggyjs:main Mar 19, 2023
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.

3 participants