peggy icon indicating copy to clipboard operation
peggy copied to clipboard

Implement syntax for importing rules

Open Mingun opened this issue 2 years ago • 3 comments

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.

Mingun avatar Jun 11 '22 20:06 Mingun

Could you please set the branch with ranges as base to this PR, so that it shows only the relevant diff?

reverofevil avatar Jun 11 '22 20:06 reverofevil

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.

Mingun avatar Jun 11 '22 21:06 Mingun

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.

hildjj avatar Jul 04 '22 18:07 hildjj

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?

hildjj avatar Dec 12 '23 19:12 hildjj

Fixed in #456

hildjj avatar Jan 27 '24 18:01 hildjj