error: use of undeclared identifier 'self'
还没有人认领这个 Issue。
评估
调研方向
使用 grammars-v4/python/python3 中的 Python3 语法复现报告的命令,并检查生成的 src/LythonCompiler/Parser/ANTLR/PythonParser.cpp 中列出的谓词错误附近的内容。跟踪语法谓词如何转换为 C++,并确认生成的解析器能够在没有未声明的自身引用的情况下编译。
由索引模型根据 Issue 内容生成。
描述
Hello, I have multiple error when compiling the generated parser and lexer.
ANTLR version: 4.13.0
Os: Macos
Command used: antlr -Dlanguage=Cpp -o ${CMAKE_CURRENT_SOURCE_DIR}/src/LythonCompiler/Parser/ANTLR/ ${CMAKE_CURRENT_SOURCE_DIR}/src/LythonCompiler/Parser/ANTLR/Python3Parser.g4
the error:
/Users/./Documents/lython-cpp/src/LythonCompiler/Parser/ANTLR/PythonParser.cpp:19168:11: error: use of undeclared identifier 'self'
if (!(self.isEqualCurrentTokenText("case"))) throw FailedPredicateException(this, "self.isEqualCurrentTokenText(\"case\")");
^
/Users/./Documents/lython-cpp/src/LythonCompiler/Parser/ANTLR/PythonParser.cpp:19224:11: error: use of undeclared identifier 'self'
if (!(self.isEqualCurrentTokenText("_"))) throw FailedPredicateException(this, "self.isEqualCurrentTokenText(\"_\")");
^
/Users/./Documents/lython-cpp/src/LythonCompiler/Parser/ANTLR/PythonParser.cpp:19280:11: error: use of undeclared identifier 'self'
if (!(self.isEqualCurrentTokenText("type"))) throw FailedPredicateException(this, "self.isEqualCurrentTokenText(\"type\")");
^
/Users/./Documents/lython-cpp/src/LythonCompiler/Parser/ANTLR/PythonParser.cpp:19329:20: error: use of undeclared identifier 'self'
case 1: return self.isnotEqualCurrentTokenText("_");
^
/Users/./Documents/lython-cpp/src/LythonCompiler/Parser/ANTLR/PythonParser.cpp:19419:21: error: use of undeclared identifier 'self'
case 10: return self.isEqualCurrentTokenText("match");
^
/Users//./Documents/lython-cpp/src/LythonCompiler/Parser/ANTLR/PythonParser.cpp:19429:21: error: use of undeclared identifier 'self'
case 11: return self.isEqualCurrentTokenText("case");
^
/Users/./Documents/lython-cpp/src/LythonCompiler/Parser/ANTLR/PythonParser.cpp:19439:21: error: use of undeclared identifier 'self'
case 12: return self.isEqualCurrentTokenText("_");
^
/Users/./Documents/lython-cpp/src/LythonCompiler/Parser/ANTLR/PythonParser.cpp:19449:21: error: use of undeclared identifier 'self'
case 13: return self.isEqualCurrentTokenText("type");
the grammar file used is located here: https://github.com/antlr/grammars-v4/tree/master/python/python3
- 主要语言
- C++
- 星标
- 80
- 派生
- 33
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
antlr/antlr4-cpp 的其他 Issue
-
难度 5/5 一周以上 新手友好度 20/100
antlr/antlr4-cpp#13 ·
-
难度 4/5 3-5 天 新手友好度 25/100
antlr/antlr4-cpp#12 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 35/100
antlr/antlr4-cpp#11 ·
-
难度 2/5 1-3 小时 新手友好度 35/100
antlr/antlr4-cpp#10 ·
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
mpfaffenberger/privateer_reimagined#658 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 85/100
microsoft/onnxruntime#33018 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
AXERA-TECH/ax-llm#81 ·
-
enhancement
难度 2/5 半天 新手友好度 78/100
ros-industrial/ros2_canopen#448 ·
-
难度 1/5 1 小时以内 新手友好度 78/100
维护者通常 1 天内回复