We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm using Dart2Parser.g4, Dart2Lexer.g4, and Dart2LexerBase.java.
The grammar could not parse the following code:
void main() { String param = ''; String text = ''' ${param.isEmpty? '''one ''':'''$param'''}two '''; print(text); }
Here is the error message:
line 4:22 no viable alternative at input 'voidmain(){Stringparam='';Stringtext='''\n ${param.isEmpty? '''one'
Here is the Java code to reproduce the issue:
package com.levelrin; import com.levelrin.antlr.generated.Dart2Lexer; import com.levelrin.antlr.generated.Dart2Parser; import com.levelrin.antlr.generated.Dart2ParserBaseListener; import org.antlr.v4.runtime.CharStream; import org.antlr.v4.runtime.CharStreams; import org.antlr.v4.runtime.CommonTokenStream; import org.antlr.v4.runtime.tree.ParseTree; import org.antlr.v4.runtime.tree.ParseTreeWalker; public final class Main { public static void main(final String... args) { final String source = """ void main() { String param = ''; String text = ''' ${param.isEmpty? '''one ''':'''$param'''}two '''; print(text); } """; final CharStream charStream = CharStreams.fromString(source); final Dart2Lexer lexer = new Dart2Lexer(charStream); final CommonTokenStream tokens = new CommonTokenStream(lexer); final Dart2Parser parser = new Dart2Parser(tokens); final ParseTree tree = parser.compilationUnit(); final Dart2ParserBaseListener listener = new Dart2ParserBaseListener(); ParseTreeWalker.DEFAULT.walk(listener, tree); } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I'm using Dart2Parser.g4, Dart2Lexer.g4, and Dart2LexerBase.java.
The grammar could not parse the following code:
Here is the error message:
Here is the Java code to reproduce the issue:
The text was updated successfully, but these errors were encountered: