Please use http://antlr.markmail.org where you will find this issue addressed many times. It is because the reference to the local input variable is not available to the DFA code, you have to use scopes instead.
Jim > -----Original Message----- > From: [email protected] [mailto:antlr-interest- > [email protected]] On Behalf Of Massimiliano D > Sent: Wednesday, August 25, 2010 11:16 AM > To: [email protected] > Subject: [antlr-interest] Syntactic predicate Issue > > > Hi, i have some problem in generated java code form one rule like this: > > grant_statement > : 'GRANT' > ( grant_system_privilege > | grant_object_privilege > ) > ; > > grant_object_privilege > : privilege[false] (COMMA privilege[false])* 'ON' on_object_clause > grantee_clause ('WITH' 'HIERARCHY' 'OPTION')? ('WITH' 'GRANT' > 'OPTION')? > ; > > privilege[boolean isSystemPriv] > : {isSystemPriv }? priv_sys > | {!isSystemPriv}? priv_obj > ; > > grant_system_privilege > : privilege[true] (COMMA privilege[true])* > grantee_clause ('IDENTIFIED' 'BY' .+)? ('WITH' 'ADMIN' 'OPTION')? > ; > > grantee_clause > : 'TO' (IDENTIFIER > | 'PUBLIC' > ) (COMMA (IDENTIFIER | 'PUBLIC'))* > ; > > whe i try to debug i got this error: cannot find symbol because in 2 generated > classes called DFAXXX the code looks like this: > > public int specialStateTransition(int s, IntStream _input) throws > NoViableAltException { > TokenStream input = (TokenStream)_input; > int _s = s; > switch ( s ) { > case 0 : > int LA97_8 = input.LA(1); > > > int index97_8 = input.index(); > input.rewind(); > s = -1; > if ( (evalPredicate(isSystemPriv ,"isSystemPriv ")) ) {s = 1;} > > else if ( (evalPredicate(!isSystemPriv,"!isSystemPriv")) ) {s = 27;} > > > input.seek(index97_8); > if ( s>=0 ) return s; > break; > case 1 : > int LA97_15 = input.LA(1); > > > int index97_15 = input.index(); > input.rewind(); > s = -1; > if ( (evalPredicate(isSystemPriv ,"isSystemPriv ")) ) {s = 1;} > > else if ( (evalPredicate(!isSystemPriv,"!isSystemPriv")) ) {s = 27;} > > > input.seek(index97_15); > if ( s>=0 ) return s; > break; > case 2 : > ........................ > ........................ > ....................... > } > if (state.backtracking>0) {state.failed=true; return -1;} > NoViableAltException nvae = > new NoViableAltException(getDescription(), 97, _s, input); > error(nvae); > throw nvae; > } > } > > but obviusly the isSystemPriv variable is not defined, am i missing > something?? > > Thanks Max. > > > 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.
