Closed AndrewRayCode closed 1 year ago
Which doesn't have any of the
^^^^^
/-->
ASCII arrows promised in the documentation.
This is because source
is a key, that should match grammarSource
in options
What is an "identifier of a grammar"?
Literally, this is an identifier, like <anonymous glsl>
in your case.
Why is it an array?
Locations in generated errors can have different source
s. Well, right now, because #298 does not yet implemented, the source is always one.
Why does format require an array argument? Doesn't it already have error location information, and source lexeme information, to generate a useful error message?
It contains positions in some input, but not the input itself. To show you pretty printed error with a part of the input you should provide it somehow.
Does #382 fix this adequately for you yet?
@Mingun ah that makes sense. The array thing confused me. Your reply gave me enough information to open https://github.com/peggyjs/peggy/pull/389/files
Fixed in #389
The documentation says:
What does this mean? What is a mapping from source to grammar? Why is it an array?
lib/peg.d.ts
saysWhat does this mean? What is an "identifier of a grammar"?
Why does format require an array argument? Doesn't it already have error location information, and source lexeme information, to generate a useful error message?
It doesn't for me, and I'm not sure how it's supposed to work.
This logs:
Which doesn't have any of the
^^^^^
/-->
ASCII arrows promised in the documentation.I'd like to update the documentation on this function as well, but I'm not yet sure what the API is trying to convey.