rrevenantt / antlr4rust

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

error generate cpp lexer #81

Open heruhday opened 1 year ago

heruhday commented 1 year ago

I tried to generate cpp lexer from https://github.com/antlr/grammars-v4/blob/master/cpp/pom.xml, but have a error like: error: expected {, found throw I think the problem is throw because rust not using throw new like java or C# for error handling.

 --> src\cpp\cpp14parser.rs:23478:64
  |
23478 .val { it.get_text() } else { "null" } .compareTo("0")!=0) throw new InputMismatchException(this); ^^^^^ expected {
note: the if expression is missing a block after this condition --> src\cpp\cpp14parser.rs:23477:6 23477 if(if let Some(it) = &(cast::<_,PureSpecifierContext >(&*_localctx)) ___^ 23478 .val { it.get_text() } else { "null" } .compareTo("0")!=0) throw new InputMismatchException(this); ___^ help: try placing this code inside a block
23478 .val { it.get_text() } else { "null" } .compareTo("0")!=0) { throw } new InputMismatchException(this);
+ +