Open aliclark opened 3 years ago
@airportyh You're the error messages person :) Could you take a look please?
This turned out to be quite straightforward, and turned out that "additional javascript" was a red herring as it also applies to backtick strings.
The following grammar produces a Syntax Error with
line
2 andcol
12:Since
offset
is18
, nearley is able to display the correct location of the error when formatting, but I think it would be nice to reflect the original file line and column also.For example, this PR with
moo
to provide contextual errors makes use ofline
andcol
overoffset
, so would point to the wrong location in this example.A workaround can be for the grammar author to move additional JS blocks towards the bottom of the grammar file, therefore not changing the line locations of the grammar above.
I imagine a straightforward fix could be to "blank" out the locations where additional JS is present in any intermediate grammar, ie. intermediate result looking like: