mjijackson/citrus — Issue #38: Support for inheritance?
Author: blambeau
Created: 2012-01-13 13:35:53+00:00
State: open

Hi,

I'd like to write an abstract grammar with two concrete instantiations and I expected Citrus to mimic ruby inheritance for this (I guess that Treetop does, btw). Unfortunately, the following example does not work:

grammar WithPar
rule function
/[a-z]/+ parens
end
rule parens '()' end
end

grammar WithBrack
include WithPar
root function
rule parens '{}' end
end

I would expect the following to work, but it's not the case (see https://gist.github.com/1606092)

WithPar.parse "hello()"
WithBrack.parse "hello{}"

Is there a way to do this in Citrus?