Hi
when I tried to migrate my grammar from version 3.3 into 3.4 I noticed this:
Grammar excerpt:
--- snap ---
subquery
:
(
//LPAREN select_statement RPAREN
// ( group_by_clause )?
// ( (k_model (k_main|k_partition|k_dimension) ) => model_clause )?
// ( union_clause )*
( fu1=for_update_clause )?
// ( order_by_clause )?
( fu2=for_update_clause )?
) -> ^(T_SUBQUERY $fu1 $fu2)
| (
LPAREN subquery RPAREN
// ( group_by_clause )?
// ( (k_model (k_main|k_partition|k_dimension) ) => model_clause )?
// ( union_clause )*
( fu1=for_update_clause )?
// ( order_by_clause )?
( fu2=for_update_clause )?
) -> ^(T_SUBQUERY subquery $fu1 $fu2)
;
/*
================================================================================
FOR UPDATE CLAUSE
================================================================================
*/
for_update_clause: r_for r_update ( r_of for_update_clause_part_first for_update_clause_part_next* )? (r_nowait | k_wait NUMBER | k_skip k_locked)? -> ^(T_FOR_UPDATE_CLAUSE r_for r_update r_of? for_update_clause_part_first? for_update_clause_part_next* r_nowait? k_wait? NUMBER? k_skip? k_locked?)
;
for_update_clause_part_first
: (schema_name DOT)? (table_name DOT)? column_name
;
for_update_clause_part_next
: COMMA (schema_name DOT)? (table_name DOT)? column_name
;
--- end snap ---
This is a minimalistic subset of my grammar that reproduces the problem.
ANTLR ver 3.4 produces C code which contains this:
--- snap ---
// $ANTLR start synpred2_OracleSQL
static void synpred2_OracleSQL_fragment(pOracleSQLParser ctx )
{
void ; // <== !! HERE !!!
#undef RETURN_TYPE_
#define RETURN_TYPE_ void
// OracleSQL.g:30:11: (fu1= for_update_clause )
// OracleSQL.g:30:11: fu1= for_update_clause
{
FOLLOWPUSH(FOLLOW_for_update_clause_in_synpred2_OracleSQL172);
fu1=for_update_clause(ctx);
FOLLOWPOP();
if (HASEXCEPTION())
{
goto rulesynpred2_OracleSQLEx;
}
if (HASFAILED())
{
return ;
}
}
// This is where rules clean up and exit
//
goto rulesynpred2_OracleSQLEx; /* Prevent compiler warnings */
rulesynpred2_OracleSQLEx: ;
}
--- end snap ---
While in version 3.3 the declaration "void ;" is replaced by
" OracleSQLParser_for_update_clause_return fu1;"
Note: Generated code for Java is also incorrect. Is it a bug or am I doing something wrong? Ivan ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.
List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
OracleSQL.g
Description: Binary data
-- 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.
