Bad generation from C++ Grammar
cppenjoy opened this issue · comments
λₐₘ commented
I copied the lexer and parser from https://github.com/antlr/grammars-v4/tree/master/cpp
but replaced CPP14 with Ctc. and when I try to build, I get:
/home/lofi/ctc-compiler/compiler/CTCParser.cpp: In member function ‘CTCParser::MemberDeclaratorContext* CTCParser::memberDeclarator()’:
/home/lofi/ctc-compiler/compiler/CTCParser.cpp:15555:21: error: request for member ‘IsPureSpecifierAllowed’ in ‘(CTCParser*)this’, which is of pointer type ‘CTCParser*’ (maybe you meant to use ‘->’ ?)
15555 | if (!( this.IsPureSpecifierAllowed() )) throw FailedPredicateException(this, " this.IsPureSpecifierAllowed() ");
| ^~~~~~~~~~~~~~~~~~~~~~
/home/lofi/ctc-compiler/compiler/CTCParser.cpp:15564:21: error: request for member ‘IsPureSpecifierAllowed’ in ‘(CTCParser*)this’, which is of pointer type ‘CTCParser*’ (maybe you meant to use ‘->’ ?)
15564 | if (!( this.IsPureSpecifierAllowed() )) throw FailedPredicateException(this, " this.IsPureSpecifierAllowed() ");
| ^~~~~~~~~~~~~~~~~~~~~~
/home/lofi/ctc-compiler/compiler/CTCParser.cpp: In member function ‘bool CTCParser::nestedNameSpecifierSempred(CTCParser::NestedNameSpecifierContext*, size_t)’:
/home/lofi/ctc-compiler/compiler/CTCParser.cpp:19370:72: warning: unused parameter ‘_localctx’ [-Wunused-parameter]
19370 | bool CTCParser::nestedNameSpecifierSempred(NestedNameSpecifierContext *_localctx, size_t predicateIndex) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
/home/lofi/ctc-compiler/compiler/CTCParser.cpp: In member function ‘bool CTCParser::postfixExpressionSempred(CTCParser::PostfixExpressionContext*, size_t)’:
/home/lofi/ctc-compiler/compiler/CTCParser.cpp:19380:68: warning: unused parameter ‘_localctx’ [-Wunused-parameter]
19380 | bool CTCParser::postfixExpressionSempred(PostfixExpressionContext *_localctx, size_t predicateIndex) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
/home/lofi/ctc-compiler/compiler/CTCParser.cpp: In member function ‘bool CTCParser::noPointerNewDeclaratorSempred(CTCParser::NoPointerNewDeclaratorContext*, size_t)’:
/home/lofi/ctc-compiler/compiler/CTCParser.cpp:19393:78: warning: unused parameter ‘_localctx’ [-Wunused-parameter]
19393 | bool CTCParser::noPointerNewDeclaratorSempred(NoPointerNewDeclaratorContext *_localctx, size_t predicateIndex) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
/home/lofi/ctc-compiler/compiler/CTCParser.cpp: In member function ‘bool CTCParser::noPointerDeclaratorSempred(CTCParser::NoPointerDeclaratorContext*, size_t)’:
/home/lofi/ctc-compiler/compiler/CTCParser.cpp:19403:72: warning: unused parameter ‘_localctx’ [-Wunused-parameter]
19403 | bool CTCParser::noPointerDeclaratorSempred(NoPointerDeclaratorContext *_localctx, size_t predicateIndex) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
/home/lofi/ctc-compiler/compiler/CTCParser.cpp: In member function ‘bool CTCParser::noPointerAbstractDeclaratorSempred(CTCParser::NoPointerAbstractDeclaratorContext*, size_t)’:
/home/lofi/ctc-compiler/compiler/CTCParser.cpp:19413:88: warning: unused parameter ‘_localctx’ [-Wunused-parameter]
19413 | bool CTCParser::noPointerAbstractDeclaratorSempred(NoPointerAbstractDeclaratorContext *_localctx, size_t predicateIndex) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
/home/lofi/ctc-compiler/compiler/CTCParser.cpp: In member function ‘bool CTCParser::noPointerAbstractPackDeclaratorSempred(CTCParser::NoPointerAbstractPackDeclaratorContext*, size_t)’:
/home/lofi/ctc-compiler/compiler/CTCParser.cpp:19423:96: warning: unused parameter ‘_localctx’ [-Wunused-parameter]
19423 | bool CTCParser::noPointerAbstractPackDeclaratorSempred(NoPointerAbstractPackDeclaratorContext *_localctx, size_t predicateIndex) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
/home/lofi/ctc-compiler/compiler/CTCParser.cpp: In member function ‘bool CTCParser::memberDeclaratorSempred(CTCParser::MemberDeclaratorContext*, size_t)’:
/home/lofi/ctc-compiler/compiler/CTCParser.cpp:19435:26: error: request for member ‘IsPureSpecifierAllowed’ in ‘(CTCParser*)this’, which is of pointer type ‘CTCParser*’ (maybe you meant to use ‘->’ ?)
19435 | case 9: return this.IsPureSpecifierAllowed() ;
| ^~~~~~~~~~~~~~~~~~~~~~
/home/lofi/ctc-compiler/compiler/CTCParser.cpp:19436:27: error: request for member ‘IsPureSpecifierAllowed’ in ‘(CTCParser*)this’, which is of pointer type ‘CTCParser*’ (maybe you meant to use ‘->’ ?)
19436 | case 10: return this.IsPureSpecifierAllowed() ;
| ^~~~~~~~~~~~~~~~~~~~~~
/home/lofi/ctc-compiler/compiler/CTCParser.cpp:19433:66: warning: unused parameter ‘_localctx’ [-Wunused-parameter]
19433 | bool CTCParser::memberDeclaratorSempred(MemberDeclaratorContext *_localctx, size_t predicateIndex) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
make[2]: *** [CMakeFiles/ctc.dir/build.make:90: CMakeFiles/ctc.dir/compiler/CTCParser.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/ctc.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
What?