You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In peggy-test and peggy-tag, I'd like to be able to pass in a grammar location along with the grammar source, so that offset, line, and column in reported errors start at something other than zero. This is useful when the grammar is embedded into a larger document, and only a portion of that larger document is passed into peggy.
Proposal:
Add a grammarLocation to the API. Carry it around all of the places grammarSource goes. It will have the same shape as that returned by location() for easily passing it through from a wrapper grammar. Only the start portion is likely to be used, however.
Do not apply the offset until the very last moment, on output in format. Otherwise the arrow pointing to the error will be in the wrong place.
Default offsets are all zero. Check for off-by-one errors in line, column, and offset of both start and end.
Compatibility:
Will break anyone currently using grammarLocation as a parameter to their grammar. We should document that the grammar* namespace is for internal use.
The text was updated successfully, but these errors were encountered:
I'm going about this a slightly different way that changes the interface a lot less. There's a special type you'll be able to pass in for grammarSource, called GrammarLocation, which keeps the offsets and the name of the source file as text.
In peggy-test and peggy-tag, I'd like to be able to pass in a grammar location along with the grammar source, so that offset, line, and column in reported errors start at something other than zero. This is useful when the grammar is embedded into a larger document, and only a portion of that larger document is passed into peggy.
Proposal:
grammarLocation
to the API. Carry it around all of the placesgrammarSource
goes. It will have the same shape as that returned bylocation()
for easily passing it through from a wrapper grammar. Only thestart
portion is likely to be used, however.format
. Otherwise the arrow pointing to the error will be in the wrong place.line
,column
, andoffset
of bothstart
andend
.Compatibility:
grammarLocation
as a parameter to their grammar. We should document that thegrammar*
namespace is for internal use.The text was updated successfully, but these errors were encountered: