diff --git a/RiddleParser.g4 b/RiddleParser.g4 index 153853a..1c9162c 100644 --- a/RiddleParser.g4 +++ b/RiddleParser.g4 @@ -96,17 +96,22 @@ exprPtr | Identifier #objectExpr | parent=exprPtr Dot child=exprPtr #blendExpr ; + +exprPtrParser + : exprPtr + ; + expression - : Less type=typeName Greater LeftBracket value=exprPtr RightBracket #castExpr + : Less type=typeName Greater LeftBracket value=exprPtrParser RightBracket #castExpr | LeftBracket expr=expression RightBracket #bracketExpr // (x) | Not expr=expression #notExpr // !x | Add expr=expression #positiveExpr // +x | Sub expr=expression #negativeExpr // -x - | Add Add expr=exprPtr #selfAddLeftExpr // ++x - | expr=exprPtr Add Add #selfAddRightExpr // x++ - | Sub Sub expr=exprPtr #selfSubLeftExpr // ++x - | expr=exprPtr Sub Sub #selfSubRightExpr // x++ - | exprPtr #ptrExpr + | Add Add expr=exprPtrParser #selfAddLeftExpr // ++x + | expr=exprPtrParser Add Add #selfAddRightExpr // x++ + | Sub Sub expr=exprPtrParser #selfSubLeftExpr // ++x + | expr=exprPtrParser Sub Sub #selfSubRightExpr // x++ + | exprPtrParser #ptrExpr | left=expression Star right=expression #mulExpr // x*y | left=expression Div right=expression #divExpr // x/y | left=expression Mod right=expression #modExpr // x%y @@ -126,19 +131,19 @@ expression | left=expression Or right=expression #bitOrExpr // x|y | left=expression And And right=expression #andExpr // x&&y | left=expression Or Or right=expression #orExpr // x||y - | left=exprPtr Assign right=expression #assignExpr // x=y - | left=exprPtr Add Assign right=expression #addAssignExpr // x+=y - | left=exprPtr Sub Assign right=expression #subAssignExpr // x-=y - | left=exprPtr Star Assign right=expression #mulAssignExpr // x*=y - | left=exprPtr Div Assign right=expression #divAssignExpr // x/=y - | left=exprPtr Mod Assign right=expression #modAssignExpr // x%=y - | left=exprPtr Add Assign right=expression #addAssignExpr // x+=y - | left=exprPtr And Assign right=expression #andAssignExpr // x&=y - | left=exprPtr Or Assign right=expression #orAssignExpr // x|=y - | left=exprPtr Xor Assign right=expression #xorAssignExpr // x^=y - | left=exprPtr LeftLeft Assign right=expression #shlAssignExpr // x<<=y - | left=exprPtr RightRight Assign right=expression #aShrAssignExpr // x>>=y - | left=exprPtr RightRightRight Assign right=expression #lShrAssignExpr // x>>>=y + | left=exprPtrParser Assign right=expression #assignExpr // x=y + | left=exprPtrParser Add Assign right=expression #addAssignExpr // x+=y + | left=exprPtrParser Sub Assign right=expression #subAssignExpr // x-=y + | left=exprPtrParser Star Assign right=expression #mulAssignExpr // x*=y + | left=exprPtrParser Div Assign right=expression #divAssignExpr // x/=y + | left=exprPtrParser Mod Assign right=expression #modAssignExpr // x%=y + | left=exprPtrParser Add Assign right=expression #addAssignExpr // x+=y + | left=exprPtrParser And Assign right=expression #andAssignExpr // x&=y + | left=exprPtrParser Or Assign right=expression #orAssignExpr // x|=y + | left=exprPtrParser Xor Assign right=expression #xorAssignExpr // x^=y + | left=exprPtrParser LeftLeft Assign right=expression #shlAssignExpr // x<<=y + | left=exprPtrParser RightRight Assign right=expression #aShrAssignExpr // x>>=y + | left=exprPtrParser RightRightRight Assign right=expression #lShrAssignExpr // x>>>=y | string #stringExpr | number #numberExpr | boolean #booleanExpr diff --git a/parser/RiddleParser.cpp b/parser/RiddleParser.cpp index f31db3b..62cd082 100644 --- a/parser/RiddleParser.cpp +++ b/parser/RiddleParser.cpp @@ -56,9 +56,9 @@ void riddleparserParserInitialize() { "program", "statement_ed", "statement", "packStatement", "importStatement", "varDefineStatement", "argsExpr", "defineArgs", "funcDefine", "funcBody", "forStatement", "whileStatement", "ifStatement", "returnStatement", - "classDefine", "classBody", "exprPtr", "expression", "id", "number", - "boolean", "string", "float", "integer", "templateArg", "templateArgs", - "typeName" + "classDefine", "classBody", "exprPtr", "exprPtrParser", "expression", + "id", "number", "boolean", "string", "float", "integer", "templateArg", + "templateArgs", "typeName" }, std::vector{ "", "'var'", "'val'", "'for'", "'while'", "'if'", "'else'", "'fun'", @@ -82,169 +82,170 @@ void riddleparserParserInitialize() { } ); static const int32_t serializedATNSegment[] = { - 4,1,63,471,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, + 4,1,63,475,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,1,0,5,0,56,8,0,10, - 0,12,0,59,9,0,1,0,3,0,62,8,0,1,1,1,1,3,1,66,8,1,1,1,3,1,69,8,1,1,1,1, - 1,3,1,73,8,1,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,5,2,87,8, - 2,10,2,12,2,90,9,2,1,2,3,2,93,8,2,1,3,1,3,1,3,1,4,1,4,1,4,1,5,1,5,1,5, - 1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,3,5,116,8,5,1,6,1,6,1, - 6,5,6,121,8,6,10,6,12,6,124,9,6,1,6,3,6,127,8,6,1,7,1,7,1,7,1,7,1,7,5, - 7,134,8,7,10,7,12,7,137,9,7,1,7,1,7,1,7,3,7,142,8,7,1,8,1,8,1,8,1,8,1, - 8,1,8,1,8,3,8,151,8,8,1,8,1,8,1,8,1,8,1,9,5,9,158,8,9,10,9,12,9,161,9, - 9,1,10,1,10,1,10,3,10,166,8,10,1,10,1,10,3,10,170,8,10,1,10,1,10,3,10, - 174,8,10,1,10,1,10,1,10,1,11,1,11,1,11,1,11,1,11,1,11,1,12,1,12,1,12, - 1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,3,12, - 201,8,12,1,13,1,13,1,13,1,14,1,14,1,14,1,14,1,14,1,14,1,15,5,15,213,8, - 15,10,15,12,15,216,9,15,1,16,1,16,1,16,1,16,1,16,1,16,1,16,3,16,225,8, - 16,1,16,1,16,1,16,5,16,230,8,16,10,16,12,16,233,9,16,1,17,1,17,1,17,1, - 17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1, - 17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1, - 17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1, - 17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1, - 17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1, - 17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1, - 17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,3,17,335, - 8,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17, - 1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17, - 1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17, - 1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17, - 1,17,1,17,1,17,1,17,1,17,1,17,1,17,5,17,399,8,17,10,17,12,17,402,9,17, - 1,18,1,18,1,18,5,18,407,8,18,10,18,12,18,410,9,18,1,19,1,19,3,19,414, - 8,19,1,20,1,20,1,20,1,20,3,20,420,8,20,1,21,1,21,1,22,1,22,1,22,1,23, - 1,23,1,23,1,23,1,23,1,23,1,23,1,23,3,23,435,8,23,1,24,1,24,3,24,439,8, - 24,1,25,1,25,1,25,5,25,444,8,25,10,25,12,25,447,9,25,1,25,3,25,450,8, - 25,1,26,1,26,1,26,1,26,1,26,1,26,1,26,3,26,459,8,26,1,26,1,26,1,26,1, - 26,1,26,5,26,466,8,26,10,26,12,26,469,9,26,1,26,0,3,32,34,52,27,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, - 0,0,530,0,61,1,0,0,0,2,72,1,0,0,0,4,92,1,0,0,0,6,94,1,0,0,0,8,97,1,0, - 0,0,10,115,1,0,0,0,12,126,1,0,0,0,14,141,1,0,0,0,16,143,1,0,0,0,18,159, - 1,0,0,0,20,162,1,0,0,0,22,178,1,0,0,0,24,200,1,0,0,0,26,202,1,0,0,0,28, - 205,1,0,0,0,30,214,1,0,0,0,32,224,1,0,0,0,34,334,1,0,0,0,36,403,1,0,0, - 0,38,413,1,0,0,0,40,419,1,0,0,0,42,421,1,0,0,0,44,423,1,0,0,0,46,434, - 1,0,0,0,48,438,1,0,0,0,50,449,1,0,0,0,52,458,1,0,0,0,54,56,3,2,1,0,55, - 54,1,0,0,0,56,59,1,0,0,0,57,55,1,0,0,0,57,58,1,0,0,0,58,62,1,0,0,0,59, - 57,1,0,0,0,60,62,5,0,0,1,61,57,1,0,0,0,61,60,1,0,0,0,62,1,1,0,0,0,63, - 65,3,4,2,0,64,66,5,27,0,0,65,64,1,0,0,0,65,66,1,0,0,0,66,68,1,0,0,0,67, - 69,5,48,0,0,68,67,1,0,0,0,68,69,1,0,0,0,69,73,1,0,0,0,70,73,5,27,0,0, - 71,73,5,48,0,0,72,63,1,0,0,0,72,70,1,0,0,0,72,71,1,0,0,0,73,3,1,0,0,0, - 74,93,3,6,3,0,75,93,3,8,4,0,76,93,3,28,14,0,77,93,3,16,8,0,78,93,3,10, - 5,0,79,93,3,20,10,0,80,93,3,22,11,0,81,93,3,24,12,0,82,93,3,26,13,0,83, - 93,3,34,17,0,84,88,5,24,0,0,85,87,3,2,1,0,86,85,1,0,0,0,87,90,1,0,0,0, - 88,86,1,0,0,0,88,89,1,0,0,0,89,91,1,0,0,0,90,88,1,0,0,0,91,93,5,25,0, - 0,92,74,1,0,0,0,92,75,1,0,0,0,92,76,1,0,0,0,92,77,1,0,0,0,92,78,1,0,0, - 0,92,79,1,0,0,0,92,80,1,0,0,0,92,81,1,0,0,0,92,82,1,0,0,0,92,83,1,0,0, - 0,92,84,1,0,0,0,93,5,1,0,0,0,94,95,5,10,0,0,95,96,3,36,18,0,96,7,1,0, - 0,0,97,98,5,9,0,0,98,99,3,36,18,0,99,9,1,0,0,0,100,101,5,1,0,0,101,102, - 5,49,0,0,102,103,5,26,0,0,103,116,3,52,26,0,104,105,5,1,0,0,105,106,5, - 49,0,0,106,107,5,30,0,0,107,116,3,34,17,0,108,109,5,1,0,0,109,110,5,49, - 0,0,110,111,5,26,0,0,111,112,3,52,26,0,112,113,5,30,0,0,113,114,3,34, - 17,0,114,116,1,0,0,0,115,100,1,0,0,0,115,104,1,0,0,0,115,108,1,0,0,0, - 116,11,1,0,0,0,117,118,3,34,17,0,118,119,5,28,0,0,119,121,1,0,0,0,120, - 117,1,0,0,0,121,124,1,0,0,0,122,120,1,0,0,0,122,123,1,0,0,0,123,125,1, - 0,0,0,124,122,1,0,0,0,125,127,3,34,17,0,126,122,1,0,0,0,126,127,1,0,0, - 0,127,13,1,0,0,0,128,129,5,49,0,0,129,130,5,26,0,0,130,131,3,52,26,0, - 131,132,5,28,0,0,132,134,1,0,0,0,133,128,1,0,0,0,134,137,1,0,0,0,135, - 133,1,0,0,0,135,136,1,0,0,0,136,138,1,0,0,0,137,135,1,0,0,0,138,139,5, - 49,0,0,139,140,5,26,0,0,140,142,3,52,26,0,141,135,1,0,0,0,141,142,1,0, - 0,0,142,15,1,0,0,0,143,144,5,7,0,0,144,145,5,49,0,0,145,146,5,20,0,0, - 146,147,3,14,7,0,147,150,5,21,0,0,148,149,5,26,0,0,149,151,3,52,26,0, - 150,148,1,0,0,0,150,151,1,0,0,0,151,152,1,0,0,0,152,153,5,24,0,0,153, - 154,3,18,9,0,154,155,5,25,0,0,155,17,1,0,0,0,156,158,3,2,1,0,157,156, - 1,0,0,0,158,161,1,0,0,0,159,157,1,0,0,0,159,160,1,0,0,0,160,19,1,0,0, - 0,161,159,1,0,0,0,162,163,5,3,0,0,163,165,5,20,0,0,164,166,3,10,5,0,165, - 164,1,0,0,0,165,166,1,0,0,0,166,167,1,0,0,0,167,169,5,27,0,0,168,170, - 3,34,17,0,169,168,1,0,0,0,169,170,1,0,0,0,170,171,1,0,0,0,171,173,5,27, - 0,0,172,174,3,4,2,0,173,172,1,0,0,0,173,174,1,0,0,0,174,175,1,0,0,0,175, - 176,5,21,0,0,176,177,3,2,1,0,177,21,1,0,0,0,178,179,5,4,0,0,179,180,5, - 20,0,0,180,181,3,34,17,0,181,182,5,21,0,0,182,183,3,2,1,0,183,23,1,0, - 0,0,184,185,5,5,0,0,185,186,5,20,0,0,186,187,3,34,17,0,187,188,5,21,0, - 0,188,189,3,2,1,0,189,190,6,12,-1,0,190,201,1,0,0,0,191,192,5,5,0,0,192, - 193,5,20,0,0,193,194,3,34,17,0,194,195,5,21,0,0,195,196,3,2,1,0,196,197, - 5,6,0,0,197,198,3,2,1,0,198,199,6,12,-1,0,199,201,1,0,0,0,200,184,1,0, - 0,0,200,191,1,0,0,0,201,25,1,0,0,0,202,203,5,8,0,0,203,204,3,2,1,0,204, - 27,1,0,0,0,205,206,5,11,0,0,206,207,3,36,18,0,207,208,5,24,0,0,208,209, - 3,30,15,0,209,210,5,25,0,0,210,29,1,0,0,0,211,213,3,2,1,0,212,211,1,0, - 0,0,213,216,1,0,0,0,214,212,1,0,0,0,214,215,1,0,0,0,215,31,1,0,0,0,216, - 214,1,0,0,0,217,218,6,16,-1,0,218,219,5,49,0,0,219,220,5,20,0,0,220,221, - 3,12,6,0,221,222,5,21,0,0,222,225,1,0,0,0,223,225,5,49,0,0,224,217,1, - 0,0,0,224,223,1,0,0,0,225,231,1,0,0,0,226,227,10,1,0,0,227,228,5,45,0, - 0,228,230,3,32,16,2,229,226,1,0,0,0,230,233,1,0,0,0,231,229,1,0,0,0,231, - 232,1,0,0,0,232,33,1,0,0,0,233,231,1,0,0,0,234,235,6,17,-1,0,235,236, - 5,32,0,0,236,237,3,52,26,0,237,238,5,31,0,0,238,239,5,20,0,0,239,240, - 3,32,16,0,240,241,5,21,0,0,241,335,1,0,0,0,242,243,5,20,0,0,243,244,3, - 34,17,0,244,245,5,21,0,0,245,335,1,0,0,0,246,247,5,41,0,0,247,335,3,34, - 17,43,248,249,5,36,0,0,249,335,3,34,17,42,250,251,5,37,0,0,251,335,3, - 34,17,41,252,253,5,36,0,0,253,254,5,36,0,0,254,335,3,32,16,0,255,256, - 3,32,16,0,256,257,5,36,0,0,257,258,5,36,0,0,258,335,1,0,0,0,259,260,5, - 37,0,0,260,261,5,37,0,0,261,335,3,32,16,0,262,263,3,32,16,0,263,264,5, - 37,0,0,264,265,5,37,0,0,265,335,1,0,0,0,266,335,3,32,16,0,267,268,3,32, - 16,0,268,269,5,30,0,0,269,270,3,34,17,16,270,335,1,0,0,0,271,272,3,32, - 16,0,272,273,5,36,0,0,273,274,5,30,0,0,274,275,3,34,17,15,275,335,1,0, - 0,0,276,277,3,32,16,0,277,278,5,37,0,0,278,279,5,30,0,0,279,280,3,34, - 17,14,280,335,1,0,0,0,281,282,3,32,16,0,282,283,5,38,0,0,283,284,5,30, - 0,0,284,285,3,34,17,13,285,335,1,0,0,0,286,287,3,32,16,0,287,288,5,39, - 0,0,288,289,5,30,0,0,289,290,3,34,17,12,290,335,1,0,0,0,291,292,3,32, - 16,0,292,293,5,40,0,0,293,294,5,30,0,0,294,295,3,34,17,11,295,335,1,0, - 0,0,296,297,3,32,16,0,297,298,5,36,0,0,298,299,5,30,0,0,299,300,3,34, - 17,10,300,335,1,0,0,0,301,302,3,32,16,0,302,303,5,42,0,0,303,304,5,30, - 0,0,304,305,3,34,17,9,305,335,1,0,0,0,306,307,3,32,16,0,307,308,5,43, - 0,0,308,309,5,30,0,0,309,310,3,34,17,8,310,335,1,0,0,0,311,312,3,32,16, - 0,312,313,5,44,0,0,313,314,5,30,0,0,314,315,3,34,17,7,315,335,1,0,0,0, - 316,317,3,32,16,0,317,318,5,33,0,0,318,319,5,30,0,0,319,320,3,34,17,6, - 320,335,1,0,0,0,321,322,3,32,16,0,322,323,5,34,0,0,323,324,5,30,0,0,324, - 325,3,34,17,5,325,335,1,0,0,0,326,327,3,32,16,0,327,328,5,35,0,0,328, - 329,5,30,0,0,329,330,3,34,17,4,330,335,1,0,0,0,331,335,3,42,21,0,332, - 335,3,38,19,0,333,335,3,40,20,0,334,234,1,0,0,0,334,242,1,0,0,0,334,246, - 1,0,0,0,334,248,1,0,0,0,334,250,1,0,0,0,334,252,1,0,0,0,334,255,1,0,0, - 0,334,259,1,0,0,0,334,262,1,0,0,0,334,266,1,0,0,0,334,267,1,0,0,0,334, - 271,1,0,0,0,334,276,1,0,0,0,334,281,1,0,0,0,334,286,1,0,0,0,334,291,1, - 0,0,0,334,296,1,0,0,0,334,301,1,0,0,0,334,306,1,0,0,0,334,311,1,0,0,0, - 334,316,1,0,0,0,334,321,1,0,0,0,334,326,1,0,0,0,334,331,1,0,0,0,334,332, - 1,0,0,0,334,333,1,0,0,0,335,400,1,0,0,0,336,337,10,35,0,0,337,338,5,38, - 0,0,338,399,3,34,17,36,339,340,10,34,0,0,340,341,5,39,0,0,341,399,3,34, - 17,35,342,343,10,33,0,0,343,344,5,40,0,0,344,399,3,34,17,34,345,346,10, - 32,0,0,346,347,5,36,0,0,347,399,3,34,17,33,348,349,10,31,0,0,349,350, - 5,37,0,0,350,399,3,34,17,32,351,352,10,30,0,0,352,353,5,33,0,0,353,399, - 3,34,17,31,354,355,10,29,0,0,355,356,5,34,0,0,356,399,3,34,17,30,357, - 358,10,28,0,0,358,359,5,35,0,0,359,399,3,34,17,29,360,361,10,27,0,0,361, - 362,5,31,0,0,362,399,3,34,17,28,363,364,10,26,0,0,364,365,5,32,0,0,365, - 399,3,34,17,27,366,367,10,25,0,0,367,368,5,31,0,0,368,369,5,30,0,0,369, - 399,3,34,17,26,370,371,10,24,0,0,371,372,5,32,0,0,372,373,5,30,0,0,373, - 399,3,34,17,25,374,375,10,23,0,0,375,376,5,29,0,0,376,399,3,34,17,24, - 377,378,10,22,0,0,378,379,5,41,0,0,379,380,5,30,0,0,380,399,3,34,17,23, - 381,382,10,21,0,0,382,383,5,42,0,0,383,399,3,34,17,22,384,385,10,20,0, - 0,385,386,5,44,0,0,386,399,3,34,17,21,387,388,10,19,0,0,388,389,5,43, - 0,0,389,399,3,34,17,20,390,391,10,18,0,0,391,392,5,42,0,0,392,393,5,42, - 0,0,393,399,3,34,17,19,394,395,10,17,0,0,395,396,5,43,0,0,396,397,5,43, - 0,0,397,399,3,34,17,18,398,336,1,0,0,0,398,339,1,0,0,0,398,342,1,0,0, - 0,398,345,1,0,0,0,398,348,1,0,0,0,398,351,1,0,0,0,398,354,1,0,0,0,398, - 357,1,0,0,0,398,360,1,0,0,0,398,363,1,0,0,0,398,366,1,0,0,0,398,370,1, - 0,0,0,398,374,1,0,0,0,398,377,1,0,0,0,398,381,1,0,0,0,398,384,1,0,0,0, - 398,387,1,0,0,0,398,390,1,0,0,0,398,394,1,0,0,0,399,402,1,0,0,0,400,398, - 1,0,0,0,400,401,1,0,0,0,401,35,1,0,0,0,402,400,1,0,0,0,403,408,5,49,0, - 0,404,405,5,45,0,0,405,407,5,49,0,0,406,404,1,0,0,0,407,410,1,0,0,0,408, - 406,1,0,0,0,408,409,1,0,0,0,409,37,1,0,0,0,410,408,1,0,0,0,411,414,3, - 46,23,0,412,414,3,44,22,0,413,411,1,0,0,0,413,412,1,0,0,0,414,39,1,0, - 0,0,415,416,5,16,0,0,416,420,6,20,-1,0,417,418,5,17,0,0,418,420,6,20, - -1,0,419,415,1,0,0,0,419,417,1,0,0,0,420,41,1,0,0,0,421,422,5,60,0,0, - 422,43,1,0,0,0,423,424,5,54,0,0,424,425,6,22,-1,0,425,45,1,0,0,0,426, - 427,5,51,0,0,427,435,6,23,-1,0,428,429,5,50,0,0,429,435,6,23,-1,0,430, - 431,5,53,0,0,431,435,6,23,-1,0,432,433,5,52,0,0,433,435,6,23,-1,0,434, - 426,1,0,0,0,434,428,1,0,0,0,434,430,1,0,0,0,434,432,1,0,0,0,435,47,1, - 0,0,0,436,439,3,34,17,0,437,439,3,52,26,0,438,436,1,0,0,0,438,437,1,0, - 0,0,439,49,1,0,0,0,440,441,3,48,24,0,441,442,5,28,0,0,442,444,1,0,0,0, - 443,440,1,0,0,0,444,447,1,0,0,0,445,443,1,0,0,0,445,446,1,0,0,0,446,448, - 1,0,0,0,447,445,1,0,0,0,448,450,3,48,24,0,449,445,1,0,0,0,449,450,1,0, - 0,0,450,51,1,0,0,0,451,452,6,26,-1,0,452,459,3,36,18,0,453,454,3,36,18, - 0,454,455,5,32,0,0,455,456,3,50,25,0,456,457,5,31,0,0,457,459,1,0,0,0, - 458,451,1,0,0,0,458,453,1,0,0,0,459,467,1,0,0,0,460,461,10,1,0,0,461, - 462,5,22,0,0,462,463,3,34,17,0,463,464,5,23,0,0,464,466,1,0,0,0,465,460, - 1,0,0,0,466,469,1,0,0,0,467,465,1,0,0,0,467,468,1,0,0,0,468,53,1,0,0, - 0,469,467,1,0,0,0,33,57,61,65,68,72,88,92,115,122,126,135,141,150,159, - 165,169,173,200,214,224,231,334,398,400,408,413,419,434,438,445,449,458, - 467 + 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,1,0,5, + 0,58,8,0,10,0,12,0,61,9,0,1,0,3,0,64,8,0,1,1,1,1,3,1,68,8,1,1,1,3,1,71, + 8,1,1,1,1,1,3,1,75,8,1,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1, + 2,5,2,89,8,2,10,2,12,2,92,9,2,1,2,3,2,95,8,2,1,3,1,3,1,3,1,4,1,4,1,4, + 1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,3,5,118,8, + 5,1,6,1,6,1,6,5,6,123,8,6,10,6,12,6,126,9,6,1,6,3,6,129,8,6,1,7,1,7,1, + 7,1,7,1,7,5,7,136,8,7,10,7,12,7,139,9,7,1,7,1,7,1,7,3,7,144,8,7,1,8,1, + 8,1,8,1,8,1,8,1,8,1,8,3,8,153,8,8,1,8,1,8,1,8,1,8,1,9,5,9,160,8,9,10, + 9,12,9,163,9,9,1,10,1,10,1,10,3,10,168,8,10,1,10,1,10,3,10,172,8,10,1, + 10,1,10,3,10,176,8,10,1,10,1,10,1,10,1,11,1,11,1,11,1,11,1,11,1,11,1, + 12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1, + 12,1,12,3,12,203,8,12,1,13,1,13,1,13,1,14,1,14,1,14,1,14,1,14,1,14,1, + 15,5,15,215,8,15,10,15,12,15,218,9,15,1,16,1,16,1,16,1,16,1,16,1,16,1, + 16,3,16,227,8,16,1,16,1,16,1,16,5,16,232,8,16,10,16,12,16,235,9,16,1, + 17,1,17,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1, + 18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1, + 18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1, + 18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1, + 18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1, + 18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1, + 18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1, + 18,1,18,1,18,1,18,3,18,339,8,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1, + 18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1, + 18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1, + 18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1, + 18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,1,18,5,18,403, + 8,18,10,18,12,18,406,9,18,1,19,1,19,1,19,5,19,411,8,19,10,19,12,19,414, + 9,19,1,20,1,20,3,20,418,8,20,1,21,1,21,1,21,1,21,3,21,424,8,21,1,22,1, + 22,1,23,1,23,1,23,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24,3,24,439,8, + 24,1,25,1,25,3,25,443,8,25,1,26,1,26,1,26,5,26,448,8,26,10,26,12,26,451, + 9,26,1,26,3,26,454,8,26,1,27,1,27,1,27,1,27,1,27,1,27,1,27,3,27,463,8, + 27,1,27,1,27,1,27,1,27,1,27,5,27,470,8,27,10,27,12,27,473,9,27,1,27,0, + 3,32,36,54,28,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,0,0,533,0,63,1,0,0,0,2,74,1,0,0,0,4,94,1,0,0, + 0,6,96,1,0,0,0,8,99,1,0,0,0,10,117,1,0,0,0,12,128,1,0,0,0,14,143,1,0, + 0,0,16,145,1,0,0,0,18,161,1,0,0,0,20,164,1,0,0,0,22,180,1,0,0,0,24,202, + 1,0,0,0,26,204,1,0,0,0,28,207,1,0,0,0,30,216,1,0,0,0,32,226,1,0,0,0,34, + 236,1,0,0,0,36,338,1,0,0,0,38,407,1,0,0,0,40,417,1,0,0,0,42,423,1,0,0, + 0,44,425,1,0,0,0,46,427,1,0,0,0,48,438,1,0,0,0,50,442,1,0,0,0,52,453, + 1,0,0,0,54,462,1,0,0,0,56,58,3,2,1,0,57,56,1,0,0,0,58,61,1,0,0,0,59,57, + 1,0,0,0,59,60,1,0,0,0,60,64,1,0,0,0,61,59,1,0,0,0,62,64,5,0,0,1,63,59, + 1,0,0,0,63,62,1,0,0,0,64,1,1,0,0,0,65,67,3,4,2,0,66,68,5,27,0,0,67,66, + 1,0,0,0,67,68,1,0,0,0,68,70,1,0,0,0,69,71,5,48,0,0,70,69,1,0,0,0,70,71, + 1,0,0,0,71,75,1,0,0,0,72,75,5,27,0,0,73,75,5,48,0,0,74,65,1,0,0,0,74, + 72,1,0,0,0,74,73,1,0,0,0,75,3,1,0,0,0,76,95,3,6,3,0,77,95,3,8,4,0,78, + 95,3,28,14,0,79,95,3,16,8,0,80,95,3,10,5,0,81,95,3,20,10,0,82,95,3,22, + 11,0,83,95,3,24,12,0,84,95,3,26,13,0,85,95,3,36,18,0,86,90,5,24,0,0,87, + 89,3,2,1,0,88,87,1,0,0,0,89,92,1,0,0,0,90,88,1,0,0,0,90,91,1,0,0,0,91, + 93,1,0,0,0,92,90,1,0,0,0,93,95,5,25,0,0,94,76,1,0,0,0,94,77,1,0,0,0,94, + 78,1,0,0,0,94,79,1,0,0,0,94,80,1,0,0,0,94,81,1,0,0,0,94,82,1,0,0,0,94, + 83,1,0,0,0,94,84,1,0,0,0,94,85,1,0,0,0,94,86,1,0,0,0,95,5,1,0,0,0,96, + 97,5,10,0,0,97,98,3,38,19,0,98,7,1,0,0,0,99,100,5,9,0,0,100,101,3,38, + 19,0,101,9,1,0,0,0,102,103,5,1,0,0,103,104,5,49,0,0,104,105,5,26,0,0, + 105,118,3,54,27,0,106,107,5,1,0,0,107,108,5,49,0,0,108,109,5,30,0,0,109, + 118,3,36,18,0,110,111,5,1,0,0,111,112,5,49,0,0,112,113,5,26,0,0,113,114, + 3,54,27,0,114,115,5,30,0,0,115,116,3,36,18,0,116,118,1,0,0,0,117,102, + 1,0,0,0,117,106,1,0,0,0,117,110,1,0,0,0,118,11,1,0,0,0,119,120,3,36,18, + 0,120,121,5,28,0,0,121,123,1,0,0,0,122,119,1,0,0,0,123,126,1,0,0,0,124, + 122,1,0,0,0,124,125,1,0,0,0,125,127,1,0,0,0,126,124,1,0,0,0,127,129,3, + 36,18,0,128,124,1,0,0,0,128,129,1,0,0,0,129,13,1,0,0,0,130,131,5,49,0, + 0,131,132,5,26,0,0,132,133,3,54,27,0,133,134,5,28,0,0,134,136,1,0,0,0, + 135,130,1,0,0,0,136,139,1,0,0,0,137,135,1,0,0,0,137,138,1,0,0,0,138,140, + 1,0,0,0,139,137,1,0,0,0,140,141,5,49,0,0,141,142,5,26,0,0,142,144,3,54, + 27,0,143,137,1,0,0,0,143,144,1,0,0,0,144,15,1,0,0,0,145,146,5,7,0,0,146, + 147,5,49,0,0,147,148,5,20,0,0,148,149,3,14,7,0,149,152,5,21,0,0,150,151, + 5,26,0,0,151,153,3,54,27,0,152,150,1,0,0,0,152,153,1,0,0,0,153,154,1, + 0,0,0,154,155,5,24,0,0,155,156,3,18,9,0,156,157,5,25,0,0,157,17,1,0,0, + 0,158,160,3,2,1,0,159,158,1,0,0,0,160,163,1,0,0,0,161,159,1,0,0,0,161, + 162,1,0,0,0,162,19,1,0,0,0,163,161,1,0,0,0,164,165,5,3,0,0,165,167,5, + 20,0,0,166,168,3,10,5,0,167,166,1,0,0,0,167,168,1,0,0,0,168,169,1,0,0, + 0,169,171,5,27,0,0,170,172,3,36,18,0,171,170,1,0,0,0,171,172,1,0,0,0, + 172,173,1,0,0,0,173,175,5,27,0,0,174,176,3,4,2,0,175,174,1,0,0,0,175, + 176,1,0,0,0,176,177,1,0,0,0,177,178,5,21,0,0,178,179,3,2,1,0,179,21,1, + 0,0,0,180,181,5,4,0,0,181,182,5,20,0,0,182,183,3,36,18,0,183,184,5,21, + 0,0,184,185,3,2,1,0,185,23,1,0,0,0,186,187,5,5,0,0,187,188,5,20,0,0,188, + 189,3,36,18,0,189,190,5,21,0,0,190,191,3,2,1,0,191,192,6,12,-1,0,192, + 203,1,0,0,0,193,194,5,5,0,0,194,195,5,20,0,0,195,196,3,36,18,0,196,197, + 5,21,0,0,197,198,3,2,1,0,198,199,5,6,0,0,199,200,3,2,1,0,200,201,6,12, + -1,0,201,203,1,0,0,0,202,186,1,0,0,0,202,193,1,0,0,0,203,25,1,0,0,0,204, + 205,5,8,0,0,205,206,3,2,1,0,206,27,1,0,0,0,207,208,5,11,0,0,208,209,3, + 38,19,0,209,210,5,24,0,0,210,211,3,30,15,0,211,212,5,25,0,0,212,29,1, + 0,0,0,213,215,3,2,1,0,214,213,1,0,0,0,215,218,1,0,0,0,216,214,1,0,0,0, + 216,217,1,0,0,0,217,31,1,0,0,0,218,216,1,0,0,0,219,220,6,16,-1,0,220, + 221,5,49,0,0,221,222,5,20,0,0,222,223,3,12,6,0,223,224,5,21,0,0,224,227, + 1,0,0,0,225,227,5,49,0,0,226,219,1,0,0,0,226,225,1,0,0,0,227,233,1,0, + 0,0,228,229,10,1,0,0,229,230,5,45,0,0,230,232,3,32,16,2,231,228,1,0,0, + 0,232,235,1,0,0,0,233,231,1,0,0,0,233,234,1,0,0,0,234,33,1,0,0,0,235, + 233,1,0,0,0,236,237,3,32,16,0,237,35,1,0,0,0,238,239,6,18,-1,0,239,240, + 5,32,0,0,240,241,3,54,27,0,241,242,5,31,0,0,242,243,5,20,0,0,243,244, + 3,34,17,0,244,245,5,21,0,0,245,339,1,0,0,0,246,247,5,20,0,0,247,248,3, + 36,18,0,248,249,5,21,0,0,249,339,1,0,0,0,250,251,5,41,0,0,251,339,3,36, + 18,43,252,253,5,36,0,0,253,339,3,36,18,42,254,255,5,37,0,0,255,339,3, + 36,18,41,256,257,5,36,0,0,257,258,5,36,0,0,258,339,3,34,17,0,259,260, + 3,34,17,0,260,261,5,36,0,0,261,262,5,36,0,0,262,339,1,0,0,0,263,264,5, + 37,0,0,264,265,5,37,0,0,265,339,3,34,17,0,266,267,3,34,17,0,267,268,5, + 37,0,0,268,269,5,37,0,0,269,339,1,0,0,0,270,339,3,34,17,0,271,272,3,34, + 17,0,272,273,5,30,0,0,273,274,3,36,18,16,274,339,1,0,0,0,275,276,3,34, + 17,0,276,277,5,36,0,0,277,278,5,30,0,0,278,279,3,36,18,15,279,339,1,0, + 0,0,280,281,3,34,17,0,281,282,5,37,0,0,282,283,5,30,0,0,283,284,3,36, + 18,14,284,339,1,0,0,0,285,286,3,34,17,0,286,287,5,38,0,0,287,288,5,30, + 0,0,288,289,3,36,18,13,289,339,1,0,0,0,290,291,3,34,17,0,291,292,5,39, + 0,0,292,293,5,30,0,0,293,294,3,36,18,12,294,339,1,0,0,0,295,296,3,34, + 17,0,296,297,5,40,0,0,297,298,5,30,0,0,298,299,3,36,18,11,299,339,1,0, + 0,0,300,301,3,34,17,0,301,302,5,36,0,0,302,303,5,30,0,0,303,304,3,36, + 18,10,304,339,1,0,0,0,305,306,3,34,17,0,306,307,5,42,0,0,307,308,5,30, + 0,0,308,309,3,36,18,9,309,339,1,0,0,0,310,311,3,34,17,0,311,312,5,43, + 0,0,312,313,5,30,0,0,313,314,3,36,18,8,314,339,1,0,0,0,315,316,3,34,17, + 0,316,317,5,44,0,0,317,318,5,30,0,0,318,319,3,36,18,7,319,339,1,0,0,0, + 320,321,3,34,17,0,321,322,5,33,0,0,322,323,5,30,0,0,323,324,3,36,18,6, + 324,339,1,0,0,0,325,326,3,34,17,0,326,327,5,34,0,0,327,328,5,30,0,0,328, + 329,3,36,18,5,329,339,1,0,0,0,330,331,3,34,17,0,331,332,5,35,0,0,332, + 333,5,30,0,0,333,334,3,36,18,4,334,339,1,0,0,0,335,339,3,44,22,0,336, + 339,3,40,20,0,337,339,3,42,21,0,338,238,1,0,0,0,338,246,1,0,0,0,338,250, + 1,0,0,0,338,252,1,0,0,0,338,254,1,0,0,0,338,256,1,0,0,0,338,259,1,0,0, + 0,338,263,1,0,0,0,338,266,1,0,0,0,338,270,1,0,0,0,338,271,1,0,0,0,338, + 275,1,0,0,0,338,280,1,0,0,0,338,285,1,0,0,0,338,290,1,0,0,0,338,295,1, + 0,0,0,338,300,1,0,0,0,338,305,1,0,0,0,338,310,1,0,0,0,338,315,1,0,0,0, + 338,320,1,0,0,0,338,325,1,0,0,0,338,330,1,0,0,0,338,335,1,0,0,0,338,336, + 1,0,0,0,338,337,1,0,0,0,339,404,1,0,0,0,340,341,10,35,0,0,341,342,5,38, + 0,0,342,403,3,36,18,36,343,344,10,34,0,0,344,345,5,39,0,0,345,403,3,36, + 18,35,346,347,10,33,0,0,347,348,5,40,0,0,348,403,3,36,18,34,349,350,10, + 32,0,0,350,351,5,36,0,0,351,403,3,36,18,33,352,353,10,31,0,0,353,354, + 5,37,0,0,354,403,3,36,18,32,355,356,10,30,0,0,356,357,5,33,0,0,357,403, + 3,36,18,31,358,359,10,29,0,0,359,360,5,34,0,0,360,403,3,36,18,30,361, + 362,10,28,0,0,362,363,5,35,0,0,363,403,3,36,18,29,364,365,10,27,0,0,365, + 366,5,31,0,0,366,403,3,36,18,28,367,368,10,26,0,0,368,369,5,32,0,0,369, + 403,3,36,18,27,370,371,10,25,0,0,371,372,5,31,0,0,372,373,5,30,0,0,373, + 403,3,36,18,26,374,375,10,24,0,0,375,376,5,32,0,0,376,377,5,30,0,0,377, + 403,3,36,18,25,378,379,10,23,0,0,379,380,5,29,0,0,380,403,3,36,18,24, + 381,382,10,22,0,0,382,383,5,41,0,0,383,384,5,30,0,0,384,403,3,36,18,23, + 385,386,10,21,0,0,386,387,5,42,0,0,387,403,3,36,18,22,388,389,10,20,0, + 0,389,390,5,44,0,0,390,403,3,36,18,21,391,392,10,19,0,0,392,393,5,43, + 0,0,393,403,3,36,18,20,394,395,10,18,0,0,395,396,5,42,0,0,396,397,5,42, + 0,0,397,403,3,36,18,19,398,399,10,17,0,0,399,400,5,43,0,0,400,401,5,43, + 0,0,401,403,3,36,18,18,402,340,1,0,0,0,402,343,1,0,0,0,402,346,1,0,0, + 0,402,349,1,0,0,0,402,352,1,0,0,0,402,355,1,0,0,0,402,358,1,0,0,0,402, + 361,1,0,0,0,402,364,1,0,0,0,402,367,1,0,0,0,402,370,1,0,0,0,402,374,1, + 0,0,0,402,378,1,0,0,0,402,381,1,0,0,0,402,385,1,0,0,0,402,388,1,0,0,0, + 402,391,1,0,0,0,402,394,1,0,0,0,402,398,1,0,0,0,403,406,1,0,0,0,404,402, + 1,0,0,0,404,405,1,0,0,0,405,37,1,0,0,0,406,404,1,0,0,0,407,412,5,49,0, + 0,408,409,5,45,0,0,409,411,5,49,0,0,410,408,1,0,0,0,411,414,1,0,0,0,412, + 410,1,0,0,0,412,413,1,0,0,0,413,39,1,0,0,0,414,412,1,0,0,0,415,418,3, + 48,24,0,416,418,3,46,23,0,417,415,1,0,0,0,417,416,1,0,0,0,418,41,1,0, + 0,0,419,420,5,16,0,0,420,424,6,21,-1,0,421,422,5,17,0,0,422,424,6,21, + -1,0,423,419,1,0,0,0,423,421,1,0,0,0,424,43,1,0,0,0,425,426,5,60,0,0, + 426,45,1,0,0,0,427,428,5,54,0,0,428,429,6,23,-1,0,429,47,1,0,0,0,430, + 431,5,51,0,0,431,439,6,24,-1,0,432,433,5,50,0,0,433,439,6,24,-1,0,434, + 435,5,53,0,0,435,439,6,24,-1,0,436,437,5,52,0,0,437,439,6,24,-1,0,438, + 430,1,0,0,0,438,432,1,0,0,0,438,434,1,0,0,0,438,436,1,0,0,0,439,49,1, + 0,0,0,440,443,3,36,18,0,441,443,3,54,27,0,442,440,1,0,0,0,442,441,1,0, + 0,0,443,51,1,0,0,0,444,445,3,50,25,0,445,446,5,28,0,0,446,448,1,0,0,0, + 447,444,1,0,0,0,448,451,1,0,0,0,449,447,1,0,0,0,449,450,1,0,0,0,450,452, + 1,0,0,0,451,449,1,0,0,0,452,454,3,50,25,0,453,449,1,0,0,0,453,454,1,0, + 0,0,454,53,1,0,0,0,455,456,6,27,-1,0,456,463,3,38,19,0,457,458,3,38,19, + 0,458,459,5,32,0,0,459,460,3,52,26,0,460,461,5,31,0,0,461,463,1,0,0,0, + 462,455,1,0,0,0,462,457,1,0,0,0,463,471,1,0,0,0,464,465,10,1,0,0,465, + 466,5,22,0,0,466,467,3,36,18,0,467,468,5,23,0,0,468,470,1,0,0,0,469,464, + 1,0,0,0,470,473,1,0,0,0,471,469,1,0,0,0,471,472,1,0,0,0,472,55,1,0,0, + 0,473,471,1,0,0,0,33,59,63,67,70,74,90,94,117,124,128,137,143,152,161, + 167,171,175,202,216,226,233,338,402,404,412,417,423,438,442,449,453,462, + 471 }; staticData->serializedATN = antlr4::atn::SerializedATNView(serializedATNSegment, sizeof(serializedATNSegment) / sizeof(serializedATNSegment[0])); @@ -349,19 +350,19 @@ RiddleParser::ProgramContext* RiddleParser::program() { exitRule(); }); try { - setState(61); + setState(63); _errHandler->sync(this); switch (getInterpreter()->adaptivePredict(_input, 1, _ctx)) { case 1: { enterOuterAlt(_localctx, 1); - setState(57); + setState(59); _errHandler->sync(this); _la = _input->LA(1); while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & 1188671236277997498) != 0)) { - setState(54); + setState(56); statement_ed(); - setState(59); + setState(61); _errHandler->sync(this); _la = _input->LA(1); } @@ -370,7 +371,7 @@ RiddleParser::ProgramContext* RiddleParser::program() { case 2: { enterOuterAlt(_localctx, 2); - setState(60); + setState(62); match(RiddleParser::EOF); break; } @@ -444,7 +445,7 @@ RiddleParser::Statement_edContext* RiddleParser::statement_ed() { exitRule(); }); try { - setState(72); + setState(74); _errHandler->sync(this); switch (_input->LA(1)) { case RiddleParser::Var: @@ -472,14 +473,14 @@ RiddleParser::Statement_edContext* RiddleParser::statement_ed() { case RiddleParser::Float: case RiddleParser::STRING: { enterOuterAlt(_localctx, 1); - setState(63); - statement(); setState(65); + statement(); + setState(67); _errHandler->sync(this); switch (getInterpreter()->adaptivePredict(_input, 2, _ctx)) { case 1: { - setState(64); + setState(66); match(RiddleParser::Semi); break; } @@ -487,12 +488,12 @@ RiddleParser::Statement_edContext* RiddleParser::statement_ed() { default: break; } - setState(68); + setState(70); _errHandler->sync(this); switch (getInterpreter()->adaptivePredict(_input, 3, _ctx)) { case 1: { - setState(67); + setState(69); match(RiddleParser::Endl); break; } @@ -505,14 +506,14 @@ RiddleParser::Statement_edContext* RiddleParser::statement_ed() { case RiddleParser::Semi: { enterOuterAlt(_localctx, 2); - setState(70); + setState(72); match(RiddleParser::Semi); break; } case RiddleParser::Endl: { enterOuterAlt(_localctx, 3); - setState(71); + setState(73); match(RiddleParser::Endl); break; } @@ -631,68 +632,68 @@ RiddleParser::StatementContext* RiddleParser::statement() { exitRule(); }); try { - setState(92); + setState(94); _errHandler->sync(this); switch (_input->LA(1)) { case RiddleParser::Package: { enterOuterAlt(_localctx, 1); - setState(74); + setState(76); packStatement(); break; } case RiddleParser::Import: { enterOuterAlt(_localctx, 2); - setState(75); + setState(77); importStatement(); break; } case RiddleParser::Class: { enterOuterAlt(_localctx, 3); - setState(76); + setState(78); classDefine(); break; } case RiddleParser::Func: { enterOuterAlt(_localctx, 4); - setState(77); + setState(79); funcDefine(); break; } case RiddleParser::Var: { enterOuterAlt(_localctx, 5); - setState(78); + setState(80); varDefineStatement(); break; } case RiddleParser::For: { enterOuterAlt(_localctx, 6); - setState(79); + setState(81); forStatement(); break; } case RiddleParser::While: { enterOuterAlt(_localctx, 7); - setState(80); + setState(82); whileStatement(); break; } case RiddleParser::If: { enterOuterAlt(_localctx, 8); - setState(81); + setState(83); ifStatement(); break; } case RiddleParser::Return: { enterOuterAlt(_localctx, 9); - setState(82); + setState(84); returnStatement(); break; } @@ -712,27 +713,27 @@ RiddleParser::StatementContext* RiddleParser::statement() { case RiddleParser::Float: case RiddleParser::STRING: { enterOuterAlt(_localctx, 10); - setState(83); + setState(85); expression(0); break; } case RiddleParser::LeftCurly: { enterOuterAlt(_localctx, 11); - setState(84); + setState(86); match(RiddleParser::LeftCurly); - setState(88); + setState(90); _errHandler->sync(this); _la = _input->LA(1); while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & 1188671236277997498) != 0)) { - setState(85); + setState(87); statement_ed(); - setState(90); + setState(92); _errHandler->sync(this); _la = _input->LA(1); } - setState(91); + setState(93); match(RiddleParser::RightCurly); break; } @@ -803,9 +804,9 @@ RiddleParser::PackStatementContext* RiddleParser::packStatement() { }); try { enterOuterAlt(_localctx, 1); - setState(94); + setState(96); match(RiddleParser::Package); - setState(95); + setState(97); antlrcpp::downCast(_localctx)->packName = id(); } @@ -870,9 +871,9 @@ RiddleParser::ImportStatementContext* RiddleParser::importStatement() { }); try { enterOuterAlt(_localctx, 1); - setState(97); + setState(99); match(RiddleParser::Import); - setState(98); + setState(100); antlrcpp::downCast(_localctx)->libName = id(); } @@ -952,48 +953,48 @@ RiddleParser::VarDefineStatementContext* RiddleParser::varDefineStatement() { exitRule(); }); try { - setState(115); + setState(117); _errHandler->sync(this); switch (getInterpreter()->adaptivePredict(_input, 7, _ctx)) { case 1: { enterOuterAlt(_localctx, 1); - setState(100); + setState(102); match(RiddleParser::Var); - setState(101); + setState(103); antlrcpp::downCast(_localctx)->name = match(RiddleParser::Identifier); - setState(102); + setState(104); match(RiddleParser::Colon); - setState(103); + setState(105); antlrcpp::downCast(_localctx)->type = typeName(0); break; } case 2: { enterOuterAlt(_localctx, 2); - setState(104); + setState(106); match(RiddleParser::Var); - setState(105); + setState(107); antlrcpp::downCast(_localctx)->name = match(RiddleParser::Identifier); - setState(106); + setState(108); match(RiddleParser::Assign); - setState(107); + setState(109); antlrcpp::downCast(_localctx)->value = expression(0); break; } case 3: { enterOuterAlt(_localctx, 3); - setState(108); + setState(110); match(RiddleParser::Var); - setState(109); + setState(111); antlrcpp::downCast(_localctx)->name = match(RiddleParser::Identifier); - setState(110); + setState(112); match(RiddleParser::Colon); - setState(111); + setState(113); antlrcpp::downCast(_localctx)->type = typeName(0); - setState(112); + setState(114); match(RiddleParser::Assign); - setState(113); + setState(115); antlrcpp::downCast(_localctx)->value = expression(0); break; } @@ -1074,27 +1075,27 @@ RiddleParser::ArgsExprContext* RiddleParser::argsExpr() { try { size_t alt; enterOuterAlt(_localctx, 1); - setState(126); + setState(128); _errHandler->sync(this); _la = _input->LA(1); if ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & 1188389761150287872) != 0)) { - setState(122); + setState(124); _errHandler->sync(this); alt = getInterpreter()->adaptivePredict(_input, 8, _ctx); while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { if (alt == 1) { - setState(117); + setState(119); expression(0); - setState(118); + setState(120); match(RiddleParser::Comma); } - setState(124); + setState(126); _errHandler->sync(this); alt = getInterpreter()->adaptivePredict(_input, 8, _ctx); } - setState(125); + setState(127); expression(0); } @@ -1186,35 +1187,35 @@ RiddleParser::DefineArgsContext* RiddleParser::defineArgs() { try { size_t alt; enterOuterAlt(_localctx, 1); - setState(141); + setState(143); _errHandler->sync(this); _la = _input->LA(1); if (_la == RiddleParser::Identifier) { - setState(135); + setState(137); _errHandler->sync(this); alt = getInterpreter()->adaptivePredict(_input, 10, _ctx); while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { if (alt == 1) { - setState(128); + setState(130); match(RiddleParser::Identifier); - setState(129); + setState(131); match(RiddleParser::Colon); - setState(130); + setState(132); typeName(0); - setState(131); + setState(133); match(RiddleParser::Comma); } - setState(137); + setState(139); _errHandler->sync(this); alt = getInterpreter()->adaptivePredict(_input, 10, _ctx); } - setState(138); + setState(140); match(RiddleParser::Identifier); - setState(139); + setState(141); match(RiddleParser::Colon); - setState(140); + setState(142); typeName(0); } @@ -1313,31 +1314,31 @@ RiddleParser::FuncDefineContext* RiddleParser::funcDefine() { }); try { enterOuterAlt(_localctx, 1); - setState(143); + setState(145); match(RiddleParser::Func); - setState(144); + setState(146); antlrcpp::downCast(_localctx)->funcName = match(RiddleParser::Identifier); - setState(145); + setState(147); match(RiddleParser::LeftBracket); - setState(146); + setState(148); antlrcpp::downCast(_localctx)->args = defineArgs(); - setState(147); + setState(149); match(RiddleParser::RightBracket); - setState(150); + setState(152); _errHandler->sync(this); _la = _input->LA(1); if (_la == RiddleParser::Colon) { - setState(148); + setState(150); match(RiddleParser::Colon); - setState(149); + setState(151); antlrcpp::downCast(_localctx)->returnType = typeName(0); } - setState(152); + setState(154); match(RiddleParser::LeftCurly); - setState(153); + setState(155); antlrcpp::downCast(_localctx)->body = funcBody(); - setState(154); + setState(156); match(RiddleParser::RightCurly); } @@ -1403,14 +1404,14 @@ RiddleParser::FuncBodyContext* RiddleParser::funcBody() { }); try { enterOuterAlt(_localctx, 1); - setState(159); + setState(161); _errHandler->sync(this); _la = _input->LA(1); while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & 1188671236277997498) != 0)) { - setState(156); + setState(158); statement_ed(); - setState(161); + setState(163); _errHandler->sync(this); _la = _input->LA(1); } @@ -1506,43 +1507,43 @@ RiddleParser::ForStatementContext* RiddleParser::forStatement() { }); try { enterOuterAlt(_localctx, 1); - setState(162); + setState(164); match(RiddleParser::For); - setState(163); - match(RiddleParser::LeftBracket); setState(165); + match(RiddleParser::LeftBracket); + setState(167); _errHandler->sync(this); _la = _input->LA(1); if (_la == RiddleParser::Var) { - setState(164); + setState(166); antlrcpp::downCast(_localctx)->init = varDefineStatement(); } - setState(167); - match(RiddleParser::Semi); setState(169); + match(RiddleParser::Semi); + setState(171); _errHandler->sync(this); _la = _input->LA(1); if ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & 1188389761150287872) != 0)) { - setState(168); + setState(170); antlrcpp::downCast(_localctx)->termCond = expression(0); } - setState(171); - match(RiddleParser::Semi); setState(173); + match(RiddleParser::Semi); + setState(175); _errHandler->sync(this); _la = _input->LA(1); if ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & 1188389761167069114) != 0)) { - setState(172); + setState(174); antlrcpp::downCast(_localctx)->selfVar = statement(); } - setState(175); + setState(177); match(RiddleParser::RightBracket); - setState(176); + setState(178); antlrcpp::downCast(_localctx)->body = statement_ed(); } @@ -1619,15 +1620,15 @@ RiddleParser::WhileStatementContext* RiddleParser::whileStatement() { }); try { enterOuterAlt(_localctx, 1); - setState(178); + setState(180); match(RiddleParser::While); - setState(179); + setState(181); match(RiddleParser::LeftBracket); - setState(180); + setState(182); antlrcpp::downCast(_localctx)->runCond = expression(0); - setState(181); + setState(183); match(RiddleParser::RightBracket); - setState(182); + setState(184); antlrcpp::downCast(_localctx)->body = statement_ed(); } @@ -1711,20 +1712,20 @@ RiddleParser::IfStatementContext* RiddleParser::ifStatement() { exitRule(); }); try { - setState(200); + setState(202); _errHandler->sync(this); switch (getInterpreter()->adaptivePredict(_input, 17, _ctx)) { case 1: { enterOuterAlt(_localctx, 1); - setState(184); + setState(186); match(RiddleParser::If); - setState(185); + setState(187); match(RiddleParser::LeftBracket); - setState(186); + setState(188); antlrcpp::downCast(_localctx)->cond = expression(0); - setState(187); + setState(189); match(RiddleParser::RightBracket); - setState(188); + setState(190); antlrcpp::downCast(_localctx)->body = statement_ed(); antlrcpp::downCast(_localctx)->hasElse = false; break; @@ -1732,19 +1733,19 @@ RiddleParser::IfStatementContext* RiddleParser::ifStatement() { case 2: { enterOuterAlt(_localctx, 2); - setState(191); + setState(193); match(RiddleParser::If); - setState(192); + setState(194); match(RiddleParser::LeftBracket); - setState(193); + setState(195); antlrcpp::downCast(_localctx)->cond = expression(0); - setState(194); + setState(196); match(RiddleParser::RightBracket); - setState(195); + setState(197); antlrcpp::downCast(_localctx)->body = statement_ed(); - setState(196); + setState(198); match(RiddleParser::Else); - setState(197); + setState(199); antlrcpp::downCast(_localctx)->elseBody = statement_ed(); antlrcpp::downCast(_localctx)->hasElse = true; break; @@ -1816,9 +1817,9 @@ RiddleParser::ReturnStatementContext* RiddleParser::returnStatement() { }); try { enterOuterAlt(_localctx, 1); - setState(202); + setState(204); match(RiddleParser::Return); - setState(203); + setState(205); antlrcpp::downCast(_localctx)->result = statement_ed(); } @@ -1895,15 +1896,15 @@ RiddleParser::ClassDefineContext* RiddleParser::classDefine() { }); try { enterOuterAlt(_localctx, 1); - setState(205); + setState(207); match(RiddleParser::Class); - setState(206); + setState(208); antlrcpp::downCast(_localctx)->className = id(); - setState(207); + setState(209); match(RiddleParser::LeftCurly); - setState(208); + setState(210); antlrcpp::downCast(_localctx)->body = classBody(); - setState(209); + setState(211); match(RiddleParser::RightCurly); } @@ -1969,14 +1970,14 @@ RiddleParser::ClassBodyContext* RiddleParser::classBody() { }); try { enterOuterAlt(_localctx, 1); - setState(214); + setState(216); _errHandler->sync(this); _la = _input->LA(1); while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & 1188671236277997498) != 0)) { - setState(211); + setState(213); statement_ed(); - setState(216); + setState(218); _errHandler->sync(this); _la = _input->LA(1); } @@ -2127,7 +2128,7 @@ RiddleParser::ExprPtrContext* RiddleParser::exprPtr(int precedence) { try { size_t alt; enterOuterAlt(_localctx, 1); - setState(224); + setState(226); _errHandler->sync(this); switch (getInterpreter()->adaptivePredict(_input, 19, _ctx)) { case 1: { @@ -2135,13 +2136,13 @@ RiddleParser::ExprPtrContext* RiddleParser::exprPtr(int precedence) { _ctx = _localctx; previousContext = _localctx; - setState(218); + setState(220); antlrcpp::downCast(_localctx)->funcName = match(RiddleParser::Identifier); - setState(219); + setState(221); match(RiddleParser::LeftBracket); - setState(220); + setState(222); antlrcpp::downCast(_localctx)->args = argsExpr(); - setState(221); + setState(223); match(RiddleParser::RightBracket); break; } @@ -2150,7 +2151,7 @@ RiddleParser::ExprPtrContext* RiddleParser::exprPtr(int precedence) { _localctx = _tracker.createInstance(_localctx); _ctx = _localctx; previousContext = _localctx; - setState(223); + setState(225); match(RiddleParser::Identifier); break; } @@ -2159,7 +2160,7 @@ RiddleParser::ExprPtrContext* RiddleParser::exprPtr(int precedence) { break; } _ctx->stop = _input->LT(-1); - setState(231); + setState(233); _errHandler->sync(this); alt = getInterpreter()->adaptivePredict(_input, 20, _ctx); while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { @@ -2171,15 +2172,15 @@ RiddleParser::ExprPtrContext* RiddleParser::exprPtr(int precedence) { _localctx = newContext; newContext->parent = previousContext; pushNewRecursionContext(newContext, startState, RuleExprPtr); - setState(226); + setState(228); if (!(precpred(_ctx, 1))) throw FailedPredicateException(this, "precpred(_ctx, 1)"); - setState(227); + setState(229); match(RiddleParser::Dot); - setState(228); + setState(230); antlrcpp::downCast(_localctx)->child = exprPtr(2); } - setState(233); + setState(235); _errHandler->sync(this); alt = getInterpreter()->adaptivePredict(_input, 20, _ctx); } @@ -2192,6 +2193,67 @@ RiddleParser::ExprPtrContext* RiddleParser::exprPtr(int precedence) { return _localctx; } +//----------------- ExprPtrParserContext ------------------------------------------------------------------ + +RiddleParser::ExprPtrParserContext::ExprPtrParserContext(ParserRuleContext *parent, size_t invokingState) + : ParserRuleContext(parent, invokingState) { +} + +RiddleParser::ExprPtrContext* RiddleParser::ExprPtrParserContext::exprPtr() { + return getRuleContext(0); +} + + +size_t RiddleParser::ExprPtrParserContext::getRuleIndex() const { + return RiddleParser::RuleExprPtrParser; +} + +void RiddleParser::ExprPtrParserContext::enterRule(tree::ParseTreeListener *listener) { + auto parserListener = dynamic_cast(listener); + if (parserListener != nullptr) + parserListener->enterExprPtrParser(this); +} + +void RiddleParser::ExprPtrParserContext::exitRule(tree::ParseTreeListener *listener) { + auto parserListener = dynamic_cast(listener); + if (parserListener != nullptr) + parserListener->exitExprPtrParser(this); +} + + +std::any RiddleParser::ExprPtrParserContext::accept(tree::ParseTreeVisitor *visitor) { + if (auto parserVisitor = dynamic_cast(visitor)) + return parserVisitor->visitExprPtrParser(this); + else + return visitor->visitChildren(this); +} + +RiddleParser::ExprPtrParserContext* RiddleParser::exprPtrParser() { + ExprPtrParserContext *_localctx = _tracker.createInstance(_ctx, getState()); + enterRule(_localctx, 34, RiddleParser::RuleExprPtrParser); + +#if __cplusplus > 201703L + auto onExit = finally([=, this] { +#else + auto onExit = finally([=] { +#endif + exitRule(); + }); + try { + enterOuterAlt(_localctx, 1); + setState(236); + exprPtr(0); + + } + catch (RecognitionException &e) { + _errHandler->reportError(this, e); + _localctx->exception = std::current_exception(); + _errHandler->recover(this, _localctx->exception); + } + + return _localctx; +} + //----------------- ExpressionContext ------------------------------------------------------------------ RiddleParser::ExpressionContext::ExpressionContext(ParserRuleContext *parent, size_t invokingState) @@ -2217,8 +2279,8 @@ tree::TerminalNode* RiddleParser::SelfSubRightExprContext::Sub(size_t i) { return getToken(RiddleParser::Sub, i); } -RiddleParser::ExprPtrContext* RiddleParser::SelfSubRightExprContext::exprPtr() { - return getRuleContext(0); +RiddleParser::ExprPtrParserContext* RiddleParser::SelfSubRightExprContext::exprPtrParser() { + return getRuleContext(0); } RiddleParser::SelfSubRightExprContext::SelfSubRightExprContext(ExpressionContext *ctx) { copyFrom(ctx); } @@ -2250,8 +2312,8 @@ tree::TerminalNode* RiddleParser::AndAssignExprContext::Assign() { return getToken(RiddleParser::Assign, 0); } -RiddleParser::ExprPtrContext* RiddleParser::AndAssignExprContext::exprPtr() { - return getRuleContext(0); +RiddleParser::ExprPtrParserContext* RiddleParser::AndAssignExprContext::exprPtrParser() { + return getRuleContext(0); } RiddleParser::ExpressionContext* RiddleParser::AndAssignExprContext::expression() { @@ -2332,8 +2394,8 @@ RiddleParser::TypeNameContext* RiddleParser::CastExprContext::typeName() { return getRuleContext(0); } -RiddleParser::ExprPtrContext* RiddleParser::CastExprContext::exprPtr() { - return getRuleContext(0); +RiddleParser::ExprPtrParserContext* RiddleParser::CastExprContext::exprPtrParser() { + return getRuleContext(0); } RiddleParser::CastExprContext::CastExprContext(ExpressionContext *ctx) { copyFrom(ctx); } @@ -2452,8 +2514,8 @@ tree::TerminalNode* RiddleParser::MulAssignExprContext::Assign() { return getToken(RiddleParser::Assign, 0); } -RiddleParser::ExprPtrContext* RiddleParser::MulAssignExprContext::exprPtr() { - return getRuleContext(0); +RiddleParser::ExprPtrParserContext* RiddleParser::MulAssignExprContext::exprPtrParser() { + return getRuleContext(0); } RiddleParser::ExpressionContext* RiddleParser::MulAssignExprContext::expression() { @@ -2489,8 +2551,8 @@ tree::TerminalNode* RiddleParser::XorAssignExprContext::Assign() { return getToken(RiddleParser::Assign, 0); } -RiddleParser::ExprPtrContext* RiddleParser::XorAssignExprContext::exprPtr() { - return getRuleContext(0); +RiddleParser::ExprPtrParserContext* RiddleParser::XorAssignExprContext::exprPtrParser() { + return getRuleContext(0); } RiddleParser::ExpressionContext* RiddleParser::XorAssignExprContext::expression() { @@ -2596,8 +2658,8 @@ tree::TerminalNode* RiddleParser::AddAssignExprContext::Assign() { return getToken(RiddleParser::Assign, 0); } -RiddleParser::ExprPtrContext* RiddleParser::AddAssignExprContext::exprPtr() { - return getRuleContext(0); +RiddleParser::ExprPtrParserContext* RiddleParser::AddAssignExprContext::exprPtrParser() { + return getRuleContext(0); } RiddleParser::ExpressionContext* RiddleParser::AddAssignExprContext::expression() { @@ -2633,8 +2695,8 @@ tree::TerminalNode* RiddleParser::OrAssignExprContext::Assign() { return getToken(RiddleParser::Assign, 0); } -RiddleParser::ExprPtrContext* RiddleParser::OrAssignExprContext::exprPtr() { - return getRuleContext(0); +RiddleParser::ExprPtrParserContext* RiddleParser::OrAssignExprContext::exprPtrParser() { + return getRuleContext(0); } RiddleParser::ExpressionContext* RiddleParser::OrAssignExprContext::expression() { @@ -2695,8 +2757,8 @@ std::any RiddleParser::BitXorExprContext::accept(tree::ParseTreeVisitor *visitor } //----------------- PtrExprContext ------------------------------------------------------------------ -RiddleParser::ExprPtrContext* RiddleParser::PtrExprContext::exprPtr() { - return getRuleContext(0); +RiddleParser::ExprPtrParserContext* RiddleParser::PtrExprContext::exprPtrParser() { + return getRuleContext(0); } RiddleParser::PtrExprContext::PtrExprContext(ExpressionContext *ctx) { copyFrom(ctx); } @@ -2786,8 +2848,8 @@ tree::TerminalNode* RiddleParser::DivAssignExprContext::Assign() { return getToken(RiddleParser::Assign, 0); } -RiddleParser::ExprPtrContext* RiddleParser::DivAssignExprContext::exprPtr() { - return getRuleContext(0); +RiddleParser::ExprPtrParserContext* RiddleParser::DivAssignExprContext::exprPtrParser() { + return getRuleContext(0); } RiddleParser::ExpressionContext* RiddleParser::DivAssignExprContext::expression() { @@ -2893,8 +2955,8 @@ tree::TerminalNode* RiddleParser::SelfSubLeftExprContext::Sub(size_t i) { return getToken(RiddleParser::Sub, i); } -RiddleParser::ExprPtrContext* RiddleParser::SelfSubLeftExprContext::exprPtr() { - return getRuleContext(0); +RiddleParser::ExprPtrParserContext* RiddleParser::SelfSubLeftExprContext::exprPtrParser() { + return getRuleContext(0); } RiddleParser::SelfSubLeftExprContext::SelfSubLeftExprContext(ExpressionContext *ctx) { copyFrom(ctx); } @@ -2988,8 +3050,8 @@ tree::TerminalNode* RiddleParser::AssignExprContext::Assign() { return getToken(RiddleParser::Assign, 0); } -RiddleParser::ExprPtrContext* RiddleParser::AssignExprContext::exprPtr() { - return getRuleContext(0); +RiddleParser::ExprPtrParserContext* RiddleParser::AssignExprContext::exprPtrParser() { + return getRuleContext(0); } RiddleParser::ExpressionContext* RiddleParser::AssignExprContext::expression() { @@ -3025,8 +3087,8 @@ tree::TerminalNode* RiddleParser::SelfAddRightExprContext::Add(size_t i) { return getToken(RiddleParser::Add, i); } -RiddleParser::ExprPtrContext* RiddleParser::SelfAddRightExprContext::exprPtr() { - return getRuleContext(0); +RiddleParser::ExprPtrParserContext* RiddleParser::SelfAddRightExprContext::exprPtrParser() { + return getRuleContext(0); } RiddleParser::SelfAddRightExprContext::SelfAddRightExprContext(ExpressionContext *ctx) { copyFrom(ctx); } @@ -3058,8 +3120,8 @@ tree::TerminalNode* RiddleParser::SubAssignExprContext::Assign() { return getToken(RiddleParser::Assign, 0); } -RiddleParser::ExprPtrContext* RiddleParser::SubAssignExprContext::exprPtr() { - return getRuleContext(0); +RiddleParser::ExprPtrParserContext* RiddleParser::SubAssignExprContext::exprPtrParser() { + return getRuleContext(0); } RiddleParser::ExpressionContext* RiddleParser::SubAssignExprContext::expression() { @@ -3256,8 +3318,8 @@ tree::TerminalNode* RiddleParser::SelfAddLeftExprContext::Add(size_t i) { return getToken(RiddleParser::Add, i); } -RiddleParser::ExprPtrContext* RiddleParser::SelfAddLeftExprContext::exprPtr() { - return getRuleContext(0); +RiddleParser::ExprPtrParserContext* RiddleParser::SelfAddLeftExprContext::exprPtrParser() { + return getRuleContext(0); } RiddleParser::SelfAddLeftExprContext::SelfAddLeftExprContext(ExpressionContext *ctx) { copyFrom(ctx); } @@ -3289,8 +3351,8 @@ tree::TerminalNode* RiddleParser::LShrAssignExprContext::Assign() { return getToken(RiddleParser::Assign, 0); } -RiddleParser::ExprPtrContext* RiddleParser::LShrAssignExprContext::exprPtr() { - return getRuleContext(0); +RiddleParser::ExprPtrParserContext* RiddleParser::LShrAssignExprContext::exprPtrParser() { + return getRuleContext(0); } RiddleParser::ExpressionContext* RiddleParser::LShrAssignExprContext::expression() { @@ -3363,8 +3425,8 @@ tree::TerminalNode* RiddleParser::AShrAssignExprContext::Assign() { return getToken(RiddleParser::Assign, 0); } -RiddleParser::ExprPtrContext* RiddleParser::AShrAssignExprContext::exprPtr() { - return getRuleContext(0); +RiddleParser::ExprPtrParserContext* RiddleParser::AShrAssignExprContext::exprPtrParser() { + return getRuleContext(0); } RiddleParser::ExpressionContext* RiddleParser::AShrAssignExprContext::expression() { @@ -3495,8 +3557,8 @@ tree::TerminalNode* RiddleParser::ShlAssignExprContext::Assign() { return getToken(RiddleParser::Assign, 0); } -RiddleParser::ExprPtrContext* RiddleParser::ShlAssignExprContext::exprPtr() { - return getRuleContext(0); +RiddleParser::ExprPtrParserContext* RiddleParser::ShlAssignExprContext::exprPtrParser() { + return getRuleContext(0); } RiddleParser::ExpressionContext* RiddleParser::ShlAssignExprContext::expression() { @@ -3532,8 +3594,8 @@ tree::TerminalNode* RiddleParser::ModAssignExprContext::Assign() { return getToken(RiddleParser::Assign, 0); } -RiddleParser::ExprPtrContext* RiddleParser::ModAssignExprContext::exprPtr() { - return getRuleContext(0); +RiddleParser::ExprPtrParserContext* RiddleParser::ModAssignExprContext::exprPtrParser() { + return getRuleContext(0); } RiddleParser::ExpressionContext* RiddleParser::ModAssignExprContext::expression() { @@ -3702,8 +3764,8 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { RiddleParser::ExpressionContext *_localctx = _tracker.createInstance(_ctx, parentState); RiddleParser::ExpressionContext *previousContext = _localctx; (void)previousContext; // Silence compiler, in case the context is not used by generated code. - size_t startState = 34; - enterRecursionRule(_localctx, 34, RiddleParser::RuleExpression, precedence); + size_t startState = 36; + enterRecursionRule(_localctx, 36, RiddleParser::RuleExpression, precedence); @@ -3717,7 +3779,7 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { try { size_t alt; enterOuterAlt(_localctx, 1); - setState(334); + setState(338); _errHandler->sync(this); switch (getInterpreter()->adaptivePredict(_input, 21, _ctx)) { case 1: { @@ -3725,17 +3787,17 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _ctx = _localctx; previousContext = _localctx; - setState(235); + setState(239); match(RiddleParser::Less); - setState(236); + setState(240); antlrcpp::downCast(_localctx)->type = typeName(0); - setState(237); + setState(241); match(RiddleParser::Greater); - setState(238); + setState(242); match(RiddleParser::LeftBracket); - setState(239); - antlrcpp::downCast(_localctx)->value = exprPtr(0); - setState(240); + setState(243); + antlrcpp::downCast(_localctx)->value = exprPtrParser(); + setState(244); match(RiddleParser::RightBracket); break; } @@ -3744,11 +3806,11 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = _tracker.createInstance(_localctx); _ctx = _localctx; previousContext = _localctx; - setState(242); + setState(246); match(RiddleParser::LeftBracket); - setState(243); + setState(247); antlrcpp::downCast(_localctx)->expr = expression(0); - setState(244); + setState(248); match(RiddleParser::RightBracket); break; } @@ -3757,9 +3819,9 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = _tracker.createInstance(_localctx); _ctx = _localctx; previousContext = _localctx; - setState(246); + setState(250); match(RiddleParser::Not); - setState(247); + setState(251); antlrcpp::downCast(_localctx)->expr = expression(43); break; } @@ -3768,9 +3830,9 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = _tracker.createInstance(_localctx); _ctx = _localctx; previousContext = _localctx; - setState(248); + setState(252); match(RiddleParser::Add); - setState(249); + setState(253); antlrcpp::downCast(_localctx)->expr = expression(42); break; } @@ -3779,9 +3841,9 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = _tracker.createInstance(_localctx); _ctx = _localctx; previousContext = _localctx; - setState(250); + setState(254); match(RiddleParser::Sub); - setState(251); + setState(255); antlrcpp::downCast(_localctx)->expr = expression(41); break; } @@ -3790,12 +3852,12 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = _tracker.createInstance(_localctx); _ctx = _localctx; previousContext = _localctx; - setState(252); + setState(256); match(RiddleParser::Add); - setState(253); + setState(257); match(RiddleParser::Add); - setState(254); - antlrcpp::downCast(_localctx)->expr = exprPtr(0); + setState(258); + antlrcpp::downCast(_localctx)->expr = exprPtrParser(); break; } @@ -3803,11 +3865,11 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = _tracker.createInstance(_localctx); _ctx = _localctx; previousContext = _localctx; - setState(255); - antlrcpp::downCast(_localctx)->expr = exprPtr(0); - setState(256); + setState(259); + antlrcpp::downCast(_localctx)->expr = exprPtrParser(); + setState(260); match(RiddleParser::Add); - setState(257); + setState(261); match(RiddleParser::Add); break; } @@ -3816,12 +3878,12 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = _tracker.createInstance(_localctx); _ctx = _localctx; previousContext = _localctx; - setState(259); + setState(263); match(RiddleParser::Sub); - setState(260); + setState(264); match(RiddleParser::Sub); - setState(261); - antlrcpp::downCast(_localctx)->expr = exprPtr(0); + setState(265); + antlrcpp::downCast(_localctx)->expr = exprPtrParser(); break; } @@ -3829,11 +3891,11 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = _tracker.createInstance(_localctx); _ctx = _localctx; previousContext = _localctx; - setState(262); - antlrcpp::downCast(_localctx)->expr = exprPtr(0); - setState(263); + setState(266); + antlrcpp::downCast(_localctx)->expr = exprPtrParser(); + setState(267); match(RiddleParser::Sub); - setState(264); + setState(268); match(RiddleParser::Sub); break; } @@ -3842,8 +3904,8 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = _tracker.createInstance(_localctx); _ctx = _localctx; previousContext = _localctx; - setState(266); - exprPtr(0); + setState(270); + exprPtrParser(); break; } @@ -3851,11 +3913,11 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = _tracker.createInstance(_localctx); _ctx = _localctx; previousContext = _localctx; - setState(267); - antlrcpp::downCast(_localctx)->left = exprPtr(0); - setState(268); + setState(271); + antlrcpp::downCast(_localctx)->left = exprPtrParser(); + setState(272); match(RiddleParser::Assign); - setState(269); + setState(273); antlrcpp::downCast(_localctx)->right = expression(16); break; } @@ -3864,13 +3926,13 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = _tracker.createInstance(_localctx); _ctx = _localctx; previousContext = _localctx; - setState(271); - antlrcpp::downCast(_localctx)->left = exprPtr(0); - setState(272); + setState(275); + antlrcpp::downCast(_localctx)->left = exprPtrParser(); + setState(276); match(RiddleParser::Add); - setState(273); + setState(277); match(RiddleParser::Assign); - setState(274); + setState(278); antlrcpp::downCast(_localctx)->right = expression(15); break; } @@ -3879,13 +3941,13 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = _tracker.createInstance(_localctx); _ctx = _localctx; previousContext = _localctx; - setState(276); - antlrcpp::downCast(_localctx)->left = exprPtr(0); - setState(277); + setState(280); + antlrcpp::downCast(_localctx)->left = exprPtrParser(); + setState(281); match(RiddleParser::Sub); - setState(278); + setState(282); match(RiddleParser::Assign); - setState(279); + setState(283); antlrcpp::downCast(_localctx)->right = expression(14); break; } @@ -3894,13 +3956,13 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = _tracker.createInstance(_localctx); _ctx = _localctx; previousContext = _localctx; - setState(281); - antlrcpp::downCast(_localctx)->left = exprPtr(0); - setState(282); + setState(285); + antlrcpp::downCast(_localctx)->left = exprPtrParser(); + setState(286); match(RiddleParser::Star); - setState(283); + setState(287); match(RiddleParser::Assign); - setState(284); + setState(288); antlrcpp::downCast(_localctx)->right = expression(13); break; } @@ -3909,13 +3971,13 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = _tracker.createInstance(_localctx); _ctx = _localctx; previousContext = _localctx; - setState(286); - antlrcpp::downCast(_localctx)->left = exprPtr(0); - setState(287); + setState(290); + antlrcpp::downCast(_localctx)->left = exprPtrParser(); + setState(291); match(RiddleParser::Div); - setState(288); + setState(292); match(RiddleParser::Assign); - setState(289); + setState(293); antlrcpp::downCast(_localctx)->right = expression(12); break; } @@ -3924,13 +3986,13 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = _tracker.createInstance(_localctx); _ctx = _localctx; previousContext = _localctx; - setState(291); - antlrcpp::downCast(_localctx)->left = exprPtr(0); - setState(292); + setState(295); + antlrcpp::downCast(_localctx)->left = exprPtrParser(); + setState(296); match(RiddleParser::Mod); - setState(293); + setState(297); match(RiddleParser::Assign); - setState(294); + setState(298); antlrcpp::downCast(_localctx)->right = expression(11); break; } @@ -3939,13 +4001,13 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = _tracker.createInstance(_localctx); _ctx = _localctx; previousContext = _localctx; - setState(296); - antlrcpp::downCast(_localctx)->left = exprPtr(0); - setState(297); + setState(300); + antlrcpp::downCast(_localctx)->left = exprPtrParser(); + setState(301); match(RiddleParser::Add); - setState(298); + setState(302); match(RiddleParser::Assign); - setState(299); + setState(303); antlrcpp::downCast(_localctx)->right = expression(10); break; } @@ -3954,13 +4016,13 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = _tracker.createInstance(_localctx); _ctx = _localctx; previousContext = _localctx; - setState(301); - antlrcpp::downCast(_localctx)->left = exprPtr(0); - setState(302); + setState(305); + antlrcpp::downCast(_localctx)->left = exprPtrParser(); + setState(306); match(RiddleParser::And); - setState(303); + setState(307); match(RiddleParser::Assign); - setState(304); + setState(308); antlrcpp::downCast(_localctx)->right = expression(9); break; } @@ -3969,13 +4031,13 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = _tracker.createInstance(_localctx); _ctx = _localctx; previousContext = _localctx; - setState(306); - antlrcpp::downCast(_localctx)->left = exprPtr(0); - setState(307); + setState(310); + antlrcpp::downCast(_localctx)->left = exprPtrParser(); + setState(311); match(RiddleParser::Or); - setState(308); + setState(312); match(RiddleParser::Assign); - setState(309); + setState(313); antlrcpp::downCast(_localctx)->right = expression(8); break; } @@ -3984,13 +4046,13 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = _tracker.createInstance(_localctx); _ctx = _localctx; previousContext = _localctx; - setState(311); - antlrcpp::downCast(_localctx)->left = exprPtr(0); - setState(312); + setState(315); + antlrcpp::downCast(_localctx)->left = exprPtrParser(); + setState(316); match(RiddleParser::Xor); - setState(313); + setState(317); match(RiddleParser::Assign); - setState(314); + setState(318); antlrcpp::downCast(_localctx)->right = expression(7); break; } @@ -3999,13 +4061,13 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = _tracker.createInstance(_localctx); _ctx = _localctx; previousContext = _localctx; - setState(316); - antlrcpp::downCast(_localctx)->left = exprPtr(0); - setState(317); + setState(320); + antlrcpp::downCast(_localctx)->left = exprPtrParser(); + setState(321); match(RiddleParser::LeftLeft); - setState(318); + setState(322); match(RiddleParser::Assign); - setState(319); + setState(323); antlrcpp::downCast(_localctx)->right = expression(6); break; } @@ -4014,13 +4076,13 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = _tracker.createInstance(_localctx); _ctx = _localctx; previousContext = _localctx; - setState(321); - antlrcpp::downCast(_localctx)->left = exprPtr(0); - setState(322); + setState(325); + antlrcpp::downCast(_localctx)->left = exprPtrParser(); + setState(326); match(RiddleParser::RightRight); - setState(323); + setState(327); match(RiddleParser::Assign); - setState(324); + setState(328); antlrcpp::downCast(_localctx)->right = expression(5); break; } @@ -4029,13 +4091,13 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = _tracker.createInstance(_localctx); _ctx = _localctx; previousContext = _localctx; - setState(326); - antlrcpp::downCast(_localctx)->left = exprPtr(0); - setState(327); + setState(330); + antlrcpp::downCast(_localctx)->left = exprPtrParser(); + setState(331); match(RiddleParser::RightRightRight); - setState(328); + setState(332); match(RiddleParser::Assign); - setState(329); + setState(333); antlrcpp::downCast(_localctx)->right = expression(4); break; } @@ -4044,7 +4106,7 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = _tracker.createInstance(_localctx); _ctx = _localctx; previousContext = _localctx; - setState(331); + setState(335); string(); break; } @@ -4053,7 +4115,7 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = _tracker.createInstance(_localctx); _ctx = _localctx; previousContext = _localctx; - setState(332); + setState(336); number(); break; } @@ -4062,7 +4124,7 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = _tracker.createInstance(_localctx); _ctx = _localctx; previousContext = _localctx; - setState(333); + setState(337); boolean(); break; } @@ -4071,7 +4133,7 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { break; } _ctx->stop = _input->LT(-1); - setState(400); + setState(404); _errHandler->sync(this); alt = getInterpreter()->adaptivePredict(_input, 23, _ctx); while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { @@ -4079,7 +4141,7 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { if (!_parseListeners.empty()) triggerExitRuleEvent(); previousContext = _localctx; - setState(398); + setState(402); _errHandler->sync(this); switch (getInterpreter()->adaptivePredict(_input, 22, _ctx)) { case 1: { @@ -4087,12 +4149,12 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = newContext; newContext->left = previousContext; pushNewRecursionContext(newContext, startState, RuleExpression); - setState(336); + setState(340); if (!(precpred(_ctx, 35))) throw FailedPredicateException(this, "precpred(_ctx, 35)"); - setState(337); + setState(341); match(RiddleParser::Star); - setState(338); + setState(342); antlrcpp::downCast(_localctx)->right = expression(36); break; } @@ -4102,12 +4164,12 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = newContext; newContext->left = previousContext; pushNewRecursionContext(newContext, startState, RuleExpression); - setState(339); + setState(343); if (!(precpred(_ctx, 34))) throw FailedPredicateException(this, "precpred(_ctx, 34)"); - setState(340); + setState(344); match(RiddleParser::Div); - setState(341); + setState(345); antlrcpp::downCast(_localctx)->right = expression(35); break; } @@ -4117,12 +4179,12 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = newContext; newContext->left = previousContext; pushNewRecursionContext(newContext, startState, RuleExpression); - setState(342); + setState(346); if (!(precpred(_ctx, 33))) throw FailedPredicateException(this, "precpred(_ctx, 33)"); - setState(343); + setState(347); match(RiddleParser::Mod); - setState(344); + setState(348); antlrcpp::downCast(_localctx)->right = expression(34); break; } @@ -4132,12 +4194,12 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = newContext; newContext->left = previousContext; pushNewRecursionContext(newContext, startState, RuleExpression); - setState(345); + setState(349); if (!(precpred(_ctx, 32))) throw FailedPredicateException(this, "precpred(_ctx, 32)"); - setState(346); + setState(350); match(RiddleParser::Add); - setState(347); + setState(351); antlrcpp::downCast(_localctx)->right = expression(33); break; } @@ -4147,12 +4209,12 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = newContext; newContext->left = previousContext; pushNewRecursionContext(newContext, startState, RuleExpression); - setState(348); + setState(352); if (!(precpred(_ctx, 31))) throw FailedPredicateException(this, "precpred(_ctx, 31)"); - setState(349); + setState(353); match(RiddleParser::Sub); - setState(350); + setState(354); antlrcpp::downCast(_localctx)->right = expression(32); break; } @@ -4162,12 +4224,12 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = newContext; newContext->left = previousContext; pushNewRecursionContext(newContext, startState, RuleExpression); - setState(351); + setState(355); if (!(precpred(_ctx, 30))) throw FailedPredicateException(this, "precpred(_ctx, 30)"); - setState(352); + setState(356); match(RiddleParser::LeftLeft); - setState(353); + setState(357); antlrcpp::downCast(_localctx)->right = expression(31); break; } @@ -4177,12 +4239,12 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = newContext; newContext->left = previousContext; pushNewRecursionContext(newContext, startState, RuleExpression); - setState(354); + setState(358); if (!(precpred(_ctx, 29))) throw FailedPredicateException(this, "precpred(_ctx, 29)"); - setState(355); + setState(359); match(RiddleParser::RightRight); - setState(356); + setState(360); antlrcpp::downCast(_localctx)->right = expression(30); break; } @@ -4192,12 +4254,12 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = newContext; newContext->left = previousContext; pushNewRecursionContext(newContext, startState, RuleExpression); - setState(357); + setState(361); if (!(precpred(_ctx, 28))) throw FailedPredicateException(this, "precpred(_ctx, 28)"); - setState(358); + setState(362); match(RiddleParser::RightRightRight); - setState(359); + setState(363); antlrcpp::downCast(_localctx)->right = expression(29); break; } @@ -4207,12 +4269,12 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = newContext; newContext->left = previousContext; pushNewRecursionContext(newContext, startState, RuleExpression); - setState(360); + setState(364); if (!(precpred(_ctx, 27))) throw FailedPredicateException(this, "precpred(_ctx, 27)"); - setState(361); + setState(365); match(RiddleParser::Greater); - setState(362); + setState(366); antlrcpp::downCast(_localctx)->right = expression(28); break; } @@ -4222,12 +4284,12 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = newContext; newContext->left = previousContext; pushNewRecursionContext(newContext, startState, RuleExpression); - setState(363); + setState(367); if (!(precpred(_ctx, 26))) throw FailedPredicateException(this, "precpred(_ctx, 26)"); - setState(364); + setState(368); match(RiddleParser::Less); - setState(365); + setState(369); antlrcpp::downCast(_localctx)->right = expression(27); break; } @@ -4237,14 +4299,14 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = newContext; newContext->left = previousContext; pushNewRecursionContext(newContext, startState, RuleExpression); - setState(366); + setState(370); if (!(precpred(_ctx, 25))) throw FailedPredicateException(this, "precpred(_ctx, 25)"); - setState(367); + setState(371); match(RiddleParser::Greater); - setState(368); + setState(372); match(RiddleParser::Assign); - setState(369); + setState(373); antlrcpp::downCast(_localctx)->right = expression(26); break; } @@ -4254,14 +4316,14 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = newContext; newContext->left = previousContext; pushNewRecursionContext(newContext, startState, RuleExpression); - setState(370); + setState(374); if (!(precpred(_ctx, 24))) throw FailedPredicateException(this, "precpred(_ctx, 24)"); - setState(371); + setState(375); match(RiddleParser::Less); - setState(372); + setState(376); match(RiddleParser::Assign); - setState(373); + setState(377); antlrcpp::downCast(_localctx)->right = expression(25); break; } @@ -4271,12 +4333,12 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = newContext; newContext->left = previousContext; pushNewRecursionContext(newContext, startState, RuleExpression); - setState(374); + setState(378); if (!(precpred(_ctx, 23))) throw FailedPredicateException(this, "precpred(_ctx, 23)"); - setState(375); + setState(379); match(RiddleParser::Equal); - setState(376); + setState(380); antlrcpp::downCast(_localctx)->right = expression(24); break; } @@ -4286,14 +4348,14 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = newContext; newContext->left = previousContext; pushNewRecursionContext(newContext, startState, RuleExpression); - setState(377); + setState(381); if (!(precpred(_ctx, 22))) throw FailedPredicateException(this, "precpred(_ctx, 22)"); - setState(378); + setState(382); match(RiddleParser::Not); - setState(379); + setState(383); match(RiddleParser::Assign); - setState(380); + setState(384); antlrcpp::downCast(_localctx)->right = expression(23); break; } @@ -4303,12 +4365,12 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = newContext; newContext->left = previousContext; pushNewRecursionContext(newContext, startState, RuleExpression); - setState(381); + setState(385); if (!(precpred(_ctx, 21))) throw FailedPredicateException(this, "precpred(_ctx, 21)"); - setState(382); + setState(386); match(RiddleParser::And); - setState(383); + setState(387); antlrcpp::downCast(_localctx)->right = expression(22); break; } @@ -4318,12 +4380,12 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = newContext; newContext->left = previousContext; pushNewRecursionContext(newContext, startState, RuleExpression); - setState(384); + setState(388); if (!(precpred(_ctx, 20))) throw FailedPredicateException(this, "precpred(_ctx, 20)"); - setState(385); + setState(389); match(RiddleParser::Xor); - setState(386); + setState(390); antlrcpp::downCast(_localctx)->right = expression(21); break; } @@ -4333,12 +4395,12 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = newContext; newContext->left = previousContext; pushNewRecursionContext(newContext, startState, RuleExpression); - setState(387); + setState(391); if (!(precpred(_ctx, 19))) throw FailedPredicateException(this, "precpred(_ctx, 19)"); - setState(388); + setState(392); match(RiddleParser::Or); - setState(389); + setState(393); antlrcpp::downCast(_localctx)->right = expression(20); break; } @@ -4348,14 +4410,14 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = newContext; newContext->left = previousContext; pushNewRecursionContext(newContext, startState, RuleExpression); - setState(390); + setState(394); if (!(precpred(_ctx, 18))) throw FailedPredicateException(this, "precpred(_ctx, 18)"); - setState(391); + setState(395); match(RiddleParser::And); - setState(392); + setState(396); match(RiddleParser::And); - setState(393); + setState(397); antlrcpp::downCast(_localctx)->right = expression(19); break; } @@ -4365,14 +4427,14 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { _localctx = newContext; newContext->left = previousContext; pushNewRecursionContext(newContext, startState, RuleExpression); - setState(394); + setState(398); if (!(precpred(_ctx, 17))) throw FailedPredicateException(this, "precpred(_ctx, 17)"); - setState(395); + setState(399); match(RiddleParser::Or); - setState(396); + setState(400); match(RiddleParser::Or); - setState(397); + setState(401); antlrcpp::downCast(_localctx)->right = expression(18); break; } @@ -4381,7 +4443,7 @@ RiddleParser::ExpressionContext* RiddleParser::expression(int precedence) { break; } } - setState(402); + setState(406); _errHandler->sync(this); alt = getInterpreter()->adaptivePredict(_input, 23, _ctx); } @@ -4443,7 +4505,7 @@ std::any RiddleParser::IdContext::accept(tree::ParseTreeVisitor *visitor) { RiddleParser::IdContext* RiddleParser::id() { IdContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 36, RiddleParser::RuleId); + enterRule(_localctx, 38, RiddleParser::RuleId); #if __cplusplus > 201703L auto onExit = finally([=, this] { @@ -4455,19 +4517,19 @@ RiddleParser::IdContext* RiddleParser::id() { try { size_t alt; enterOuterAlt(_localctx, 1); - setState(403); + setState(407); match(RiddleParser::Identifier); - setState(408); + setState(412); _errHandler->sync(this); alt = getInterpreter()->adaptivePredict(_input, 24, _ctx); while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { if (alt == 1) { - setState(404); + setState(408); match(RiddleParser::Dot); - setState(405); + setState(409); match(RiddleParser::Identifier); } - setState(410); + setState(414); _errHandler->sync(this); alt = getInterpreter()->adaptivePredict(_input, 24, _ctx); } @@ -4523,7 +4585,7 @@ std::any RiddleParser::NumberContext::accept(tree::ParseTreeVisitor *visitor) { RiddleParser::NumberContext* RiddleParser::number() { NumberContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 38, RiddleParser::RuleNumber); + enterRule(_localctx, 40, RiddleParser::RuleNumber); #if __cplusplus > 201703L auto onExit = finally([=, this] { @@ -4533,7 +4595,7 @@ RiddleParser::NumberContext* RiddleParser::number() { exitRule(); }); try { - setState(413); + setState(417); _errHandler->sync(this); switch (_input->LA(1)) { case RiddleParser::Hexadecimal: @@ -4541,14 +4603,14 @@ RiddleParser::NumberContext* RiddleParser::number() { case RiddleParser::Octal: case RiddleParser::Binary: { enterOuterAlt(_localctx, 1); - setState(411); + setState(415); integer(); break; } case RiddleParser::Float: { enterOuterAlt(_localctx, 2); - setState(412); + setState(416); float_(); break; } @@ -4608,7 +4670,7 @@ std::any RiddleParser::BooleanContext::accept(tree::ParseTreeVisitor *visitor) { RiddleParser::BooleanContext* RiddleParser::boolean() { BooleanContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 40, RiddleParser::RuleBoolean); + enterRule(_localctx, 42, RiddleParser::RuleBoolean); #if __cplusplus > 201703L auto onExit = finally([=, this] { @@ -4618,12 +4680,12 @@ RiddleParser::BooleanContext* RiddleParser::boolean() { exitRule(); }); try { - setState(419); + setState(423); _errHandler->sync(this); switch (_input->LA(1)) { case RiddleParser::True: { enterOuterAlt(_localctx, 1); - setState(415); + setState(419); match(RiddleParser::True); antlrcpp::downCast(_localctx)->value = true; break; @@ -4631,7 +4693,7 @@ RiddleParser::BooleanContext* RiddleParser::boolean() { case RiddleParser::False: { enterOuterAlt(_localctx, 2); - setState(417); + setState(421); match(RiddleParser::False); antlrcpp::downCast(_localctx)->value = false; break; @@ -4688,7 +4750,7 @@ std::any RiddleParser::StringContext::accept(tree::ParseTreeVisitor *visitor) { RiddleParser::StringContext* RiddleParser::string() { StringContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 42, RiddleParser::RuleString); + enterRule(_localctx, 44, RiddleParser::RuleString); #if __cplusplus > 201703L auto onExit = finally([=, this] { @@ -4699,7 +4761,7 @@ RiddleParser::StringContext* RiddleParser::string() { }); try { enterOuterAlt(_localctx, 1); - setState(421); + setState(425); match(RiddleParser::STRING); } @@ -4749,7 +4811,7 @@ std::any RiddleParser::FloatContext::accept(tree::ParseTreeVisitor *visitor) { RiddleParser::FloatContext* RiddleParser::float_() { FloatContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 44, RiddleParser::RuleFloat); + enterRule(_localctx, 46, RiddleParser::RuleFloat); #if __cplusplus > 201703L auto onExit = finally([=, this] { @@ -4760,7 +4822,7 @@ RiddleParser::FloatContext* RiddleParser::float_() { }); try { enterOuterAlt(_localctx, 1); - setState(423); + setState(427); antlrcpp::downCast(_localctx)->floatToken = match(RiddleParser::Float); antlrcpp::downCast(_localctx)->value = stod((antlrcpp::downCast(_localctx)->floatToken != nullptr ? antlrcpp::downCast(_localctx)->floatToken->getText() : "")); @@ -4825,7 +4887,7 @@ std::any RiddleParser::IntegerContext::accept(tree::ParseTreeVisitor *visitor) { RiddleParser::IntegerContext* RiddleParser::integer() { IntegerContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 46, RiddleParser::RuleInteger); + enterRule(_localctx, 48, RiddleParser::RuleInteger); #if __cplusplus > 201703L auto onExit = finally([=, this] { @@ -4835,12 +4897,12 @@ RiddleParser::IntegerContext* RiddleParser::integer() { exitRule(); }); try { - setState(434); + setState(438); _errHandler->sync(this); switch (_input->LA(1)) { case RiddleParser::Decimal: { enterOuterAlt(_localctx, 1); - setState(426); + setState(430); antlrcpp::downCast(_localctx)->decimalToken = match(RiddleParser::Decimal); antlrcpp::downCast(_localctx)->value = stoi((antlrcpp::downCast(_localctx)->decimalToken != nullptr ? antlrcpp::downCast(_localctx)->decimalToken->getText() : "")); @@ -4850,7 +4912,7 @@ RiddleParser::IntegerContext* RiddleParser::integer() { case RiddleParser::Hexadecimal: { enterOuterAlt(_localctx, 2); - setState(428); + setState(432); antlrcpp::downCast(_localctx)->hexadecimalToken = match(RiddleParser::Hexadecimal); antlrcpp::downCast(_localctx)->value = stoi((antlrcpp::downCast(_localctx)->hexadecimalToken != nullptr ? antlrcpp::downCast(_localctx)->hexadecimalToken->getText() : "").substr(2),nullptr,16); @@ -4860,7 +4922,7 @@ RiddleParser::IntegerContext* RiddleParser::integer() { case RiddleParser::Binary: { enterOuterAlt(_localctx, 3); - setState(430); + setState(434); antlrcpp::downCast(_localctx)->binaryToken = match(RiddleParser::Binary); antlrcpp::downCast(_localctx)->value = stoi((antlrcpp::downCast(_localctx)->binaryToken != nullptr ? antlrcpp::downCast(_localctx)->binaryToken->getText() : "").substr(2),nullptr,2); @@ -4870,7 +4932,7 @@ RiddleParser::IntegerContext* RiddleParser::integer() { case RiddleParser::Octal: { enterOuterAlt(_localctx, 4); - setState(432); + setState(436); antlrcpp::downCast(_localctx)->octalToken = match(RiddleParser::Octal); antlrcpp::downCast(_localctx)->value = stoi((antlrcpp::downCast(_localctx)->octalToken != nullptr ? antlrcpp::downCast(_localctx)->octalToken->getText() : "").substr(1),nullptr,8); @@ -4933,7 +4995,7 @@ std::any RiddleParser::TemplateArgContext::accept(tree::ParseTreeVisitor *visito RiddleParser::TemplateArgContext* RiddleParser::templateArg() { TemplateArgContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 48, RiddleParser::RuleTemplateArg); + enterRule(_localctx, 50, RiddleParser::RuleTemplateArg); #if __cplusplus > 201703L auto onExit = finally([=, this] { @@ -4943,19 +5005,19 @@ RiddleParser::TemplateArgContext* RiddleParser::templateArg() { exitRule(); }); try { - setState(438); + setState(442); _errHandler->sync(this); switch (getInterpreter()->adaptivePredict(_input, 28, _ctx)) { case 1: { enterOuterAlt(_localctx, 1); - setState(436); + setState(440); expression(0); break; } case 2: { enterOuterAlt(_localctx, 2); - setState(437); + setState(441); typeName(0); break; } @@ -5023,7 +5085,7 @@ std::any RiddleParser::TemplateArgsContext::accept(tree::ParseTreeVisitor *visit RiddleParser::TemplateArgsContext* RiddleParser::templateArgs() { TemplateArgsContext *_localctx = _tracker.createInstance(_ctx, getState()); - enterRule(_localctx, 50, RiddleParser::RuleTemplateArgs); + enterRule(_localctx, 52, RiddleParser::RuleTemplateArgs); size_t _la = 0; #if __cplusplus > 201703L @@ -5036,27 +5098,27 @@ RiddleParser::TemplateArgsContext* RiddleParser::templateArgs() { try { size_t alt; enterOuterAlt(_localctx, 1); - setState(449); + setState(453); _errHandler->sync(this); _la = _input->LA(1); if ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & 1188389761150287872) != 0)) { - setState(445); + setState(449); _errHandler->sync(this); alt = getInterpreter()->adaptivePredict(_input, 29, _ctx); while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { if (alt == 1) { - setState(440); + setState(444); templateArg(); - setState(441); + setState(445); match(RiddleParser::Comma); } - setState(447); + setState(451); _errHandler->sync(this); alt = getInterpreter()->adaptivePredict(_input, 29, _ctx); } - setState(448); + setState(452); templateArg(); } @@ -5144,8 +5206,8 @@ RiddleParser::TypeNameContext* RiddleParser::typeName(int precedence) { RiddleParser::TypeNameContext *_localctx = _tracker.createInstance(_ctx, parentState); RiddleParser::TypeNameContext *previousContext = _localctx; (void)previousContext; // Silence compiler, in case the context is not used by generated code. - size_t startState = 52; - enterRecursionRule(_localctx, 52, RiddleParser::RuleTypeName, precedence); + size_t startState = 54; + enterRecursionRule(_localctx, 54, RiddleParser::RuleTypeName, precedence); @@ -5159,23 +5221,23 @@ RiddleParser::TypeNameContext* RiddleParser::typeName(int precedence) { try { size_t alt; enterOuterAlt(_localctx, 1); - setState(458); + setState(462); _errHandler->sync(this); switch (getInterpreter()->adaptivePredict(_input, 31, _ctx)) { case 1: { - setState(452); + setState(456); antlrcpp::downCast(_localctx)->name = id(); break; } case 2: { - setState(453); + setState(457); antlrcpp::downCast(_localctx)->name = id(); - setState(454); + setState(458); match(RiddleParser::Less); - setState(455); + setState(459); antlrcpp::downCast(_localctx)->args = templateArgs(); - setState(456); + setState(460); match(RiddleParser::Greater); break; } @@ -5184,7 +5246,7 @@ RiddleParser::TypeNameContext* RiddleParser::typeName(int precedence) { break; } _ctx->stop = _input->LT(-1); - setState(467); + setState(471); _errHandler->sync(this); alt = getInterpreter()->adaptivePredict(_input, 32, _ctx); while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { @@ -5195,17 +5257,17 @@ RiddleParser::TypeNameContext* RiddleParser::typeName(int precedence) { _localctx = _tracker.createInstance(parentContext, parentState); _localctx->baseType = previousContext; pushNewRecursionContext(_localctx, startState, RuleTypeName); - setState(460); + setState(464); if (!(precpred(_ctx, 1))) throw FailedPredicateException(this, "precpred(_ctx, 1)"); - setState(461); + setState(465); match(RiddleParser::LeftSquare); - setState(462); + setState(466); antlrcpp::downCast(_localctx)->size = expression(0); - setState(463); + setState(467); match(RiddleParser::RightSquare); } - setState(469); + setState(473); _errHandler->sync(this); alt = getInterpreter()->adaptivePredict(_input, 32, _ctx); } @@ -5221,8 +5283,8 @@ RiddleParser::TypeNameContext* RiddleParser::typeName(int precedence) { bool RiddleParser::sempred(RuleContext *context, size_t ruleIndex, size_t predicateIndex) { switch (ruleIndex) { case 16: return exprPtrSempred(antlrcpp::downCast(context), predicateIndex); - case 17: return expressionSempred(antlrcpp::downCast(context), predicateIndex); - case 26: return typeNameSempred(antlrcpp::downCast(context), predicateIndex); + case 18: return expressionSempred(antlrcpp::downCast(context), predicateIndex); + case 27: return typeNameSempred(antlrcpp::downCast(context), predicateIndex); default: break; diff --git a/parser/RiddleParser.h b/parser/RiddleParser.h index 1d94446..fee3550 100644 --- a/parser/RiddleParser.h +++ b/parser/RiddleParser.h @@ -31,9 +31,10 @@ class RiddleParser : public antlr4::Parser { RuleImportStatement = 4, RuleVarDefineStatement = 5, RuleArgsExpr = 6, RuleDefineArgs = 7, RuleFuncDefine = 8, RuleFuncBody = 9, RuleForStatement = 10, RuleWhileStatement = 11, RuleIfStatement = 12, RuleReturnStatement = 13, - RuleClassDefine = 14, RuleClassBody = 15, RuleExprPtr = 16, RuleExpression = 17, - RuleId = 18, RuleNumber = 19, RuleBoolean = 20, RuleString = 21, RuleFloat = 22, - RuleInteger = 23, RuleTemplateArg = 24, RuleTemplateArgs = 25, RuleTypeName = 26 + RuleClassDefine = 14, RuleClassBody = 15, RuleExprPtr = 16, RuleExprPtrParser = 17, + RuleExpression = 18, RuleId = 19, RuleNumber = 20, RuleBoolean = 21, + RuleString = 22, RuleFloat = 23, RuleInteger = 24, RuleTemplateArg = 25, + RuleTemplateArgs = 26, RuleTypeName = 27 }; explicit RiddleParser(antlr4::TokenStream *input); @@ -70,6 +71,7 @@ class RiddleParser : public antlr4::Parser { class ClassDefineContext; class ClassBodyContext; class ExprPtrContext; + class ExprPtrParserContext; class ExpressionContext; class IdContext; class NumberContext; @@ -468,6 +470,21 @@ class RiddleParser : public antlr4::Parser { ExprPtrContext* exprPtr(); ExprPtrContext* exprPtr(int precedence); + class ExprPtrParserContext : public antlr4::ParserRuleContext { + public: + ExprPtrParserContext(antlr4::ParserRuleContext *parent, size_t invokingState); + virtual size_t getRuleIndex() const override; + ExprPtrContext *exprPtr(); + + virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override; + virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override; + + virtual std::any accept(antlr4::tree::ParseTreeVisitor *visitor) override; + + }; + + ExprPtrParserContext* exprPtrParser(); + class ExpressionContext : public antlr4::ParserRuleContext { public: ExpressionContext(antlr4::ParserRuleContext *parent, size_t invokingState); @@ -485,10 +502,10 @@ class RiddleParser : public antlr4::Parser { public: SelfSubRightExprContext(ExpressionContext *ctx); - RiddleParser::ExprPtrContext *expr = nullptr; + RiddleParser::ExprPtrParserContext *expr = nullptr; std::vector Sub(); antlr4::tree::TerminalNode* Sub(size_t i); - ExprPtrContext *exprPtr(); + ExprPtrParserContext *exprPtrParser(); virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override; virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override; @@ -499,11 +516,11 @@ class RiddleParser : public antlr4::Parser { public: AndAssignExprContext(ExpressionContext *ctx); - RiddleParser::ExprPtrContext *left = nullptr; + RiddleParser::ExprPtrParserContext *left = nullptr; RiddleParser::ExpressionContext *right = nullptr; antlr4::tree::TerminalNode *And(); antlr4::tree::TerminalNode *Assign(); - ExprPtrContext *exprPtr(); + ExprPtrParserContext *exprPtrParser(); ExpressionContext *expression(); virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override; virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override; @@ -531,13 +548,13 @@ class RiddleParser : public antlr4::Parser { CastExprContext(ExpressionContext *ctx); RiddleParser::TypeNameContext *type = nullptr; - RiddleParser::ExprPtrContext *value = nullptr; + RiddleParser::ExprPtrParserContext *value = nullptr; antlr4::tree::TerminalNode *Less(); antlr4::tree::TerminalNode *Greater(); antlr4::tree::TerminalNode *LeftBracket(); antlr4::tree::TerminalNode *RightBracket(); TypeNameContext *typeName(); - ExprPtrContext *exprPtr(); + ExprPtrParserContext *exprPtrParser(); virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override; virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override; @@ -587,11 +604,11 @@ class RiddleParser : public antlr4::Parser { public: MulAssignExprContext(ExpressionContext *ctx); - RiddleParser::ExprPtrContext *left = nullptr; + RiddleParser::ExprPtrParserContext *left = nullptr; RiddleParser::ExpressionContext *right = nullptr; antlr4::tree::TerminalNode *Star(); antlr4::tree::TerminalNode *Assign(); - ExprPtrContext *exprPtr(); + ExprPtrParserContext *exprPtrParser(); ExpressionContext *expression(); virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override; virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override; @@ -603,11 +620,11 @@ class RiddleParser : public antlr4::Parser { public: XorAssignExprContext(ExpressionContext *ctx); - RiddleParser::ExprPtrContext *left = nullptr; + RiddleParser::ExprPtrParserContext *left = nullptr; RiddleParser::ExpressionContext *right = nullptr; antlr4::tree::TerminalNode *Xor(); antlr4::tree::TerminalNode *Assign(); - ExprPtrContext *exprPtr(); + ExprPtrParserContext *exprPtrParser(); ExpressionContext *expression(); virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override; virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override; @@ -650,11 +667,11 @@ class RiddleParser : public antlr4::Parser { public: AddAssignExprContext(ExpressionContext *ctx); - RiddleParser::ExprPtrContext *left = nullptr; + RiddleParser::ExprPtrParserContext *left = nullptr; RiddleParser::ExpressionContext *right = nullptr; antlr4::tree::TerminalNode *Add(); antlr4::tree::TerminalNode *Assign(); - ExprPtrContext *exprPtr(); + ExprPtrParserContext *exprPtrParser(); ExpressionContext *expression(); virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override; virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override; @@ -666,11 +683,11 @@ class RiddleParser : public antlr4::Parser { public: OrAssignExprContext(ExpressionContext *ctx); - RiddleParser::ExprPtrContext *left = nullptr; + RiddleParser::ExprPtrParserContext *left = nullptr; RiddleParser::ExpressionContext *right = nullptr; antlr4::tree::TerminalNode *Or(); antlr4::tree::TerminalNode *Assign(); - ExprPtrContext *exprPtr(); + ExprPtrParserContext *exprPtrParser(); ExpressionContext *expression(); virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override; virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override; @@ -697,7 +714,7 @@ class RiddleParser : public antlr4::Parser { public: PtrExprContext(ExpressionContext *ctx); - ExprPtrContext *exprPtr(); + ExprPtrParserContext *exprPtrParser(); virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override; virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override; @@ -734,11 +751,11 @@ class RiddleParser : public antlr4::Parser { public: DivAssignExprContext(ExpressionContext *ctx); - RiddleParser::ExprPtrContext *left = nullptr; + RiddleParser::ExprPtrParserContext *left = nullptr; RiddleParser::ExpressionContext *right = nullptr; antlr4::tree::TerminalNode *Div(); antlr4::tree::TerminalNode *Assign(); - ExprPtrContext *exprPtr(); + ExprPtrParserContext *exprPtrParser(); ExpressionContext *expression(); virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override; virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override; @@ -781,10 +798,10 @@ class RiddleParser : public antlr4::Parser { public: SelfSubLeftExprContext(ExpressionContext *ctx); - RiddleParser::ExprPtrContext *expr = nullptr; + RiddleParser::ExprPtrParserContext *expr = nullptr; std::vector Sub(); antlr4::tree::TerminalNode* Sub(size_t i); - ExprPtrContext *exprPtr(); + ExprPtrParserContext *exprPtrParser(); virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override; virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override; @@ -825,10 +842,10 @@ class RiddleParser : public antlr4::Parser { public: AssignExprContext(ExpressionContext *ctx); - RiddleParser::ExprPtrContext *left = nullptr; + RiddleParser::ExprPtrParserContext *left = nullptr; RiddleParser::ExpressionContext *right = nullptr; antlr4::tree::TerminalNode *Assign(); - ExprPtrContext *exprPtr(); + ExprPtrParserContext *exprPtrParser(); ExpressionContext *expression(); virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override; virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override; @@ -840,10 +857,10 @@ class RiddleParser : public antlr4::Parser { public: SelfAddRightExprContext(ExpressionContext *ctx); - RiddleParser::ExprPtrContext *expr = nullptr; + RiddleParser::ExprPtrParserContext *expr = nullptr; std::vector Add(); antlr4::tree::TerminalNode* Add(size_t i); - ExprPtrContext *exprPtr(); + ExprPtrParserContext *exprPtrParser(); virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override; virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override; @@ -854,11 +871,11 @@ class RiddleParser : public antlr4::Parser { public: SubAssignExprContext(ExpressionContext *ctx); - RiddleParser::ExprPtrContext *left = nullptr; + RiddleParser::ExprPtrParserContext *left = nullptr; RiddleParser::ExpressionContext *right = nullptr; antlr4::tree::TerminalNode *Sub(); antlr4::tree::TerminalNode *Assign(); - ExprPtrContext *exprPtr(); + ExprPtrParserContext *exprPtrParser(); ExpressionContext *expression(); virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override; virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override; @@ -941,10 +958,10 @@ class RiddleParser : public antlr4::Parser { public: SelfAddLeftExprContext(ExpressionContext *ctx); - RiddleParser::ExprPtrContext *expr = nullptr; + RiddleParser::ExprPtrParserContext *expr = nullptr; std::vector Add(); antlr4::tree::TerminalNode* Add(size_t i); - ExprPtrContext *exprPtr(); + ExprPtrParserContext *exprPtrParser(); virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override; virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override; @@ -955,11 +972,11 @@ class RiddleParser : public antlr4::Parser { public: LShrAssignExprContext(ExpressionContext *ctx); - RiddleParser::ExprPtrContext *left = nullptr; + RiddleParser::ExprPtrParserContext *left = nullptr; RiddleParser::ExpressionContext *right = nullptr; antlr4::tree::TerminalNode *RightRightRight(); antlr4::tree::TerminalNode *Assign(); - ExprPtrContext *exprPtr(); + ExprPtrParserContext *exprPtrParser(); ExpressionContext *expression(); virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override; virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override; @@ -987,11 +1004,11 @@ class RiddleParser : public antlr4::Parser { public: AShrAssignExprContext(ExpressionContext *ctx); - RiddleParser::ExprPtrContext *left = nullptr; + RiddleParser::ExprPtrParserContext *left = nullptr; RiddleParser::ExpressionContext *right = nullptr; antlr4::tree::TerminalNode *RightRight(); antlr4::tree::TerminalNode *Assign(); - ExprPtrContext *exprPtr(); + ExprPtrParserContext *exprPtrParser(); ExpressionContext *expression(); virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override; virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override; @@ -1046,11 +1063,11 @@ class RiddleParser : public antlr4::Parser { public: ShlAssignExprContext(ExpressionContext *ctx); - RiddleParser::ExprPtrContext *left = nullptr; + RiddleParser::ExprPtrParserContext *left = nullptr; RiddleParser::ExpressionContext *right = nullptr; antlr4::tree::TerminalNode *LeftLeft(); antlr4::tree::TerminalNode *Assign(); - ExprPtrContext *exprPtr(); + ExprPtrParserContext *exprPtrParser(); ExpressionContext *expression(); virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override; virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override; @@ -1062,11 +1079,11 @@ class RiddleParser : public antlr4::Parser { public: ModAssignExprContext(ExpressionContext *ctx); - RiddleParser::ExprPtrContext *left = nullptr; + RiddleParser::ExprPtrParserContext *left = nullptr; RiddleParser::ExpressionContext *right = nullptr; antlr4::tree::TerminalNode *Mod(); antlr4::tree::TerminalNode *Assign(); - ExprPtrContext *exprPtr(); + ExprPtrParserContext *exprPtrParser(); ExpressionContext *expression(); virtual void enterRule(antlr4::tree::ParseTreeListener *listener) override; virtual void exitRule(antlr4::tree::ParseTreeListener *listener) override; diff --git a/parser/RiddleParser.interp b/parser/RiddleParser.interp index c591b19..ad6ab82 100644 --- a/parser/RiddleParser.interp +++ b/parser/RiddleParser.interp @@ -148,6 +148,7 @@ returnStatement classDefine classBody exprPtr +exprPtrParser expression id number @@ -161,4 +162,4 @@ typeName atn: -[4, 1, 63, 471, 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, 1, 0, 5, 0, 56, 8, 0, 10, 0, 12, 0, 59, 9, 0, 1, 0, 3, 0, 62, 8, 0, 1, 1, 1, 1, 3, 1, 66, 8, 1, 1, 1, 3, 1, 69, 8, 1, 1, 1, 1, 1, 3, 1, 73, 8, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 87, 8, 2, 10, 2, 12, 2, 90, 9, 2, 1, 2, 3, 2, 93, 8, 2, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 116, 8, 5, 1, 6, 1, 6, 1, 6, 5, 6, 121, 8, 6, 10, 6, 12, 6, 124, 9, 6, 1, 6, 3, 6, 127, 8, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 5, 7, 134, 8, 7, 10, 7, 12, 7, 137, 9, 7, 1, 7, 1, 7, 1, 7, 3, 7, 142, 8, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 151, 8, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 5, 9, 158, 8, 9, 10, 9, 12, 9, 161, 9, 9, 1, 10, 1, 10, 1, 10, 3, 10, 166, 8, 10, 1, 10, 1, 10, 3, 10, 170, 8, 10, 1, 10, 1, 10, 3, 10, 174, 8, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 201, 8, 12, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 5, 15, 213, 8, 15, 10, 15, 12, 15, 216, 9, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 3, 16, 225, 8, 16, 1, 16, 1, 16, 1, 16, 5, 16, 230, 8, 16, 10, 16, 12, 16, 233, 9, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 335, 8, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 5, 17, 399, 8, 17, 10, 17, 12, 17, 402, 9, 17, 1, 18, 1, 18, 1, 18, 5, 18, 407, 8, 18, 10, 18, 12, 18, 410, 9, 18, 1, 19, 1, 19, 3, 19, 414, 8, 19, 1, 20, 1, 20, 1, 20, 1, 20, 3, 20, 420, 8, 20, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 3, 23, 435, 8, 23, 1, 24, 1, 24, 3, 24, 439, 8, 24, 1, 25, 1, 25, 1, 25, 5, 25, 444, 8, 25, 10, 25, 12, 25, 447, 9, 25, 1, 25, 3, 25, 450, 8, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 3, 26, 459, 8, 26, 1, 26, 1, 26, 1, 26, 1, 26, 1, 26, 5, 26, 466, 8, 26, 10, 26, 12, 26, 469, 9, 26, 1, 26, 0, 3, 32, 34, 52, 27, 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, 0, 0, 530, 0, 61, 1, 0, 0, 0, 2, 72, 1, 0, 0, 0, 4, 92, 1, 0, 0, 0, 6, 94, 1, 0, 0, 0, 8, 97, 1, 0, 0, 0, 10, 115, 1, 0, 0, 0, 12, 126, 1, 0, 0, 0, 14, 141, 1, 0, 0, 0, 16, 143, 1, 0, 0, 0, 18, 159, 1, 0, 0, 0, 20, 162, 1, 0, 0, 0, 22, 178, 1, 0, 0, 0, 24, 200, 1, 0, 0, 0, 26, 202, 1, 0, 0, 0, 28, 205, 1, 0, 0, 0, 30, 214, 1, 0, 0, 0, 32, 224, 1, 0, 0, 0, 34, 334, 1, 0, 0, 0, 36, 403, 1, 0, 0, 0, 38, 413, 1, 0, 0, 0, 40, 419, 1, 0, 0, 0, 42, 421, 1, 0, 0, 0, 44, 423, 1, 0, 0, 0, 46, 434, 1, 0, 0, 0, 48, 438, 1, 0, 0, 0, 50, 449, 1, 0, 0, 0, 52, 458, 1, 0, 0, 0, 54, 56, 3, 2, 1, 0, 55, 54, 1, 0, 0, 0, 56, 59, 1, 0, 0, 0, 57, 55, 1, 0, 0, 0, 57, 58, 1, 0, 0, 0, 58, 62, 1, 0, 0, 0, 59, 57, 1, 0, 0, 0, 60, 62, 5, 0, 0, 1, 61, 57, 1, 0, 0, 0, 61, 60, 1, 0, 0, 0, 62, 1, 1, 0, 0, 0, 63, 65, 3, 4, 2, 0, 64, 66, 5, 27, 0, 0, 65, 64, 1, 0, 0, 0, 65, 66, 1, 0, 0, 0, 66, 68, 1, 0, 0, 0, 67, 69, 5, 48, 0, 0, 68, 67, 1, 0, 0, 0, 68, 69, 1, 0, 0, 0, 69, 73, 1, 0, 0, 0, 70, 73, 5, 27, 0, 0, 71, 73, 5, 48, 0, 0, 72, 63, 1, 0, 0, 0, 72, 70, 1, 0, 0, 0, 72, 71, 1, 0, 0, 0, 73, 3, 1, 0, 0, 0, 74, 93, 3, 6, 3, 0, 75, 93, 3, 8, 4, 0, 76, 93, 3, 28, 14, 0, 77, 93, 3, 16, 8, 0, 78, 93, 3, 10, 5, 0, 79, 93, 3, 20, 10, 0, 80, 93, 3, 22, 11, 0, 81, 93, 3, 24, 12, 0, 82, 93, 3, 26, 13, 0, 83, 93, 3, 34, 17, 0, 84, 88, 5, 24, 0, 0, 85, 87, 3, 2, 1, 0, 86, 85, 1, 0, 0, 0, 87, 90, 1, 0, 0, 0, 88, 86, 1, 0, 0, 0, 88, 89, 1, 0, 0, 0, 89, 91, 1, 0, 0, 0, 90, 88, 1, 0, 0, 0, 91, 93, 5, 25, 0, 0, 92, 74, 1, 0, 0, 0, 92, 75, 1, 0, 0, 0, 92, 76, 1, 0, 0, 0, 92, 77, 1, 0, 0, 0, 92, 78, 1, 0, 0, 0, 92, 79, 1, 0, 0, 0, 92, 80, 1, 0, 0, 0, 92, 81, 1, 0, 0, 0, 92, 82, 1, 0, 0, 0, 92, 83, 1, 0, 0, 0, 92, 84, 1, 0, 0, 0, 93, 5, 1, 0, 0, 0, 94, 95, 5, 10, 0, 0, 95, 96, 3, 36, 18, 0, 96, 7, 1, 0, 0, 0, 97, 98, 5, 9, 0, 0, 98, 99, 3, 36, 18, 0, 99, 9, 1, 0, 0, 0, 100, 101, 5, 1, 0, 0, 101, 102, 5, 49, 0, 0, 102, 103, 5, 26, 0, 0, 103, 116, 3, 52, 26, 0, 104, 105, 5, 1, 0, 0, 105, 106, 5, 49, 0, 0, 106, 107, 5, 30, 0, 0, 107, 116, 3, 34, 17, 0, 108, 109, 5, 1, 0, 0, 109, 110, 5, 49, 0, 0, 110, 111, 5, 26, 0, 0, 111, 112, 3, 52, 26, 0, 112, 113, 5, 30, 0, 0, 113, 114, 3, 34, 17, 0, 114, 116, 1, 0, 0, 0, 115, 100, 1, 0, 0, 0, 115, 104, 1, 0, 0, 0, 115, 108, 1, 0, 0, 0, 116, 11, 1, 0, 0, 0, 117, 118, 3, 34, 17, 0, 118, 119, 5, 28, 0, 0, 119, 121, 1, 0, 0, 0, 120, 117, 1, 0, 0, 0, 121, 124, 1, 0, 0, 0, 122, 120, 1, 0, 0, 0, 122, 123, 1, 0, 0, 0, 123, 125, 1, 0, 0, 0, 124, 122, 1, 0, 0, 0, 125, 127, 3, 34, 17, 0, 126, 122, 1, 0, 0, 0, 126, 127, 1, 0, 0, 0, 127, 13, 1, 0, 0, 0, 128, 129, 5, 49, 0, 0, 129, 130, 5, 26, 0, 0, 130, 131, 3, 52, 26, 0, 131, 132, 5, 28, 0, 0, 132, 134, 1, 0, 0, 0, 133, 128, 1, 0, 0, 0, 134, 137, 1, 0, 0, 0, 135, 133, 1, 0, 0, 0, 135, 136, 1, 0, 0, 0, 136, 138, 1, 0, 0, 0, 137, 135, 1, 0, 0, 0, 138, 139, 5, 49, 0, 0, 139, 140, 5, 26, 0, 0, 140, 142, 3, 52, 26, 0, 141, 135, 1, 0, 0, 0, 141, 142, 1, 0, 0, 0, 142, 15, 1, 0, 0, 0, 143, 144, 5, 7, 0, 0, 144, 145, 5, 49, 0, 0, 145, 146, 5, 20, 0, 0, 146, 147, 3, 14, 7, 0, 147, 150, 5, 21, 0, 0, 148, 149, 5, 26, 0, 0, 149, 151, 3, 52, 26, 0, 150, 148, 1, 0, 0, 0, 150, 151, 1, 0, 0, 0, 151, 152, 1, 0, 0, 0, 152, 153, 5, 24, 0, 0, 153, 154, 3, 18, 9, 0, 154, 155, 5, 25, 0, 0, 155, 17, 1, 0, 0, 0, 156, 158, 3, 2, 1, 0, 157, 156, 1, 0, 0, 0, 158, 161, 1, 0, 0, 0, 159, 157, 1, 0, 0, 0, 159, 160, 1, 0, 0, 0, 160, 19, 1, 0, 0, 0, 161, 159, 1, 0, 0, 0, 162, 163, 5, 3, 0, 0, 163, 165, 5, 20, 0, 0, 164, 166, 3, 10, 5, 0, 165, 164, 1, 0, 0, 0, 165, 166, 1, 0, 0, 0, 166, 167, 1, 0, 0, 0, 167, 169, 5, 27, 0, 0, 168, 170, 3, 34, 17, 0, 169, 168, 1, 0, 0, 0, 169, 170, 1, 0, 0, 0, 170, 171, 1, 0, 0, 0, 171, 173, 5, 27, 0, 0, 172, 174, 3, 4, 2, 0, 173, 172, 1, 0, 0, 0, 173, 174, 1, 0, 0, 0, 174, 175, 1, 0, 0, 0, 175, 176, 5, 21, 0, 0, 176, 177, 3, 2, 1, 0, 177, 21, 1, 0, 0, 0, 178, 179, 5, 4, 0, 0, 179, 180, 5, 20, 0, 0, 180, 181, 3, 34, 17, 0, 181, 182, 5, 21, 0, 0, 182, 183, 3, 2, 1, 0, 183, 23, 1, 0, 0, 0, 184, 185, 5, 5, 0, 0, 185, 186, 5, 20, 0, 0, 186, 187, 3, 34, 17, 0, 187, 188, 5, 21, 0, 0, 188, 189, 3, 2, 1, 0, 189, 190, 6, 12, -1, 0, 190, 201, 1, 0, 0, 0, 191, 192, 5, 5, 0, 0, 192, 193, 5, 20, 0, 0, 193, 194, 3, 34, 17, 0, 194, 195, 5, 21, 0, 0, 195, 196, 3, 2, 1, 0, 196, 197, 5, 6, 0, 0, 197, 198, 3, 2, 1, 0, 198, 199, 6, 12, -1, 0, 199, 201, 1, 0, 0, 0, 200, 184, 1, 0, 0, 0, 200, 191, 1, 0, 0, 0, 201, 25, 1, 0, 0, 0, 202, 203, 5, 8, 0, 0, 203, 204, 3, 2, 1, 0, 204, 27, 1, 0, 0, 0, 205, 206, 5, 11, 0, 0, 206, 207, 3, 36, 18, 0, 207, 208, 5, 24, 0, 0, 208, 209, 3, 30, 15, 0, 209, 210, 5, 25, 0, 0, 210, 29, 1, 0, 0, 0, 211, 213, 3, 2, 1, 0, 212, 211, 1, 0, 0, 0, 213, 216, 1, 0, 0, 0, 214, 212, 1, 0, 0, 0, 214, 215, 1, 0, 0, 0, 215, 31, 1, 0, 0, 0, 216, 214, 1, 0, 0, 0, 217, 218, 6, 16, -1, 0, 218, 219, 5, 49, 0, 0, 219, 220, 5, 20, 0, 0, 220, 221, 3, 12, 6, 0, 221, 222, 5, 21, 0, 0, 222, 225, 1, 0, 0, 0, 223, 225, 5, 49, 0, 0, 224, 217, 1, 0, 0, 0, 224, 223, 1, 0, 0, 0, 225, 231, 1, 0, 0, 0, 226, 227, 10, 1, 0, 0, 227, 228, 5, 45, 0, 0, 228, 230, 3, 32, 16, 2, 229, 226, 1, 0, 0, 0, 230, 233, 1, 0, 0, 0, 231, 229, 1, 0, 0, 0, 231, 232, 1, 0, 0, 0, 232, 33, 1, 0, 0, 0, 233, 231, 1, 0, 0, 0, 234, 235, 6, 17, -1, 0, 235, 236, 5, 32, 0, 0, 236, 237, 3, 52, 26, 0, 237, 238, 5, 31, 0, 0, 238, 239, 5, 20, 0, 0, 239, 240, 3, 32, 16, 0, 240, 241, 5, 21, 0, 0, 241, 335, 1, 0, 0, 0, 242, 243, 5, 20, 0, 0, 243, 244, 3, 34, 17, 0, 244, 245, 5, 21, 0, 0, 245, 335, 1, 0, 0, 0, 246, 247, 5, 41, 0, 0, 247, 335, 3, 34, 17, 43, 248, 249, 5, 36, 0, 0, 249, 335, 3, 34, 17, 42, 250, 251, 5, 37, 0, 0, 251, 335, 3, 34, 17, 41, 252, 253, 5, 36, 0, 0, 253, 254, 5, 36, 0, 0, 254, 335, 3, 32, 16, 0, 255, 256, 3, 32, 16, 0, 256, 257, 5, 36, 0, 0, 257, 258, 5, 36, 0, 0, 258, 335, 1, 0, 0, 0, 259, 260, 5, 37, 0, 0, 260, 261, 5, 37, 0, 0, 261, 335, 3, 32, 16, 0, 262, 263, 3, 32, 16, 0, 263, 264, 5, 37, 0, 0, 264, 265, 5, 37, 0, 0, 265, 335, 1, 0, 0, 0, 266, 335, 3, 32, 16, 0, 267, 268, 3, 32, 16, 0, 268, 269, 5, 30, 0, 0, 269, 270, 3, 34, 17, 16, 270, 335, 1, 0, 0, 0, 271, 272, 3, 32, 16, 0, 272, 273, 5, 36, 0, 0, 273, 274, 5, 30, 0, 0, 274, 275, 3, 34, 17, 15, 275, 335, 1, 0, 0, 0, 276, 277, 3, 32, 16, 0, 277, 278, 5, 37, 0, 0, 278, 279, 5, 30, 0, 0, 279, 280, 3, 34, 17, 14, 280, 335, 1, 0, 0, 0, 281, 282, 3, 32, 16, 0, 282, 283, 5, 38, 0, 0, 283, 284, 5, 30, 0, 0, 284, 285, 3, 34, 17, 13, 285, 335, 1, 0, 0, 0, 286, 287, 3, 32, 16, 0, 287, 288, 5, 39, 0, 0, 288, 289, 5, 30, 0, 0, 289, 290, 3, 34, 17, 12, 290, 335, 1, 0, 0, 0, 291, 292, 3, 32, 16, 0, 292, 293, 5, 40, 0, 0, 293, 294, 5, 30, 0, 0, 294, 295, 3, 34, 17, 11, 295, 335, 1, 0, 0, 0, 296, 297, 3, 32, 16, 0, 297, 298, 5, 36, 0, 0, 298, 299, 5, 30, 0, 0, 299, 300, 3, 34, 17, 10, 300, 335, 1, 0, 0, 0, 301, 302, 3, 32, 16, 0, 302, 303, 5, 42, 0, 0, 303, 304, 5, 30, 0, 0, 304, 305, 3, 34, 17, 9, 305, 335, 1, 0, 0, 0, 306, 307, 3, 32, 16, 0, 307, 308, 5, 43, 0, 0, 308, 309, 5, 30, 0, 0, 309, 310, 3, 34, 17, 8, 310, 335, 1, 0, 0, 0, 311, 312, 3, 32, 16, 0, 312, 313, 5, 44, 0, 0, 313, 314, 5, 30, 0, 0, 314, 315, 3, 34, 17, 7, 315, 335, 1, 0, 0, 0, 316, 317, 3, 32, 16, 0, 317, 318, 5, 33, 0, 0, 318, 319, 5, 30, 0, 0, 319, 320, 3, 34, 17, 6, 320, 335, 1, 0, 0, 0, 321, 322, 3, 32, 16, 0, 322, 323, 5, 34, 0, 0, 323, 324, 5, 30, 0, 0, 324, 325, 3, 34, 17, 5, 325, 335, 1, 0, 0, 0, 326, 327, 3, 32, 16, 0, 327, 328, 5, 35, 0, 0, 328, 329, 5, 30, 0, 0, 329, 330, 3, 34, 17, 4, 330, 335, 1, 0, 0, 0, 331, 335, 3, 42, 21, 0, 332, 335, 3, 38, 19, 0, 333, 335, 3, 40, 20, 0, 334, 234, 1, 0, 0, 0, 334, 242, 1, 0, 0, 0, 334, 246, 1, 0, 0, 0, 334, 248, 1, 0, 0, 0, 334, 250, 1, 0, 0, 0, 334, 252, 1, 0, 0, 0, 334, 255, 1, 0, 0, 0, 334, 259, 1, 0, 0, 0, 334, 262, 1, 0, 0, 0, 334, 266, 1, 0, 0, 0, 334, 267, 1, 0, 0, 0, 334, 271, 1, 0, 0, 0, 334, 276, 1, 0, 0, 0, 334, 281, 1, 0, 0, 0, 334, 286, 1, 0, 0, 0, 334, 291, 1, 0, 0, 0, 334, 296, 1, 0, 0, 0, 334, 301, 1, 0, 0, 0, 334, 306, 1, 0, 0, 0, 334, 311, 1, 0, 0, 0, 334, 316, 1, 0, 0, 0, 334, 321, 1, 0, 0, 0, 334, 326, 1, 0, 0, 0, 334, 331, 1, 0, 0, 0, 334, 332, 1, 0, 0, 0, 334, 333, 1, 0, 0, 0, 335, 400, 1, 0, 0, 0, 336, 337, 10, 35, 0, 0, 337, 338, 5, 38, 0, 0, 338, 399, 3, 34, 17, 36, 339, 340, 10, 34, 0, 0, 340, 341, 5, 39, 0, 0, 341, 399, 3, 34, 17, 35, 342, 343, 10, 33, 0, 0, 343, 344, 5, 40, 0, 0, 344, 399, 3, 34, 17, 34, 345, 346, 10, 32, 0, 0, 346, 347, 5, 36, 0, 0, 347, 399, 3, 34, 17, 33, 348, 349, 10, 31, 0, 0, 349, 350, 5, 37, 0, 0, 350, 399, 3, 34, 17, 32, 351, 352, 10, 30, 0, 0, 352, 353, 5, 33, 0, 0, 353, 399, 3, 34, 17, 31, 354, 355, 10, 29, 0, 0, 355, 356, 5, 34, 0, 0, 356, 399, 3, 34, 17, 30, 357, 358, 10, 28, 0, 0, 358, 359, 5, 35, 0, 0, 359, 399, 3, 34, 17, 29, 360, 361, 10, 27, 0, 0, 361, 362, 5, 31, 0, 0, 362, 399, 3, 34, 17, 28, 363, 364, 10, 26, 0, 0, 364, 365, 5, 32, 0, 0, 365, 399, 3, 34, 17, 27, 366, 367, 10, 25, 0, 0, 367, 368, 5, 31, 0, 0, 368, 369, 5, 30, 0, 0, 369, 399, 3, 34, 17, 26, 370, 371, 10, 24, 0, 0, 371, 372, 5, 32, 0, 0, 372, 373, 5, 30, 0, 0, 373, 399, 3, 34, 17, 25, 374, 375, 10, 23, 0, 0, 375, 376, 5, 29, 0, 0, 376, 399, 3, 34, 17, 24, 377, 378, 10, 22, 0, 0, 378, 379, 5, 41, 0, 0, 379, 380, 5, 30, 0, 0, 380, 399, 3, 34, 17, 23, 381, 382, 10, 21, 0, 0, 382, 383, 5, 42, 0, 0, 383, 399, 3, 34, 17, 22, 384, 385, 10, 20, 0, 0, 385, 386, 5, 44, 0, 0, 386, 399, 3, 34, 17, 21, 387, 388, 10, 19, 0, 0, 388, 389, 5, 43, 0, 0, 389, 399, 3, 34, 17, 20, 390, 391, 10, 18, 0, 0, 391, 392, 5, 42, 0, 0, 392, 393, 5, 42, 0, 0, 393, 399, 3, 34, 17, 19, 394, 395, 10, 17, 0, 0, 395, 396, 5, 43, 0, 0, 396, 397, 5, 43, 0, 0, 397, 399, 3, 34, 17, 18, 398, 336, 1, 0, 0, 0, 398, 339, 1, 0, 0, 0, 398, 342, 1, 0, 0, 0, 398, 345, 1, 0, 0, 0, 398, 348, 1, 0, 0, 0, 398, 351, 1, 0, 0, 0, 398, 354, 1, 0, 0, 0, 398, 357, 1, 0, 0, 0, 398, 360, 1, 0, 0, 0, 398, 363, 1, 0, 0, 0, 398, 366, 1, 0, 0, 0, 398, 370, 1, 0, 0, 0, 398, 374, 1, 0, 0, 0, 398, 377, 1, 0, 0, 0, 398, 381, 1, 0, 0, 0, 398, 384, 1, 0, 0, 0, 398, 387, 1, 0, 0, 0, 398, 390, 1, 0, 0, 0, 398, 394, 1, 0, 0, 0, 399, 402, 1, 0, 0, 0, 400, 398, 1, 0, 0, 0, 400, 401, 1, 0, 0, 0, 401, 35, 1, 0, 0, 0, 402, 400, 1, 0, 0, 0, 403, 408, 5, 49, 0, 0, 404, 405, 5, 45, 0, 0, 405, 407, 5, 49, 0, 0, 406, 404, 1, 0, 0, 0, 407, 410, 1, 0, 0, 0, 408, 406, 1, 0, 0, 0, 408, 409, 1, 0, 0, 0, 409, 37, 1, 0, 0, 0, 410, 408, 1, 0, 0, 0, 411, 414, 3, 46, 23, 0, 412, 414, 3, 44, 22, 0, 413, 411, 1, 0, 0, 0, 413, 412, 1, 0, 0, 0, 414, 39, 1, 0, 0, 0, 415, 416, 5, 16, 0, 0, 416, 420, 6, 20, -1, 0, 417, 418, 5, 17, 0, 0, 418, 420, 6, 20, -1, 0, 419, 415, 1, 0, 0, 0, 419, 417, 1, 0, 0, 0, 420, 41, 1, 0, 0, 0, 421, 422, 5, 60, 0, 0, 422, 43, 1, 0, 0, 0, 423, 424, 5, 54, 0, 0, 424, 425, 6, 22, -1, 0, 425, 45, 1, 0, 0, 0, 426, 427, 5, 51, 0, 0, 427, 435, 6, 23, -1, 0, 428, 429, 5, 50, 0, 0, 429, 435, 6, 23, -1, 0, 430, 431, 5, 53, 0, 0, 431, 435, 6, 23, -1, 0, 432, 433, 5, 52, 0, 0, 433, 435, 6, 23, -1, 0, 434, 426, 1, 0, 0, 0, 434, 428, 1, 0, 0, 0, 434, 430, 1, 0, 0, 0, 434, 432, 1, 0, 0, 0, 435, 47, 1, 0, 0, 0, 436, 439, 3, 34, 17, 0, 437, 439, 3, 52, 26, 0, 438, 436, 1, 0, 0, 0, 438, 437, 1, 0, 0, 0, 439, 49, 1, 0, 0, 0, 440, 441, 3, 48, 24, 0, 441, 442, 5, 28, 0, 0, 442, 444, 1, 0, 0, 0, 443, 440, 1, 0, 0, 0, 444, 447, 1, 0, 0, 0, 445, 443, 1, 0, 0, 0, 445, 446, 1, 0, 0, 0, 446, 448, 1, 0, 0, 0, 447, 445, 1, 0, 0, 0, 448, 450, 3, 48, 24, 0, 449, 445, 1, 0, 0, 0, 449, 450, 1, 0, 0, 0, 450, 51, 1, 0, 0, 0, 451, 452, 6, 26, -1, 0, 452, 459, 3, 36, 18, 0, 453, 454, 3, 36, 18, 0, 454, 455, 5, 32, 0, 0, 455, 456, 3, 50, 25, 0, 456, 457, 5, 31, 0, 0, 457, 459, 1, 0, 0, 0, 458, 451, 1, 0, 0, 0, 458, 453, 1, 0, 0, 0, 459, 467, 1, 0, 0, 0, 460, 461, 10, 1, 0, 0, 461, 462, 5, 22, 0, 0, 462, 463, 3, 34, 17, 0, 463, 464, 5, 23, 0, 0, 464, 466, 1, 0, 0, 0, 465, 460, 1, 0, 0, 0, 466, 469, 1, 0, 0, 0, 467, 465, 1, 0, 0, 0, 467, 468, 1, 0, 0, 0, 468, 53, 1, 0, 0, 0, 469, 467, 1, 0, 0, 0, 33, 57, 61, 65, 68, 72, 88, 92, 115, 122, 126, 135, 141, 150, 159, 165, 169, 173, 200, 214, 224, 231, 334, 398, 400, 408, 413, 419, 434, 438, 445, 449, 458, 467] \ No newline at end of file +[4, 1, 63, 475, 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, 1, 0, 5, 0, 58, 8, 0, 10, 0, 12, 0, 61, 9, 0, 1, 0, 3, 0, 64, 8, 0, 1, 1, 1, 1, 3, 1, 68, 8, 1, 1, 1, 3, 1, 71, 8, 1, 1, 1, 1, 1, 3, 1, 75, 8, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 89, 8, 2, 10, 2, 12, 2, 92, 9, 2, 1, 2, 3, 2, 95, 8, 2, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 118, 8, 5, 1, 6, 1, 6, 1, 6, 5, 6, 123, 8, 6, 10, 6, 12, 6, 126, 9, 6, 1, 6, 3, 6, 129, 8, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 5, 7, 136, 8, 7, 10, 7, 12, 7, 139, 9, 7, 1, 7, 1, 7, 1, 7, 3, 7, 144, 8, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 153, 8, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 5, 9, 160, 8, 9, 10, 9, 12, 9, 163, 9, 9, 1, 10, 1, 10, 1, 10, 3, 10, 168, 8, 10, 1, 10, 1, 10, 3, 10, 172, 8, 10, 1, 10, 1, 10, 3, 10, 176, 8, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 203, 8, 12, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 5, 15, 215, 8, 15, 10, 15, 12, 15, 218, 9, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 3, 16, 227, 8, 16, 1, 16, 1, 16, 1, 16, 5, 16, 232, 8, 16, 10, 16, 12, 16, 235, 9, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 3, 18, 339, 8, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 5, 18, 403, 8, 18, 10, 18, 12, 18, 406, 9, 18, 1, 19, 1, 19, 1, 19, 5, 19, 411, 8, 19, 10, 19, 12, 19, 414, 9, 19, 1, 20, 1, 20, 3, 20, 418, 8, 20, 1, 21, 1, 21, 1, 21, 1, 21, 3, 21, 424, 8, 21, 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 3, 24, 439, 8, 24, 1, 25, 1, 25, 3, 25, 443, 8, 25, 1, 26, 1, 26, 1, 26, 5, 26, 448, 8, 26, 10, 26, 12, 26, 451, 9, 26, 1, 26, 3, 26, 454, 8, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 3, 27, 463, 8, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 5, 27, 470, 8, 27, 10, 27, 12, 27, 473, 9, 27, 1, 27, 0, 3, 32, 36, 54, 28, 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, 0, 0, 533, 0, 63, 1, 0, 0, 0, 2, 74, 1, 0, 0, 0, 4, 94, 1, 0, 0, 0, 6, 96, 1, 0, 0, 0, 8, 99, 1, 0, 0, 0, 10, 117, 1, 0, 0, 0, 12, 128, 1, 0, 0, 0, 14, 143, 1, 0, 0, 0, 16, 145, 1, 0, 0, 0, 18, 161, 1, 0, 0, 0, 20, 164, 1, 0, 0, 0, 22, 180, 1, 0, 0, 0, 24, 202, 1, 0, 0, 0, 26, 204, 1, 0, 0, 0, 28, 207, 1, 0, 0, 0, 30, 216, 1, 0, 0, 0, 32, 226, 1, 0, 0, 0, 34, 236, 1, 0, 0, 0, 36, 338, 1, 0, 0, 0, 38, 407, 1, 0, 0, 0, 40, 417, 1, 0, 0, 0, 42, 423, 1, 0, 0, 0, 44, 425, 1, 0, 0, 0, 46, 427, 1, 0, 0, 0, 48, 438, 1, 0, 0, 0, 50, 442, 1, 0, 0, 0, 52, 453, 1, 0, 0, 0, 54, 462, 1, 0, 0, 0, 56, 58, 3, 2, 1, 0, 57, 56, 1, 0, 0, 0, 58, 61, 1, 0, 0, 0, 59, 57, 1, 0, 0, 0, 59, 60, 1, 0, 0, 0, 60, 64, 1, 0, 0, 0, 61, 59, 1, 0, 0, 0, 62, 64, 5, 0, 0, 1, 63, 59, 1, 0, 0, 0, 63, 62, 1, 0, 0, 0, 64, 1, 1, 0, 0, 0, 65, 67, 3, 4, 2, 0, 66, 68, 5, 27, 0, 0, 67, 66, 1, 0, 0, 0, 67, 68, 1, 0, 0, 0, 68, 70, 1, 0, 0, 0, 69, 71, 5, 48, 0, 0, 70, 69, 1, 0, 0, 0, 70, 71, 1, 0, 0, 0, 71, 75, 1, 0, 0, 0, 72, 75, 5, 27, 0, 0, 73, 75, 5, 48, 0, 0, 74, 65, 1, 0, 0, 0, 74, 72, 1, 0, 0, 0, 74, 73, 1, 0, 0, 0, 75, 3, 1, 0, 0, 0, 76, 95, 3, 6, 3, 0, 77, 95, 3, 8, 4, 0, 78, 95, 3, 28, 14, 0, 79, 95, 3, 16, 8, 0, 80, 95, 3, 10, 5, 0, 81, 95, 3, 20, 10, 0, 82, 95, 3, 22, 11, 0, 83, 95, 3, 24, 12, 0, 84, 95, 3, 26, 13, 0, 85, 95, 3, 36, 18, 0, 86, 90, 5, 24, 0, 0, 87, 89, 3, 2, 1, 0, 88, 87, 1, 0, 0, 0, 89, 92, 1, 0, 0, 0, 90, 88, 1, 0, 0, 0, 90, 91, 1, 0, 0, 0, 91, 93, 1, 0, 0, 0, 92, 90, 1, 0, 0, 0, 93, 95, 5, 25, 0, 0, 94, 76, 1, 0, 0, 0, 94, 77, 1, 0, 0, 0, 94, 78, 1, 0, 0, 0, 94, 79, 1, 0, 0, 0, 94, 80, 1, 0, 0, 0, 94, 81, 1, 0, 0, 0, 94, 82, 1, 0, 0, 0, 94, 83, 1, 0, 0, 0, 94, 84, 1, 0, 0, 0, 94, 85, 1, 0, 0, 0, 94, 86, 1, 0, 0, 0, 95, 5, 1, 0, 0, 0, 96, 97, 5, 10, 0, 0, 97, 98, 3, 38, 19, 0, 98, 7, 1, 0, 0, 0, 99, 100, 5, 9, 0, 0, 100, 101, 3, 38, 19, 0, 101, 9, 1, 0, 0, 0, 102, 103, 5, 1, 0, 0, 103, 104, 5, 49, 0, 0, 104, 105, 5, 26, 0, 0, 105, 118, 3, 54, 27, 0, 106, 107, 5, 1, 0, 0, 107, 108, 5, 49, 0, 0, 108, 109, 5, 30, 0, 0, 109, 118, 3, 36, 18, 0, 110, 111, 5, 1, 0, 0, 111, 112, 5, 49, 0, 0, 112, 113, 5, 26, 0, 0, 113, 114, 3, 54, 27, 0, 114, 115, 5, 30, 0, 0, 115, 116, 3, 36, 18, 0, 116, 118, 1, 0, 0, 0, 117, 102, 1, 0, 0, 0, 117, 106, 1, 0, 0, 0, 117, 110, 1, 0, 0, 0, 118, 11, 1, 0, 0, 0, 119, 120, 3, 36, 18, 0, 120, 121, 5, 28, 0, 0, 121, 123, 1, 0, 0, 0, 122, 119, 1, 0, 0, 0, 123, 126, 1, 0, 0, 0, 124, 122, 1, 0, 0, 0, 124, 125, 1, 0, 0, 0, 125, 127, 1, 0, 0, 0, 126, 124, 1, 0, 0, 0, 127, 129, 3, 36, 18, 0, 128, 124, 1, 0, 0, 0, 128, 129, 1, 0, 0, 0, 129, 13, 1, 0, 0, 0, 130, 131, 5, 49, 0, 0, 131, 132, 5, 26, 0, 0, 132, 133, 3, 54, 27, 0, 133, 134, 5, 28, 0, 0, 134, 136, 1, 0, 0, 0, 135, 130, 1, 0, 0, 0, 136, 139, 1, 0, 0, 0, 137, 135, 1, 0, 0, 0, 137, 138, 1, 0, 0, 0, 138, 140, 1, 0, 0, 0, 139, 137, 1, 0, 0, 0, 140, 141, 5, 49, 0, 0, 141, 142, 5, 26, 0, 0, 142, 144, 3, 54, 27, 0, 143, 137, 1, 0, 0, 0, 143, 144, 1, 0, 0, 0, 144, 15, 1, 0, 0, 0, 145, 146, 5, 7, 0, 0, 146, 147, 5, 49, 0, 0, 147, 148, 5, 20, 0, 0, 148, 149, 3, 14, 7, 0, 149, 152, 5, 21, 0, 0, 150, 151, 5, 26, 0, 0, 151, 153, 3, 54, 27, 0, 152, 150, 1, 0, 0, 0, 152, 153, 1, 0, 0, 0, 153, 154, 1, 0, 0, 0, 154, 155, 5, 24, 0, 0, 155, 156, 3, 18, 9, 0, 156, 157, 5, 25, 0, 0, 157, 17, 1, 0, 0, 0, 158, 160, 3, 2, 1, 0, 159, 158, 1, 0, 0, 0, 160, 163, 1, 0, 0, 0, 161, 159, 1, 0, 0, 0, 161, 162, 1, 0, 0, 0, 162, 19, 1, 0, 0, 0, 163, 161, 1, 0, 0, 0, 164, 165, 5, 3, 0, 0, 165, 167, 5, 20, 0, 0, 166, 168, 3, 10, 5, 0, 167, 166, 1, 0, 0, 0, 167, 168, 1, 0, 0, 0, 168, 169, 1, 0, 0, 0, 169, 171, 5, 27, 0, 0, 170, 172, 3, 36, 18, 0, 171, 170, 1, 0, 0, 0, 171, 172, 1, 0, 0, 0, 172, 173, 1, 0, 0, 0, 173, 175, 5, 27, 0, 0, 174, 176, 3, 4, 2, 0, 175, 174, 1, 0, 0, 0, 175, 176, 1, 0, 0, 0, 176, 177, 1, 0, 0, 0, 177, 178, 5, 21, 0, 0, 178, 179, 3, 2, 1, 0, 179, 21, 1, 0, 0, 0, 180, 181, 5, 4, 0, 0, 181, 182, 5, 20, 0, 0, 182, 183, 3, 36, 18, 0, 183, 184, 5, 21, 0, 0, 184, 185, 3, 2, 1, 0, 185, 23, 1, 0, 0, 0, 186, 187, 5, 5, 0, 0, 187, 188, 5, 20, 0, 0, 188, 189, 3, 36, 18, 0, 189, 190, 5, 21, 0, 0, 190, 191, 3, 2, 1, 0, 191, 192, 6, 12, -1, 0, 192, 203, 1, 0, 0, 0, 193, 194, 5, 5, 0, 0, 194, 195, 5, 20, 0, 0, 195, 196, 3, 36, 18, 0, 196, 197, 5, 21, 0, 0, 197, 198, 3, 2, 1, 0, 198, 199, 5, 6, 0, 0, 199, 200, 3, 2, 1, 0, 200, 201, 6, 12, -1, 0, 201, 203, 1, 0, 0, 0, 202, 186, 1, 0, 0, 0, 202, 193, 1, 0, 0, 0, 203, 25, 1, 0, 0, 0, 204, 205, 5, 8, 0, 0, 205, 206, 3, 2, 1, 0, 206, 27, 1, 0, 0, 0, 207, 208, 5, 11, 0, 0, 208, 209, 3, 38, 19, 0, 209, 210, 5, 24, 0, 0, 210, 211, 3, 30, 15, 0, 211, 212, 5, 25, 0, 0, 212, 29, 1, 0, 0, 0, 213, 215, 3, 2, 1, 0, 214, 213, 1, 0, 0, 0, 215, 218, 1, 0, 0, 0, 216, 214, 1, 0, 0, 0, 216, 217, 1, 0, 0, 0, 217, 31, 1, 0, 0, 0, 218, 216, 1, 0, 0, 0, 219, 220, 6, 16, -1, 0, 220, 221, 5, 49, 0, 0, 221, 222, 5, 20, 0, 0, 222, 223, 3, 12, 6, 0, 223, 224, 5, 21, 0, 0, 224, 227, 1, 0, 0, 0, 225, 227, 5, 49, 0, 0, 226, 219, 1, 0, 0, 0, 226, 225, 1, 0, 0, 0, 227, 233, 1, 0, 0, 0, 228, 229, 10, 1, 0, 0, 229, 230, 5, 45, 0, 0, 230, 232, 3, 32, 16, 2, 231, 228, 1, 0, 0, 0, 232, 235, 1, 0, 0, 0, 233, 231, 1, 0, 0, 0, 233, 234, 1, 0, 0, 0, 234, 33, 1, 0, 0, 0, 235, 233, 1, 0, 0, 0, 236, 237, 3, 32, 16, 0, 237, 35, 1, 0, 0, 0, 238, 239, 6, 18, -1, 0, 239, 240, 5, 32, 0, 0, 240, 241, 3, 54, 27, 0, 241, 242, 5, 31, 0, 0, 242, 243, 5, 20, 0, 0, 243, 244, 3, 34, 17, 0, 244, 245, 5, 21, 0, 0, 245, 339, 1, 0, 0, 0, 246, 247, 5, 20, 0, 0, 247, 248, 3, 36, 18, 0, 248, 249, 5, 21, 0, 0, 249, 339, 1, 0, 0, 0, 250, 251, 5, 41, 0, 0, 251, 339, 3, 36, 18, 43, 252, 253, 5, 36, 0, 0, 253, 339, 3, 36, 18, 42, 254, 255, 5, 37, 0, 0, 255, 339, 3, 36, 18, 41, 256, 257, 5, 36, 0, 0, 257, 258, 5, 36, 0, 0, 258, 339, 3, 34, 17, 0, 259, 260, 3, 34, 17, 0, 260, 261, 5, 36, 0, 0, 261, 262, 5, 36, 0, 0, 262, 339, 1, 0, 0, 0, 263, 264, 5, 37, 0, 0, 264, 265, 5, 37, 0, 0, 265, 339, 3, 34, 17, 0, 266, 267, 3, 34, 17, 0, 267, 268, 5, 37, 0, 0, 268, 269, 5, 37, 0, 0, 269, 339, 1, 0, 0, 0, 270, 339, 3, 34, 17, 0, 271, 272, 3, 34, 17, 0, 272, 273, 5, 30, 0, 0, 273, 274, 3, 36, 18, 16, 274, 339, 1, 0, 0, 0, 275, 276, 3, 34, 17, 0, 276, 277, 5, 36, 0, 0, 277, 278, 5, 30, 0, 0, 278, 279, 3, 36, 18, 15, 279, 339, 1, 0, 0, 0, 280, 281, 3, 34, 17, 0, 281, 282, 5, 37, 0, 0, 282, 283, 5, 30, 0, 0, 283, 284, 3, 36, 18, 14, 284, 339, 1, 0, 0, 0, 285, 286, 3, 34, 17, 0, 286, 287, 5, 38, 0, 0, 287, 288, 5, 30, 0, 0, 288, 289, 3, 36, 18, 13, 289, 339, 1, 0, 0, 0, 290, 291, 3, 34, 17, 0, 291, 292, 5, 39, 0, 0, 292, 293, 5, 30, 0, 0, 293, 294, 3, 36, 18, 12, 294, 339, 1, 0, 0, 0, 295, 296, 3, 34, 17, 0, 296, 297, 5, 40, 0, 0, 297, 298, 5, 30, 0, 0, 298, 299, 3, 36, 18, 11, 299, 339, 1, 0, 0, 0, 300, 301, 3, 34, 17, 0, 301, 302, 5, 36, 0, 0, 302, 303, 5, 30, 0, 0, 303, 304, 3, 36, 18, 10, 304, 339, 1, 0, 0, 0, 305, 306, 3, 34, 17, 0, 306, 307, 5, 42, 0, 0, 307, 308, 5, 30, 0, 0, 308, 309, 3, 36, 18, 9, 309, 339, 1, 0, 0, 0, 310, 311, 3, 34, 17, 0, 311, 312, 5, 43, 0, 0, 312, 313, 5, 30, 0, 0, 313, 314, 3, 36, 18, 8, 314, 339, 1, 0, 0, 0, 315, 316, 3, 34, 17, 0, 316, 317, 5, 44, 0, 0, 317, 318, 5, 30, 0, 0, 318, 319, 3, 36, 18, 7, 319, 339, 1, 0, 0, 0, 320, 321, 3, 34, 17, 0, 321, 322, 5, 33, 0, 0, 322, 323, 5, 30, 0, 0, 323, 324, 3, 36, 18, 6, 324, 339, 1, 0, 0, 0, 325, 326, 3, 34, 17, 0, 326, 327, 5, 34, 0, 0, 327, 328, 5, 30, 0, 0, 328, 329, 3, 36, 18, 5, 329, 339, 1, 0, 0, 0, 330, 331, 3, 34, 17, 0, 331, 332, 5, 35, 0, 0, 332, 333, 5, 30, 0, 0, 333, 334, 3, 36, 18, 4, 334, 339, 1, 0, 0, 0, 335, 339, 3, 44, 22, 0, 336, 339, 3, 40, 20, 0, 337, 339, 3, 42, 21, 0, 338, 238, 1, 0, 0, 0, 338, 246, 1, 0, 0, 0, 338, 250, 1, 0, 0, 0, 338, 252, 1, 0, 0, 0, 338, 254, 1, 0, 0, 0, 338, 256, 1, 0, 0, 0, 338, 259, 1, 0, 0, 0, 338, 263, 1, 0, 0, 0, 338, 266, 1, 0, 0, 0, 338, 270, 1, 0, 0, 0, 338, 271, 1, 0, 0, 0, 338, 275, 1, 0, 0, 0, 338, 280, 1, 0, 0, 0, 338, 285, 1, 0, 0, 0, 338, 290, 1, 0, 0, 0, 338, 295, 1, 0, 0, 0, 338, 300, 1, 0, 0, 0, 338, 305, 1, 0, 0, 0, 338, 310, 1, 0, 0, 0, 338, 315, 1, 0, 0, 0, 338, 320, 1, 0, 0, 0, 338, 325, 1, 0, 0, 0, 338, 330, 1, 0, 0, 0, 338, 335, 1, 0, 0, 0, 338, 336, 1, 0, 0, 0, 338, 337, 1, 0, 0, 0, 339, 404, 1, 0, 0, 0, 340, 341, 10, 35, 0, 0, 341, 342, 5, 38, 0, 0, 342, 403, 3, 36, 18, 36, 343, 344, 10, 34, 0, 0, 344, 345, 5, 39, 0, 0, 345, 403, 3, 36, 18, 35, 346, 347, 10, 33, 0, 0, 347, 348, 5, 40, 0, 0, 348, 403, 3, 36, 18, 34, 349, 350, 10, 32, 0, 0, 350, 351, 5, 36, 0, 0, 351, 403, 3, 36, 18, 33, 352, 353, 10, 31, 0, 0, 353, 354, 5, 37, 0, 0, 354, 403, 3, 36, 18, 32, 355, 356, 10, 30, 0, 0, 356, 357, 5, 33, 0, 0, 357, 403, 3, 36, 18, 31, 358, 359, 10, 29, 0, 0, 359, 360, 5, 34, 0, 0, 360, 403, 3, 36, 18, 30, 361, 362, 10, 28, 0, 0, 362, 363, 5, 35, 0, 0, 363, 403, 3, 36, 18, 29, 364, 365, 10, 27, 0, 0, 365, 366, 5, 31, 0, 0, 366, 403, 3, 36, 18, 28, 367, 368, 10, 26, 0, 0, 368, 369, 5, 32, 0, 0, 369, 403, 3, 36, 18, 27, 370, 371, 10, 25, 0, 0, 371, 372, 5, 31, 0, 0, 372, 373, 5, 30, 0, 0, 373, 403, 3, 36, 18, 26, 374, 375, 10, 24, 0, 0, 375, 376, 5, 32, 0, 0, 376, 377, 5, 30, 0, 0, 377, 403, 3, 36, 18, 25, 378, 379, 10, 23, 0, 0, 379, 380, 5, 29, 0, 0, 380, 403, 3, 36, 18, 24, 381, 382, 10, 22, 0, 0, 382, 383, 5, 41, 0, 0, 383, 384, 5, 30, 0, 0, 384, 403, 3, 36, 18, 23, 385, 386, 10, 21, 0, 0, 386, 387, 5, 42, 0, 0, 387, 403, 3, 36, 18, 22, 388, 389, 10, 20, 0, 0, 389, 390, 5, 44, 0, 0, 390, 403, 3, 36, 18, 21, 391, 392, 10, 19, 0, 0, 392, 393, 5, 43, 0, 0, 393, 403, 3, 36, 18, 20, 394, 395, 10, 18, 0, 0, 395, 396, 5, 42, 0, 0, 396, 397, 5, 42, 0, 0, 397, 403, 3, 36, 18, 19, 398, 399, 10, 17, 0, 0, 399, 400, 5, 43, 0, 0, 400, 401, 5, 43, 0, 0, 401, 403, 3, 36, 18, 18, 402, 340, 1, 0, 0, 0, 402, 343, 1, 0, 0, 0, 402, 346, 1, 0, 0, 0, 402, 349, 1, 0, 0, 0, 402, 352, 1, 0, 0, 0, 402, 355, 1, 0, 0, 0, 402, 358, 1, 0, 0, 0, 402, 361, 1, 0, 0, 0, 402, 364, 1, 0, 0, 0, 402, 367, 1, 0, 0, 0, 402, 370, 1, 0, 0, 0, 402, 374, 1, 0, 0, 0, 402, 378, 1, 0, 0, 0, 402, 381, 1, 0, 0, 0, 402, 385, 1, 0, 0, 0, 402, 388, 1, 0, 0, 0, 402, 391, 1, 0, 0, 0, 402, 394, 1, 0, 0, 0, 402, 398, 1, 0, 0, 0, 403, 406, 1, 0, 0, 0, 404, 402, 1, 0, 0, 0, 404, 405, 1, 0, 0, 0, 405, 37, 1, 0, 0, 0, 406, 404, 1, 0, 0, 0, 407, 412, 5, 49, 0, 0, 408, 409, 5, 45, 0, 0, 409, 411, 5, 49, 0, 0, 410, 408, 1, 0, 0, 0, 411, 414, 1, 0, 0, 0, 412, 410, 1, 0, 0, 0, 412, 413, 1, 0, 0, 0, 413, 39, 1, 0, 0, 0, 414, 412, 1, 0, 0, 0, 415, 418, 3, 48, 24, 0, 416, 418, 3, 46, 23, 0, 417, 415, 1, 0, 0, 0, 417, 416, 1, 0, 0, 0, 418, 41, 1, 0, 0, 0, 419, 420, 5, 16, 0, 0, 420, 424, 6, 21, -1, 0, 421, 422, 5, 17, 0, 0, 422, 424, 6, 21, -1, 0, 423, 419, 1, 0, 0, 0, 423, 421, 1, 0, 0, 0, 424, 43, 1, 0, 0, 0, 425, 426, 5, 60, 0, 0, 426, 45, 1, 0, 0, 0, 427, 428, 5, 54, 0, 0, 428, 429, 6, 23, -1, 0, 429, 47, 1, 0, 0, 0, 430, 431, 5, 51, 0, 0, 431, 439, 6, 24, -1, 0, 432, 433, 5, 50, 0, 0, 433, 439, 6, 24, -1, 0, 434, 435, 5, 53, 0, 0, 435, 439, 6, 24, -1, 0, 436, 437, 5, 52, 0, 0, 437, 439, 6, 24, -1, 0, 438, 430, 1, 0, 0, 0, 438, 432, 1, 0, 0, 0, 438, 434, 1, 0, 0, 0, 438, 436, 1, 0, 0, 0, 439, 49, 1, 0, 0, 0, 440, 443, 3, 36, 18, 0, 441, 443, 3, 54, 27, 0, 442, 440, 1, 0, 0, 0, 442, 441, 1, 0, 0, 0, 443, 51, 1, 0, 0, 0, 444, 445, 3, 50, 25, 0, 445, 446, 5, 28, 0, 0, 446, 448, 1, 0, 0, 0, 447, 444, 1, 0, 0, 0, 448, 451, 1, 0, 0, 0, 449, 447, 1, 0, 0, 0, 449, 450, 1, 0, 0, 0, 450, 452, 1, 0, 0, 0, 451, 449, 1, 0, 0, 0, 452, 454, 3, 50, 25, 0, 453, 449, 1, 0, 0, 0, 453, 454, 1, 0, 0, 0, 454, 53, 1, 0, 0, 0, 455, 456, 6, 27, -1, 0, 456, 463, 3, 38, 19, 0, 457, 458, 3, 38, 19, 0, 458, 459, 5, 32, 0, 0, 459, 460, 3, 52, 26, 0, 460, 461, 5, 31, 0, 0, 461, 463, 1, 0, 0, 0, 462, 455, 1, 0, 0, 0, 462, 457, 1, 0, 0, 0, 463, 471, 1, 0, 0, 0, 464, 465, 10, 1, 0, 0, 465, 466, 5, 22, 0, 0, 466, 467, 3, 36, 18, 0, 467, 468, 5, 23, 0, 0, 468, 470, 1, 0, 0, 0, 469, 464, 1, 0, 0, 0, 470, 473, 1, 0, 0, 0, 471, 469, 1, 0, 0, 0, 471, 472, 1, 0, 0, 0, 472, 55, 1, 0, 0, 0, 473, 471, 1, 0, 0, 0, 33, 59, 63, 67, 70, 74, 90, 94, 117, 124, 128, 137, 143, 152, 161, 167, 171, 175, 202, 216, 226, 233, 338, 402, 404, 412, 417, 423, 438, 442, 449, 453, 462, 471] \ No newline at end of file diff --git a/parser/RiddleParserBaseListener.h b/parser/RiddleParserBaseListener.h index 1a82693..bef4741 100644 --- a/parser/RiddleParserBaseListener.h +++ b/parser/RiddleParserBaseListener.h @@ -73,6 +73,9 @@ class RiddleParserBaseListener : public RiddleParserListener { virtual void enterBlendExpr(RiddleParser::BlendExprContext * /*ctx*/) override { } virtual void exitBlendExpr(RiddleParser::BlendExprContext * /*ctx*/) override { } + virtual void enterExprPtrParser(RiddleParser::ExprPtrParserContext * /*ctx*/) override { } + virtual void exitExprPtrParser(RiddleParser::ExprPtrParserContext * /*ctx*/) override { } + virtual void enterSelfSubRightExpr(RiddleParser::SelfSubRightExprContext * /*ctx*/) override { } virtual void exitSelfSubRightExpr(RiddleParser::SelfSubRightExprContext * /*ctx*/) override { } diff --git a/parser/RiddleParserBaseVisitor.h b/parser/RiddleParserBaseVisitor.h index b33a956..b21aae8 100644 --- a/parser/RiddleParserBaseVisitor.h +++ b/parser/RiddleParserBaseVisitor.h @@ -91,6 +91,10 @@ class RiddleParserBaseVisitor : public RiddleParserVisitor { return visitChildren(ctx); } + virtual std::any visitExprPtrParser(RiddleParser::ExprPtrParserContext *ctx) override { + return visitChildren(ctx); + } + virtual std::any visitSelfSubRightExpr(RiddleParser::SelfSubRightExprContext *ctx) override { return visitChildren(ctx); } diff --git a/parser/RiddleParserListener.h b/parser/RiddleParserListener.h index ed22d02..f1e6527 100644 --- a/parser/RiddleParserListener.h +++ b/parser/RiddleParserListener.h @@ -71,6 +71,9 @@ class RiddleParserListener : public antlr4::tree::ParseTreeListener { virtual void enterBlendExpr(RiddleParser::BlendExprContext *ctx) = 0; virtual void exitBlendExpr(RiddleParser::BlendExprContext *ctx) = 0; + virtual void enterExprPtrParser(RiddleParser::ExprPtrParserContext *ctx) = 0; + virtual void exitExprPtrParser(RiddleParser::ExprPtrParserContext *ctx) = 0; + virtual void enterSelfSubRightExpr(RiddleParser::SelfSubRightExprContext *ctx) = 0; virtual void exitSelfSubRightExpr(RiddleParser::SelfSubRightExprContext *ctx) = 0; diff --git a/parser/RiddleParserVisitor.h b/parser/RiddleParserVisitor.h index 174e27c..cdd6443 100644 --- a/parser/RiddleParserVisitor.h +++ b/parser/RiddleParserVisitor.h @@ -57,6 +57,8 @@ class RiddleParserVisitor : public antlr4::tree::AbstractParseTreeVisitor { virtual std::any visitBlendExpr(RiddleParser::BlendExprContext *context) = 0; + virtual std::any visitExprPtrParser(RiddleParser::ExprPtrParserContext *context) = 0; + virtual std::any visitSelfSubRightExpr(RiddleParser::SelfSubRightExprContext *context) = 0; virtual std::any visitAndAssignExpr(RiddleParser::AndAssignExprContext *context) = 0; diff --git a/src/Tools/GenTools.h b/src/Tools/GenTools.h index 097abf1..f37d894 100644 --- a/src/Tools/GenTools.h +++ b/src/Tools/GenTools.h @@ -1,13 +1,13 @@ #ifndef RIDDLE_LANGUAGE_GENTOOLS_H #define RIDDLE_LANGUAGE_GENTOOLS_H +#include #include #include #include #include #include -#include -namespace Riddle{ +namespace Riddle { /// @brief 获取简单类型 /// @param type 简单类型的名称 /// @param Builder 生成器 @@ -25,7 +25,7 @@ namespace Riddle{ /// @param tree 节点 bool isIdentifier(antlr4::tree::ParseTree *tree); - struct DefineArgsType{ + struct DefineArgsType { std::vector types; std::vector names; }; @@ -41,7 +41,7 @@ namespace Riddle{ /// @brief 判断当前是否在类的定义中 /// @param parent 父栈 /// @return 是否在类的定义中 - inline bool isClassDefine(const std::variant parent){ + inline bool isClassDefine(const std::variant &parent) { return std::holds_alternative(parent); } } // namespace Riddle diff --git a/src/Visitors/GenVisitor.cpp b/src/Visitors/GenVisitor.cpp index 9fcfdc0..6cfab8f 100644 --- a/src/Visitors/GenVisitor.cpp +++ b/src/Visitors/GenVisitor.cpp @@ -13,6 +13,7 @@ namespace Riddle { [[maybe_unused]] GenVisitor::GenVisitor(const std::string &moduleName): Builder(globalContext) { module = new llvm::Module(moduleName, globalContext); + module->setSourceFileName(moduleName + ".red"); opMap = getBinaryOpMap(Builder); // print 函数 const auto printType = llvm::FunctionType::get( @@ -44,7 +45,7 @@ namespace Riddle { std::any GenVisitor::visitObjectExpr(RiddleParser::ObjectExprContext *ctx) { llvm::Value *value = varManager.getVar(ctx->Identifier()->getText()).value; - return value; + return std::tuple{value,value->getType()}; } std::any GenVisitor::visitProgram(RiddleParser::ProgramContext *ctx) { @@ -249,6 +250,7 @@ namespace Riddle { } llvm::Value *GenVisitor::binaryOperator(llvm::Value *value1, llvm::Value *value2, const std::string &op) { + if(op == "") return value2; //基本类型处理 const auto it = opMap.find(op); if(it == opMap.end()) throw std::logic_error("没实现"); @@ -473,10 +475,10 @@ namespace Riddle { if(!FuncCalls.contains(funcName)) { throw std::logic_error("This function \"" + std::string(funcName) + "\" is undefined"); } - auto args = any_cast>(visit(ctx->args)); - auto func = FuncCalls[funcName]; + const auto args = any_cast>(visit(ctx->args)); + const auto func = FuncCalls[funcName]; llvm::Value *result = Builder.CreateCall(func, args); - return result; + return std::tuple{result,result->getType()}; } std::any GenVisitor::visitArgsExpr(RiddleParser::ArgsExprContext *ctx) { @@ -508,17 +510,38 @@ namespace Riddle { return value; } + // BUG 这里不考虑对函数返回的对象的引用 std::any GenVisitor::visitBlendExpr(RiddleParser::BlendExprContext *ctx) { // todo 这里暂时没法使用对象的函数 - const auto parent = llvm::dyn_cast(std::any_cast(visit(ctx->parent))); + const auto [parent,type] = std::any_cast>(visit(ctx->parent)); + const auto childName = ctx->child->getText(); - const auto theClass = classManager.getClass(parent->getAllocatedType()->getStructName().str()); - const auto it = theClass.get().names.find(childName); - if(it == theClass.get().names.end()) { - throw std::logic_error("没有这个成员"); + ClassNode theClass; + + if(const auto Alloca = llvm::dyn_cast(parent)) { + theClass = classManager.getClass(Alloca->getAllocatedType()->getStructName().str()); + }else { + theClass = classManager.getClass(type->getStructName().str()); } - llvm::Value *result = Builder.CreateStructGEP(parent->getAllocatedType(), parent, it->second); - return result; + + if(const auto FuncExpr = dynamic_cast(ctx->child)) { + const auto func = theClass.get().funcs.at(childName); + const auto args = any_cast>(visit(FuncExpr->args)); + llvm::Value *result = Builder.CreateCall(func, args); + return std::tuple{result,result->getType()}; + } else { + const auto it = theClass.get().names.find(childName); + if(it == theClass.get().names.end()) { + throw std::logic_error("没有这个成员"); + } + llvm::Value *result = Builder.CreateStructGEP(theClass.get().types, parent, it->second); + return std::tuple{result,theClass.get().types->getElementType(it->second)}; + } + } + std::any GenVisitor::visitExprPtrParser(RiddleParser::ExprPtrParserContext *ctx) { + auto tp = any_cast>(visit(ctx->children[0])); + auto [value,type] = tp; + return value; } diff --git a/src/Visitors/GenVisitor.h b/src/Visitors/GenVisitor.h index c14e554..096da8d 100644 --- a/src/Visitors/GenVisitor.h +++ b/src/Visitors/GenVisitor.h @@ -218,6 +218,7 @@ namespace Riddle { /// @brief 获取一个混合对象 /// @return llvm::Value* std::any visitBlendExpr(RiddleParser::BlendExprContext *ctx) override; + std::any visitExprPtrParser(RiddleParser::ExprPtrParserContext *context) override; }; }// namespace Riddle