-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Splitting lexer and parser grammar into separate files causes error #15
Comments
@StuartReavley - did you try adding both files to the command line ? eg:
|
I hit the same problem with the generated code of a PL/SQL grammar even if I used the lexer and parser grammar together. antlr4 -Dlanguage=Rust -o src -Xexact-output-dir grammars/PlSqlLexer.g4 grammars/PlSqlParser.g4 Compiling the generated code
Renaming the generated trait to sed -i s/PlSqlParserParserContext/PlSqlParserContext/g src/plsqlparser.rs |
Same for me working with https://github.com/p-org/P/tree/bec256f/Src/PCompiler/CompilerCore/Parser I'm using antlr4-4.8-2-Rust0.3.0-beta and |
Did anyone ever figure out what causes this? I just hit it as well. |
To repro:
use grammars here: https://github.com/sepp2k/antlr4-string-interpolation-examples/tree/master/with-duplication
run commands
java -jar ./antlr4-4.8-2-SNAPSHOT-complete.jar -Dlanguage=Rust StringLexer.g4
java -jar ./antlr4-4.8-2-SNAPSHOT-complete.jar -Dlanguage=Rust StringParser.g4
Observe errors, e.g:
error[E0412]: cannot find type `StringParserParserContextType` in this scope --> src/parsing/jasm/gen/stringparser.rs:532:49 | 156 | pub struct StringParserContextType; | ----------------------------------- similarly named struct `StringParserContextType` defined here ... 532 | fn RPAR(&self) -> Option<Rc<TerminalNode<'input,StringParserParserContextType>>> where Self:Sized{ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
As I understand, there is no way to use lexer modes (e.g. in that example) without separate files. Any way to get this to work?
Thank you!
Stuart
The text was updated successfully, but these errors were encountered: