Hi All,

    This is Falzur. I am using Antlr 2.7.6 to parse MySQL queries. I am
facing a problem with the multiple inheritance. I wrote a seperate grammar
file for each MySQL statement. and a base file for the comman grammar. In
MySQL we have a begin end block statement, in which any statement can come.
Here the problem raised. The grammar for the begin end block is as follows:

compound_stmt {SaToken t;}: t = begin_end_block
  {
  cout<<"Pushing for element compound_stmt at depth "<<currentDepth<<endl;
  ElemToken elem_token = createElementToken(currentDepth,
ELEMENT_TYPE_compound_stmt, t);
  add_elem_token_to_list(elem_token);
  currentDepth --;
  };

begin_end_block : (begin_label COLON)? begin_clause (statement_list)?
end_clause;

begin_clause returns [SaToken t] : e: "begin" {
  t = createSaToken (e);
};

end_clause: "end" (end_label)?;

statement_list: (stmt)* ;

stmt: (subquery | create_stmt | replace_stmt | update_stmt | alter_stmt |
truncate_stmt | compound_stmt);

begin_label: identifier;
end_label: begin_label;

Where all the,  subquery, create_stmt, replace_stmt, update_stmt,
alter_stmt, truncate_stmt, compound_stmt are in different parser files.

and i choosed the following options:

options {

     importVocab = BaseLexer;

     k = 3;

    defaultErrorHandler = false;

    buildAST = true;

    classHeaderSuffix = UpdateParser, ReplaceParser, TruncateParser,
AlterPaser, SelectParser;

}

When i compile, it raises an error

rule classDef trapped

expecting SEMI, found ','

ane when i compile with the option classHeaderSuffix = UpdateParser; then,
the compilation throws errors saying that the following statements doesn't
have the rule define, which is right.

create_stmt,

replace_stmt,

update_stmt,

alter_stmt,

truncate_stmt

I would like to inherit each grammar file in the current file. So that all
the Tokens should resolve.

Can anybody help me out how to resolve this problem.  Thanks in advance.

-- 
Thanks & Regards,

Fazlur Rahaman Naik

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address

Reply via email to