rrevenantt / antlr4rust

ANTLR4 parser generator runtime for Rust programming laguage
Other
398 stars 70 forks source link

Fix generated code for PlSqlParser.g4 #53

Open peteromoon opened 2 years ago

peteromoon commented 2 years ago

When building the PlSql grammar from https://github.com/antlr/grammars-v4/blob/master/sql/plsql/PlSqlParser.g4 and https://github.com/antlr/grammars-v4/blob/master/sql/plsql/PlSqlLexer.g4, the generated Rust code fails to compile with the following error.

error[E0405]: cannot find trait `PlSqlParserParserContext` in this scope
      --> tests/gen/plsqlparser.rs:112704:14
       |
4550   | / pub trait PlSqlParserContext<'input>:
4551   | |     for<'x> Listenable<dyn PlSqlParserListener<'input> + 'x > + 
4552   | |     ParserRuleContext<'input, TF=LocalTokenFactory<'input>, Ctx=PlSqlParserContextType>
4553   | | {}
       | |__- similarly named trait `PlSqlParserContext` defined here
...
112704 |   impl<'input> PlSqlParserParserContext<'input> for Table_ref_aux_internalContextAll<'input>{}
       |                ^^^^^^^^^^^^^^^^^^^^^^^^ help: a trait with a similar name exists: `PlSqlParserContext`

The PlSqlParser.g4 and PlSqlLexer.g4 files need to modified to remove references to self. You can find the modified version at: https://github.com/peteromoon/antlr4rust/blob/plsqltest/grammars/PlSqlLexer.g4 and https://github.com/peteromoon/antlr4rust/blob/plsqltest/grammars/PlSqlParser.g4.