Please read the documentation:
@declarations {}
@init {}
Then search the list using antlr.markmail.org for hoisted predicates and local
variables. It isn't the C target it is just that the local variable or
parameter is out of scope for the predicate, so you must use scopes if you have
to use semantic predicates (with parameters).
Jim
> -----Original Message-----
> From: [email protected] [mailto:antlr-interest-
> [email protected]] On Behalf Of Anton Bychkov
> Sent: Thursday, April 01, 2010 4:20 AM
> To: [email protected] interest
> Subject: [antlr-interest] backtrack + rule arguments + C target
>
> Hi.
>
> I have some problems with backtrack option and rule arguments.
>
> Example grammar:
>
> grammar testbt;
>
> options
> {
> language = C;
> backtrack = true;
> }
>
> expr
> @init {
> int i = 1;
> }
> :
> num[i] | id[i]
> ;
>
>
> num[int i] : '0'..'9'+;
> id[int i] : 'a'..'z'+;
>
> Generated files does not compile with error "error C2065: 'i' :
> undeclared identifier".
> (The problem is that C target does not insert rule arguments into
> argument list of autogenerated 'synpred' functions.)
>
> How can I fix this?
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.