dlang-community / Pegged

A Parsing Expression Grammar (PEG) module, using the D programming language.
534 stars 66 forks source link

Parameterized rules #75

Closed callumenator closed 12 years ago

callumenator commented 12 years ago

Just tried compiling this from the tutorial, latest git head:

mixin(grammar(`
R:
    ArgList <- '(' List(identifier, ',') ')'
    List(Elem, Sep) <  Elem (Sep Elem)*
`));

Bunch of compile errors (ambiguous template getName!(named)....), dmd 2.060.

PhilippeSigaud commented 12 years ago

Oops, I forgot a commit (didn't push it on github). That should be OK now. At least, your example compiles with my current version.

callumenator commented 12 years ago

Oh the problem was a conflict between peg.getName and std.path.getName. My main module was importing std.path. If I generate a module it works fine, but the mixin has to contend with my other imports.

PhilippeSigaud commented 12 years ago

That means I'll have to use a qualified name for getName.

PhilippeSigaud commented 12 years ago

I pushed a commit for this.

callumenator commented 12 years ago

Cool thanks

On Mon, Oct 29, 2012 at 2:12 PM, Philippe Sigaud notifications@github.comwrote:

I pushed a commit for this.

— Reply to this email directly or view it on GitHubhttps://github.com/PhilippeSigaud/Pegged/issues/75#issuecomment-9887601.

callumenator commented 12 years ago

This is fixed, but there is an unrelated unit test failing from a previous commit (the and() one I think), just heads up

PhilippeSigaud commented 12 years ago

This is fixed, but there is an unrelated unit test failing from a previous commit (the and() one I think), just heads up

Yeah, compiling took so long with all unittests (like, minutes) that I stopped using the -unittest flag for a few commits :( Strangely, compiling is back to taking only a few seconds, even with all unit tests being exercised. I re-enabled the -unittest flag again.

This incapacity to obtain real names in and is starting to bother me. When I use the full name given by getName, I go into infinite loops in recursive rules.