peggy icon indicating copy to clipboard operation
peggy copied to clipboard

Importing grammar rules from a file

Open jarble opened this issue 2 years ago • 1 comments

I often re-use the same grammar rules in multiple grammar files, so I want to save these rules in one file and import them into other grammar files.

If I defined a rule in a file named rules.peggy:

function_call = a1:var_name "(" _ a2:exprs _ ")" {return a1+"("+a2+")";}

I would want to import it into another grammar file:

import rules.peggy

Does Peggy have a feature that allows grammar rules to be imported like this?

jarble avatar Jun 13 '22 20:06 jarble

We're currently talking about it here, and in a draft PR that isn't finished yet.

hildjj avatar Jun 13 '22 20:06 hildjj

Also #417

hildjj avatar Dec 13 '23 17:12 hildjj

I think #456 is the full fix for this.

hildjj avatar Jan 27 '24 17:01 hildjj

Fixed by #456

hildjj avatar Jan 27 '24 19:01 hildjj