You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
antlr4 -Dlanguage=Cpp A.g4 && g++ AParser.cpp -o /dev/null -I /usr/include/antlr4-runtime/ -c
AParser.cpp:121:23: error: no declaration matches ‘AParser::RuleContext*AParser::CmdContext::rule_()’
121 | AParser::RuleContext*AParser::CmdContext::rule_() {
| ^~~~~~~
In file included from AListener.h:8,
from AParser.cpp:5:
AParser.h:46:18: note: candidate is: ‘antlr4::RuleContext*AParser::CmdContext::rule_()’
46 | RuleContext *rule_();
| ^~~~~
AParser.h:42:10: note: ‘class AParser::CmdContext’ defined here
42 | class CmdContext : public antlr4::ParserRuleContext {
| ^~~~~~~~~~
It's becase that rule in the grammar creates confusion between generated AParser::RuleContext and antlr4::RuleContext. This fix is obvious. The generated AParser.h should have:
AParser::RuleContext* rule_();
instead of current:
RuleContext* rule_();
The text was updated successfully, but these errors were encountered:
$ make
bash build.sh
Restore complete (0.8s)
Build succeeded in 1.2s
Restore complete (0.4s)
Test succeeded with 1 warning(s) (2.8s) → bin\Debug\net8.0\Test.dll
C:\msys64\home\Kenne\temp\Generated-CSharp\AParser.cs(129,23): warning CS0108: 'AParser.RuleContext' hides inherited member 'Parser.RuleContext'. Use the new keyword if hiding was intended.
Build succeeded with 1 warning(s) in 3.8s
Workload updates are available. Run `dotnet workload list` for more information.
03/21-07:19:52 ~/temp/Generated-CSharp
In Dart, we get this:
$ make
bash build.sh
Resolving dependencies... (2.6s)
+ _fe_analyzer_shared 67.0.0 (80.0.0 available)
+ analyzer 6.4.1 (7.3.0 available)
+ crypto 3.0.3 (3.0.6 available)
...
+ webkit_inspection_protocol 1.2.1
+ yaml 3.1.2 (3.1.3 available)
Changed 48 dependencies!
1 package is discontinued.
33 packages have newer versions incompatible with dependency constraints.
Try `dart pub outdated` for more information.
ABaseListener.dart:5:1: Error: 'RuleContext' is imported from both 'AParser.dart' and 'package:antlr4/src/rule_context.dart'.
import 'AParser.dart';
^^^^^^^^^^^
AListener.dart:5:1: Error: 'RuleContext' is imported from both 'AParser.dart' and 'package:antlr4/src/rule_context.dart'.
import 'AParser.dart';
^^^^^^^^^^^
Error: AOT compilation failed
Generating AOT kernel dill failed!
mingw32-make: *** [makefile:3: build] Error 64
03/21-07:22:59 ~/temp/Generated-Dart
$
In TypeScript, we get this:
$ make
bash build.sh
CLI_BASEDIR = C:\Program Files\nodejs
changed 20 packages in 3s
CLI_BASEDIR = C:\Program Files\nodejs
added 13 packages, and audited 14 packages in 2s
3 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
AParser.ts:9:2 - error TS2395: Individual declarations in merged declaration 'RuleContext' must be all exported or all local.
9 RuleContext, ParserRuleContext, PredictionMode, PredictionContextCache,
~~~~~~~~~~~
...
In Antlr4ng/antlr-ng, we don't get any errors.
Using "rule" as a parser symbol causes a "symbol conflict." This was supposed to be taken care of by #3451. Any fixes for Cpp should be checked and fixed for the other targets.
With this grammar:
I see:
It's becase that
rule
in the grammar creates confusion between generatedAParser::RuleContext
andantlr4::RuleContext
. This fix is obvious. The generatedAParser.h
should have:AParser::RuleContext* rule_();
instead of current:
RuleContext* rule_();
The text was updated successfully, but these errors were encountered: