3013 lines
88 KiB
C++
3013 lines
88 KiB
C++
|
|
// Generated from Python3Parser.g4 by ANTLR 4.13.1
|
|
|
|
|
|
#include "Python3ParserVisitor.h"
|
|
|
|
#include "Python3Parser.h"
|
|
|
|
|
|
using namespace antlrcpp;
|
|
|
|
using namespace antlr4;
|
|
|
|
namespace {
|
|
|
|
struct Python3ParserStaticData final {
|
|
Python3ParserStaticData(std::vector<std::string> ruleNames,
|
|
std::vector<std::string> literalNames,
|
|
std::vector<std::string> symbolicNames)
|
|
: ruleNames(std::move(ruleNames)), literalNames(std::move(literalNames)),
|
|
symbolicNames(std::move(symbolicNames)),
|
|
vocabulary(this->literalNames, this->symbolicNames) {}
|
|
|
|
Python3ParserStaticData(const Python3ParserStaticData&) = delete;
|
|
Python3ParserStaticData(Python3ParserStaticData&&) = delete;
|
|
Python3ParserStaticData& operator=(const Python3ParserStaticData&) = delete;
|
|
Python3ParserStaticData& operator=(Python3ParserStaticData&&) = delete;
|
|
|
|
std::vector<antlr4::dfa::DFA> decisionToDFA;
|
|
antlr4::atn::PredictionContextCache sharedContextCache;
|
|
const std::vector<std::string> ruleNames;
|
|
const std::vector<std::string> literalNames;
|
|
const std::vector<std::string> symbolicNames;
|
|
const antlr4::dfa::Vocabulary vocabulary;
|
|
antlr4::atn::SerializedATNView serializedATN;
|
|
std::unique_ptr<antlr4::atn::ATN> atn;
|
|
};
|
|
|
|
::antlr4::internal::OnceFlag python3parserParserOnceFlag;
|
|
#if ANTLR4_USE_THREAD_LOCAL_CACHE
|
|
static thread_local
|
|
#endif
|
|
Python3ParserStaticData *python3parserParserStaticData = nullptr;
|
|
|
|
void python3parserParserInitialize() {
|
|
#if ANTLR4_USE_THREAD_LOCAL_CACHE
|
|
if (python3parserParserStaticData != nullptr) {
|
|
return;
|
|
}
|
|
#else
|
|
assert(python3parserParserStaticData == nullptr);
|
|
#endif
|
|
auto staticData = std::make_unique<Python3ParserStaticData>(
|
|
std::vector<std::string>{
|
|
"file_input", "funcdef", "parameters", "typedargslist", "tfpdef",
|
|
"stmt", "simple_stmt", "small_stmt", "expr_stmt", "augassign", "flow_stmt",
|
|
"break_stmt", "continue_stmt", "return_stmt", "compound_stmt", "if_stmt",
|
|
"while_stmt", "suite", "test", "or_test", "and_test", "not_test",
|
|
"comparison", "comp_op", "arith_expr", "addorsub_op", "term", "muldivmod_op",
|
|
"factor", "atom_expr", "trailer", "atom", "testlist", "arglist", "argument"
|
|
},
|
|
std::vector<std::string>{
|
|
"", "", "", "", "", "", "'def'", "'return'", "'if'", "'elif'", "'else'",
|
|
"'while'", "'for'", "'in'", "'or'", "'and'", "'not'", "'None'", "'True'",
|
|
"'False'", "'continue'", "'break'", "", "", "", "", "", "", "", "",
|
|
"", "", "'.'", "'...'", "'*'", "'('", "')'", "','", "':'", "';'",
|
|
"'**'", "'='", "'['", "']'", "'|'", "'^'", "'&'", "'<<'", "'>>'",
|
|
"'+'", "'-'", "'/'", "'%'", "'//'", "'~'", "'{'", "'}'", "'<'", "'>'",
|
|
"'=='", "'>='", "'<='", "'<>'", "'!='", "'@'", "'->'", "'+='", "'-='",
|
|
"'*='", "'@='", "'/='", "'%='", "'&='", "'|='", "'^='", "'<<='", "'>>='",
|
|
"'**='", "'//='"
|
|
},
|
|
std::vector<std::string>{
|
|
"", "INDENT", "DEDENT", "STRING", "NUMBER", "INTEGER", "DEF", "RETURN",
|
|
"IF", "ELIF", "ELSE", "WHILE", "FOR", "IN", "OR", "AND", "NOT", "NONE",
|
|
"TRUE", "FALSE", "CONTINUE", "BREAK", "NEWLINE", "NAME", "STRING_LITERAL",
|
|
"BYTES_LITERAL", "DECIMAL_INTEGER", "OCT_INTEGER", "HEX_INTEGER",
|
|
"BIN_INTEGER", "FLOAT_NUMBER", "IMAG_NUMBER", "DOT", "ELLIPSIS", "STAR",
|
|
"OPEN_PAREN", "CLOSE_PAREN", "COMMA", "COLON", "SEMI_COLON", "POWER",
|
|
"ASSIGN", "OPEN_BRACK", "CLOSE_BRACK", "OR_OP", "XOR", "AND_OP", "LEFT_SHIFT",
|
|
"RIGHT_SHIFT", "ADD", "MINUS", "DIV", "MOD", "IDIV", "NOT_OP", "OPEN_BRACE",
|
|
"CLOSE_BRACE", "LESS_THAN", "GREATER_THAN", "EQUALS", "GT_EQ", "LT_EQ",
|
|
"NOT_EQ_1", "NOT_EQ_2", "AT", "ARROW", "ADD_ASSIGN", "SUB_ASSIGN",
|
|
"MULT_ASSIGN", "AT_ASSIGN", "DIV_ASSIGN", "MOD_ASSIGN", "AND_ASSIGN",
|
|
"OR_ASSIGN", "XOR_ASSIGN", "LEFT_SHIFT_ASSIGN", "RIGHT_SHIFT_ASSIGN",
|
|
"POWER_ASSIGN", "IDIV_ASSIGN", "SKIP_", "UNKNOWN_CHAR"
|
|
}
|
|
);
|
|
static const int32_t serializedATNSegment[] = {
|
|
4,1,80,306,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,
|
|
7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,
|
|
14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,
|
|
21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28,7,
|
|
28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,1,0,1,
|
|
0,5,0,73,8,0,10,0,12,0,76,9,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,
|
|
3,2,88,8,2,1,2,1,2,1,3,1,3,1,3,3,3,95,8,3,1,3,1,3,1,3,1,3,3,3,101,8,3,
|
|
5,3,103,8,3,10,3,12,3,106,9,3,1,4,1,4,1,5,1,5,3,5,112,8,5,1,6,1,6,1,6,
|
|
1,7,1,7,3,7,119,8,7,1,8,1,8,1,8,1,8,1,8,1,8,5,8,127,8,8,10,8,12,8,130,
|
|
9,8,3,8,132,8,8,1,9,1,9,1,10,1,10,1,10,3,10,139,8,10,1,11,1,11,1,12,1,
|
|
12,1,13,1,13,3,13,147,8,13,1,14,1,14,1,14,3,14,152,8,14,1,15,1,15,1,15,
|
|
1,15,1,15,1,15,1,15,1,15,1,15,5,15,163,8,15,10,15,12,15,166,9,15,1,15,
|
|
1,15,1,15,3,15,171,8,15,1,16,1,16,1,16,1,16,1,16,1,17,1,17,1,17,1,17,
|
|
4,17,182,8,17,11,17,12,17,183,1,17,1,17,3,17,188,8,17,1,18,1,18,1,19,
|
|
1,19,1,19,5,19,195,8,19,10,19,12,19,198,9,19,1,20,1,20,1,20,5,20,203,
|
|
8,20,10,20,12,20,206,9,20,1,21,1,21,1,21,3,21,211,8,21,1,22,1,22,1,22,
|
|
1,22,5,22,217,8,22,10,22,12,22,220,9,22,1,23,1,23,1,24,1,24,1,24,1,24,
|
|
5,24,228,8,24,10,24,12,24,231,9,24,1,25,1,25,1,26,1,26,1,26,1,26,5,26,
|
|
239,8,26,10,26,12,26,242,9,26,1,27,1,27,1,28,1,28,1,28,3,28,249,8,28,
|
|
1,29,1,29,3,29,253,8,29,1,30,1,30,3,30,257,8,30,1,30,1,30,1,31,1,31,1,
|
|
31,4,31,264,8,31,11,31,12,31,265,1,31,1,31,1,31,1,31,1,31,1,31,1,31,3,
|
|
31,275,8,31,1,32,1,32,1,32,5,32,280,8,32,10,32,12,32,283,9,32,1,32,3,
|
|
32,286,8,32,1,33,1,33,1,33,5,33,291,8,33,10,33,12,33,294,9,33,1,33,3,
|
|
33,297,8,33,1,34,1,34,1,34,1,34,1,34,3,34,304,8,34,1,34,0,0,35,0,2,4,
|
|
6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,
|
|
54,56,58,60,62,64,66,68,0,4,3,0,66,68,70,71,78,78,2,0,57,61,63,63,1,0,
|
|
49,50,2,0,34,34,51,53,310,0,74,1,0,0,0,2,79,1,0,0,0,4,85,1,0,0,0,6,91,
|
|
1,0,0,0,8,107,1,0,0,0,10,111,1,0,0,0,12,113,1,0,0,0,14,118,1,0,0,0,16,
|
|
120,1,0,0,0,18,133,1,0,0,0,20,138,1,0,0,0,22,140,1,0,0,0,24,142,1,0,0,
|
|
0,26,144,1,0,0,0,28,151,1,0,0,0,30,153,1,0,0,0,32,172,1,0,0,0,34,187,
|
|
1,0,0,0,36,189,1,0,0,0,38,191,1,0,0,0,40,199,1,0,0,0,42,210,1,0,0,0,44,
|
|
212,1,0,0,0,46,221,1,0,0,0,48,223,1,0,0,0,50,232,1,0,0,0,52,234,1,0,0,
|
|
0,54,243,1,0,0,0,56,248,1,0,0,0,58,250,1,0,0,0,60,254,1,0,0,0,62,274,
|
|
1,0,0,0,64,276,1,0,0,0,66,287,1,0,0,0,68,303,1,0,0,0,70,73,5,22,0,0,71,
|
|
73,3,10,5,0,72,70,1,0,0,0,72,71,1,0,0,0,73,76,1,0,0,0,74,72,1,0,0,0,74,
|
|
75,1,0,0,0,75,77,1,0,0,0,76,74,1,0,0,0,77,78,5,0,0,1,78,1,1,0,0,0,79,
|
|
80,5,6,0,0,80,81,5,23,0,0,81,82,3,4,2,0,82,83,5,38,0,0,83,84,3,34,17,
|
|
0,84,3,1,0,0,0,85,87,5,35,0,0,86,88,3,6,3,0,87,86,1,0,0,0,87,88,1,0,0,
|
|
0,88,89,1,0,0,0,89,90,5,36,0,0,90,5,1,0,0,0,91,94,3,8,4,0,92,93,5,41,
|
|
0,0,93,95,3,36,18,0,94,92,1,0,0,0,94,95,1,0,0,0,95,104,1,0,0,0,96,97,
|
|
5,37,0,0,97,100,3,8,4,0,98,99,5,41,0,0,99,101,3,36,18,0,100,98,1,0,0,
|
|
0,100,101,1,0,0,0,101,103,1,0,0,0,102,96,1,0,0,0,103,106,1,0,0,0,104,
|
|
102,1,0,0,0,104,105,1,0,0,0,105,7,1,0,0,0,106,104,1,0,0,0,107,108,5,23,
|
|
0,0,108,9,1,0,0,0,109,112,3,12,6,0,110,112,3,28,14,0,111,109,1,0,0,0,
|
|
111,110,1,0,0,0,112,11,1,0,0,0,113,114,3,14,7,0,114,115,5,22,0,0,115,
|
|
13,1,0,0,0,116,119,3,16,8,0,117,119,3,20,10,0,118,116,1,0,0,0,118,117,
|
|
1,0,0,0,119,15,1,0,0,0,120,131,3,64,32,0,121,122,3,18,9,0,122,123,3,64,
|
|
32,0,123,132,1,0,0,0,124,125,5,41,0,0,125,127,3,64,32,0,126,124,1,0,0,
|
|
0,127,130,1,0,0,0,128,126,1,0,0,0,128,129,1,0,0,0,129,132,1,0,0,0,130,
|
|
128,1,0,0,0,131,121,1,0,0,0,131,128,1,0,0,0,132,17,1,0,0,0,133,134,7,
|
|
0,0,0,134,19,1,0,0,0,135,139,3,22,11,0,136,139,3,24,12,0,137,139,3,26,
|
|
13,0,138,135,1,0,0,0,138,136,1,0,0,0,138,137,1,0,0,0,139,21,1,0,0,0,140,
|
|
141,5,21,0,0,141,23,1,0,0,0,142,143,5,20,0,0,143,25,1,0,0,0,144,146,5,
|
|
7,0,0,145,147,3,64,32,0,146,145,1,0,0,0,146,147,1,0,0,0,147,27,1,0,0,
|
|
0,148,152,3,30,15,0,149,152,3,32,16,0,150,152,3,2,1,0,151,148,1,0,0,0,
|
|
151,149,1,0,0,0,151,150,1,0,0,0,152,29,1,0,0,0,153,154,5,8,0,0,154,155,
|
|
3,36,18,0,155,156,5,38,0,0,156,164,3,34,17,0,157,158,5,9,0,0,158,159,
|
|
3,36,18,0,159,160,5,38,0,0,160,161,3,34,17,0,161,163,1,0,0,0,162,157,
|
|
1,0,0,0,163,166,1,0,0,0,164,162,1,0,0,0,164,165,1,0,0,0,165,170,1,0,0,
|
|
0,166,164,1,0,0,0,167,168,5,10,0,0,168,169,5,38,0,0,169,171,3,34,17,0,
|
|
170,167,1,0,0,0,170,171,1,0,0,0,171,31,1,0,0,0,172,173,5,11,0,0,173,174,
|
|
3,36,18,0,174,175,5,38,0,0,175,176,3,34,17,0,176,33,1,0,0,0,177,188,3,
|
|
12,6,0,178,179,5,22,0,0,179,181,5,1,0,0,180,182,3,10,5,0,181,180,1,0,
|
|
0,0,182,183,1,0,0,0,183,181,1,0,0,0,183,184,1,0,0,0,184,185,1,0,0,0,185,
|
|
186,5,2,0,0,186,188,1,0,0,0,187,177,1,0,0,0,187,178,1,0,0,0,188,35,1,
|
|
0,0,0,189,190,3,38,19,0,190,37,1,0,0,0,191,196,3,40,20,0,192,193,5,14,
|
|
0,0,193,195,3,40,20,0,194,192,1,0,0,0,195,198,1,0,0,0,196,194,1,0,0,0,
|
|
196,197,1,0,0,0,197,39,1,0,0,0,198,196,1,0,0,0,199,204,3,42,21,0,200,
|
|
201,5,15,0,0,201,203,3,42,21,0,202,200,1,0,0,0,203,206,1,0,0,0,204,202,
|
|
1,0,0,0,204,205,1,0,0,0,205,41,1,0,0,0,206,204,1,0,0,0,207,208,5,16,0,
|
|
0,208,211,3,42,21,0,209,211,3,44,22,0,210,207,1,0,0,0,210,209,1,0,0,0,
|
|
211,43,1,0,0,0,212,218,3,48,24,0,213,214,3,46,23,0,214,215,3,48,24,0,
|
|
215,217,1,0,0,0,216,213,1,0,0,0,217,220,1,0,0,0,218,216,1,0,0,0,218,219,
|
|
1,0,0,0,219,45,1,0,0,0,220,218,1,0,0,0,221,222,7,1,0,0,222,47,1,0,0,0,
|
|
223,229,3,52,26,0,224,225,3,50,25,0,225,226,3,52,26,0,226,228,1,0,0,0,
|
|
227,224,1,0,0,0,228,231,1,0,0,0,229,227,1,0,0,0,229,230,1,0,0,0,230,49,
|
|
1,0,0,0,231,229,1,0,0,0,232,233,7,2,0,0,233,51,1,0,0,0,234,240,3,56,28,
|
|
0,235,236,3,54,27,0,236,237,3,56,28,0,237,239,1,0,0,0,238,235,1,0,0,0,
|
|
239,242,1,0,0,0,240,238,1,0,0,0,240,241,1,0,0,0,241,53,1,0,0,0,242,240,
|
|
1,0,0,0,243,244,7,3,0,0,244,55,1,0,0,0,245,246,7,2,0,0,246,249,3,56,28,
|
|
0,247,249,3,58,29,0,248,245,1,0,0,0,248,247,1,0,0,0,249,57,1,0,0,0,250,
|
|
252,3,62,31,0,251,253,3,60,30,0,252,251,1,0,0,0,252,253,1,0,0,0,253,59,
|
|
1,0,0,0,254,256,5,35,0,0,255,257,3,66,33,0,256,255,1,0,0,0,256,257,1,
|
|
0,0,0,257,258,1,0,0,0,258,259,5,36,0,0,259,61,1,0,0,0,260,275,5,23,0,
|
|
0,261,275,5,4,0,0,262,264,5,3,0,0,263,262,1,0,0,0,264,265,1,0,0,0,265,
|
|
263,1,0,0,0,265,266,1,0,0,0,266,275,1,0,0,0,267,275,5,17,0,0,268,275,
|
|
5,18,0,0,269,275,5,19,0,0,270,271,5,35,0,0,271,272,3,36,18,0,272,273,
|
|
5,36,0,0,273,275,1,0,0,0,274,260,1,0,0,0,274,261,1,0,0,0,274,263,1,0,
|
|
0,0,274,267,1,0,0,0,274,268,1,0,0,0,274,269,1,0,0,0,274,270,1,0,0,0,275,
|
|
63,1,0,0,0,276,281,3,36,18,0,277,278,5,37,0,0,278,280,3,36,18,0,279,277,
|
|
1,0,0,0,280,283,1,0,0,0,281,279,1,0,0,0,281,282,1,0,0,0,282,285,1,0,0,
|
|
0,283,281,1,0,0,0,284,286,5,37,0,0,285,284,1,0,0,0,285,286,1,0,0,0,286,
|
|
65,1,0,0,0,287,292,3,68,34,0,288,289,5,37,0,0,289,291,3,68,34,0,290,288,
|
|
1,0,0,0,291,294,1,0,0,0,292,290,1,0,0,0,292,293,1,0,0,0,293,296,1,0,0,
|
|
0,294,292,1,0,0,0,295,297,5,37,0,0,296,295,1,0,0,0,296,297,1,0,0,0,297,
|
|
67,1,0,0,0,298,304,3,36,18,0,299,300,3,36,18,0,300,301,5,41,0,0,301,302,
|
|
3,36,18,0,302,304,1,0,0,0,303,298,1,0,0,0,303,299,1,0,0,0,304,69,1,0,
|
|
0,0,33,72,74,87,94,100,104,111,118,128,131,138,146,151,164,170,183,187,
|
|
196,204,210,218,229,240,248,252,256,265,274,281,285,292,296,303
|
|
};
|
|
staticData->serializedATN = antlr4::atn::SerializedATNView(serializedATNSegment, sizeof(serializedATNSegment) / sizeof(serializedATNSegment[0]));
|
|
|
|
antlr4::atn::ATNDeserializer deserializer;
|
|
staticData->atn = deserializer.deserialize(staticData->serializedATN);
|
|
|
|
const size_t count = staticData->atn->getNumberOfDecisions();
|
|
staticData->decisionToDFA.reserve(count);
|
|
for (size_t i = 0; i < count; i++) {
|
|
staticData->decisionToDFA.emplace_back(staticData->atn->getDecisionState(i), i);
|
|
}
|
|
python3parserParserStaticData = staticData.release();
|
|
}
|
|
|
|
}
|
|
|
|
Python3Parser::Python3Parser(TokenStream *input) : Python3Parser(input, antlr4::atn::ParserATNSimulatorOptions()) {}
|
|
|
|
Python3Parser::Python3Parser(TokenStream *input, const antlr4::atn::ParserATNSimulatorOptions &options) : Parser(input) {
|
|
Python3Parser::initialize();
|
|
_interpreter = new atn::ParserATNSimulator(this, *python3parserParserStaticData->atn, python3parserParserStaticData->decisionToDFA, python3parserParserStaticData->sharedContextCache, options);
|
|
}
|
|
|
|
Python3Parser::~Python3Parser() {
|
|
delete _interpreter;
|
|
}
|
|
|
|
const atn::ATN& Python3Parser::getATN() const {
|
|
return *python3parserParserStaticData->atn;
|
|
}
|
|
|
|
std::string Python3Parser::getGrammarFileName() const {
|
|
return "Python3Parser.g4";
|
|
}
|
|
|
|
const std::vector<std::string>& Python3Parser::getRuleNames() const {
|
|
return python3parserParserStaticData->ruleNames;
|
|
}
|
|
|
|
const dfa::Vocabulary& Python3Parser::getVocabulary() const {
|
|
return python3parserParserStaticData->vocabulary;
|
|
}
|
|
|
|
antlr4::atn::SerializedATNView Python3Parser::getSerializedATN() const {
|
|
return python3parserParserStaticData->serializedATN;
|
|
}
|
|
|
|
|
|
//----------------- File_inputContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::File_inputContext::File_inputContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::File_inputContext::EOF() {
|
|
return getToken(Python3Parser::EOF, 0);
|
|
}
|
|
|
|
std::vector<tree::TerminalNode *> Python3Parser::File_inputContext::NEWLINE() {
|
|
return getTokens(Python3Parser::NEWLINE);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::File_inputContext::NEWLINE(size_t i) {
|
|
return getToken(Python3Parser::NEWLINE, i);
|
|
}
|
|
|
|
std::vector<Python3Parser::StmtContext *> Python3Parser::File_inputContext::stmt() {
|
|
return getRuleContexts<Python3Parser::StmtContext>();
|
|
}
|
|
|
|
Python3Parser::StmtContext* Python3Parser::File_inputContext::stmt(size_t i) {
|
|
return getRuleContext<Python3Parser::StmtContext>(i);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::File_inputContext::getRuleIndex() const {
|
|
return Python3Parser::RuleFile_input;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::File_inputContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitFile_input(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::File_inputContext* Python3Parser::file_input() {
|
|
File_inputContext *_localctx = _tracker.createInstance<File_inputContext>(_ctx, getState());
|
|
enterRule(_localctx, 0, Python3Parser::RuleFile_input);
|
|
size_t _la = 0;
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(74);
|
|
_errHandler->sync(this);
|
|
_la = _input->LA(1);
|
|
while ((((_la & ~ 0x3fULL) == 0) &&
|
|
((1ULL << _la) & 1688884236716504) != 0)) {
|
|
setState(72);
|
|
_errHandler->sync(this);
|
|
switch (_input->LA(1)) {
|
|
case Python3Parser::NEWLINE: {
|
|
setState(70);
|
|
match(Python3Parser::NEWLINE);
|
|
break;
|
|
}
|
|
|
|
case Python3Parser::STRING:
|
|
case Python3Parser::NUMBER:
|
|
case Python3Parser::DEF:
|
|
case Python3Parser::RETURN:
|
|
case Python3Parser::IF:
|
|
case Python3Parser::WHILE:
|
|
case Python3Parser::NOT:
|
|
case Python3Parser::NONE:
|
|
case Python3Parser::TRUE:
|
|
case Python3Parser::FALSE:
|
|
case Python3Parser::CONTINUE:
|
|
case Python3Parser::BREAK:
|
|
case Python3Parser::NAME:
|
|
case Python3Parser::OPEN_PAREN:
|
|
case Python3Parser::ADD:
|
|
case Python3Parser::MINUS: {
|
|
setState(71);
|
|
stmt();
|
|
break;
|
|
}
|
|
|
|
default:
|
|
throw NoViableAltException(this);
|
|
}
|
|
setState(76);
|
|
_errHandler->sync(this);
|
|
_la = _input->LA(1);
|
|
}
|
|
setState(77);
|
|
match(Python3Parser::EOF);
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- FuncdefContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::FuncdefContext::FuncdefContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::FuncdefContext::DEF() {
|
|
return getToken(Python3Parser::DEF, 0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::FuncdefContext::NAME() {
|
|
return getToken(Python3Parser::NAME, 0);
|
|
}
|
|
|
|
Python3Parser::ParametersContext* Python3Parser::FuncdefContext::parameters() {
|
|
return getRuleContext<Python3Parser::ParametersContext>(0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::FuncdefContext::COLON() {
|
|
return getToken(Python3Parser::COLON, 0);
|
|
}
|
|
|
|
Python3Parser::SuiteContext* Python3Parser::FuncdefContext::suite() {
|
|
return getRuleContext<Python3Parser::SuiteContext>(0);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::FuncdefContext::getRuleIndex() const {
|
|
return Python3Parser::RuleFuncdef;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::FuncdefContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitFuncdef(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::FuncdefContext* Python3Parser::funcdef() {
|
|
FuncdefContext *_localctx = _tracker.createInstance<FuncdefContext>(_ctx, getState());
|
|
enterRule(_localctx, 2, Python3Parser::RuleFuncdef);
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(79);
|
|
match(Python3Parser::DEF);
|
|
setState(80);
|
|
match(Python3Parser::NAME);
|
|
setState(81);
|
|
parameters();
|
|
setState(82);
|
|
match(Python3Parser::COLON);
|
|
setState(83);
|
|
suite();
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- ParametersContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::ParametersContext::ParametersContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::ParametersContext::OPEN_PAREN() {
|
|
return getToken(Python3Parser::OPEN_PAREN, 0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::ParametersContext::CLOSE_PAREN() {
|
|
return getToken(Python3Parser::CLOSE_PAREN, 0);
|
|
}
|
|
|
|
Python3Parser::TypedargslistContext* Python3Parser::ParametersContext::typedargslist() {
|
|
return getRuleContext<Python3Parser::TypedargslistContext>(0);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::ParametersContext::getRuleIndex() const {
|
|
return Python3Parser::RuleParameters;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::ParametersContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitParameters(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::ParametersContext* Python3Parser::parameters() {
|
|
ParametersContext *_localctx = _tracker.createInstance<ParametersContext>(_ctx, getState());
|
|
enterRule(_localctx, 4, Python3Parser::RuleParameters);
|
|
size_t _la = 0;
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(85);
|
|
match(Python3Parser::OPEN_PAREN);
|
|
setState(87);
|
|
_errHandler->sync(this);
|
|
|
|
_la = _input->LA(1);
|
|
if (_la == Python3Parser::NAME) {
|
|
setState(86);
|
|
typedargslist();
|
|
}
|
|
setState(89);
|
|
match(Python3Parser::CLOSE_PAREN);
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- TypedargslistContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::TypedargslistContext::TypedargslistContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
std::vector<Python3Parser::TfpdefContext *> Python3Parser::TypedargslistContext::tfpdef() {
|
|
return getRuleContexts<Python3Parser::TfpdefContext>();
|
|
}
|
|
|
|
Python3Parser::TfpdefContext* Python3Parser::TypedargslistContext::tfpdef(size_t i) {
|
|
return getRuleContext<Python3Parser::TfpdefContext>(i);
|
|
}
|
|
|
|
std::vector<tree::TerminalNode *> Python3Parser::TypedargslistContext::ASSIGN() {
|
|
return getTokens(Python3Parser::ASSIGN);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::TypedargslistContext::ASSIGN(size_t i) {
|
|
return getToken(Python3Parser::ASSIGN, i);
|
|
}
|
|
|
|
std::vector<Python3Parser::TestContext *> Python3Parser::TypedargslistContext::test() {
|
|
return getRuleContexts<Python3Parser::TestContext>();
|
|
}
|
|
|
|
Python3Parser::TestContext* Python3Parser::TypedargslistContext::test(size_t i) {
|
|
return getRuleContext<Python3Parser::TestContext>(i);
|
|
}
|
|
|
|
std::vector<tree::TerminalNode *> Python3Parser::TypedargslistContext::COMMA() {
|
|
return getTokens(Python3Parser::COMMA);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::TypedargslistContext::COMMA(size_t i) {
|
|
return getToken(Python3Parser::COMMA, i);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::TypedargslistContext::getRuleIndex() const {
|
|
return Python3Parser::RuleTypedargslist;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::TypedargslistContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitTypedargslist(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::TypedargslistContext* Python3Parser::typedargslist() {
|
|
TypedargslistContext *_localctx = _tracker.createInstance<TypedargslistContext>(_ctx, getState());
|
|
enterRule(_localctx, 6, Python3Parser::RuleTypedargslist);
|
|
size_t _la = 0;
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(91);
|
|
tfpdef();
|
|
setState(94);
|
|
_errHandler->sync(this);
|
|
|
|
_la = _input->LA(1);
|
|
if (_la == Python3Parser::ASSIGN) {
|
|
setState(92);
|
|
match(Python3Parser::ASSIGN);
|
|
setState(93);
|
|
test();
|
|
}
|
|
setState(104);
|
|
_errHandler->sync(this);
|
|
_la = _input->LA(1);
|
|
while (_la == Python3Parser::COMMA) {
|
|
setState(96);
|
|
match(Python3Parser::COMMA);
|
|
setState(97);
|
|
tfpdef();
|
|
setState(100);
|
|
_errHandler->sync(this);
|
|
|
|
_la = _input->LA(1);
|
|
if (_la == Python3Parser::ASSIGN) {
|
|
setState(98);
|
|
match(Python3Parser::ASSIGN);
|
|
setState(99);
|
|
test();
|
|
}
|
|
setState(106);
|
|
_errHandler->sync(this);
|
|
_la = _input->LA(1);
|
|
}
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- TfpdefContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::TfpdefContext::TfpdefContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::TfpdefContext::NAME() {
|
|
return getToken(Python3Parser::NAME, 0);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::TfpdefContext::getRuleIndex() const {
|
|
return Python3Parser::RuleTfpdef;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::TfpdefContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitTfpdef(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::TfpdefContext* Python3Parser::tfpdef() {
|
|
TfpdefContext *_localctx = _tracker.createInstance<TfpdefContext>(_ctx, getState());
|
|
enterRule(_localctx, 8, Python3Parser::RuleTfpdef);
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(107);
|
|
match(Python3Parser::NAME);
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- StmtContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::StmtContext::StmtContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
Python3Parser::Simple_stmtContext* Python3Parser::StmtContext::simple_stmt() {
|
|
return getRuleContext<Python3Parser::Simple_stmtContext>(0);
|
|
}
|
|
|
|
Python3Parser::Compound_stmtContext* Python3Parser::StmtContext::compound_stmt() {
|
|
return getRuleContext<Python3Parser::Compound_stmtContext>(0);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::StmtContext::getRuleIndex() const {
|
|
return Python3Parser::RuleStmt;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::StmtContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitStmt(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::StmtContext* Python3Parser::stmt() {
|
|
StmtContext *_localctx = _tracker.createInstance<StmtContext>(_ctx, getState());
|
|
enterRule(_localctx, 10, Python3Parser::RuleStmt);
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
setState(111);
|
|
_errHandler->sync(this);
|
|
switch (_input->LA(1)) {
|
|
case Python3Parser::STRING:
|
|
case Python3Parser::NUMBER:
|
|
case Python3Parser::RETURN:
|
|
case Python3Parser::NOT:
|
|
case Python3Parser::NONE:
|
|
case Python3Parser::TRUE:
|
|
case Python3Parser::FALSE:
|
|
case Python3Parser::CONTINUE:
|
|
case Python3Parser::BREAK:
|
|
case Python3Parser::NAME:
|
|
case Python3Parser::OPEN_PAREN:
|
|
case Python3Parser::ADD:
|
|
case Python3Parser::MINUS: {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(109);
|
|
simple_stmt();
|
|
break;
|
|
}
|
|
|
|
case Python3Parser::DEF:
|
|
case Python3Parser::IF:
|
|
case Python3Parser::WHILE: {
|
|
enterOuterAlt(_localctx, 2);
|
|
setState(110);
|
|
compound_stmt();
|
|
break;
|
|
}
|
|
|
|
default:
|
|
throw NoViableAltException(this);
|
|
}
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- Simple_stmtContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::Simple_stmtContext::Simple_stmtContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
Python3Parser::Small_stmtContext* Python3Parser::Simple_stmtContext::small_stmt() {
|
|
return getRuleContext<Python3Parser::Small_stmtContext>(0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::Simple_stmtContext::NEWLINE() {
|
|
return getToken(Python3Parser::NEWLINE, 0);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::Simple_stmtContext::getRuleIndex() const {
|
|
return Python3Parser::RuleSimple_stmt;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::Simple_stmtContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitSimple_stmt(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::Simple_stmtContext* Python3Parser::simple_stmt() {
|
|
Simple_stmtContext *_localctx = _tracker.createInstance<Simple_stmtContext>(_ctx, getState());
|
|
enterRule(_localctx, 12, Python3Parser::RuleSimple_stmt);
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(113);
|
|
small_stmt();
|
|
setState(114);
|
|
match(Python3Parser::NEWLINE);
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- Small_stmtContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::Small_stmtContext::Small_stmtContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
Python3Parser::Expr_stmtContext* Python3Parser::Small_stmtContext::expr_stmt() {
|
|
return getRuleContext<Python3Parser::Expr_stmtContext>(0);
|
|
}
|
|
|
|
Python3Parser::Flow_stmtContext* Python3Parser::Small_stmtContext::flow_stmt() {
|
|
return getRuleContext<Python3Parser::Flow_stmtContext>(0);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::Small_stmtContext::getRuleIndex() const {
|
|
return Python3Parser::RuleSmall_stmt;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::Small_stmtContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitSmall_stmt(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::Small_stmtContext* Python3Parser::small_stmt() {
|
|
Small_stmtContext *_localctx = _tracker.createInstance<Small_stmtContext>(_ctx, getState());
|
|
enterRule(_localctx, 14, Python3Parser::RuleSmall_stmt);
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
setState(118);
|
|
_errHandler->sync(this);
|
|
switch (_input->LA(1)) {
|
|
case Python3Parser::STRING:
|
|
case Python3Parser::NUMBER:
|
|
case Python3Parser::NOT:
|
|
case Python3Parser::NONE:
|
|
case Python3Parser::TRUE:
|
|
case Python3Parser::FALSE:
|
|
case Python3Parser::NAME:
|
|
case Python3Parser::OPEN_PAREN:
|
|
case Python3Parser::ADD:
|
|
case Python3Parser::MINUS: {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(116);
|
|
expr_stmt();
|
|
break;
|
|
}
|
|
|
|
case Python3Parser::RETURN:
|
|
case Python3Parser::CONTINUE:
|
|
case Python3Parser::BREAK: {
|
|
enterOuterAlt(_localctx, 2);
|
|
setState(117);
|
|
flow_stmt();
|
|
break;
|
|
}
|
|
|
|
default:
|
|
throw NoViableAltException(this);
|
|
}
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- Expr_stmtContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::Expr_stmtContext::Expr_stmtContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
std::vector<Python3Parser::TestlistContext *> Python3Parser::Expr_stmtContext::testlist() {
|
|
return getRuleContexts<Python3Parser::TestlistContext>();
|
|
}
|
|
|
|
Python3Parser::TestlistContext* Python3Parser::Expr_stmtContext::testlist(size_t i) {
|
|
return getRuleContext<Python3Parser::TestlistContext>(i);
|
|
}
|
|
|
|
Python3Parser::AugassignContext* Python3Parser::Expr_stmtContext::augassign() {
|
|
return getRuleContext<Python3Parser::AugassignContext>(0);
|
|
}
|
|
|
|
std::vector<tree::TerminalNode *> Python3Parser::Expr_stmtContext::ASSIGN() {
|
|
return getTokens(Python3Parser::ASSIGN);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::Expr_stmtContext::ASSIGN(size_t i) {
|
|
return getToken(Python3Parser::ASSIGN, i);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::Expr_stmtContext::getRuleIndex() const {
|
|
return Python3Parser::RuleExpr_stmt;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::Expr_stmtContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitExpr_stmt(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::Expr_stmtContext* Python3Parser::expr_stmt() {
|
|
Expr_stmtContext *_localctx = _tracker.createInstance<Expr_stmtContext>(_ctx, getState());
|
|
enterRule(_localctx, 16, Python3Parser::RuleExpr_stmt);
|
|
size_t _la = 0;
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(120);
|
|
testlist();
|
|
setState(131);
|
|
_errHandler->sync(this);
|
|
switch (_input->LA(1)) {
|
|
case Python3Parser::ADD_ASSIGN:
|
|
case Python3Parser::SUB_ASSIGN:
|
|
case Python3Parser::MULT_ASSIGN:
|
|
case Python3Parser::DIV_ASSIGN:
|
|
case Python3Parser::MOD_ASSIGN:
|
|
case Python3Parser::IDIV_ASSIGN: {
|
|
setState(121);
|
|
augassign();
|
|
setState(122);
|
|
testlist();
|
|
break;
|
|
}
|
|
|
|
case Python3Parser::NEWLINE:
|
|
case Python3Parser::ASSIGN: {
|
|
setState(128);
|
|
_errHandler->sync(this);
|
|
_la = _input->LA(1);
|
|
while (_la == Python3Parser::ASSIGN) {
|
|
setState(124);
|
|
match(Python3Parser::ASSIGN);
|
|
setState(125);
|
|
testlist();
|
|
setState(130);
|
|
_errHandler->sync(this);
|
|
_la = _input->LA(1);
|
|
}
|
|
break;
|
|
}
|
|
|
|
default:
|
|
throw NoViableAltException(this);
|
|
}
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- AugassignContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::AugassignContext::AugassignContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::AugassignContext::ADD_ASSIGN() {
|
|
return getToken(Python3Parser::ADD_ASSIGN, 0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::AugassignContext::SUB_ASSIGN() {
|
|
return getToken(Python3Parser::SUB_ASSIGN, 0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::AugassignContext::MULT_ASSIGN() {
|
|
return getToken(Python3Parser::MULT_ASSIGN, 0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::AugassignContext::DIV_ASSIGN() {
|
|
return getToken(Python3Parser::DIV_ASSIGN, 0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::AugassignContext::IDIV_ASSIGN() {
|
|
return getToken(Python3Parser::IDIV_ASSIGN, 0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::AugassignContext::MOD_ASSIGN() {
|
|
return getToken(Python3Parser::MOD_ASSIGN, 0);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::AugassignContext::getRuleIndex() const {
|
|
return Python3Parser::RuleAugassign;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::AugassignContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitAugassign(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::AugassignContext* Python3Parser::augassign() {
|
|
AugassignContext *_localctx = _tracker.createInstance<AugassignContext>(_ctx, getState());
|
|
enterRule(_localctx, 18, Python3Parser::RuleAugassign);
|
|
size_t _la = 0;
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(133);
|
|
_la = _input->LA(1);
|
|
if (!(((((_la - 66) & ~ 0x3fULL) == 0) &&
|
|
((1ULL << (_la - 66)) & 4151) != 0))) {
|
|
_errHandler->recoverInline(this);
|
|
}
|
|
else {
|
|
_errHandler->reportMatch(this);
|
|
consume();
|
|
}
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- Flow_stmtContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::Flow_stmtContext::Flow_stmtContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
Python3Parser::Break_stmtContext* Python3Parser::Flow_stmtContext::break_stmt() {
|
|
return getRuleContext<Python3Parser::Break_stmtContext>(0);
|
|
}
|
|
|
|
Python3Parser::Continue_stmtContext* Python3Parser::Flow_stmtContext::continue_stmt() {
|
|
return getRuleContext<Python3Parser::Continue_stmtContext>(0);
|
|
}
|
|
|
|
Python3Parser::Return_stmtContext* Python3Parser::Flow_stmtContext::return_stmt() {
|
|
return getRuleContext<Python3Parser::Return_stmtContext>(0);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::Flow_stmtContext::getRuleIndex() const {
|
|
return Python3Parser::RuleFlow_stmt;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::Flow_stmtContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitFlow_stmt(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::Flow_stmtContext* Python3Parser::flow_stmt() {
|
|
Flow_stmtContext *_localctx = _tracker.createInstance<Flow_stmtContext>(_ctx, getState());
|
|
enterRule(_localctx, 20, Python3Parser::RuleFlow_stmt);
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
setState(138);
|
|
_errHandler->sync(this);
|
|
switch (_input->LA(1)) {
|
|
case Python3Parser::BREAK: {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(135);
|
|
break_stmt();
|
|
break;
|
|
}
|
|
|
|
case Python3Parser::CONTINUE: {
|
|
enterOuterAlt(_localctx, 2);
|
|
setState(136);
|
|
continue_stmt();
|
|
break;
|
|
}
|
|
|
|
case Python3Parser::RETURN: {
|
|
enterOuterAlt(_localctx, 3);
|
|
setState(137);
|
|
return_stmt();
|
|
break;
|
|
}
|
|
|
|
default:
|
|
throw NoViableAltException(this);
|
|
}
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- Break_stmtContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::Break_stmtContext::Break_stmtContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::Break_stmtContext::BREAK() {
|
|
return getToken(Python3Parser::BREAK, 0);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::Break_stmtContext::getRuleIndex() const {
|
|
return Python3Parser::RuleBreak_stmt;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::Break_stmtContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitBreak_stmt(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::Break_stmtContext* Python3Parser::break_stmt() {
|
|
Break_stmtContext *_localctx = _tracker.createInstance<Break_stmtContext>(_ctx, getState());
|
|
enterRule(_localctx, 22, Python3Parser::RuleBreak_stmt);
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(140);
|
|
match(Python3Parser::BREAK);
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- Continue_stmtContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::Continue_stmtContext::Continue_stmtContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::Continue_stmtContext::CONTINUE() {
|
|
return getToken(Python3Parser::CONTINUE, 0);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::Continue_stmtContext::getRuleIndex() const {
|
|
return Python3Parser::RuleContinue_stmt;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::Continue_stmtContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitContinue_stmt(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::Continue_stmtContext* Python3Parser::continue_stmt() {
|
|
Continue_stmtContext *_localctx = _tracker.createInstance<Continue_stmtContext>(_ctx, getState());
|
|
enterRule(_localctx, 24, Python3Parser::RuleContinue_stmt);
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(142);
|
|
match(Python3Parser::CONTINUE);
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- Return_stmtContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::Return_stmtContext::Return_stmtContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::Return_stmtContext::RETURN() {
|
|
return getToken(Python3Parser::RETURN, 0);
|
|
}
|
|
|
|
Python3Parser::TestlistContext* Python3Parser::Return_stmtContext::testlist() {
|
|
return getRuleContext<Python3Parser::TestlistContext>(0);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::Return_stmtContext::getRuleIndex() const {
|
|
return Python3Parser::RuleReturn_stmt;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::Return_stmtContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitReturn_stmt(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::Return_stmtContext* Python3Parser::return_stmt() {
|
|
Return_stmtContext *_localctx = _tracker.createInstance<Return_stmtContext>(_ctx, getState());
|
|
enterRule(_localctx, 26, Python3Parser::RuleReturn_stmt);
|
|
size_t _la = 0;
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(144);
|
|
match(Python3Parser::RETURN);
|
|
setState(146);
|
|
_errHandler->sync(this);
|
|
|
|
_la = _input->LA(1);
|
|
if ((((_la & ~ 0x3fULL) == 0) &&
|
|
((1ULL << _la) & 1688884229373976) != 0)) {
|
|
setState(145);
|
|
testlist();
|
|
}
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- Compound_stmtContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::Compound_stmtContext::Compound_stmtContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
Python3Parser::If_stmtContext* Python3Parser::Compound_stmtContext::if_stmt() {
|
|
return getRuleContext<Python3Parser::If_stmtContext>(0);
|
|
}
|
|
|
|
Python3Parser::While_stmtContext* Python3Parser::Compound_stmtContext::while_stmt() {
|
|
return getRuleContext<Python3Parser::While_stmtContext>(0);
|
|
}
|
|
|
|
Python3Parser::FuncdefContext* Python3Parser::Compound_stmtContext::funcdef() {
|
|
return getRuleContext<Python3Parser::FuncdefContext>(0);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::Compound_stmtContext::getRuleIndex() const {
|
|
return Python3Parser::RuleCompound_stmt;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::Compound_stmtContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitCompound_stmt(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::Compound_stmtContext* Python3Parser::compound_stmt() {
|
|
Compound_stmtContext *_localctx = _tracker.createInstance<Compound_stmtContext>(_ctx, getState());
|
|
enterRule(_localctx, 28, Python3Parser::RuleCompound_stmt);
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
setState(151);
|
|
_errHandler->sync(this);
|
|
switch (_input->LA(1)) {
|
|
case Python3Parser::IF: {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(148);
|
|
if_stmt();
|
|
break;
|
|
}
|
|
|
|
case Python3Parser::WHILE: {
|
|
enterOuterAlt(_localctx, 2);
|
|
setState(149);
|
|
while_stmt();
|
|
break;
|
|
}
|
|
|
|
case Python3Parser::DEF: {
|
|
enterOuterAlt(_localctx, 3);
|
|
setState(150);
|
|
funcdef();
|
|
break;
|
|
}
|
|
|
|
default:
|
|
throw NoViableAltException(this);
|
|
}
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- If_stmtContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::If_stmtContext::If_stmtContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::If_stmtContext::IF() {
|
|
return getToken(Python3Parser::IF, 0);
|
|
}
|
|
|
|
std::vector<Python3Parser::TestContext *> Python3Parser::If_stmtContext::test() {
|
|
return getRuleContexts<Python3Parser::TestContext>();
|
|
}
|
|
|
|
Python3Parser::TestContext* Python3Parser::If_stmtContext::test(size_t i) {
|
|
return getRuleContext<Python3Parser::TestContext>(i);
|
|
}
|
|
|
|
std::vector<tree::TerminalNode *> Python3Parser::If_stmtContext::COLON() {
|
|
return getTokens(Python3Parser::COLON);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::If_stmtContext::COLON(size_t i) {
|
|
return getToken(Python3Parser::COLON, i);
|
|
}
|
|
|
|
std::vector<Python3Parser::SuiteContext *> Python3Parser::If_stmtContext::suite() {
|
|
return getRuleContexts<Python3Parser::SuiteContext>();
|
|
}
|
|
|
|
Python3Parser::SuiteContext* Python3Parser::If_stmtContext::suite(size_t i) {
|
|
return getRuleContext<Python3Parser::SuiteContext>(i);
|
|
}
|
|
|
|
std::vector<tree::TerminalNode *> Python3Parser::If_stmtContext::ELIF() {
|
|
return getTokens(Python3Parser::ELIF);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::If_stmtContext::ELIF(size_t i) {
|
|
return getToken(Python3Parser::ELIF, i);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::If_stmtContext::ELSE() {
|
|
return getToken(Python3Parser::ELSE, 0);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::If_stmtContext::getRuleIndex() const {
|
|
return Python3Parser::RuleIf_stmt;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::If_stmtContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitIf_stmt(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::If_stmtContext* Python3Parser::if_stmt() {
|
|
If_stmtContext *_localctx = _tracker.createInstance<If_stmtContext>(_ctx, getState());
|
|
enterRule(_localctx, 30, Python3Parser::RuleIf_stmt);
|
|
size_t _la = 0;
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(153);
|
|
match(Python3Parser::IF);
|
|
setState(154);
|
|
test();
|
|
setState(155);
|
|
match(Python3Parser::COLON);
|
|
setState(156);
|
|
suite();
|
|
setState(164);
|
|
_errHandler->sync(this);
|
|
_la = _input->LA(1);
|
|
while (_la == Python3Parser::ELIF) {
|
|
setState(157);
|
|
match(Python3Parser::ELIF);
|
|
setState(158);
|
|
test();
|
|
setState(159);
|
|
match(Python3Parser::COLON);
|
|
setState(160);
|
|
suite();
|
|
setState(166);
|
|
_errHandler->sync(this);
|
|
_la = _input->LA(1);
|
|
}
|
|
setState(170);
|
|
_errHandler->sync(this);
|
|
|
|
_la = _input->LA(1);
|
|
if (_la == Python3Parser::ELSE) {
|
|
setState(167);
|
|
match(Python3Parser::ELSE);
|
|
setState(168);
|
|
match(Python3Parser::COLON);
|
|
setState(169);
|
|
suite();
|
|
}
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- While_stmtContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::While_stmtContext::While_stmtContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::While_stmtContext::WHILE() {
|
|
return getToken(Python3Parser::WHILE, 0);
|
|
}
|
|
|
|
Python3Parser::TestContext* Python3Parser::While_stmtContext::test() {
|
|
return getRuleContext<Python3Parser::TestContext>(0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::While_stmtContext::COLON() {
|
|
return getToken(Python3Parser::COLON, 0);
|
|
}
|
|
|
|
Python3Parser::SuiteContext* Python3Parser::While_stmtContext::suite() {
|
|
return getRuleContext<Python3Parser::SuiteContext>(0);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::While_stmtContext::getRuleIndex() const {
|
|
return Python3Parser::RuleWhile_stmt;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::While_stmtContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitWhile_stmt(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::While_stmtContext* Python3Parser::while_stmt() {
|
|
While_stmtContext *_localctx = _tracker.createInstance<While_stmtContext>(_ctx, getState());
|
|
enterRule(_localctx, 32, Python3Parser::RuleWhile_stmt);
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(172);
|
|
match(Python3Parser::WHILE);
|
|
setState(173);
|
|
test();
|
|
setState(174);
|
|
match(Python3Parser::COLON);
|
|
setState(175);
|
|
suite();
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- SuiteContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::SuiteContext::SuiteContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
Python3Parser::Simple_stmtContext* Python3Parser::SuiteContext::simple_stmt() {
|
|
return getRuleContext<Python3Parser::Simple_stmtContext>(0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::SuiteContext::NEWLINE() {
|
|
return getToken(Python3Parser::NEWLINE, 0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::SuiteContext::INDENT() {
|
|
return getToken(Python3Parser::INDENT, 0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::SuiteContext::DEDENT() {
|
|
return getToken(Python3Parser::DEDENT, 0);
|
|
}
|
|
|
|
std::vector<Python3Parser::StmtContext *> Python3Parser::SuiteContext::stmt() {
|
|
return getRuleContexts<Python3Parser::StmtContext>();
|
|
}
|
|
|
|
Python3Parser::StmtContext* Python3Parser::SuiteContext::stmt(size_t i) {
|
|
return getRuleContext<Python3Parser::StmtContext>(i);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::SuiteContext::getRuleIndex() const {
|
|
return Python3Parser::RuleSuite;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::SuiteContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitSuite(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::SuiteContext* Python3Parser::suite() {
|
|
SuiteContext *_localctx = _tracker.createInstance<SuiteContext>(_ctx, getState());
|
|
enterRule(_localctx, 34, Python3Parser::RuleSuite);
|
|
size_t _la = 0;
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
setState(187);
|
|
_errHandler->sync(this);
|
|
switch (_input->LA(1)) {
|
|
case Python3Parser::STRING:
|
|
case Python3Parser::NUMBER:
|
|
case Python3Parser::RETURN:
|
|
case Python3Parser::NOT:
|
|
case Python3Parser::NONE:
|
|
case Python3Parser::TRUE:
|
|
case Python3Parser::FALSE:
|
|
case Python3Parser::CONTINUE:
|
|
case Python3Parser::BREAK:
|
|
case Python3Parser::NAME:
|
|
case Python3Parser::OPEN_PAREN:
|
|
case Python3Parser::ADD:
|
|
case Python3Parser::MINUS: {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(177);
|
|
simple_stmt();
|
|
break;
|
|
}
|
|
|
|
case Python3Parser::NEWLINE: {
|
|
enterOuterAlt(_localctx, 2);
|
|
setState(178);
|
|
match(Python3Parser::NEWLINE);
|
|
setState(179);
|
|
match(Python3Parser::INDENT);
|
|
setState(181);
|
|
_errHandler->sync(this);
|
|
_la = _input->LA(1);
|
|
do {
|
|
setState(180);
|
|
stmt();
|
|
setState(183);
|
|
_errHandler->sync(this);
|
|
_la = _input->LA(1);
|
|
} while ((((_la & ~ 0x3fULL) == 0) &&
|
|
((1ULL << _la) & 1688884232522200) != 0));
|
|
setState(185);
|
|
match(Python3Parser::DEDENT);
|
|
break;
|
|
}
|
|
|
|
default:
|
|
throw NoViableAltException(this);
|
|
}
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- TestContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::TestContext::TestContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
Python3Parser::Or_testContext* Python3Parser::TestContext::or_test() {
|
|
return getRuleContext<Python3Parser::Or_testContext>(0);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::TestContext::getRuleIndex() const {
|
|
return Python3Parser::RuleTest;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::TestContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitTest(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::TestContext* Python3Parser::test() {
|
|
TestContext *_localctx = _tracker.createInstance<TestContext>(_ctx, getState());
|
|
enterRule(_localctx, 36, Python3Parser::RuleTest);
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(189);
|
|
or_test();
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- Or_testContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::Or_testContext::Or_testContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
std::vector<Python3Parser::And_testContext *> Python3Parser::Or_testContext::and_test() {
|
|
return getRuleContexts<Python3Parser::And_testContext>();
|
|
}
|
|
|
|
Python3Parser::And_testContext* Python3Parser::Or_testContext::and_test(size_t i) {
|
|
return getRuleContext<Python3Parser::And_testContext>(i);
|
|
}
|
|
|
|
std::vector<tree::TerminalNode *> Python3Parser::Or_testContext::OR() {
|
|
return getTokens(Python3Parser::OR);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::Or_testContext::OR(size_t i) {
|
|
return getToken(Python3Parser::OR, i);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::Or_testContext::getRuleIndex() const {
|
|
return Python3Parser::RuleOr_test;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::Or_testContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitOr_test(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::Or_testContext* Python3Parser::or_test() {
|
|
Or_testContext *_localctx = _tracker.createInstance<Or_testContext>(_ctx, getState());
|
|
enterRule(_localctx, 38, Python3Parser::RuleOr_test);
|
|
size_t _la = 0;
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(191);
|
|
and_test();
|
|
setState(196);
|
|
_errHandler->sync(this);
|
|
_la = _input->LA(1);
|
|
while (_la == Python3Parser::OR) {
|
|
setState(192);
|
|
match(Python3Parser::OR);
|
|
setState(193);
|
|
and_test();
|
|
setState(198);
|
|
_errHandler->sync(this);
|
|
_la = _input->LA(1);
|
|
}
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- And_testContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::And_testContext::And_testContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
std::vector<Python3Parser::Not_testContext *> Python3Parser::And_testContext::not_test() {
|
|
return getRuleContexts<Python3Parser::Not_testContext>();
|
|
}
|
|
|
|
Python3Parser::Not_testContext* Python3Parser::And_testContext::not_test(size_t i) {
|
|
return getRuleContext<Python3Parser::Not_testContext>(i);
|
|
}
|
|
|
|
std::vector<tree::TerminalNode *> Python3Parser::And_testContext::AND() {
|
|
return getTokens(Python3Parser::AND);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::And_testContext::AND(size_t i) {
|
|
return getToken(Python3Parser::AND, i);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::And_testContext::getRuleIndex() const {
|
|
return Python3Parser::RuleAnd_test;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::And_testContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitAnd_test(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::And_testContext* Python3Parser::and_test() {
|
|
And_testContext *_localctx = _tracker.createInstance<And_testContext>(_ctx, getState());
|
|
enterRule(_localctx, 40, Python3Parser::RuleAnd_test);
|
|
size_t _la = 0;
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(199);
|
|
not_test();
|
|
setState(204);
|
|
_errHandler->sync(this);
|
|
_la = _input->LA(1);
|
|
while (_la == Python3Parser::AND) {
|
|
setState(200);
|
|
match(Python3Parser::AND);
|
|
setState(201);
|
|
not_test();
|
|
setState(206);
|
|
_errHandler->sync(this);
|
|
_la = _input->LA(1);
|
|
}
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- Not_testContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::Not_testContext::Not_testContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::Not_testContext::NOT() {
|
|
return getToken(Python3Parser::NOT, 0);
|
|
}
|
|
|
|
Python3Parser::Not_testContext* Python3Parser::Not_testContext::not_test() {
|
|
return getRuleContext<Python3Parser::Not_testContext>(0);
|
|
}
|
|
|
|
Python3Parser::ComparisonContext* Python3Parser::Not_testContext::comparison() {
|
|
return getRuleContext<Python3Parser::ComparisonContext>(0);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::Not_testContext::getRuleIndex() const {
|
|
return Python3Parser::RuleNot_test;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::Not_testContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitNot_test(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::Not_testContext* Python3Parser::not_test() {
|
|
Not_testContext *_localctx = _tracker.createInstance<Not_testContext>(_ctx, getState());
|
|
enterRule(_localctx, 42, Python3Parser::RuleNot_test);
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
setState(210);
|
|
_errHandler->sync(this);
|
|
switch (_input->LA(1)) {
|
|
case Python3Parser::NOT: {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(207);
|
|
match(Python3Parser::NOT);
|
|
setState(208);
|
|
not_test();
|
|
break;
|
|
}
|
|
|
|
case Python3Parser::STRING:
|
|
case Python3Parser::NUMBER:
|
|
case Python3Parser::NONE:
|
|
case Python3Parser::TRUE:
|
|
case Python3Parser::FALSE:
|
|
case Python3Parser::NAME:
|
|
case Python3Parser::OPEN_PAREN:
|
|
case Python3Parser::ADD:
|
|
case Python3Parser::MINUS: {
|
|
enterOuterAlt(_localctx, 2);
|
|
setState(209);
|
|
comparison();
|
|
break;
|
|
}
|
|
|
|
default:
|
|
throw NoViableAltException(this);
|
|
}
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- ComparisonContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::ComparisonContext::ComparisonContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
std::vector<Python3Parser::Arith_exprContext *> Python3Parser::ComparisonContext::arith_expr() {
|
|
return getRuleContexts<Python3Parser::Arith_exprContext>();
|
|
}
|
|
|
|
Python3Parser::Arith_exprContext* Python3Parser::ComparisonContext::arith_expr(size_t i) {
|
|
return getRuleContext<Python3Parser::Arith_exprContext>(i);
|
|
}
|
|
|
|
std::vector<Python3Parser::Comp_opContext *> Python3Parser::ComparisonContext::comp_op() {
|
|
return getRuleContexts<Python3Parser::Comp_opContext>();
|
|
}
|
|
|
|
Python3Parser::Comp_opContext* Python3Parser::ComparisonContext::comp_op(size_t i) {
|
|
return getRuleContext<Python3Parser::Comp_opContext>(i);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::ComparisonContext::getRuleIndex() const {
|
|
return Python3Parser::RuleComparison;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::ComparisonContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitComparison(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::ComparisonContext* Python3Parser::comparison() {
|
|
ComparisonContext *_localctx = _tracker.createInstance<ComparisonContext>(_ctx, getState());
|
|
enterRule(_localctx, 44, Python3Parser::RuleComparison);
|
|
size_t _la = 0;
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(212);
|
|
arith_expr();
|
|
setState(218);
|
|
_errHandler->sync(this);
|
|
_la = _input->LA(1);
|
|
while ((((_la & ~ 0x3fULL) == 0) &&
|
|
((1ULL << _la) & -4755801206503243776) != 0)) {
|
|
setState(213);
|
|
comp_op();
|
|
setState(214);
|
|
arith_expr();
|
|
setState(220);
|
|
_errHandler->sync(this);
|
|
_la = _input->LA(1);
|
|
}
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- Comp_opContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::Comp_opContext::Comp_opContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::Comp_opContext::LESS_THAN() {
|
|
return getToken(Python3Parser::LESS_THAN, 0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::Comp_opContext::GREATER_THAN() {
|
|
return getToken(Python3Parser::GREATER_THAN, 0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::Comp_opContext::EQUALS() {
|
|
return getToken(Python3Parser::EQUALS, 0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::Comp_opContext::GT_EQ() {
|
|
return getToken(Python3Parser::GT_EQ, 0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::Comp_opContext::LT_EQ() {
|
|
return getToken(Python3Parser::LT_EQ, 0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::Comp_opContext::NOT_EQ_2() {
|
|
return getToken(Python3Parser::NOT_EQ_2, 0);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::Comp_opContext::getRuleIndex() const {
|
|
return Python3Parser::RuleComp_op;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::Comp_opContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitComp_op(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::Comp_opContext* Python3Parser::comp_op() {
|
|
Comp_opContext *_localctx = _tracker.createInstance<Comp_opContext>(_ctx, getState());
|
|
enterRule(_localctx, 46, Python3Parser::RuleComp_op);
|
|
size_t _la = 0;
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(221);
|
|
_la = _input->LA(1);
|
|
if (!((((_la & ~ 0x3fULL) == 0) &&
|
|
((1ULL << _la) & -4755801206503243776) != 0))) {
|
|
_errHandler->recoverInline(this);
|
|
}
|
|
else {
|
|
_errHandler->reportMatch(this);
|
|
consume();
|
|
}
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- Arith_exprContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::Arith_exprContext::Arith_exprContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
std::vector<Python3Parser::TermContext *> Python3Parser::Arith_exprContext::term() {
|
|
return getRuleContexts<Python3Parser::TermContext>();
|
|
}
|
|
|
|
Python3Parser::TermContext* Python3Parser::Arith_exprContext::term(size_t i) {
|
|
return getRuleContext<Python3Parser::TermContext>(i);
|
|
}
|
|
|
|
std::vector<Python3Parser::Addorsub_opContext *> Python3Parser::Arith_exprContext::addorsub_op() {
|
|
return getRuleContexts<Python3Parser::Addorsub_opContext>();
|
|
}
|
|
|
|
Python3Parser::Addorsub_opContext* Python3Parser::Arith_exprContext::addorsub_op(size_t i) {
|
|
return getRuleContext<Python3Parser::Addorsub_opContext>(i);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::Arith_exprContext::getRuleIndex() const {
|
|
return Python3Parser::RuleArith_expr;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::Arith_exprContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitArith_expr(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::Arith_exprContext* Python3Parser::arith_expr() {
|
|
Arith_exprContext *_localctx = _tracker.createInstance<Arith_exprContext>(_ctx, getState());
|
|
enterRule(_localctx, 48, Python3Parser::RuleArith_expr);
|
|
size_t _la = 0;
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(223);
|
|
term();
|
|
setState(229);
|
|
_errHandler->sync(this);
|
|
_la = _input->LA(1);
|
|
while (_la == Python3Parser::ADD
|
|
|
|
|| _la == Python3Parser::MINUS) {
|
|
setState(224);
|
|
addorsub_op();
|
|
setState(225);
|
|
term();
|
|
setState(231);
|
|
_errHandler->sync(this);
|
|
_la = _input->LA(1);
|
|
}
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- Addorsub_opContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::Addorsub_opContext::Addorsub_opContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::Addorsub_opContext::ADD() {
|
|
return getToken(Python3Parser::ADD, 0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::Addorsub_opContext::MINUS() {
|
|
return getToken(Python3Parser::MINUS, 0);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::Addorsub_opContext::getRuleIndex() const {
|
|
return Python3Parser::RuleAddorsub_op;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::Addorsub_opContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitAddorsub_op(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::Addorsub_opContext* Python3Parser::addorsub_op() {
|
|
Addorsub_opContext *_localctx = _tracker.createInstance<Addorsub_opContext>(_ctx, getState());
|
|
enterRule(_localctx, 50, Python3Parser::RuleAddorsub_op);
|
|
size_t _la = 0;
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(232);
|
|
_la = _input->LA(1);
|
|
if (!(_la == Python3Parser::ADD
|
|
|
|
|| _la == Python3Parser::MINUS)) {
|
|
_errHandler->recoverInline(this);
|
|
}
|
|
else {
|
|
_errHandler->reportMatch(this);
|
|
consume();
|
|
}
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- TermContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::TermContext::TermContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
std::vector<Python3Parser::FactorContext *> Python3Parser::TermContext::factor() {
|
|
return getRuleContexts<Python3Parser::FactorContext>();
|
|
}
|
|
|
|
Python3Parser::FactorContext* Python3Parser::TermContext::factor(size_t i) {
|
|
return getRuleContext<Python3Parser::FactorContext>(i);
|
|
}
|
|
|
|
std::vector<Python3Parser::Muldivmod_opContext *> Python3Parser::TermContext::muldivmod_op() {
|
|
return getRuleContexts<Python3Parser::Muldivmod_opContext>();
|
|
}
|
|
|
|
Python3Parser::Muldivmod_opContext* Python3Parser::TermContext::muldivmod_op(size_t i) {
|
|
return getRuleContext<Python3Parser::Muldivmod_opContext>(i);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::TermContext::getRuleIndex() const {
|
|
return Python3Parser::RuleTerm;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::TermContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitTerm(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::TermContext* Python3Parser::term() {
|
|
TermContext *_localctx = _tracker.createInstance<TermContext>(_ctx, getState());
|
|
enterRule(_localctx, 52, Python3Parser::RuleTerm);
|
|
size_t _la = 0;
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(234);
|
|
factor();
|
|
setState(240);
|
|
_errHandler->sync(this);
|
|
_la = _input->LA(1);
|
|
while ((((_la & ~ 0x3fULL) == 0) &&
|
|
((1ULL << _la) & 15762615875665920) != 0)) {
|
|
setState(235);
|
|
muldivmod_op();
|
|
setState(236);
|
|
factor();
|
|
setState(242);
|
|
_errHandler->sync(this);
|
|
_la = _input->LA(1);
|
|
}
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- Muldivmod_opContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::Muldivmod_opContext::Muldivmod_opContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::Muldivmod_opContext::STAR() {
|
|
return getToken(Python3Parser::STAR, 0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::Muldivmod_opContext::DIV() {
|
|
return getToken(Python3Parser::DIV, 0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::Muldivmod_opContext::IDIV() {
|
|
return getToken(Python3Parser::IDIV, 0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::Muldivmod_opContext::MOD() {
|
|
return getToken(Python3Parser::MOD, 0);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::Muldivmod_opContext::getRuleIndex() const {
|
|
return Python3Parser::RuleMuldivmod_op;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::Muldivmod_opContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitMuldivmod_op(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::Muldivmod_opContext* Python3Parser::muldivmod_op() {
|
|
Muldivmod_opContext *_localctx = _tracker.createInstance<Muldivmod_opContext>(_ctx, getState());
|
|
enterRule(_localctx, 54, Python3Parser::RuleMuldivmod_op);
|
|
size_t _la = 0;
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(243);
|
|
_la = _input->LA(1);
|
|
if (!((((_la & ~ 0x3fULL) == 0) &&
|
|
((1ULL << _la) & 15762615875665920) != 0))) {
|
|
_errHandler->recoverInline(this);
|
|
}
|
|
else {
|
|
_errHandler->reportMatch(this);
|
|
consume();
|
|
}
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- FactorContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::FactorContext::FactorContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
Python3Parser::FactorContext* Python3Parser::FactorContext::factor() {
|
|
return getRuleContext<Python3Parser::FactorContext>(0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::FactorContext::ADD() {
|
|
return getToken(Python3Parser::ADD, 0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::FactorContext::MINUS() {
|
|
return getToken(Python3Parser::MINUS, 0);
|
|
}
|
|
|
|
Python3Parser::Atom_exprContext* Python3Parser::FactorContext::atom_expr() {
|
|
return getRuleContext<Python3Parser::Atom_exprContext>(0);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::FactorContext::getRuleIndex() const {
|
|
return Python3Parser::RuleFactor;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::FactorContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitFactor(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::FactorContext* Python3Parser::factor() {
|
|
FactorContext *_localctx = _tracker.createInstance<FactorContext>(_ctx, getState());
|
|
enterRule(_localctx, 56, Python3Parser::RuleFactor);
|
|
size_t _la = 0;
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
setState(248);
|
|
_errHandler->sync(this);
|
|
switch (_input->LA(1)) {
|
|
case Python3Parser::ADD:
|
|
case Python3Parser::MINUS: {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(245);
|
|
_la = _input->LA(1);
|
|
if (!(_la == Python3Parser::ADD
|
|
|
|
|| _la == Python3Parser::MINUS)) {
|
|
_errHandler->recoverInline(this);
|
|
}
|
|
else {
|
|
_errHandler->reportMatch(this);
|
|
consume();
|
|
}
|
|
setState(246);
|
|
factor();
|
|
break;
|
|
}
|
|
|
|
case Python3Parser::STRING:
|
|
case Python3Parser::NUMBER:
|
|
case Python3Parser::NONE:
|
|
case Python3Parser::TRUE:
|
|
case Python3Parser::FALSE:
|
|
case Python3Parser::NAME:
|
|
case Python3Parser::OPEN_PAREN: {
|
|
enterOuterAlt(_localctx, 2);
|
|
setState(247);
|
|
atom_expr();
|
|
break;
|
|
}
|
|
|
|
default:
|
|
throw NoViableAltException(this);
|
|
}
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- Atom_exprContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::Atom_exprContext::Atom_exprContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
Python3Parser::AtomContext* Python3Parser::Atom_exprContext::atom() {
|
|
return getRuleContext<Python3Parser::AtomContext>(0);
|
|
}
|
|
|
|
Python3Parser::TrailerContext* Python3Parser::Atom_exprContext::trailer() {
|
|
return getRuleContext<Python3Parser::TrailerContext>(0);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::Atom_exprContext::getRuleIndex() const {
|
|
return Python3Parser::RuleAtom_expr;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::Atom_exprContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitAtom_expr(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::Atom_exprContext* Python3Parser::atom_expr() {
|
|
Atom_exprContext *_localctx = _tracker.createInstance<Atom_exprContext>(_ctx, getState());
|
|
enterRule(_localctx, 58, Python3Parser::RuleAtom_expr);
|
|
size_t _la = 0;
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(250);
|
|
atom();
|
|
setState(252);
|
|
_errHandler->sync(this);
|
|
|
|
_la = _input->LA(1);
|
|
if (_la == Python3Parser::OPEN_PAREN) {
|
|
setState(251);
|
|
trailer();
|
|
}
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- TrailerContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::TrailerContext::TrailerContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::TrailerContext::OPEN_PAREN() {
|
|
return getToken(Python3Parser::OPEN_PAREN, 0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::TrailerContext::CLOSE_PAREN() {
|
|
return getToken(Python3Parser::CLOSE_PAREN, 0);
|
|
}
|
|
|
|
Python3Parser::ArglistContext* Python3Parser::TrailerContext::arglist() {
|
|
return getRuleContext<Python3Parser::ArglistContext>(0);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::TrailerContext::getRuleIndex() const {
|
|
return Python3Parser::RuleTrailer;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::TrailerContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitTrailer(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::TrailerContext* Python3Parser::trailer() {
|
|
TrailerContext *_localctx = _tracker.createInstance<TrailerContext>(_ctx, getState());
|
|
enterRule(_localctx, 60, Python3Parser::RuleTrailer);
|
|
size_t _la = 0;
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(254);
|
|
match(Python3Parser::OPEN_PAREN);
|
|
setState(256);
|
|
_errHandler->sync(this);
|
|
|
|
_la = _input->LA(1);
|
|
if ((((_la & ~ 0x3fULL) == 0) &&
|
|
((1ULL << _la) & 1688884229373976) != 0)) {
|
|
setState(255);
|
|
arglist();
|
|
}
|
|
setState(258);
|
|
match(Python3Parser::CLOSE_PAREN);
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- AtomContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::AtomContext::AtomContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::AtomContext::NAME() {
|
|
return getToken(Python3Parser::NAME, 0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::AtomContext::NUMBER() {
|
|
return getToken(Python3Parser::NUMBER, 0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::AtomContext::NONE() {
|
|
return getToken(Python3Parser::NONE, 0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::AtomContext::TRUE() {
|
|
return getToken(Python3Parser::TRUE, 0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::AtomContext::FALSE() {
|
|
return getToken(Python3Parser::FALSE, 0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::AtomContext::OPEN_PAREN() {
|
|
return getToken(Python3Parser::OPEN_PAREN, 0);
|
|
}
|
|
|
|
Python3Parser::TestContext* Python3Parser::AtomContext::test() {
|
|
return getRuleContext<Python3Parser::TestContext>(0);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::AtomContext::CLOSE_PAREN() {
|
|
return getToken(Python3Parser::CLOSE_PAREN, 0);
|
|
}
|
|
|
|
std::vector<tree::TerminalNode *> Python3Parser::AtomContext::STRING() {
|
|
return getTokens(Python3Parser::STRING);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::AtomContext::STRING(size_t i) {
|
|
return getToken(Python3Parser::STRING, i);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::AtomContext::getRuleIndex() const {
|
|
return Python3Parser::RuleAtom;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::AtomContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitAtom(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::AtomContext* Python3Parser::atom() {
|
|
AtomContext *_localctx = _tracker.createInstance<AtomContext>(_ctx, getState());
|
|
enterRule(_localctx, 62, Python3Parser::RuleAtom);
|
|
size_t _la = 0;
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(274);
|
|
_errHandler->sync(this);
|
|
switch (_input->LA(1)) {
|
|
case Python3Parser::NAME: {
|
|
setState(260);
|
|
match(Python3Parser::NAME);
|
|
break;
|
|
}
|
|
|
|
case Python3Parser::NUMBER: {
|
|
setState(261);
|
|
match(Python3Parser::NUMBER);
|
|
break;
|
|
}
|
|
|
|
case Python3Parser::STRING: {
|
|
setState(263);
|
|
_errHandler->sync(this);
|
|
_la = _input->LA(1);
|
|
do {
|
|
setState(262);
|
|
match(Python3Parser::STRING);
|
|
setState(265);
|
|
_errHandler->sync(this);
|
|
_la = _input->LA(1);
|
|
} while (_la == Python3Parser::STRING);
|
|
break;
|
|
}
|
|
|
|
case Python3Parser::NONE: {
|
|
setState(267);
|
|
match(Python3Parser::NONE);
|
|
break;
|
|
}
|
|
|
|
case Python3Parser::TRUE: {
|
|
setState(268);
|
|
match(Python3Parser::TRUE);
|
|
break;
|
|
}
|
|
|
|
case Python3Parser::FALSE: {
|
|
setState(269);
|
|
match(Python3Parser::FALSE);
|
|
break;
|
|
}
|
|
|
|
case Python3Parser::OPEN_PAREN: {
|
|
setState(270);
|
|
match(Python3Parser::OPEN_PAREN);
|
|
setState(271);
|
|
test();
|
|
setState(272);
|
|
match(Python3Parser::CLOSE_PAREN);
|
|
break;
|
|
}
|
|
|
|
default:
|
|
throw NoViableAltException(this);
|
|
}
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- TestlistContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::TestlistContext::TestlistContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
std::vector<Python3Parser::TestContext *> Python3Parser::TestlistContext::test() {
|
|
return getRuleContexts<Python3Parser::TestContext>();
|
|
}
|
|
|
|
Python3Parser::TestContext* Python3Parser::TestlistContext::test(size_t i) {
|
|
return getRuleContext<Python3Parser::TestContext>(i);
|
|
}
|
|
|
|
std::vector<tree::TerminalNode *> Python3Parser::TestlistContext::COMMA() {
|
|
return getTokens(Python3Parser::COMMA);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::TestlistContext::COMMA(size_t i) {
|
|
return getToken(Python3Parser::COMMA, i);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::TestlistContext::getRuleIndex() const {
|
|
return Python3Parser::RuleTestlist;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::TestlistContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitTestlist(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::TestlistContext* Python3Parser::testlist() {
|
|
TestlistContext *_localctx = _tracker.createInstance<TestlistContext>(_ctx, getState());
|
|
enterRule(_localctx, 64, Python3Parser::RuleTestlist);
|
|
size_t _la = 0;
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
size_t alt;
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(276);
|
|
test();
|
|
setState(281);
|
|
_errHandler->sync(this);
|
|
alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 28, _ctx);
|
|
while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) {
|
|
if (alt == 1) {
|
|
setState(277);
|
|
match(Python3Parser::COMMA);
|
|
setState(278);
|
|
test();
|
|
}
|
|
setState(283);
|
|
_errHandler->sync(this);
|
|
alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 28, _ctx);
|
|
}
|
|
setState(285);
|
|
_errHandler->sync(this);
|
|
|
|
_la = _input->LA(1);
|
|
if (_la == Python3Parser::COMMA) {
|
|
setState(284);
|
|
match(Python3Parser::COMMA);
|
|
}
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- ArglistContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::ArglistContext::ArglistContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
std::vector<Python3Parser::ArgumentContext *> Python3Parser::ArglistContext::argument() {
|
|
return getRuleContexts<Python3Parser::ArgumentContext>();
|
|
}
|
|
|
|
Python3Parser::ArgumentContext* Python3Parser::ArglistContext::argument(size_t i) {
|
|
return getRuleContext<Python3Parser::ArgumentContext>(i);
|
|
}
|
|
|
|
std::vector<tree::TerminalNode *> Python3Parser::ArglistContext::COMMA() {
|
|
return getTokens(Python3Parser::COMMA);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::ArglistContext::COMMA(size_t i) {
|
|
return getToken(Python3Parser::COMMA, i);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::ArglistContext::getRuleIndex() const {
|
|
return Python3Parser::RuleArglist;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::ArglistContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitArglist(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::ArglistContext* Python3Parser::arglist() {
|
|
ArglistContext *_localctx = _tracker.createInstance<ArglistContext>(_ctx, getState());
|
|
enterRule(_localctx, 66, Python3Parser::RuleArglist);
|
|
size_t _la = 0;
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
size_t alt;
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(287);
|
|
argument();
|
|
setState(292);
|
|
_errHandler->sync(this);
|
|
alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 30, _ctx);
|
|
while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) {
|
|
if (alt == 1) {
|
|
setState(288);
|
|
match(Python3Parser::COMMA);
|
|
setState(289);
|
|
argument();
|
|
}
|
|
setState(294);
|
|
_errHandler->sync(this);
|
|
alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 30, _ctx);
|
|
}
|
|
setState(296);
|
|
_errHandler->sync(this);
|
|
|
|
_la = _input->LA(1);
|
|
if (_la == Python3Parser::COMMA) {
|
|
setState(295);
|
|
match(Python3Parser::COMMA);
|
|
}
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
//----------------- ArgumentContext ------------------------------------------------------------------
|
|
|
|
Python3Parser::ArgumentContext::ArgumentContext(ParserRuleContext *parent, size_t invokingState)
|
|
: ParserRuleContext(parent, invokingState) {
|
|
}
|
|
|
|
std::vector<Python3Parser::TestContext *> Python3Parser::ArgumentContext::test() {
|
|
return getRuleContexts<Python3Parser::TestContext>();
|
|
}
|
|
|
|
Python3Parser::TestContext* Python3Parser::ArgumentContext::test(size_t i) {
|
|
return getRuleContext<Python3Parser::TestContext>(i);
|
|
}
|
|
|
|
tree::TerminalNode* Python3Parser::ArgumentContext::ASSIGN() {
|
|
return getToken(Python3Parser::ASSIGN, 0);
|
|
}
|
|
|
|
|
|
size_t Python3Parser::ArgumentContext::getRuleIndex() const {
|
|
return Python3Parser::RuleArgument;
|
|
}
|
|
|
|
|
|
std::any Python3Parser::ArgumentContext::accept(tree::ParseTreeVisitor *visitor) {
|
|
if (auto parserVisitor = dynamic_cast<Python3ParserVisitor*>(visitor))
|
|
return parserVisitor->visitArgument(this);
|
|
else
|
|
return visitor->visitChildren(this);
|
|
}
|
|
|
|
Python3Parser::ArgumentContext* Python3Parser::argument() {
|
|
ArgumentContext *_localctx = _tracker.createInstance<ArgumentContext>(_ctx, getState());
|
|
enterRule(_localctx, 68, Python3Parser::RuleArgument);
|
|
|
|
#if __cplusplus > 201703L
|
|
auto onExit = finally([=, this] {
|
|
#else
|
|
auto onExit = finally([=] {
|
|
#endif
|
|
exitRule();
|
|
});
|
|
try {
|
|
enterOuterAlt(_localctx, 1);
|
|
setState(303);
|
|
_errHandler->sync(this);
|
|
switch (getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 32, _ctx)) {
|
|
case 1: {
|
|
setState(298);
|
|
test();
|
|
break;
|
|
}
|
|
|
|
case 2: {
|
|
setState(299);
|
|
test();
|
|
setState(300);
|
|
match(Python3Parser::ASSIGN);
|
|
setState(301);
|
|
test();
|
|
break;
|
|
}
|
|
|
|
default:
|
|
break;
|
|
}
|
|
|
|
}
|
|
catch (RecognitionException &e) {
|
|
_errHandler->reportError(this, e);
|
|
_localctx->exception = std::current_exception();
|
|
_errHandler->recover(this, _localctx->exception);
|
|
}
|
|
|
|
return _localctx;
|
|
}
|
|
|
|
void Python3Parser::initialize() {
|
|
#if ANTLR4_USE_THREAD_LOCAL_CACHE
|
|
python3parserParserInitialize();
|
|
#else
|
|
::antlr4::internal::call_once(python3parserParserOnceFlag, python3parserParserInitialize);
|
|
#endif
|
|
}
|