Dart code generater generates type errors for dart3 which can easy fixed
I tried to build a dart package to parse Prisma Orm file. But this problems happens also on your hello grammar file:
// Define a grammar called Hello
grammar Hello;
r : 'hello' ID ; // match keyword hello followed by an identifier
ID : [a-z]+ ; // match lower-case identifiers
WS : [ \t\r\n]+ -> skip ; // skip spaces, tabs, newlines
antlr4 -Dlanguage=Dart Hello.g4 -o lib/hello
Used versions ANTLR Parser Generator Version 4.13.1 Dart SDK version: 3.1.3 (stable) (Tue Sep 26 14:25:13 2023 +0000) on "macos_arm64"
The HelloParser.dart file contains a lot of warnings and an some error: The argument type 'dynamic' can't be assigned to the parameter type 'ParserRuleContext'.
dynamic _localctx = HelloFileContext(context, state);
this can be fixed by generating:
final _localctx = HelloFileContext(context, state);
I made a quick fix for this: https://github.com/antlr/antlr4/compare/dev...udiedrichsen:antlr4:dev
I also ran into this. Thanks for the patch @udiedrichsen