[antlr-interest] Some Problem with antlrv3

femtowin1 femtowin1 at gmail.com
Mon May 7 18:24:48 PDT 2007


Hi Terence, sorry for not state the problem clearly, for point 1,
just ignore the Rubyv3Parser(TokenStream input, Rubyv3Parser parent) constructor, assume we only only one
construtor now: Rubyv3Parser(TokenStream input) , the problem
is this constructor is generated and I can't add customization
initialization code to it , actually I need is the following:
public Rubyv3Parser(TokenStream input) {
         super(input);
           ((Rubyv3Lexer) input.getTokenSource()).setParser(this); 
     }
but this constructor is auto generated, I just can't put the above
code into members section cause when generating, there will be 
two same signature constructor which is compile error.

for point 3, actually I need building a compiler,
because ruby's double quote string has inner structure,
you can put any statement inside #{}, so what I did is attach
an expression to the token when lexing, so while walking the tree,
I need to get the expression, 
expression returns[Expression e]
	:	 value=DOUBLE_QUOTE_STRING{e=((MyToken)$value.getToken()).getExpression();}
the current implementation doesn't support specifying Token type in tree grammar.
______________________________________
Sent from my www.pageflakes.com startpage


More information about the antlr-interest mailing list