peggy
peggy copied to clipboard
Implement syntax for importing rules
Draft that implements syntax for importing rules. Does not implement actual importing. Design questions should be discussed in the #239 first.
I open this PR so anyone can experiment with implementing importing.
Could you please set the branch with ranges as base to this PR, so that it shows only the relevant diff?
Could you please set the branch with ranges as base to this PR, so that it shows only the relevant diff?
Unfortunately, this is impossible, because branch ranges
in my repository, and this PR against peggy
repository. Of course, GitHub does not allow me to set it as a base. But you can select, what commits you want to see on the Files changed tab.
I think we should do a release with #291 in it, then finish the design and implementation of this. This might be big enough to warrant a 3.0, in which case we could slide whatever breaking change we decide on in #302 into that release as well.
I think #417 is kind of the inverse of this approach. it defines semantics, but no syntax. One of the problems I've got with the import syntax is that either the core peggy code needs to know how to read files and do path munging, or you need to pass in primitives that do so. In node, you'd use fs
and path
. In the browser, you'd use fetch
and URL
. In the browser you'd either need to know the fully-qualified URL of the input document, or only allow imports of fully-qualified URLs.
I wonder if we actually need syntax for this, or if #417's approach of passing in an array in the same shape that GrammarError.format()
takes will be enough?
Fixed in #456