[antlr-interest] Need help with rule-parameters (ANTLR bug?)
Sean Walton
ab8kf at aim.com
Tue Jan 17 07:22:41 PST 2012
Interesting. I think that this problem is very related, and it appears that the problem was not fixed.
BTW, when are synth-preds created?
Sean Walton
ab8kf at aim.com
-----Original Message-----
From: Eric <researcher0x00 at gmail.com>
To: Sean Walton <ab8kf at aim.com>; ANTLR interest <antlr-interest at antlr.org>
Sent: Tue, Jan 17, 2012 8:10 am
Subject: Re: [antlr-interest] Need help with rule-parameters (ANTLR bug?)
Sean,
Have you seen? http://markmail.org/message/wr44syoliwmy6ors
Eric
On Mon, Jan 16, 2012 at 5:12 PM, Sean Walton <ab8kf at aim.com> wrote:
When I put in this:
1 cccl_declaration[Object tree]
2 : cccl_name cccl_def_options '\n'
3 -> ^(CCCL_DECLARATION cccl_name cccl_def_options)
4 | n=cccl_name cccl_def_options '\n' cccl_declaration[n.getTree()]
5 -> ^(CCCL_DECLARATION cccl_name cccl_def_options)
6 | cccl_name cccl_command_params* ':' '\n' cccl_execution_block
7 -> ^(CCCL_IMPLEMENTATION { $tree } cccl_name cccl_command_params* cccl_execution_block)
8 ;
I get this:
1 public final void synpred3_cccl_fragment() throws RecognitionException {
2--> void =null;
3
4
5 // /home/swalton/Projects/Arthur/Tools/Testing/CCCL/cccl.g:153:4: (n= cccl_name cccl_def_options '\\n' cccl_declaration[n.getTree()] )
6 // /home/swalton/Projects/Arthur/Tools/Testing/CCCL/cccl.g:153:4: n= cccl_name cccl_def_options '\\n' cccl_declaration[n.getTree()]
7 {
8 pushFollow(FOLLOW_cccl_name_in_synpred3_cccl402);
9--> n=cccl_name();
10
11 state._fsp--;
12 if (state.failed) return ;
13
14 pushFollow(FOLLOW_cccl_def_options_in_synpred3_cccl404);
15 cccl_def_options();
16
17 state._fsp--;
18 if (state.failed) return ;
19
20 match(input,113,FOLLOW_113_in_synpred3_cccl406); if (state.failed) return ;
21
22 pushFollow(FOLLOW_cccl_declaration_in_synpred3_cccl408);
23 cccl_declaration(n.getTree());
24
26 state._fsp--;
27 if (state.failed) return ;
28
29 }
}
Note the arrows. "void =null" is clearly wrong, and in "n=cccl_name()" the "n" is not defined (it is defined outside this synthetic predicate).
What I want to do:
I need to collect "cccl_name" from "cccl_declaration" and place them in the CCCL_IMPLEMENTATION (line #7) rewrite.
Sean Walton
ab8kf at aim.com
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
More information about the antlr-interest
mailing list