peggyjs / peggy

Peggy: Parser generator for JavaScript
https://peggyjs.org/
MIT License
915 stars 65 forks source link

Updating grammarSource documentation #382

Closed AndrewRayCode closed 1 year ago

AndrewRayCode commented 1 year ago

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

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 commented 1 year ago

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

hildjj commented 1 year ago

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

AndrewRayCode commented 1 year ago

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 commented 1 year ago

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.