[antlr-interest] Templates in rules
Corno
antlr-interest at schraverus.com
Wed Apr 26 23:21:01 PDT 2006
Hi all,
The software I'm currently writing (in C++) uses a lot of template classes.
I'm also writing a frontend in ANTLR that has to interact with those
template classes.
What I found myself doing was writing wrappers for those template classes so
that I could pass the as a variable from one rule to another but this is a
very inconvenient way.
So let's say I have;
std::vector<A>
std::vector<B>
I have written the following wrapper classes; class AnyVector {
...
std::vector<A> imp;
};
class Avector : public AnyVector
{
...
std::vector<A> imp;
};
class Bvector : public AnyVector
{
...
std::vector<B> imp;
};
So that I can have the following rule
Foo [AnyVector& theVector]
:
( X | Y )
;
What I would like to have is something like this;
Foo <Element>[std::vector<Element>& theVector]
:
( X | Y )
;
Is there any way that I can parametrize an antlr rule to achieve that
effect?
TIA,
Corno
More information about the antlr-interest
mailing list