From f99087bb87b78c76a80f4bf3799facb4d7661f20 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Sun, 12 May 2024 10:28:13 +0200 Subject: [PATCH] Add `a ** b` syntax for `number::pow` (#60) --- src/antlr4/Navi.g4 | 6 +- src/antlr4/NaviLexer.js | 289 +++---- src/antlr4/NaviListener.js | 9 + src/antlr4/NaviParser.js | 1064 +++++++++++++----------- src/parse.ts | 21 +- tests/__snapshots__/parse.test.ts.snap | 19 +- tests/parse.test.ts | 7 +- 7 files changed, 778 insertions(+), 637 deletions(-) diff --git a/src/antlr4/Navi.g4 b/src/antlr4/Navi.g4 index 37ad070..b07b93b 100644 --- a/src/antlr4/Navi.g4 +++ b/src/antlr4/Navi.g4 @@ -61,7 +61,10 @@ ifExpression: fieldAccessExpression: primaryExpression ('.' Identifier)*; -negateExpression: OpMinus? fieldAccessExpression; +powExpression: + fieldAccessExpression (OpPow fieldAccessExpression)?; + +negateExpression: OpMinus? powExpression; multiplicativeExpression: negateExpression ((OpMult | OpDiv) negateExpression)*; @@ -168,6 +171,7 @@ OpMinus: '-'; OpPlus: '+'; OpMult: '*'; OpDiv: '/'; +OpPow: '**'; OpEqual: '=='; OpNotEqual: '!='; OpGt: '>'; diff --git a/src/antlr4/NaviLexer.js b/src/antlr4/NaviLexer.js index 5922d4c..1531010 100644 --- a/src/antlr4/NaviLexer.js +++ b/src/antlr4/NaviLexer.js @@ -3,139 +3,141 @@ import antlr4 from 'antlr4'; -const serializedATN = [4,0,51,404,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2, +const serializedATN = [4,0,52,409,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2, 4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7, 12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19, 2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2, 27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,2,34, 7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,2,40,7,40,2,41,7, 41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,46,7,46,2,47,7,47,2,48,7,48, -2,49,7,49,2,50,7,50,2,51,7,51,2,52,7,52,1,0,1,0,1,1,1,1,1,2,1,2,1,3,1,3, -1,4,1,4,1,5,1,5,1,6,1,6,1,7,1,7,1,7,1,8,1,8,1,9,1,9,1,10,1,10,1,11,1,11, -1,12,1,12,1,12,1,13,1,13,1,13,1,13,1,14,1,14,1,14,1,15,1,15,1,15,1,15,1, -16,1,16,1,16,1,16,1,16,1,17,1,17,1,17,1,17,1,17,1,18,1,18,1,18,1,19,1,19, -1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,20,1,20,1,20,1,20,1,21,1,21,1, -21,1,21,1,21,1,21,1,22,1,22,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,25,1,25,1,25,1,25,1,25,1,26,1,26,1,26,1,26,1,26,1,26,1, -27,1,27,1,28,1,28,1,28,1,28,1,28,3,28,212,8,28,1,28,1,28,3,28,216,8,28,1, -28,1,28,3,28,220,8,28,1,28,1,28,1,29,1,29,1,29,1,29,1,29,1,29,1,29,1,29, -3,29,232,8,29,1,29,1,29,3,29,236,8,29,1,29,1,29,3,29,240,8,29,1,29,1,29, -1,30,3,30,245,8,30,1,30,1,30,1,30,1,30,3,30,251,8,30,1,31,3,31,254,8,31, -1,31,1,31,1,31,1,31,1,31,3,31,261,8,31,1,32,3,32,264,8,32,1,32,1,32,1,32, -1,32,1,32,3,32,271,8,32,1,33,3,33,274,8,33,1,33,1,33,1,33,1,33,1,33,1,33, -3,33,282,8,33,1,34,3,34,285,8,34,1,34,1,34,1,34,4,34,290,8,34,11,34,12,34, -291,3,34,294,8,34,1,34,1,34,3,34,298,8,34,1,34,3,34,301,8,34,1,34,1,34,1, -34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,3,34,313,8,34,1,35,1,35,1,35,1,35, -5,35,319,8,35,10,35,12,35,322,9,35,1,35,1,35,1,36,1,36,1,36,5,36,329,8,36, -10,36,12,36,332,9,36,3,36,334,8,36,1,37,1,37,1,38,1,38,5,38,340,8,38,10, -38,12,38,343,9,38,1,39,1,39,1,40,1,40,1,41,1,41,1,42,1,42,1,43,1,43,1,43, -1,44,1,44,1,44,1,45,1,45,1,46,1,46,1,47,1,47,1,47,1,48,1,48,1,48,1,49,1, -49,1,49,1,49,1,50,4,50,374,8,50,11,50,12,50,375,1,50,1,50,1,51,1,51,1,51, -1,51,5,51,384,8,51,10,51,12,51,387,9,51,1,51,1,51,1,52,1,52,1,52,1,52,5, -52,395,8,52,10,52,12,52,398,9,52,1,52,1,52,1,52,1,52,1,52,1,396,0,53,1,1, -3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,21,11,23,12,25,13,27,14,29,15, -31,16,33,17,35,18,37,19,39,20,41,21,43,22,45,23,47,24,49,25,51,26,53,27, -55,28,57,29,59,30,61,31,63,32,65,33,67,34,69,35,71,36,73,0,75,0,77,37,79, -38,81,39,83,40,85,41,87,42,89,43,91,44,93,45,95,46,97,47,99,48,101,49,103, -50,105,51,1,0,10,1,0,48,57,2,0,69,69,101,101,2,0,43,43,45,45,3,0,0,31,34, -34,92,92,2,0,10,10,13,13,1,0,49,57,3,0,48,57,65,70,97,102,2,0,65,90,97,122, -4,0,48,57,65,90,95,95,97,122,3,0,9,10,13,13,32,32,431,0,1,1,0,0,0,0,3,1, -0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15, -1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0, -0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0,37,1, -0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,45,1,0,0,0,0,47,1,0,0,0,0, -49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55,1,0,0,0,0,57,1,0,0,0,0,59,1,0, -0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65,1,0,0,0,0,67,1,0,0,0,0,69,1,0,0,0,0,71, -1,0,0,0,0,77,1,0,0,0,0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0,0,0,85,1,0,0,0, -0,87,1,0,0,0,0,89,1,0,0,0,0,91,1,0,0,0,0,93,1,0,0,0,0,95,1,0,0,0,0,97,1, -0,0,0,0,99,1,0,0,0,0,101,1,0,0,0,0,103,1,0,0,0,0,105,1,0,0,0,1,107,1,0,0, -0,3,109,1,0,0,0,5,111,1,0,0,0,7,113,1,0,0,0,9,115,1,0,0,0,11,117,1,0,0,0, -13,119,1,0,0,0,15,121,1,0,0,0,17,124,1,0,0,0,19,126,1,0,0,0,21,128,1,0,0, -0,23,130,1,0,0,0,25,132,1,0,0,0,27,135,1,0,0,0,29,139,1,0,0,0,31,142,1,0, -0,0,33,146,1,0,0,0,35,151,1,0,0,0,37,156,1,0,0,0,39,159,1,0,0,0,41,169,1, -0,0,0,43,173,1,0,0,0,45,179,1,0,0,0,47,183,1,0,0,0,49,186,1,0,0,0,51,193, -1,0,0,0,53,198,1,0,0,0,55,204,1,0,0,0,57,206,1,0,0,0,59,223,1,0,0,0,61,244, -1,0,0,0,63,253,1,0,0,0,65,263,1,0,0,0,67,273,1,0,0,0,69,312,1,0,0,0,71,314, -1,0,0,0,73,333,1,0,0,0,75,335,1,0,0,0,77,337,1,0,0,0,79,344,1,0,0,0,81,346, -1,0,0,0,83,348,1,0,0,0,85,350,1,0,0,0,87,352,1,0,0,0,89,355,1,0,0,0,91,358, -1,0,0,0,93,360,1,0,0,0,95,362,1,0,0,0,97,365,1,0,0,0,99,368,1,0,0,0,101, -373,1,0,0,0,103,379,1,0,0,0,105,390,1,0,0,0,107,108,5,59,0,0,108,2,1,0,0, -0,109,110,5,61,0,0,110,4,1,0,0,0,111,112,5,123,0,0,112,6,1,0,0,0,113,114, -5,44,0,0,114,8,1,0,0,0,115,116,5,125,0,0,116,10,1,0,0,0,117,118,5,40,0,0, -118,12,1,0,0,0,119,120,5,41,0,0,120,14,1,0,0,0,121,122,5,61,0,0,122,123, -5,62,0,0,123,16,1,0,0,0,124,125,5,46,0,0,125,18,1,0,0,0,126,127,5,38,0,0, -127,20,1,0,0,0,128,129,5,124,0,0,129,22,1,0,0,0,130,131,5,58,0,0,131,24, -1,0,0,0,132,133,5,58,0,0,133,134,5,58,0,0,134,26,1,0,0,0,135,136,5,97,0, -0,136,137,5,110,0,0,137,138,5,100,0,0,138,28,1,0,0,0,139,140,5,97,0,0,140, -141,5,115,0,0,141,30,1,0,0,0,142,143,5,100,0,0,143,144,5,101,0,0,144,145, -5,102,0,0,145,32,1,0,0,0,146,147,5,101,0,0,147,148,5,108,0,0,148,149,5,115, -0,0,149,150,5,101,0,0,150,34,1,0,0,0,151,152,5,101,0,0,152,153,5,110,0,0, -153,154,5,117,0,0,154,155,5,109,0,0,155,36,1,0,0,0,156,157,5,105,0,0,157, -158,5,102,0,0,158,38,1,0,0,0,159,160,5,105,0,0,160,161,5,110,0,0,161,162, -5,116,0,0,162,163,5,114,0,0,163,164,5,105,0,0,164,165,5,110,0,0,165,166, -5,115,0,0,166,167,5,105,0,0,167,168,5,99,0,0,168,40,1,0,0,0,169,170,5,108, -0,0,170,171,5,101,0,0,171,172,5,116,0,0,172,42,1,0,0,0,173,174,5,109,0,0, -174,175,5,97,0,0,175,176,5,116,0,0,176,177,5,99,0,0,177,178,5,104,0,0,178, -44,1,0,0,0,179,180,5,110,0,0,180,181,5,111,0,0,181,182,5,116,0,0,182,46, -1,0,0,0,183,184,5,111,0,0,184,185,5,114,0,0,185,48,1,0,0,0,186,187,5,115, -0,0,187,188,5,116,0,0,188,189,5,114,0,0,189,190,5,117,0,0,190,191,5,99,0, -0,191,192,5,116,0,0,192,50,1,0,0,0,193,194,5,115,0,0,194,195,5,101,0,0,195, -196,5,108,0,0,196,197,5,102,0,0,197,52,1,0,0,0,198,199,5,116,0,0,199,200, -5,114,0,0,200,201,5,97,0,0,201,202,5,105,0,0,202,203,5,116,0,0,203,54,1, -0,0,0,204,205,5,95,0,0,205,56,1,0,0,0,206,207,5,105,0,0,207,208,5,110,0, -0,208,209,5,116,0,0,209,211,1,0,0,0,210,212,3,101,50,0,211,210,1,0,0,0,211, -212,1,0,0,0,212,213,1,0,0,0,213,215,5,40,0,0,214,216,3,101,50,0,215,214, -1,0,0,0,215,216,1,0,0,0,216,217,1,0,0,0,217,219,3,61,30,0,218,220,3,101, -50,0,219,218,1,0,0,0,219,220,1,0,0,0,220,221,1,0,0,0,221,222,5,41,0,0,222, -58,1,0,0,0,223,224,5,110,0,0,224,225,5,111,0,0,225,226,5,110,0,0,226,227, -5,73,0,0,227,228,5,110,0,0,228,229,5,116,0,0,229,231,1,0,0,0,230,232,3,101, -50,0,231,230,1,0,0,0,231,232,1,0,0,0,232,233,1,0,0,0,233,235,5,40,0,0,234, -236,3,101,50,0,235,234,1,0,0,0,235,236,1,0,0,0,236,237,1,0,0,0,237,239,3, -61,30,0,238,240,3,101,50,0,239,238,1,0,0,0,239,240,1,0,0,0,240,241,1,0,0, -0,241,242,5,41,0,0,242,60,1,0,0,0,243,245,3,69,34,0,244,243,1,0,0,0,244, -245,1,0,0,0,245,246,1,0,0,0,246,247,5,46,0,0,247,248,5,46,0,0,248,250,1, -0,0,0,249,251,3,69,34,0,250,249,1,0,0,0,250,251,1,0,0,0,251,62,1,0,0,0,252, -254,3,69,34,0,253,252,1,0,0,0,253,254,1,0,0,0,254,255,1,0,0,0,255,256,5, -33,0,0,256,257,5,46,0,0,257,258,5,46,0,0,258,260,1,0,0,0,259,261,3,69,34, -0,260,259,1,0,0,0,260,261,1,0,0,0,261,64,1,0,0,0,262,264,3,69,34,0,263,262, -1,0,0,0,263,264,1,0,0,0,264,265,1,0,0,0,265,266,5,46,0,0,266,267,5,46,0, -0,267,268,5,33,0,0,268,270,1,0,0,0,269,271,3,69,34,0,270,269,1,0,0,0,270, -271,1,0,0,0,271,66,1,0,0,0,272,274,3,69,34,0,273,272,1,0,0,0,273,274,1,0, -0,0,274,275,1,0,0,0,275,276,5,33,0,0,276,277,5,46,0,0,277,278,5,46,0,0,278, -279,5,33,0,0,279,281,1,0,0,0,280,282,3,69,34,0,281,280,1,0,0,0,281,282,1, -0,0,0,282,68,1,0,0,0,283,285,5,45,0,0,284,283,1,0,0,0,284,285,1,0,0,0,285, -286,1,0,0,0,286,293,3,73,36,0,287,289,5,46,0,0,288,290,7,0,0,0,289,288,1, -0,0,0,290,291,1,0,0,0,291,289,1,0,0,0,291,292,1,0,0,0,292,294,1,0,0,0,293, -287,1,0,0,0,293,294,1,0,0,0,294,300,1,0,0,0,295,297,7,1,0,0,296,298,7,2, -0,0,297,296,1,0,0,0,297,298,1,0,0,0,298,299,1,0,0,0,299,301,3,73,36,0,300, -295,1,0,0,0,300,301,1,0,0,0,301,313,1,0,0,0,302,303,5,105,0,0,303,304,5, -110,0,0,304,313,5,102,0,0,305,306,5,45,0,0,306,307,5,105,0,0,307,308,5,110, -0,0,308,313,5,102,0,0,309,310,5,110,0,0,310,311,5,97,0,0,311,313,5,110,0, -0,312,284,1,0,0,0,312,302,1,0,0,0,312,305,1,0,0,0,312,309,1,0,0,0,313,70, -1,0,0,0,314,320,5,34,0,0,315,319,8,3,0,0,316,317,5,92,0,0,317,319,8,4,0, -0,318,315,1,0,0,0,318,316,1,0,0,0,319,322,1,0,0,0,320,318,1,0,0,0,320,321, -1,0,0,0,321,323,1,0,0,0,322,320,1,0,0,0,323,324,5,34,0,0,324,72,1,0,0,0, -325,334,5,48,0,0,326,330,7,5,0,0,327,329,7,0,0,0,328,327,1,0,0,0,329,332, -1,0,0,0,330,328,1,0,0,0,330,331,1,0,0,0,331,334,1,0,0,0,332,330,1,0,0,0, -333,325,1,0,0,0,333,326,1,0,0,0,334,74,1,0,0,0,335,336,7,6,0,0,336,76,1, -0,0,0,337,341,7,7,0,0,338,340,7,8,0,0,339,338,1,0,0,0,340,343,1,0,0,0,341, -339,1,0,0,0,341,342,1,0,0,0,342,78,1,0,0,0,343,341,1,0,0,0,344,345,5,45, -0,0,345,80,1,0,0,0,346,347,5,43,0,0,347,82,1,0,0,0,348,349,5,42,0,0,349, -84,1,0,0,0,350,351,5,47,0,0,351,86,1,0,0,0,352,353,5,61,0,0,353,354,5,61, -0,0,354,88,1,0,0,0,355,356,5,33,0,0,356,357,5,61,0,0,357,90,1,0,0,0,358, -359,5,62,0,0,359,92,1,0,0,0,360,361,5,60,0,0,361,94,1,0,0,0,362,363,5,62, -0,0,363,364,5,61,0,0,364,96,1,0,0,0,365,366,5,60,0,0,366,367,5,61,0,0,367, -98,1,0,0,0,368,369,5,46,0,0,369,370,5,46,0,0,370,371,5,46,0,0,371,100,1, -0,0,0,372,374,7,9,0,0,373,372,1,0,0,0,374,375,1,0,0,0,375,373,1,0,0,0,375, -376,1,0,0,0,376,377,1,0,0,0,377,378,6,50,0,0,378,102,1,0,0,0,379,380,5,47, -0,0,380,381,5,47,0,0,381,385,1,0,0,0,382,384,8,4,0,0,383,382,1,0,0,0,384, -387,1,0,0,0,385,383,1,0,0,0,385,386,1,0,0,0,386,388,1,0,0,0,387,385,1,0, -0,0,388,389,6,51,0,0,389,104,1,0,0,0,390,391,5,47,0,0,391,392,5,42,0,0,392, -396,1,0,0,0,393,395,9,0,0,0,394,393,1,0,0,0,395,398,1,0,0,0,396,397,1,0, -0,0,396,394,1,0,0,0,397,399,1,0,0,0,398,396,1,0,0,0,399,400,5,42,0,0,400, -401,5,47,0,0,401,402,1,0,0,0,402,403,6,52,0,0,403,106,1,0,0,0,29,0,211,215, -219,231,235,239,244,250,253,260,263,270,273,281,284,291,293,297,300,312, -318,320,330,333,341,375,385,396,1,6,0,0]; +2,49,7,49,2,50,7,50,2,51,7,51,2,52,7,52,2,53,7,53,1,0,1,0,1,1,1,1,1,2,1, +2,1,3,1,3,1,4,1,4,1,5,1,5,1,6,1,6,1,7,1,7,1,7,1,8,1,8,1,9,1,9,1,10,1,10, +1,11,1,11,1,12,1,12,1,12,1,13,1,13,1,13,1,13,1,14,1,14,1,14,1,15,1,15,1, +15,1,15,1,16,1,16,1,16,1,16,1,16,1,17,1,17,1,17,1,17,1,17,1,18,1,18,1,18, +1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,20,1,20,1,20,1,20,1, +21,1,21,1,21,1,21,1,21,1,21,1,22,1,22,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,25,1,25,1,25,1,25,1,25,1,26,1,26,1,26,1,26,1, +26,1,26,1,27,1,27,1,28,1,28,1,28,1,28,1,28,3,28,214,8,28,1,28,1,28,3,28, +218,8,28,1,28,1,28,3,28,222,8,28,1,28,1,28,1,29,1,29,1,29,1,29,1,29,1,29, +1,29,1,29,3,29,234,8,29,1,29,1,29,3,29,238,8,29,1,29,1,29,3,29,242,8,29, +1,29,1,29,1,30,3,30,247,8,30,1,30,1,30,1,30,1,30,3,30,253,8,30,1,31,3,31, +256,8,31,1,31,1,31,1,31,1,31,1,31,3,31,263,8,31,1,32,3,32,266,8,32,1,32, +1,32,1,32,1,32,1,32,3,32,273,8,32,1,33,3,33,276,8,33,1,33,1,33,1,33,1,33, +1,33,1,33,3,33,284,8,33,1,34,3,34,287,8,34,1,34,1,34,1,34,4,34,292,8,34, +11,34,12,34,293,3,34,296,8,34,1,34,1,34,3,34,300,8,34,1,34,3,34,303,8,34, +1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,1,34,3,34,315,8,34,1,35,1,35, +1,35,1,35,5,35,321,8,35,10,35,12,35,324,9,35,1,35,1,35,1,36,1,36,1,36,5, +36,331,8,36,10,36,12,36,334,9,36,3,36,336,8,36,1,37,1,37,1,38,1,38,5,38, +342,8,38,10,38,12,38,345,9,38,1,39,1,39,1,40,1,40,1,41,1,41,1,42,1,42,1, +43,1,43,1,43,1,44,1,44,1,44,1,45,1,45,1,45,1,46,1,46,1,47,1,47,1,48,1,48, +1,48,1,49,1,49,1,49,1,50,1,50,1,50,1,50,1,51,4,51,379,8,51,11,51,12,51,380, +1,51,1,51,1,52,1,52,1,52,1,52,5,52,389,8,52,10,52,12,52,392,9,52,1,52,1, +52,1,53,1,53,1,53,1,53,5,53,400,8,53,10,53,12,53,403,9,53,1,53,1,53,1,53, +1,53,1,53,1,401,0,54,1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,21,11, +23,12,25,13,27,14,29,15,31,16,33,17,35,18,37,19,39,20,41,21,43,22,45,23, +47,24,49,25,51,26,53,27,55,28,57,29,59,30,61,31,63,32,65,33,67,34,69,35, +71,36,73,0,75,0,77,37,79,38,81,39,83,40,85,41,87,42,89,43,91,44,93,45,95, +46,97,47,99,48,101,49,103,50,105,51,107,52,1,0,10,1,0,48,57,2,0,69,69,101, +101,2,0,43,43,45,45,3,0,0,31,34,34,92,92,2,0,10,10,13,13,1,0,49,57,3,0,48, +57,65,70,97,102,2,0,65,90,97,122,4,0,48,57,65,90,95,95,97,122,3,0,9,10,13, +13,32,32,436,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0, +0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1, +0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0, +33,1,0,0,0,0,35,1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0, +0,0,0,45,1,0,0,0,0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55, +1,0,0,0,0,57,1,0,0,0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65,1,0,0,0, +0,67,1,0,0,0,0,69,1,0,0,0,0,71,1,0,0,0,0,77,1,0,0,0,0,79,1,0,0,0,0,81,1, +0,0,0,0,83,1,0,0,0,0,85,1,0,0,0,0,87,1,0,0,0,0,89,1,0,0,0,0,91,1,0,0,0,0, +93,1,0,0,0,0,95,1,0,0,0,0,97,1,0,0,0,0,99,1,0,0,0,0,101,1,0,0,0,0,103,1, +0,0,0,0,105,1,0,0,0,0,107,1,0,0,0,1,109,1,0,0,0,3,111,1,0,0,0,5,113,1,0, +0,0,7,115,1,0,0,0,9,117,1,0,0,0,11,119,1,0,0,0,13,121,1,0,0,0,15,123,1,0, +0,0,17,126,1,0,0,0,19,128,1,0,0,0,21,130,1,0,0,0,23,132,1,0,0,0,25,134,1, +0,0,0,27,137,1,0,0,0,29,141,1,0,0,0,31,144,1,0,0,0,33,148,1,0,0,0,35,153, +1,0,0,0,37,158,1,0,0,0,39,161,1,0,0,0,41,171,1,0,0,0,43,175,1,0,0,0,45,181, +1,0,0,0,47,185,1,0,0,0,49,188,1,0,0,0,51,195,1,0,0,0,53,200,1,0,0,0,55,206, +1,0,0,0,57,208,1,0,0,0,59,225,1,0,0,0,61,246,1,0,0,0,63,255,1,0,0,0,65,265, +1,0,0,0,67,275,1,0,0,0,69,314,1,0,0,0,71,316,1,0,0,0,73,335,1,0,0,0,75,337, +1,0,0,0,77,339,1,0,0,0,79,346,1,0,0,0,81,348,1,0,0,0,83,350,1,0,0,0,85,352, +1,0,0,0,87,354,1,0,0,0,89,357,1,0,0,0,91,360,1,0,0,0,93,363,1,0,0,0,95,365, +1,0,0,0,97,367,1,0,0,0,99,370,1,0,0,0,101,373,1,0,0,0,103,378,1,0,0,0,105, +384,1,0,0,0,107,395,1,0,0,0,109,110,5,59,0,0,110,2,1,0,0,0,111,112,5,61, +0,0,112,4,1,0,0,0,113,114,5,123,0,0,114,6,1,0,0,0,115,116,5,44,0,0,116,8, +1,0,0,0,117,118,5,125,0,0,118,10,1,0,0,0,119,120,5,40,0,0,120,12,1,0,0,0, +121,122,5,41,0,0,122,14,1,0,0,0,123,124,5,61,0,0,124,125,5,62,0,0,125,16, +1,0,0,0,126,127,5,46,0,0,127,18,1,0,0,0,128,129,5,38,0,0,129,20,1,0,0,0, +130,131,5,124,0,0,131,22,1,0,0,0,132,133,5,58,0,0,133,24,1,0,0,0,134,135, +5,58,0,0,135,136,5,58,0,0,136,26,1,0,0,0,137,138,5,97,0,0,138,139,5,110, +0,0,139,140,5,100,0,0,140,28,1,0,0,0,141,142,5,97,0,0,142,143,5,115,0,0, +143,30,1,0,0,0,144,145,5,100,0,0,145,146,5,101,0,0,146,147,5,102,0,0,147, +32,1,0,0,0,148,149,5,101,0,0,149,150,5,108,0,0,150,151,5,115,0,0,151,152, +5,101,0,0,152,34,1,0,0,0,153,154,5,101,0,0,154,155,5,110,0,0,155,156,5,117, +0,0,156,157,5,109,0,0,157,36,1,0,0,0,158,159,5,105,0,0,159,160,5,102,0,0, +160,38,1,0,0,0,161,162,5,105,0,0,162,163,5,110,0,0,163,164,5,116,0,0,164, +165,5,114,0,0,165,166,5,105,0,0,166,167,5,110,0,0,167,168,5,115,0,0,168, +169,5,105,0,0,169,170,5,99,0,0,170,40,1,0,0,0,171,172,5,108,0,0,172,173, +5,101,0,0,173,174,5,116,0,0,174,42,1,0,0,0,175,176,5,109,0,0,176,177,5,97, +0,0,177,178,5,116,0,0,178,179,5,99,0,0,179,180,5,104,0,0,180,44,1,0,0,0, +181,182,5,110,0,0,182,183,5,111,0,0,183,184,5,116,0,0,184,46,1,0,0,0,185, +186,5,111,0,0,186,187,5,114,0,0,187,48,1,0,0,0,188,189,5,115,0,0,189,190, +5,116,0,0,190,191,5,114,0,0,191,192,5,117,0,0,192,193,5,99,0,0,193,194,5, +116,0,0,194,50,1,0,0,0,195,196,5,115,0,0,196,197,5,101,0,0,197,198,5,108, +0,0,198,199,5,102,0,0,199,52,1,0,0,0,200,201,5,116,0,0,201,202,5,114,0,0, +202,203,5,97,0,0,203,204,5,105,0,0,204,205,5,116,0,0,205,54,1,0,0,0,206, +207,5,95,0,0,207,56,1,0,0,0,208,209,5,105,0,0,209,210,5,110,0,0,210,211, +5,116,0,0,211,213,1,0,0,0,212,214,3,103,51,0,213,212,1,0,0,0,213,214,1,0, +0,0,214,215,1,0,0,0,215,217,5,40,0,0,216,218,3,103,51,0,217,216,1,0,0,0, +217,218,1,0,0,0,218,219,1,0,0,0,219,221,3,61,30,0,220,222,3,103,51,0,221, +220,1,0,0,0,221,222,1,0,0,0,222,223,1,0,0,0,223,224,5,41,0,0,224,58,1,0, +0,0,225,226,5,110,0,0,226,227,5,111,0,0,227,228,5,110,0,0,228,229,5,73,0, +0,229,230,5,110,0,0,230,231,5,116,0,0,231,233,1,0,0,0,232,234,3,103,51,0, +233,232,1,0,0,0,233,234,1,0,0,0,234,235,1,0,0,0,235,237,5,40,0,0,236,238, +3,103,51,0,237,236,1,0,0,0,237,238,1,0,0,0,238,239,1,0,0,0,239,241,3,61, +30,0,240,242,3,103,51,0,241,240,1,0,0,0,241,242,1,0,0,0,242,243,1,0,0,0, +243,244,5,41,0,0,244,60,1,0,0,0,245,247,3,69,34,0,246,245,1,0,0,0,246,247, +1,0,0,0,247,248,1,0,0,0,248,249,5,46,0,0,249,250,5,46,0,0,250,252,1,0,0, +0,251,253,3,69,34,0,252,251,1,0,0,0,252,253,1,0,0,0,253,62,1,0,0,0,254,256, +3,69,34,0,255,254,1,0,0,0,255,256,1,0,0,0,256,257,1,0,0,0,257,258,5,33,0, +0,258,259,5,46,0,0,259,260,5,46,0,0,260,262,1,0,0,0,261,263,3,69,34,0,262, +261,1,0,0,0,262,263,1,0,0,0,263,64,1,0,0,0,264,266,3,69,34,0,265,264,1,0, +0,0,265,266,1,0,0,0,266,267,1,0,0,0,267,268,5,46,0,0,268,269,5,46,0,0,269, +270,5,33,0,0,270,272,1,0,0,0,271,273,3,69,34,0,272,271,1,0,0,0,272,273,1, +0,0,0,273,66,1,0,0,0,274,276,3,69,34,0,275,274,1,0,0,0,275,276,1,0,0,0,276, +277,1,0,0,0,277,278,5,33,0,0,278,279,5,46,0,0,279,280,5,46,0,0,280,281,5, +33,0,0,281,283,1,0,0,0,282,284,3,69,34,0,283,282,1,0,0,0,283,284,1,0,0,0, +284,68,1,0,0,0,285,287,5,45,0,0,286,285,1,0,0,0,286,287,1,0,0,0,287,288, +1,0,0,0,288,295,3,73,36,0,289,291,5,46,0,0,290,292,7,0,0,0,291,290,1,0,0, +0,292,293,1,0,0,0,293,291,1,0,0,0,293,294,1,0,0,0,294,296,1,0,0,0,295,289, +1,0,0,0,295,296,1,0,0,0,296,302,1,0,0,0,297,299,7,1,0,0,298,300,7,2,0,0, +299,298,1,0,0,0,299,300,1,0,0,0,300,301,1,0,0,0,301,303,3,73,36,0,302,297, +1,0,0,0,302,303,1,0,0,0,303,315,1,0,0,0,304,305,5,105,0,0,305,306,5,110, +0,0,306,315,5,102,0,0,307,308,5,45,0,0,308,309,5,105,0,0,309,310,5,110,0, +0,310,315,5,102,0,0,311,312,5,110,0,0,312,313,5,97,0,0,313,315,5,110,0,0, +314,286,1,0,0,0,314,304,1,0,0,0,314,307,1,0,0,0,314,311,1,0,0,0,315,70,1, +0,0,0,316,322,5,34,0,0,317,321,8,3,0,0,318,319,5,92,0,0,319,321,8,4,0,0, +320,317,1,0,0,0,320,318,1,0,0,0,321,324,1,0,0,0,322,320,1,0,0,0,322,323, +1,0,0,0,323,325,1,0,0,0,324,322,1,0,0,0,325,326,5,34,0,0,326,72,1,0,0,0, +327,336,5,48,0,0,328,332,7,5,0,0,329,331,7,0,0,0,330,329,1,0,0,0,331,334, +1,0,0,0,332,330,1,0,0,0,332,333,1,0,0,0,333,336,1,0,0,0,334,332,1,0,0,0, +335,327,1,0,0,0,335,328,1,0,0,0,336,74,1,0,0,0,337,338,7,6,0,0,338,76,1, +0,0,0,339,343,7,7,0,0,340,342,7,8,0,0,341,340,1,0,0,0,342,345,1,0,0,0,343, +341,1,0,0,0,343,344,1,0,0,0,344,78,1,0,0,0,345,343,1,0,0,0,346,347,5,45, +0,0,347,80,1,0,0,0,348,349,5,43,0,0,349,82,1,0,0,0,350,351,5,42,0,0,351, +84,1,0,0,0,352,353,5,47,0,0,353,86,1,0,0,0,354,355,5,42,0,0,355,356,5,42, +0,0,356,88,1,0,0,0,357,358,5,61,0,0,358,359,5,61,0,0,359,90,1,0,0,0,360, +361,5,33,0,0,361,362,5,61,0,0,362,92,1,0,0,0,363,364,5,62,0,0,364,94,1,0, +0,0,365,366,5,60,0,0,366,96,1,0,0,0,367,368,5,62,0,0,368,369,5,61,0,0,369, +98,1,0,0,0,370,371,5,60,0,0,371,372,5,61,0,0,372,100,1,0,0,0,373,374,5,46, +0,0,374,375,5,46,0,0,375,376,5,46,0,0,376,102,1,0,0,0,377,379,7,9,0,0,378, +377,1,0,0,0,379,380,1,0,0,0,380,378,1,0,0,0,380,381,1,0,0,0,381,382,1,0, +0,0,382,383,6,51,0,0,383,104,1,0,0,0,384,385,5,47,0,0,385,386,5,47,0,0,386, +390,1,0,0,0,387,389,8,4,0,0,388,387,1,0,0,0,389,392,1,0,0,0,390,388,1,0, +0,0,390,391,1,0,0,0,391,393,1,0,0,0,392,390,1,0,0,0,393,394,6,52,0,0,394, +106,1,0,0,0,395,396,5,47,0,0,396,397,5,42,0,0,397,401,1,0,0,0,398,400,9, +0,0,0,399,398,1,0,0,0,400,403,1,0,0,0,401,402,1,0,0,0,401,399,1,0,0,0,402, +404,1,0,0,0,403,401,1,0,0,0,404,405,5,42,0,0,405,406,5,47,0,0,406,407,1, +0,0,0,407,408,6,53,0,0,408,108,1,0,0,0,29,0,213,217,221,233,237,241,246, +252,255,262,265,272,275,283,286,293,295,299,302,314,320,322,332,335,343, +380,390,401,1,6,0,0]; const atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN); @@ -153,8 +155,8 @@ export default class NaviLexer extends antlr4.Lexer { "'intrinsic'", "'let'", "'match'", "'not'", "'or'", "'struct'", "'self'", "'trait'", "'_'", null, null, null, null, null, null, null, null, null, "'-'", - "'+'", "'*'", "'/'", "'=='", "'!='", "'>'", "'<'", - "'>='", "'<='", "'...'" ]; + "'+'", "'*'", "'/'", "'**'", "'=='", "'!='", "'>'", + "'<'", "'>='", "'<='", "'...'" ]; static symbolicNames = [ null, null, null, null, null, null, null, null, null, null, null, null, null, null, "And", "As", "Def", "Else", "Enum", "If", "Intrinsic", "Let", @@ -162,9 +164,9 @@ export default class NaviLexer extends antlr4.Lexer { "Discard", "IntInterval", "NonIntInterval", "IntervalInclusive", "IntervalMinExclusive", "IntervalMaxExclusive", "IntervalExclusive", "Number", "String", "Identifier", - "OpMinus", "OpPlus", "OpMult", "OpDiv", "OpEqual", - "OpNotEqual", "OpGt", "OpLt", "OpGte", "OpLte", - "OpSpread", "Space", "LineComment", "BlockComment" ]; + "OpMinus", "OpPlus", "OpMult", "OpDiv", "OpPow", + "OpEqual", "OpNotEqual", "OpGt", "OpLt", "OpGte", + "OpLte", "OpSpread", "Space", "LineComment", "BlockComment" ]; static ruleNames = [ "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", "T__7", "T__8", "T__9", "T__10", "T__11", "T__12", "And", "As", "Def", "Else", "Enum", "If", "Intrinsic", @@ -172,7 +174,7 @@ export default class NaviLexer extends antlr4.Lexer { "Discard", "IntInterval", "NonIntInterval", "IntervalInclusive", "IntervalMinExclusive", "IntervalMaxExclusive", "IntervalExclusive", "Number", "String", "DIGITS", "HEX", "Identifier", - "OpMinus", "OpPlus", "OpMult", "OpDiv", "OpEqual", + "OpMinus", "OpPlus", "OpMult", "OpDiv", "OpPow", "OpEqual", "OpNotEqual", "OpGt", "OpLt", "OpGte", "OpLte", "OpSpread", "Space", "LineComment", "BlockComment" ]; @@ -224,16 +226,17 @@ NaviLexer.OpMinus = 38; NaviLexer.OpPlus = 39; NaviLexer.OpMult = 40; NaviLexer.OpDiv = 41; -NaviLexer.OpEqual = 42; -NaviLexer.OpNotEqual = 43; -NaviLexer.OpGt = 44; -NaviLexer.OpLt = 45; -NaviLexer.OpGte = 46; -NaviLexer.OpLte = 47; -NaviLexer.OpSpread = 48; -NaviLexer.Space = 49; -NaviLexer.LineComment = 50; -NaviLexer.BlockComment = 51; +NaviLexer.OpPow = 42; +NaviLexer.OpEqual = 43; +NaviLexer.OpNotEqual = 44; +NaviLexer.OpGt = 45; +NaviLexer.OpLt = 46; +NaviLexer.OpGte = 47; +NaviLexer.OpLte = 48; +NaviLexer.OpSpread = 49; +NaviLexer.Space = 50; +NaviLexer.LineComment = 51; +NaviLexer.BlockComment = 52; diff --git a/src/antlr4/NaviListener.js b/src/antlr4/NaviListener.js index 94b5129..6854919 100644 --- a/src/antlr4/NaviListener.js +++ b/src/antlr4/NaviListener.js @@ -176,6 +176,15 @@ export default class NaviListener extends antlr4.tree.ParseTreeListener { } + // Enter a parse tree produced by NaviParser#powExpression. + enterPowExpression(ctx) { + } + + // Exit a parse tree produced by NaviParser#powExpression. + exitPowExpression(ctx) { + } + + // Enter a parse tree produced by NaviParser#negateExpression. enterNegateExpression(ctx) { } diff --git a/src/antlr4/NaviParser.js b/src/antlr4/NaviParser.js index aa6bbb5..941d6c7 100644 --- a/src/antlr4/NaviParser.js +++ b/src/antlr4/NaviParser.js @@ -2,158 +2,161 @@ // jshint ignore: start import antlr4 from 'antlr4'; import NaviListener from './NaviListener.js'; -const serializedATN = [4,1,51,469,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7, +const serializedATN = [4,1,52,476,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7, 4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12, 2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2, 20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27, 7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,2,34,7, 34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,2,40,7,40,2,41,7,41, -1,0,1,0,5,0,87,8,0,10,0,12,0,90,9,0,1,0,1,0,1,1,5,1,95,8,1,10,1,12,1,98, -9,1,1,1,1,1,1,1,1,2,1,2,1,3,1,3,1,3,1,3,1,3,3,3,110,8,3,1,3,1,3,1,4,1,4, -1,4,1,4,3,4,118,8,4,1,5,1,5,1,5,1,5,3,5,124,8,5,1,6,1,6,1,6,1,6,3,6,130, -8,6,1,6,1,6,1,6,1,6,1,6,3,6,137,8,6,1,7,1,7,1,7,3,7,142,8,7,1,7,1,7,1,7, -1,7,1,8,1,8,1,8,1,8,1,8,1,8,5,8,154,8,8,10,8,12,8,157,9,8,1,8,3,8,160,8, -8,5,8,162,8,8,10,8,12,8,165,9,8,1,8,1,8,1,9,1,9,3,9,171,8,9,1,10,1,10,1, +2,42,7,42,1,0,1,0,5,0,89,8,0,10,0,12,0,92,9,0,1,0,1,0,1,1,5,1,97,8,1,10, +1,12,1,100,9,1,1,1,1,1,1,1,1,2,1,2,1,3,1,3,1,3,1,3,1,3,3,3,112,8,3,1,3,1, +3,1,4,1,4,1,4,1,4,3,4,120,8,4,1,5,1,5,1,5,1,5,3,5,126,8,5,1,6,1,6,1,6,1, +6,3,6,132,8,6,1,6,1,6,1,6,1,6,1,6,3,6,139,8,6,1,7,1,7,1,7,3,7,144,8,7,1, +7,1,7,1,7,1,7,1,8,1,8,1,8,1,8,1,8,1,8,5,8,156,8,8,10,8,12,8,159,9,8,1,8, +3,8,162,8,8,5,8,164,8,8,10,8,12,8,167,9,8,1,8,1,8,1,9,1,9,3,9,173,8,9,1, 10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10, -1,10,3,10,191,8,10,1,11,1,11,1,11,1,11,1,11,1,11,5,11,199,8,11,10,11,12, -11,202,9,11,1,11,3,11,205,8,11,3,11,207,8,11,1,11,1,11,1,12,1,12,3,12,213, -8,12,1,12,1,12,3,12,217,8,12,1,12,1,12,1,12,1,13,1,13,1,13,1,13,1,13,1,14, -1,14,1,15,1,15,1,15,1,16,1,16,5,16,234,8,16,10,16,12,16,237,9,16,1,16,1, -16,1,16,1,17,1,17,1,17,1,17,1,17,1,17,3,17,248,8,17,1,18,1,18,1,18,5,18, -253,8,18,10,18,12,18,256,9,18,1,19,3,19,259,8,19,1,19,1,19,1,20,1,20,1,20, -5,20,266,8,20,10,20,12,20,269,9,20,1,21,1,21,1,21,5,21,274,8,21,10,21,12, -21,277,9,21,1,22,1,22,1,22,5,22,282,8,22,10,22,12,22,285,9,22,1,23,1,23, -1,23,5,23,290,8,23,10,23,12,23,293,9,23,1,24,1,24,1,24,3,24,298,8,24,1,25, -5,25,301,8,25,10,25,12,25,304,9,25,1,25,1,25,1,26,1,26,1,26,5,26,311,8,26, -10,26,12,26,314,9,26,1,27,1,27,1,27,5,27,319,8,27,10,27,12,27,322,9,27,1, -28,1,28,1,29,1,29,1,29,5,29,329,8,29,10,29,12,29,332,9,29,1,29,3,29,335, -8,29,3,29,337,8,29,1,30,1,30,1,30,1,30,5,30,343,8,30,10,30,12,30,346,9,30, -1,30,3,30,349,8,30,3,30,351,8,30,1,30,1,30,1,31,1,31,1,31,1,31,5,31,359, -8,31,10,31,12,31,362,9,31,1,31,1,31,1,31,1,31,5,31,368,8,31,10,31,12,31, -371,9,31,1,31,3,31,374,8,31,3,31,376,8,31,3,31,378,8,31,1,31,1,31,1,31,5, -31,383,8,31,10,31,12,31,386,9,31,1,31,3,31,389,8,31,3,31,391,8,31,3,31,393, -8,31,1,31,1,31,1,32,1,32,1,32,1,33,1,33,1,33,1,34,1,34,3,34,405,8,34,1,35, -1,35,1,35,1,35,5,35,411,8,35,10,35,12,35,414,9,35,1,35,3,35,417,8,35,3,35, -419,8,35,1,35,1,35,1,36,1,36,1,36,1,36,5,36,427,8,36,10,36,12,36,430,9,36, -1,36,1,36,3,36,434,8,36,1,36,3,36,437,8,36,1,36,3,36,440,8,36,3,36,442,8, -36,1,36,1,36,1,37,1,37,1,37,1,38,1,38,1,38,1,38,1,39,1,39,1,39,1,40,1,40, -1,41,1,41,1,41,1,41,3,41,462,8,41,5,41,464,8,41,10,41,12,41,467,9,41,1,41, -0,0,42,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46, -48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,0,4,1,0,40,41,1,0, -38,39,1,0,42,47,2,0,14,14,23,24,498,0,88,1,0,0,0,2,96,1,0,0,0,4,102,1,0, -0,0,6,104,1,0,0,0,8,117,1,0,0,0,10,119,1,0,0,0,12,125,1,0,0,0,14,138,1,0, -0,0,16,147,1,0,0,0,18,168,1,0,0,0,20,190,1,0,0,0,22,192,1,0,0,0,24,212,1, -0,0,0,26,221,1,0,0,0,28,226,1,0,0,0,30,228,1,0,0,0,32,231,1,0,0,0,34,241, -1,0,0,0,36,249,1,0,0,0,38,258,1,0,0,0,40,262,1,0,0,0,42,270,1,0,0,0,44,278, -1,0,0,0,46,286,1,0,0,0,48,294,1,0,0,0,50,302,1,0,0,0,52,307,1,0,0,0,54,315, -1,0,0,0,56,323,1,0,0,0,58,336,1,0,0,0,60,338,1,0,0,0,62,354,1,0,0,0,64,396, -1,0,0,0,66,399,1,0,0,0,68,402,1,0,0,0,70,406,1,0,0,0,72,422,1,0,0,0,74,445, -1,0,0,0,76,448,1,0,0,0,78,452,1,0,0,0,80,455,1,0,0,0,82,457,1,0,0,0,84,87, -3,8,4,0,85,87,3,4,2,0,86,84,1,0,0,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,92,5,0,0,1,92,1,1,0,0, -0,93,95,3,8,4,0,94,93,1,0,0,0,95,98,1,0,0,0,96,94,1,0,0,0,96,97,1,0,0,0, -97,99,1,0,0,0,98,96,1,0,0,0,99,100,3,56,28,0,100,101,5,0,0,1,101,3,1,0,0, -0,102,103,3,6,3,0,103,5,1,0,0,0,104,105,5,20,0,0,105,106,5,16,0,0,106,107, -3,82,41,0,107,109,3,72,36,0,108,110,3,78,39,0,109,108,1,0,0,0,109,110,1, -0,0,0,110,111,1,0,0,0,111,112,5,1,0,0,112,7,1,0,0,0,113,118,3,10,5,0,114, -118,3,12,6,0,115,118,3,14,7,0,116,118,3,16,8,0,117,113,1,0,0,0,117,114,1, -0,0,0,117,115,1,0,0,0,117,116,1,0,0,0,118,9,1,0,0,0,119,120,5,25,0,0,120, -123,3,82,41,0,121,124,5,1,0,0,122,124,3,60,30,0,123,121,1,0,0,0,123,122, -1,0,0,0,124,11,1,0,0,0,125,126,5,16,0,0,126,127,3,82,41,0,127,129,3,70,35, -0,128,130,3,78,39,0,129,128,1,0,0,0,129,130,1,0,0,0,130,136,1,0,0,0,131, -132,5,2,0,0,132,133,3,56,28,0,133,134,5,1,0,0,134,137,1,0,0,0,135,137,3, -32,16,0,136,131,1,0,0,0,136,135,1,0,0,0,137,13,1,0,0,0,138,139,5,21,0,0, -139,141,3,82,41,0,140,142,3,78,39,0,141,140,1,0,0,0,141,142,1,0,0,0,142, -143,1,0,0,0,143,144,5,2,0,0,144,145,3,56,28,0,145,146,5,1,0,0,146,15,1,0, -0,0,147,148,5,18,0,0,148,149,3,82,41,0,149,163,5,3,0,0,150,155,3,18,9,0, -151,152,5,4,0,0,152,154,3,18,9,0,153,151,1,0,0,0,154,157,1,0,0,0,155,153, -1,0,0,0,155,156,1,0,0,0,156,159,1,0,0,0,157,155,1,0,0,0,158,160,5,4,0,0, -159,158,1,0,0,0,159,160,1,0,0,0,160,162,1,0,0,0,161,150,1,0,0,0,162,165, -1,0,0,0,163,161,1,0,0,0,163,164,1,0,0,0,164,166,1,0,0,0,165,163,1,0,0,0, -166,167,5,5,0,0,167,17,1,0,0,0,168,170,5,37,0,0,169,171,3,60,30,0,170,169, -1,0,0,0,170,171,1,0,0,0,171,19,1,0,0,0,172,191,5,29,0,0,173,191,5,30,0,0, -174,191,5,31,0,0,175,191,5,32,0,0,176,191,5,33,0,0,177,191,5,34,0,0,178, -191,5,35,0,0,179,191,5,36,0,0,180,191,3,22,11,0,181,191,3,34,17,0,182,191, -3,26,13,0,183,191,3,28,14,0,184,191,3,30,15,0,185,191,3,32,16,0,186,187, -5,6,0,0,187,188,3,56,28,0,188,189,5,7,0,0,189,191,1,0,0,0,190,172,1,0,0, -0,190,173,1,0,0,0,190,174,1,0,0,0,190,175,1,0,0,0,190,176,1,0,0,0,190,177, -1,0,0,0,190,178,1,0,0,0,190,179,1,0,0,0,190,180,1,0,0,0,190,181,1,0,0,0, -190,182,1,0,0,0,190,183,1,0,0,0,190,184,1,0,0,0,190,185,1,0,0,0,190,186, -1,0,0,0,191,21,1,0,0,0,192,193,5,22,0,0,193,194,3,56,28,0,194,206,5,3,0, -0,195,200,3,24,12,0,196,197,5,4,0,0,197,199,3,24,12,0,198,196,1,0,0,0,199, -202,1,0,0,0,200,198,1,0,0,0,200,201,1,0,0,0,201,204,1,0,0,0,202,200,1,0, -0,0,203,205,5,4,0,0,204,203,1,0,0,0,204,205,1,0,0,0,205,207,1,0,0,0,206, -195,1,0,0,0,206,207,1,0,0,0,207,208,1,0,0,0,208,209,5,5,0,0,209,23,1,0,0, -0,210,213,5,28,0,0,211,213,3,56,28,0,212,210,1,0,0,0,212,211,1,0,0,0,213, -216,1,0,0,0,214,215,5,15,0,0,215,217,5,37,0,0,216,214,1,0,0,0,216,217,1, -0,0,0,217,218,1,0,0,0,218,219,5,8,0,0,219,220,3,56,28,0,220,25,1,0,0,0,221, -222,3,82,41,0,222,223,5,6,0,0,223,224,3,58,29,0,224,225,5,7,0,0,225,27,1, -0,0,0,226,227,3,82,41,0,227,29,1,0,0,0,228,229,3,82,41,0,229,230,3,62,31, -0,230,31,1,0,0,0,231,235,5,3,0,0,232,234,3,8,4,0,233,232,1,0,0,0,234,237, -1,0,0,0,235,233,1,0,0,0,235,236,1,0,0,0,236,238,1,0,0,0,237,235,1,0,0,0, -238,239,3,56,28,0,239,240,5,5,0,0,240,33,1,0,0,0,241,242,5,19,0,0,242,243, -3,56,28,0,243,244,3,32,16,0,244,247,5,17,0,0,245,248,3,32,16,0,246,248,3, -34,17,0,247,245,1,0,0,0,247,246,1,0,0,0,248,35,1,0,0,0,249,254,3,20,10,0, -250,251,5,9,0,0,251,253,5,37,0,0,252,250,1,0,0,0,253,256,1,0,0,0,254,252, -1,0,0,0,254,255,1,0,0,0,255,37,1,0,0,0,256,254,1,0,0,0,257,259,5,38,0,0, -258,257,1,0,0,0,258,259,1,0,0,0,259,260,1,0,0,0,260,261,3,36,18,0,261,39, -1,0,0,0,262,267,3,38,19,0,263,264,7,0,0,0,264,266,3,38,19,0,265,263,1,0, -0,0,266,269,1,0,0,0,267,265,1,0,0,0,267,268,1,0,0,0,268,41,1,0,0,0,269,267, -1,0,0,0,270,275,3,40,20,0,271,272,7,1,0,0,272,274,3,40,20,0,273,271,1,0, -0,0,274,277,1,0,0,0,275,273,1,0,0,0,275,276,1,0,0,0,276,43,1,0,0,0,277,275, -1,0,0,0,278,283,3,42,21,0,279,280,5,10,0,0,280,282,3,42,21,0,281,279,1,0, -0,0,282,285,1,0,0,0,283,281,1,0,0,0,283,284,1,0,0,0,284,45,1,0,0,0,285,283, -1,0,0,0,286,291,3,44,22,0,287,288,5,11,0,0,288,290,3,44,22,0,289,287,1,0, -0,0,290,293,1,0,0,0,291,289,1,0,0,0,291,292,1,0,0,0,292,47,1,0,0,0,293,291, -1,0,0,0,294,297,3,46,23,0,295,296,7,2,0,0,296,298,3,46,23,0,297,295,1,0, -0,0,297,298,1,0,0,0,298,49,1,0,0,0,299,301,5,23,0,0,300,299,1,0,0,0,301, -304,1,0,0,0,302,300,1,0,0,0,302,303,1,0,0,0,303,305,1,0,0,0,304,302,1,0, -0,0,305,306,3,48,24,0,306,51,1,0,0,0,307,312,3,50,25,0,308,309,5,14,0,0, -309,311,3,50,25,0,310,308,1,0,0,0,311,314,1,0,0,0,312,310,1,0,0,0,312,313, -1,0,0,0,313,53,1,0,0,0,314,312,1,0,0,0,315,320,3,52,26,0,316,317,5,24,0, -0,317,319,3,52,26,0,318,316,1,0,0,0,319,322,1,0,0,0,320,318,1,0,0,0,320, -321,1,0,0,0,321,55,1,0,0,0,322,320,1,0,0,0,323,324,3,54,27,0,324,57,1,0, -0,0,325,330,3,56,28,0,326,327,5,4,0,0,327,329,3,56,28,0,328,326,1,0,0,0, -329,332,1,0,0,0,330,328,1,0,0,0,330,331,1,0,0,0,331,334,1,0,0,0,332,330, -1,0,0,0,333,335,5,4,0,0,334,333,1,0,0,0,334,335,1,0,0,0,335,337,1,0,0,0, -336,325,1,0,0,0,336,337,1,0,0,0,337,59,1,0,0,0,338,350,5,3,0,0,339,344,3, -66,33,0,340,341,5,4,0,0,341,343,3,66,33,0,342,340,1,0,0,0,343,346,1,0,0, -0,344,342,1,0,0,0,344,345,1,0,0,0,345,348,1,0,0,0,346,344,1,0,0,0,347,349, -5,4,0,0,348,347,1,0,0,0,348,349,1,0,0,0,349,351,1,0,0,0,350,339,1,0,0,0, -350,351,1,0,0,0,351,352,1,0,0,0,352,353,5,5,0,0,353,61,1,0,0,0,354,392,5, -3,0,0,355,360,3,64,32,0,356,357,5,4,0,0,357,359,3,64,32,0,358,356,1,0,0, -0,359,362,1,0,0,0,360,358,1,0,0,0,360,361,1,0,0,0,361,377,1,0,0,0,362,360, -1,0,0,0,363,375,5,4,0,0,364,369,3,68,34,0,365,366,5,4,0,0,366,368,3,68,34, -0,367,365,1,0,0,0,368,371,1,0,0,0,369,367,1,0,0,0,369,370,1,0,0,0,370,373, -1,0,0,0,371,369,1,0,0,0,372,374,5,4,0,0,373,372,1,0,0,0,373,374,1,0,0,0, -374,376,1,0,0,0,375,364,1,0,0,0,375,376,1,0,0,0,376,378,1,0,0,0,377,363, -1,0,0,0,377,378,1,0,0,0,378,393,1,0,0,0,379,384,3,68,34,0,380,381,5,4,0, -0,381,383,3,68,34,0,382,380,1,0,0,0,383,386,1,0,0,0,384,382,1,0,0,0,384, -385,1,0,0,0,385,388,1,0,0,0,386,384,1,0,0,0,387,389,5,4,0,0,388,387,1,0, -0,0,388,389,1,0,0,0,389,391,1,0,0,0,390,379,1,0,0,0,390,391,1,0,0,0,391, -393,1,0,0,0,392,355,1,0,0,0,392,390,1,0,0,0,393,394,1,0,0,0,394,395,5,5, -0,0,395,63,1,0,0,0,396,397,5,48,0,0,397,398,3,56,28,0,398,65,1,0,0,0,399, -400,5,37,0,0,400,401,3,78,39,0,401,67,1,0,0,0,402,404,5,37,0,0,403,405,3, -78,39,0,404,403,1,0,0,0,404,405,1,0,0,0,405,69,1,0,0,0,406,418,5,6,0,0,407, -412,3,74,37,0,408,409,5,4,0,0,409,411,3,74,37,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,416,1,0,0,0,414,412,1,0,0,0, -415,417,5,4,0,0,416,415,1,0,0,0,416,417,1,0,0,0,417,419,1,0,0,0,418,407, -1,0,0,0,418,419,1,0,0,0,419,420,1,0,0,0,420,421,5,7,0,0,421,71,1,0,0,0,422, -441,5,6,0,0,423,428,3,74,37,0,424,425,5,4,0,0,425,427,3,74,37,0,426,424, -1,0,0,0,427,430,1,0,0,0,428,426,1,0,0,0,428,429,1,0,0,0,429,433,1,0,0,0, -430,428,1,0,0,0,431,432,5,4,0,0,432,434,3,76,38,0,433,431,1,0,0,0,433,434, -1,0,0,0,434,437,1,0,0,0,435,437,3,76,38,0,436,423,1,0,0,0,436,435,1,0,0, -0,437,439,1,0,0,0,438,440,5,4,0,0,439,438,1,0,0,0,439,440,1,0,0,0,440,442, -1,0,0,0,441,436,1,0,0,0,441,442,1,0,0,0,442,443,1,0,0,0,443,444,5,7,0,0, -444,73,1,0,0,0,445,446,5,37,0,0,446,447,3,78,39,0,447,75,1,0,0,0,448,449, -5,48,0,0,449,450,5,37,0,0,450,451,3,78,39,0,451,77,1,0,0,0,452,453,5,12, -0,0,453,454,3,56,28,0,454,79,1,0,0,0,455,456,7,3,0,0,456,81,1,0,0,0,457, -465,5,37,0,0,458,461,5,13,0,0,459,462,5,37,0,0,460,462,3,80,40,0,461,459, -1,0,0,0,461,460,1,0,0,0,462,464,1,0,0,0,463,458,1,0,0,0,464,467,1,0,0,0, -465,463,1,0,0,0,465,466,1,0,0,0,466,83,1,0,0,0,467,465,1,0,0,0,57,86,88, -96,109,117,123,129,136,141,155,159,163,170,190,200,204,206,212,216,235,247, -254,258,267,275,283,291,297,302,312,320,330,334,336,344,348,350,360,369, -373,375,377,384,388,390,392,404,412,416,418,428,433,436,439,441,461,465]; +1,10,1,10,1,10,3,10,193,8,10,1,11,1,11,1,11,1,11,1,11,1,11,5,11,201,8,11, +10,11,12,11,204,9,11,1,11,3,11,207,8,11,3,11,209,8,11,1,11,1,11,1,12,1,12, +3,12,215,8,12,1,12,1,12,3,12,219,8,12,1,12,1,12,1,12,1,13,1,13,1,13,1,13, +1,13,1,14,1,14,1,15,1,15,1,15,1,16,1,16,5,16,236,8,16,10,16,12,16,239,9, +16,1,16,1,16,1,16,1,17,1,17,1,17,1,17,1,17,1,17,3,17,250,8,17,1,18,1,18, +1,18,5,18,255,8,18,10,18,12,18,258,9,18,1,19,1,19,1,19,3,19,263,8,19,1,20, +3,20,266,8,20,1,20,1,20,1,21,1,21,1,21,5,21,273,8,21,10,21,12,21,276,9,21, +1,22,1,22,1,22,5,22,281,8,22,10,22,12,22,284,9,22,1,23,1,23,1,23,5,23,289, +8,23,10,23,12,23,292,9,23,1,24,1,24,1,24,5,24,297,8,24,10,24,12,24,300,9, +24,1,25,1,25,1,25,3,25,305,8,25,1,26,5,26,308,8,26,10,26,12,26,311,9,26, +1,26,1,26,1,27,1,27,1,27,5,27,318,8,27,10,27,12,27,321,9,27,1,28,1,28,1, +28,5,28,326,8,28,10,28,12,28,329,9,28,1,29,1,29,1,30,1,30,1,30,5,30,336, +8,30,10,30,12,30,339,9,30,1,30,3,30,342,8,30,3,30,344,8,30,1,31,1,31,1,31, +1,31,5,31,350,8,31,10,31,12,31,353,9,31,1,31,3,31,356,8,31,3,31,358,8,31, +1,31,1,31,1,32,1,32,1,32,1,32,5,32,366,8,32,10,32,12,32,369,9,32,1,32,1, +32,1,32,1,32,5,32,375,8,32,10,32,12,32,378,9,32,1,32,3,32,381,8,32,3,32, +383,8,32,3,32,385,8,32,1,32,1,32,1,32,5,32,390,8,32,10,32,12,32,393,9,32, +1,32,3,32,396,8,32,3,32,398,8,32,3,32,400,8,32,1,32,1,32,1,33,1,33,1,33, +1,34,1,34,1,34,1,35,1,35,3,35,412,8,35,1,36,1,36,1,36,1,36,5,36,418,8,36, +10,36,12,36,421,9,36,1,36,3,36,424,8,36,3,36,426,8,36,1,36,1,36,1,37,1,37, +1,37,1,37,5,37,434,8,37,10,37,12,37,437,9,37,1,37,1,37,3,37,441,8,37,1,37, +3,37,444,8,37,1,37,3,37,447,8,37,3,37,449,8,37,1,37,1,37,1,38,1,38,1,38, +1,39,1,39,1,39,1,39,1,40,1,40,1,40,1,41,1,41,1,42,1,42,1,42,1,42,3,42,469, +8,42,5,42,471,8,42,10,42,12,42,474,9,42,1,42,0,0,43,0,2,4,6,8,10,12,14,16, +18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64, +66,68,70,72,74,76,78,80,82,84,0,4,1,0,40,41,1,0,38,39,1,0,43,48,2,0,14,14, +23,24,505,0,90,1,0,0,0,2,98,1,0,0,0,4,104,1,0,0,0,6,106,1,0,0,0,8,119,1, +0,0,0,10,121,1,0,0,0,12,127,1,0,0,0,14,140,1,0,0,0,16,149,1,0,0,0,18,170, +1,0,0,0,20,192,1,0,0,0,22,194,1,0,0,0,24,214,1,0,0,0,26,223,1,0,0,0,28,228, +1,0,0,0,30,230,1,0,0,0,32,233,1,0,0,0,34,243,1,0,0,0,36,251,1,0,0,0,38,259, +1,0,0,0,40,265,1,0,0,0,42,269,1,0,0,0,44,277,1,0,0,0,46,285,1,0,0,0,48,293, +1,0,0,0,50,301,1,0,0,0,52,309,1,0,0,0,54,314,1,0,0,0,56,322,1,0,0,0,58,330, +1,0,0,0,60,343,1,0,0,0,62,345,1,0,0,0,64,361,1,0,0,0,66,403,1,0,0,0,68,406, +1,0,0,0,70,409,1,0,0,0,72,413,1,0,0,0,74,429,1,0,0,0,76,452,1,0,0,0,78,455, +1,0,0,0,80,459,1,0,0,0,82,462,1,0,0,0,84,464,1,0,0,0,86,89,3,8,4,0,87,89, +3,4,2,0,88,86,1,0,0,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,94,5,0,0,1,94,1,1,0,0,0,95,97,3,8,4, +0,96,95,1,0,0,0,97,100,1,0,0,0,98,96,1,0,0,0,98,99,1,0,0,0,99,101,1,0,0, +0,100,98,1,0,0,0,101,102,3,58,29,0,102,103,5,0,0,1,103,3,1,0,0,0,104,105, +3,6,3,0,105,5,1,0,0,0,106,107,5,20,0,0,107,108,5,16,0,0,108,109,3,84,42, +0,109,111,3,74,37,0,110,112,3,80,40,0,111,110,1,0,0,0,111,112,1,0,0,0,112, +113,1,0,0,0,113,114,5,1,0,0,114,7,1,0,0,0,115,120,3,10,5,0,116,120,3,12, +6,0,117,120,3,14,7,0,118,120,3,16,8,0,119,115,1,0,0,0,119,116,1,0,0,0,119, +117,1,0,0,0,119,118,1,0,0,0,120,9,1,0,0,0,121,122,5,25,0,0,122,125,3,84, +42,0,123,126,5,1,0,0,124,126,3,62,31,0,125,123,1,0,0,0,125,124,1,0,0,0,126, +11,1,0,0,0,127,128,5,16,0,0,128,129,3,84,42,0,129,131,3,72,36,0,130,132, +3,80,40,0,131,130,1,0,0,0,131,132,1,0,0,0,132,138,1,0,0,0,133,134,5,2,0, +0,134,135,3,58,29,0,135,136,5,1,0,0,136,139,1,0,0,0,137,139,3,32,16,0,138, +133,1,0,0,0,138,137,1,0,0,0,139,13,1,0,0,0,140,141,5,21,0,0,141,143,3,84, +42,0,142,144,3,80,40,0,143,142,1,0,0,0,143,144,1,0,0,0,144,145,1,0,0,0,145, +146,5,2,0,0,146,147,3,58,29,0,147,148,5,1,0,0,148,15,1,0,0,0,149,150,5,18, +0,0,150,151,3,84,42,0,151,165,5,3,0,0,152,157,3,18,9,0,153,154,5,4,0,0,154, +156,3,18,9,0,155,153,1,0,0,0,156,159,1,0,0,0,157,155,1,0,0,0,157,158,1,0, +0,0,158,161,1,0,0,0,159,157,1,0,0,0,160,162,5,4,0,0,161,160,1,0,0,0,161, +162,1,0,0,0,162,164,1,0,0,0,163,152,1,0,0,0,164,167,1,0,0,0,165,163,1,0, +0,0,165,166,1,0,0,0,166,168,1,0,0,0,167,165,1,0,0,0,168,169,5,5,0,0,169, +17,1,0,0,0,170,172,5,37,0,0,171,173,3,62,31,0,172,171,1,0,0,0,172,173,1, +0,0,0,173,19,1,0,0,0,174,193,5,29,0,0,175,193,5,30,0,0,176,193,5,31,0,0, +177,193,5,32,0,0,178,193,5,33,0,0,179,193,5,34,0,0,180,193,5,35,0,0,181, +193,5,36,0,0,182,193,3,22,11,0,183,193,3,34,17,0,184,193,3,26,13,0,185,193, +3,28,14,0,186,193,3,30,15,0,187,193,3,32,16,0,188,189,5,6,0,0,189,190,3, +58,29,0,190,191,5,7,0,0,191,193,1,0,0,0,192,174,1,0,0,0,192,175,1,0,0,0, +192,176,1,0,0,0,192,177,1,0,0,0,192,178,1,0,0,0,192,179,1,0,0,0,192,180, +1,0,0,0,192,181,1,0,0,0,192,182,1,0,0,0,192,183,1,0,0,0,192,184,1,0,0,0, +192,185,1,0,0,0,192,186,1,0,0,0,192,187,1,0,0,0,192,188,1,0,0,0,193,21,1, +0,0,0,194,195,5,22,0,0,195,196,3,58,29,0,196,208,5,3,0,0,197,202,3,24,12, +0,198,199,5,4,0,0,199,201,3,24,12,0,200,198,1,0,0,0,201,204,1,0,0,0,202, +200,1,0,0,0,202,203,1,0,0,0,203,206,1,0,0,0,204,202,1,0,0,0,205,207,5,4, +0,0,206,205,1,0,0,0,206,207,1,0,0,0,207,209,1,0,0,0,208,197,1,0,0,0,208, +209,1,0,0,0,209,210,1,0,0,0,210,211,5,5,0,0,211,23,1,0,0,0,212,215,5,28, +0,0,213,215,3,58,29,0,214,212,1,0,0,0,214,213,1,0,0,0,215,218,1,0,0,0,216, +217,5,15,0,0,217,219,5,37,0,0,218,216,1,0,0,0,218,219,1,0,0,0,219,220,1, +0,0,0,220,221,5,8,0,0,221,222,3,58,29,0,222,25,1,0,0,0,223,224,3,84,42,0, +224,225,5,6,0,0,225,226,3,60,30,0,226,227,5,7,0,0,227,27,1,0,0,0,228,229, +3,84,42,0,229,29,1,0,0,0,230,231,3,84,42,0,231,232,3,64,32,0,232,31,1,0, +0,0,233,237,5,3,0,0,234,236,3,8,4,0,235,234,1,0,0,0,236,239,1,0,0,0,237, +235,1,0,0,0,237,238,1,0,0,0,238,240,1,0,0,0,239,237,1,0,0,0,240,241,3,58, +29,0,241,242,5,5,0,0,242,33,1,0,0,0,243,244,5,19,0,0,244,245,3,58,29,0,245, +246,3,32,16,0,246,249,5,17,0,0,247,250,3,32,16,0,248,250,3,34,17,0,249,247, +1,0,0,0,249,248,1,0,0,0,250,35,1,0,0,0,251,256,3,20,10,0,252,253,5,9,0,0, +253,255,5,37,0,0,254,252,1,0,0,0,255,258,1,0,0,0,256,254,1,0,0,0,256,257, +1,0,0,0,257,37,1,0,0,0,258,256,1,0,0,0,259,262,3,36,18,0,260,261,5,42,0, +0,261,263,3,36,18,0,262,260,1,0,0,0,262,263,1,0,0,0,263,39,1,0,0,0,264,266, +5,38,0,0,265,264,1,0,0,0,265,266,1,0,0,0,266,267,1,0,0,0,267,268,3,38,19, +0,268,41,1,0,0,0,269,274,3,40,20,0,270,271,7,0,0,0,271,273,3,40,20,0,272, +270,1,0,0,0,273,276,1,0,0,0,274,272,1,0,0,0,274,275,1,0,0,0,275,43,1,0,0, +0,276,274,1,0,0,0,277,282,3,42,21,0,278,279,7,1,0,0,279,281,3,42,21,0,280, +278,1,0,0,0,281,284,1,0,0,0,282,280,1,0,0,0,282,283,1,0,0,0,283,45,1,0,0, +0,284,282,1,0,0,0,285,290,3,44,22,0,286,287,5,10,0,0,287,289,3,44,22,0,288, +286,1,0,0,0,289,292,1,0,0,0,290,288,1,0,0,0,290,291,1,0,0,0,291,47,1,0,0, +0,292,290,1,0,0,0,293,298,3,46,23,0,294,295,5,11,0,0,295,297,3,46,23,0,296, +294,1,0,0,0,297,300,1,0,0,0,298,296,1,0,0,0,298,299,1,0,0,0,299,49,1,0,0, +0,300,298,1,0,0,0,301,304,3,48,24,0,302,303,7,2,0,0,303,305,3,48,24,0,304, +302,1,0,0,0,304,305,1,0,0,0,305,51,1,0,0,0,306,308,5,23,0,0,307,306,1,0, +0,0,308,311,1,0,0,0,309,307,1,0,0,0,309,310,1,0,0,0,310,312,1,0,0,0,311, +309,1,0,0,0,312,313,3,50,25,0,313,53,1,0,0,0,314,319,3,52,26,0,315,316,5, +14,0,0,316,318,3,52,26,0,317,315,1,0,0,0,318,321,1,0,0,0,319,317,1,0,0,0, +319,320,1,0,0,0,320,55,1,0,0,0,321,319,1,0,0,0,322,327,3,54,27,0,323,324, +5,24,0,0,324,326,3,54,27,0,325,323,1,0,0,0,326,329,1,0,0,0,327,325,1,0,0, +0,327,328,1,0,0,0,328,57,1,0,0,0,329,327,1,0,0,0,330,331,3,56,28,0,331,59, +1,0,0,0,332,337,3,58,29,0,333,334,5,4,0,0,334,336,3,58,29,0,335,333,1,0, +0,0,336,339,1,0,0,0,337,335,1,0,0,0,337,338,1,0,0,0,338,341,1,0,0,0,339, +337,1,0,0,0,340,342,5,4,0,0,341,340,1,0,0,0,341,342,1,0,0,0,342,344,1,0, +0,0,343,332,1,0,0,0,343,344,1,0,0,0,344,61,1,0,0,0,345,357,5,3,0,0,346,351, +3,68,34,0,347,348,5,4,0,0,348,350,3,68,34,0,349,347,1,0,0,0,350,353,1,0, +0,0,351,349,1,0,0,0,351,352,1,0,0,0,352,355,1,0,0,0,353,351,1,0,0,0,354, +356,5,4,0,0,355,354,1,0,0,0,355,356,1,0,0,0,356,358,1,0,0,0,357,346,1,0, +0,0,357,358,1,0,0,0,358,359,1,0,0,0,359,360,5,5,0,0,360,63,1,0,0,0,361,399, +5,3,0,0,362,367,3,66,33,0,363,364,5,4,0,0,364,366,3,66,33,0,365,363,1,0, +0,0,366,369,1,0,0,0,367,365,1,0,0,0,367,368,1,0,0,0,368,384,1,0,0,0,369, +367,1,0,0,0,370,382,5,4,0,0,371,376,3,70,35,0,372,373,5,4,0,0,373,375,3, +70,35,0,374,372,1,0,0,0,375,378,1,0,0,0,376,374,1,0,0,0,376,377,1,0,0,0, +377,380,1,0,0,0,378,376,1,0,0,0,379,381,5,4,0,0,380,379,1,0,0,0,380,381, +1,0,0,0,381,383,1,0,0,0,382,371,1,0,0,0,382,383,1,0,0,0,383,385,1,0,0,0, +384,370,1,0,0,0,384,385,1,0,0,0,385,400,1,0,0,0,386,391,3,70,35,0,387,388, +5,4,0,0,388,390,3,70,35,0,389,387,1,0,0,0,390,393,1,0,0,0,391,389,1,0,0, +0,391,392,1,0,0,0,392,395,1,0,0,0,393,391,1,0,0,0,394,396,5,4,0,0,395,394, +1,0,0,0,395,396,1,0,0,0,396,398,1,0,0,0,397,386,1,0,0,0,397,398,1,0,0,0, +398,400,1,0,0,0,399,362,1,0,0,0,399,397,1,0,0,0,400,401,1,0,0,0,401,402, +5,5,0,0,402,65,1,0,0,0,403,404,5,49,0,0,404,405,3,58,29,0,405,67,1,0,0,0, +406,407,5,37,0,0,407,408,3,80,40,0,408,69,1,0,0,0,409,411,5,37,0,0,410,412, +3,80,40,0,411,410,1,0,0,0,411,412,1,0,0,0,412,71,1,0,0,0,413,425,5,6,0,0, +414,419,3,76,38,0,415,416,5,4,0,0,416,418,3,76,38,0,417,415,1,0,0,0,418, +421,1,0,0,0,419,417,1,0,0,0,419,420,1,0,0,0,420,423,1,0,0,0,421,419,1,0, +0,0,422,424,5,4,0,0,423,422,1,0,0,0,423,424,1,0,0,0,424,426,1,0,0,0,425, +414,1,0,0,0,425,426,1,0,0,0,426,427,1,0,0,0,427,428,5,7,0,0,428,73,1,0,0, +0,429,448,5,6,0,0,430,435,3,76,38,0,431,432,5,4,0,0,432,434,3,76,38,0,433, +431,1,0,0,0,434,437,1,0,0,0,435,433,1,0,0,0,435,436,1,0,0,0,436,440,1,0, +0,0,437,435,1,0,0,0,438,439,5,4,0,0,439,441,3,78,39,0,440,438,1,0,0,0,440, +441,1,0,0,0,441,444,1,0,0,0,442,444,3,78,39,0,443,430,1,0,0,0,443,442,1, +0,0,0,444,446,1,0,0,0,445,447,5,4,0,0,446,445,1,0,0,0,446,447,1,0,0,0,447, +449,1,0,0,0,448,443,1,0,0,0,448,449,1,0,0,0,449,450,1,0,0,0,450,451,5,7, +0,0,451,75,1,0,0,0,452,453,5,37,0,0,453,454,3,80,40,0,454,77,1,0,0,0,455, +456,5,49,0,0,456,457,5,37,0,0,457,458,3,80,40,0,458,79,1,0,0,0,459,460,5, +12,0,0,460,461,3,58,29,0,461,81,1,0,0,0,462,463,7,3,0,0,463,83,1,0,0,0,464, +472,5,37,0,0,465,468,5,13,0,0,466,469,5,37,0,0,467,469,3,82,41,0,468,466, +1,0,0,0,468,467,1,0,0,0,469,471,1,0,0,0,470,465,1,0,0,0,471,474,1,0,0,0, +472,470,1,0,0,0,472,473,1,0,0,0,473,85,1,0,0,0,474,472,1,0,0,0,58,88,90, +98,111,119,125,131,138,143,157,161,165,172,192,202,206,208,214,218,237,249, +256,262,265,274,282,290,298,304,309,319,327,337,341,343,351,355,357,367, +376,380,382,384,391,395,397,399,411,419,423,425,435,440,443,446,448,468, +472]; const atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN); @@ -171,8 +174,8 @@ export default class NaviParser extends antlr4.Parser { "'if'", "'intrinsic'", "'let'", "'match'", "'not'", "'or'", "'struct'", "'self'", "'trait'", "'_'", null, null, null, null, null, null, null, null, - null, "'-'", "'+'", "'*'", "'/'", "'=='", "'!='", - "'>'", "'<'", "'>='", "'<='", "'...'" ]; + null, "'-'", "'+'", "'*'", "'/'", "'**'", "'=='", + "'!='", "'>'", "'<'", "'>='", "'<='", "'...'" ]; static symbolicNames = [ null, null, null, null, null, null, null, null, null, null, null, null, null, null, "And", "As", "Def", "Else", "Enum", "If", "Intrinsic", @@ -181,16 +184,16 @@ export default class NaviParser extends antlr4.Parser { "IntervalInclusive", "IntervalMinExclusive", "IntervalMaxExclusive", "IntervalExclusive", "Number", "String", "Identifier", "OpMinus", - "OpPlus", "OpMult", "OpDiv", "OpEqual", "OpNotEqual", - "OpGt", "OpLt", "OpGte", "OpLte", "OpSpread", - "Space", "LineComment", "BlockComment" ]; + "OpPlus", "OpMult", "OpDiv", "OpPow", "OpEqual", + "OpNotEqual", "OpGt", "OpLt", "OpGte", "OpLte", + "OpSpread", "Space", "LineComment", "BlockComment" ]; static ruleNames = [ "definitionDocument", "expressionDocument", "declaration", "intrinsicFunctionDeclaration", "definition", "structDefinition", "functionDefinition", "variableDefinition", "enumDefinition", "enumVariant", "primaryExpression", "matchExpression", "matchArm", "functionCall", "named", "structExpression", "scopeExpression", "ifExpression", "fieldAccessExpression", - "negateExpression", "multiplicativeExpression", + "powExpression", "negateExpression", "multiplicativeExpression", "additiveExpression", "intersectionExpression", "unionExpression", "comparisonExpression", "logicalNotExpression", "logicalAndExpression", "logicalOrExpression", @@ -215,32 +218,32 @@ export default class NaviParser extends antlr4.Parser { var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 88; + this.state = 90; this._errHandler.sync(this); _la = this._input.LA(1); while((((_la) & ~0x1f) === 0 && ((1 << _la) & 37027840) !== 0)) { - this.state = 86; + this.state = 88; this._errHandler.sync(this); switch(this._input.LA(1)) { case 16: case 18: case 21: case 25: - this.state = 84; + this.state = 86; this.definition(); break; case 20: - this.state = 85; + this.state = 87; this.declaration(); break; default: throw new antlr4.error.NoViableAltException(this); } - this.state = 90; + this.state = 92; this._errHandler.sync(this); _la = this._input.LA(1); } - this.state = 91; + this.state = 93; this.match(NaviParser.EOF); } catch (re) { if(re instanceof antlr4.error.RecognitionException) { @@ -264,19 +267,19 @@ export default class NaviParser extends antlr4.Parser { var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 96; + this.state = 98; this._errHandler.sync(this); _la = this._input.LA(1); while((((_la) & ~0x1f) === 0 && ((1 << _la) & 35979264) !== 0)) { - this.state = 93; + this.state = 95; this.definition(); - this.state = 98; + this.state = 100; this._errHandler.sync(this); _la = this._input.LA(1); } - this.state = 99; + this.state = 101; this.expression(); - this.state = 100; + this.state = 102; this.match(NaviParser.EOF); } catch (re) { if(re instanceof antlr4.error.RecognitionException) { @@ -299,7 +302,7 @@ export default class NaviParser extends antlr4.Parser { this.enterRule(localctx, 4, NaviParser.RULE_declaration); try { this.enterOuterAlt(localctx, 1); - this.state = 102; + this.state = 104; this.intrinsicFunctionDeclaration(); } catch (re) { if(re instanceof antlr4.error.RecognitionException) { @@ -323,23 +326,23 @@ export default class NaviParser extends antlr4.Parser { var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 104; + this.state = 106; this.match(NaviParser.Intrinsic); - this.state = 105; + this.state = 107; this.match(NaviParser.Def); - this.state = 106; + this.state = 108; this.name(); - this.state = 107; - this.varArgParameters(); this.state = 109; + this.varArgParameters(); + this.state = 111; this._errHandler.sync(this); _la = this._input.LA(1); if(_la===12) { - this.state = 108; + this.state = 110; this.assert(); } - this.state = 111; + this.state = 113; this.match(NaviParser.T__0); } catch (re) { if(re instanceof antlr4.error.RecognitionException) { @@ -361,27 +364,27 @@ export default class NaviParser extends antlr4.Parser { let localctx = new DefinitionContext(this, this._ctx, this.state); this.enterRule(localctx, 8, NaviParser.RULE_definition); try { - this.state = 117; + this.state = 119; this._errHandler.sync(this); switch(this._input.LA(1)) { case 25: this.enterOuterAlt(localctx, 1); - this.state = 113; + this.state = 115; this.structDefinition(); break; case 16: this.enterOuterAlt(localctx, 2); - this.state = 114; + this.state = 116; this.functionDefinition(); break; case 21: this.enterOuterAlt(localctx, 3); - this.state = 115; + this.state = 117; this.variableDefinition(); break; case 18: this.enterOuterAlt(localctx, 4); - this.state = 116; + this.state = 118; this.enumDefinition(); break; default: @@ -408,19 +411,19 @@ export default class NaviParser extends antlr4.Parser { this.enterRule(localctx, 10, NaviParser.RULE_structDefinition); try { this.enterOuterAlt(localctx, 1); - this.state = 119; + this.state = 121; this.match(NaviParser.Struct); - this.state = 120; + this.state = 122; this.name(); - this.state = 123; + this.state = 125; this._errHandler.sync(this); switch(this._input.LA(1)) { case 1: - this.state = 121; + this.state = 123; this.match(NaviParser.T__0); break; case 3: - this.state = 122; + this.state = 124; this.fields(); break; default: @@ -448,33 +451,33 @@ export default class NaviParser extends antlr4.Parser { var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 125; + this.state = 127; this.match(NaviParser.Def); - this.state = 126; + this.state = 128; this.name(); - this.state = 127; - this.parameters(); this.state = 129; + this.parameters(); + this.state = 131; this._errHandler.sync(this); _la = this._input.LA(1); if(_la===12) { - this.state = 128; + this.state = 130; this.assert(); } - this.state = 136; + this.state = 138; this._errHandler.sync(this); switch(this._input.LA(1)) { case 2: - this.state = 131; + this.state = 133; this.match(NaviParser.T__1); - this.state = 132; + this.state = 134; this.expression(); - this.state = 133; + this.state = 135; this.match(NaviParser.T__0); break; case 3: - this.state = 135; + this.state = 137; this.scopeExpression(); break; default: @@ -502,23 +505,23 @@ export default class NaviParser extends antlr4.Parser { var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 138; + this.state = 140; this.match(NaviParser.Let); - this.state = 139; - this.name(); this.state = 141; + this.name(); + this.state = 143; this._errHandler.sync(this); _la = this._input.LA(1); if(_la===12) { - this.state = 140; + this.state = 142; this.assert(); } - this.state = 143; + this.state = 145; this.match(NaviParser.T__1); - this.state = 144; + this.state = 146; this.expression(); - this.state = 145; + this.state = 147; this.match(NaviParser.T__0); } catch (re) { if(re instanceof antlr4.error.RecognitionException) { @@ -542,46 +545,46 @@ export default class NaviParser extends antlr4.Parser { var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 147; + this.state = 149; this.match(NaviParser.Enum); - this.state = 148; + this.state = 150; this.name(); - this.state = 149; + this.state = 151; this.match(NaviParser.T__2); - this.state = 163; + this.state = 165; this._errHandler.sync(this); _la = this._input.LA(1); while(_la===37) { - this.state = 150; + this.state = 152; this.enumVariant(); - this.state = 155; + this.state = 157; this._errHandler.sync(this); var _alt = this._interp.adaptivePredict(this._input,9,this._ctx) while(_alt!=2 && _alt!=antlr4.atn.ATN.INVALID_ALT_NUMBER) { if(_alt===1) { - this.state = 151; + this.state = 153; this.match(NaviParser.T__3); - this.state = 152; + this.state = 154; this.enumVariant(); } - this.state = 157; + this.state = 159; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input,9,this._ctx); } - this.state = 159; + this.state = 161; this._errHandler.sync(this); _la = this._input.LA(1); if(_la===4) { - this.state = 158; + this.state = 160; this.match(NaviParser.T__3); } - this.state = 165; + this.state = 167; this._errHandler.sync(this); _la = this._input.LA(1); } - this.state = 166; + this.state = 168; this.match(NaviParser.T__4); } catch (re) { if(re instanceof antlr4.error.RecognitionException) { @@ -605,13 +608,13 @@ export default class NaviParser extends antlr4.Parser { var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 168; - this.match(NaviParser.Identifier); this.state = 170; + this.match(NaviParser.Identifier); + this.state = 172; this._errHandler.sync(this); _la = this._input.LA(1); if(_la===3) { - this.state = 169; + this.state = 171; this.fields(); } @@ -635,101 +638,101 @@ export default class NaviParser extends antlr4.Parser { let localctx = new PrimaryExpressionContext(this, this._ctx, this.state); this.enterRule(localctx, 20, NaviParser.RULE_primaryExpression); try { - this.state = 190; + this.state = 192; this._errHandler.sync(this); var la_ = this._interp.adaptivePredict(this._input,13,this._ctx); switch(la_) { case 1: this.enterOuterAlt(localctx, 1); - this.state = 172; + this.state = 174; this.match(NaviParser.IntInterval); break; case 2: this.enterOuterAlt(localctx, 2); - this.state = 173; + this.state = 175; this.match(NaviParser.NonIntInterval); break; case 3: this.enterOuterAlt(localctx, 3); - this.state = 174; + this.state = 176; this.match(NaviParser.IntervalInclusive); break; case 4: this.enterOuterAlt(localctx, 4); - this.state = 175; + this.state = 177; this.match(NaviParser.IntervalMinExclusive); break; case 5: this.enterOuterAlt(localctx, 5); - this.state = 176; + this.state = 178; this.match(NaviParser.IntervalMaxExclusive); break; case 6: this.enterOuterAlt(localctx, 6); - this.state = 177; + this.state = 179; this.match(NaviParser.IntervalExclusive); break; case 7: this.enterOuterAlt(localctx, 7); - this.state = 178; + this.state = 180; this.match(NaviParser.Number); break; case 8: this.enterOuterAlt(localctx, 8); - this.state = 179; + this.state = 181; this.match(NaviParser.String); break; case 9: this.enterOuterAlt(localctx, 9); - this.state = 180; + this.state = 182; this.matchExpression(); break; case 10: this.enterOuterAlt(localctx, 10); - this.state = 181; + this.state = 183; this.ifExpression(); break; case 11: this.enterOuterAlt(localctx, 11); - this.state = 182; + this.state = 184; this.functionCall(); break; case 12: this.enterOuterAlt(localctx, 12); - this.state = 183; + this.state = 185; this.named(); break; case 13: this.enterOuterAlt(localctx, 13); - this.state = 184; + this.state = 186; this.structExpression(); break; case 14: this.enterOuterAlt(localctx, 14); - this.state = 185; + this.state = 187; this.scopeExpression(); break; case 15: this.enterOuterAlt(localctx, 15); - this.state = 186; + this.state = 188; this.match(NaviParser.T__5); - this.state = 187; + this.state = 189; this.expression(); - this.state = 188; + this.state = 190; this.match(NaviParser.T__6); break; @@ -756,44 +759,44 @@ export default class NaviParser extends antlr4.Parser { var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 192; + this.state = 194; this.match(NaviParser.Match); - this.state = 193; + this.state = 195; this.expression(); - this.state = 194; + this.state = 196; this.match(NaviParser.T__2); - this.state = 206; + this.state = 208; this._errHandler.sync(this); _la = this._input.LA(1); if((((_la) & ~0x1f) === 0 && ((1 << _la) & 4039639112) !== 0) || ((((_la - 32)) & ~0x1f) === 0 && ((1 << (_la - 32)) & 127) !== 0)) { - this.state = 195; + this.state = 197; this.matchArm(); - this.state = 200; + this.state = 202; this._errHandler.sync(this); var _alt = this._interp.adaptivePredict(this._input,14,this._ctx) while(_alt!=2 && _alt!=antlr4.atn.ATN.INVALID_ALT_NUMBER) { if(_alt===1) { - this.state = 196; + this.state = 198; this.match(NaviParser.T__3); - this.state = 197; + this.state = 199; this.matchArm(); } - this.state = 202; + this.state = 204; this._errHandler.sync(this); _alt = this._interp.adaptivePredict(this._input,14,this._ctx); } - this.state = 204; + this.state = 206; this._errHandler.sync(this); _la = this._input.LA(1); if(_la===4) { - this.state = 203; + this.state = 205; this.match(NaviParser.T__3); } } - this.state = 208; + this.state = 210; this.match(NaviParser.T__4); } catch (re) { if(re instanceof antlr4.error.RecognitionException) { @@ -817,11 +820,11 @@ export default class NaviParser extends antlr4.Parser { var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 212; + this.state = 214; this._errHandler.sync(this); switch(this._input.LA(1)) { case 28: - this.state = 210; + this.state = 212; this.match(NaviParser.Discard); break; case 3: @@ -839,25 +842,25 @@ export default class NaviParser extends antlr4.Parser { case 36: case 37: case 38: - this.state = 211; + this.state = 213; this.expression(); break; default: throw new antlr4.error.NoViableAltException(this); } - this.state = 216; + this.state = 218; this._errHandler.sync(this); _la = this._input.LA(1); if(_la===15) { - this.state = 214; + this.state = 216; this.match(NaviParser.As); - this.state = 215; + this.state = 217; this.match(NaviParser.Identifier); } - this.state = 218; + this.state = 220; this.match(NaviParser.T__7); - this.state = 219; + this.state = 221; this.expression(); } catch (re) { if(re instanceof antlr4.error.RecognitionException) { @@ -880,13 +883,13 @@ export default class NaviParser extends antlr4.Parser { this.enterRule(localctx, 26, NaviParser.RULE_functionCall); try { this.enterOuterAlt(localctx, 1); - this.state = 221; + this.state = 223; this.name(); - this.state = 222; + this.state = 224; this.match(NaviParser.T__5); - this.state = 223; + this.state = 225; this.args(); - this.state = 224; + this.state = 226; this.match(NaviParser.T__6); } catch (re) { if(re instanceof antlr4.error.RecognitionException) { @@ -909,7 +912,7 @@ export default class NaviParser extends antlr4.Parser { this.enterRule(localctx, 28, NaviParser.RULE_named); try { this.enterOuterAlt(localctx, 1); - this.state = 226; + this.state = 228; this.name(); } catch (re) { if(re instanceof antlr4.error.RecognitionException) { @@ -932,9 +935,9 @@ export default class NaviParser extends antlr4.Parser { this.enterRule(localctx, 30, NaviParser.RULE_structExpression); try { this.enterOuterAlt(localctx, 1); - this.state = 228; + this.state = 230; this.name(); - this.state = 229; + this.state = 231; this.fieldsSpread(); } catch (re) { if(re instanceof antlr4.error.RecognitionException) { @@ -958,21 +961,21 @@ export default class NaviParser extends antlr4.Parser { var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 231; + this.state = 233; this.match(NaviParser.T__2); - this.state = 235; + this.state = 237; this._errHandler.sync(this); _la = this._input.LA(1); while((((_la) & ~0x1f) === 0 && ((1 << _la) & 35979264) !== 0)) { - this.state = 232; + this.state = 234; this.definition(); - this.state = 237; + this.state = 239; this._errHandler.sync(this); _la = this._input.LA(1); } - this.state = 238; + this.state = 240; this.expression(); - this.state = 239; + this.state = 241; this.match(NaviParser.T__4); } catch (re) { if(re instanceof antlr4.error.RecognitionException) { @@ -995,23 +998,23 @@ export default class NaviParser extends antlr4.Parser { this.enterRule(localctx, 34, NaviParser.RULE_ifExpression); try { this.enterOuterAlt(localctx, 1); - this.state = 241; + this.state = 243; this.match(NaviParser.If); - this.state = 242; + this.state = 244; this.expression(); - this.state = 243; + this.state = 245; this.scopeExpression(); - this.state = 244; + this.state = 246; this.match(NaviParser.Else); - this.state = 247; + this.state = 249; this._errHandler.sync(this); switch(this._input.LA(1)) { case 3: - this.state = 245; + this.state = 247; this.scopeExpression(); break; case 19: - this.state = 246; + this.state = 248; this.ifExpression(); break; default: @@ -1039,17 +1042,17 @@ export default class NaviParser extends antlr4.Parser { var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 249; + this.state = 251; this.primaryExpression(); - this.state = 254; + this.state = 256; this._errHandler.sync(this); _la = this._input.LA(1); while(_la===9) { - this.state = 250; + this.state = 252; this.match(NaviParser.T__8); - this.state = 251; + this.state = 253; this.match(NaviParser.Identifier); - this.state = 256; + this.state = 258; this._errHandler.sync(this); _la = this._input.LA(1); } @@ -1069,22 +1072,56 @@ export default class NaviParser extends antlr4.Parser { + powExpression() { + let localctx = new PowExpressionContext(this, this._ctx, this.state); + this.enterRule(localctx, 38, NaviParser.RULE_powExpression); + var _la = 0; + try { + this.enterOuterAlt(localctx, 1); + this.state = 259; + this.fieldAccessExpression(); + this.state = 262; + this._errHandler.sync(this); + _la = this._input.LA(1); + if(_la===42) { + this.state = 260; + this.match(NaviParser.OpPow); + this.state = 261; + this.fieldAccessExpression(); + } + + } catch (re) { + if(re instanceof antlr4.error.RecognitionException) { + localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } finally { + this.exitRule(); + } + return localctx; + } + + + negateExpression() { let localctx = new NegateExpressionContext(this, this._ctx, this.state); - this.enterRule(localctx, 38, NaviParser.RULE_negateExpression); + this.enterRule(localctx, 40, NaviParser.RULE_negateExpression); var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 258; + this.state = 265; this._errHandler.sync(this); _la = this._input.LA(1); if(_la===38) { - this.state = 257; + this.state = 264; this.match(NaviParser.OpMinus); } - this.state = 260; - this.fieldAccessExpression(); + this.state = 267; + this.powExpression(); } catch (re) { if(re instanceof antlr4.error.RecognitionException) { localctx.exception = re; @@ -1103,17 +1140,17 @@ export default class NaviParser extends antlr4.Parser { multiplicativeExpression() { let localctx = new MultiplicativeExpressionContext(this, this._ctx, this.state); - this.enterRule(localctx, 40, NaviParser.RULE_multiplicativeExpression); + this.enterRule(localctx, 42, NaviParser.RULE_multiplicativeExpression); var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 262; + this.state = 269; this.negateExpression(); - this.state = 267; + this.state = 274; this._errHandler.sync(this); _la = this._input.LA(1); while(_la===40 || _la===41) { - this.state = 263; + this.state = 270; _la = this._input.LA(1); if(!(_la===40 || _la===41)) { this._errHandler.recoverInline(this); @@ -1122,9 +1159,9 @@ export default class NaviParser extends antlr4.Parser { this._errHandler.reportMatch(this); this.consume(); } - this.state = 264; + this.state = 271; this.negateExpression(); - this.state = 269; + this.state = 276; this._errHandler.sync(this); _la = this._input.LA(1); } @@ -1146,17 +1183,17 @@ export default class NaviParser extends antlr4.Parser { additiveExpression() { let localctx = new AdditiveExpressionContext(this, this._ctx, this.state); - this.enterRule(localctx, 42, NaviParser.RULE_additiveExpression); + this.enterRule(localctx, 44, NaviParser.RULE_additiveExpression); var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 270; + this.state = 277; this.multiplicativeExpression(); - this.state = 275; + this.state = 282; this._errHandler.sync(this); _la = this._input.LA(1); while(_la===38 || _la===39) { - this.state = 271; + this.state = 278; _la = this._input.LA(1); if(!(_la===38 || _la===39)) { this._errHandler.recoverInline(this); @@ -1165,9 +1202,9 @@ export default class NaviParser extends antlr4.Parser { this._errHandler.reportMatch(this); this.consume(); } - this.state = 272; + this.state = 279; this.multiplicativeExpression(); - this.state = 277; + this.state = 284; this._errHandler.sync(this); _la = this._input.LA(1); } @@ -1189,21 +1226,21 @@ export default class NaviParser extends antlr4.Parser { intersectionExpression() { let localctx = new IntersectionExpressionContext(this, this._ctx, this.state); - this.enterRule(localctx, 44, NaviParser.RULE_intersectionExpression); + this.enterRule(localctx, 46, NaviParser.RULE_intersectionExpression); var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 278; + this.state = 285; this.additiveExpression(); - this.state = 283; + this.state = 290; this._errHandler.sync(this); _la = this._input.LA(1); while(_la===10) { - this.state = 279; + this.state = 286; this.match(NaviParser.T__9); - this.state = 280; + this.state = 287; this.additiveExpression(); - this.state = 285; + this.state = 292; this._errHandler.sync(this); _la = this._input.LA(1); } @@ -1225,21 +1262,21 @@ export default class NaviParser extends antlr4.Parser { unionExpression() { let localctx = new UnionExpressionContext(this, this._ctx, this.state); - this.enterRule(localctx, 46, NaviParser.RULE_unionExpression); + this.enterRule(localctx, 48, NaviParser.RULE_unionExpression); var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 286; + this.state = 293; this.intersectionExpression(); - this.state = 291; + this.state = 298; this._errHandler.sync(this); _la = this._input.LA(1); while(_la===11) { - this.state = 287; + this.state = 294; this.match(NaviParser.T__10); - this.state = 288; + this.state = 295; this.intersectionExpression(); - this.state = 293; + this.state = 300; this._errHandler.sync(this); _la = this._input.LA(1); } @@ -1261,26 +1298,26 @@ export default class NaviParser extends antlr4.Parser { comparisonExpression() { let localctx = new ComparisonExpressionContext(this, this._ctx, this.state); - this.enterRule(localctx, 48, NaviParser.RULE_comparisonExpression); + this.enterRule(localctx, 50, NaviParser.RULE_comparisonExpression); var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 294; + this.state = 301; this.unionExpression(); - this.state = 297; + this.state = 304; this._errHandler.sync(this); _la = this._input.LA(1); - if(((((_la - 42)) & ~0x1f) === 0 && ((1 << (_la - 42)) & 63) !== 0)) { - this.state = 295; + if(((((_la - 43)) & ~0x1f) === 0 && ((1 << (_la - 43)) & 63) !== 0)) { + this.state = 302; _la = this._input.LA(1); - if(!(((((_la - 42)) & ~0x1f) === 0 && ((1 << (_la - 42)) & 63) !== 0))) { + if(!(((((_la - 43)) & ~0x1f) === 0 && ((1 << (_la - 43)) & 63) !== 0))) { this._errHandler.recoverInline(this); } else { this._errHandler.reportMatch(this); this.consume(); } - this.state = 296; + this.state = 303; this.unionExpression(); } @@ -1302,21 +1339,21 @@ export default class NaviParser extends antlr4.Parser { logicalNotExpression() { let localctx = new LogicalNotExpressionContext(this, this._ctx, this.state); - this.enterRule(localctx, 50, NaviParser.RULE_logicalNotExpression); + this.enterRule(localctx, 52, NaviParser.RULE_logicalNotExpression); var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 302; + this.state = 309; this._errHandler.sync(this); _la = this._input.LA(1); while(_la===23) { - this.state = 299; + this.state = 306; this.match(NaviParser.Not); - this.state = 304; + this.state = 311; this._errHandler.sync(this); _la = this._input.LA(1); } - this.state = 305; + this.state = 312; this.comparisonExpression(); } catch (re) { if(re instanceof antlr4.error.RecognitionException) { @@ -1336,21 +1373,21 @@ export default class NaviParser extends antlr4.Parser { logicalAndExpression() { let localctx = new LogicalAndExpressionContext(this, this._ctx, this.state); - this.enterRule(localctx, 52, NaviParser.RULE_logicalAndExpression); + this.enterRule(localctx, 54, NaviParser.RULE_logicalAndExpression); var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 307; + this.state = 314; this.logicalNotExpression(); - this.state = 312; + this.state = 319; this._errHandler.sync(this); _la = this._input.LA(1); while(_la===14) { - this.state = 308; + this.state = 315; this.match(NaviParser.And); - this.state = 309; + this.state = 316; this.logicalNotExpression(); - this.state = 314; + this.state = 321; this._errHandler.sync(this); _la = this._input.LA(1); } @@ -1372,21 +1409,21 @@ export default class NaviParser extends antlr4.Parser { logicalOrExpression() { let localctx = new LogicalOrExpressionContext(this, this._ctx, this.state); - this.enterRule(localctx, 54, NaviParser.RULE_logicalOrExpression); + this.enterRule(localctx, 56, NaviParser.RULE_logicalOrExpression); var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 315; + this.state = 322; this.logicalAndExpression(); - this.state = 320; + this.state = 327; this._errHandler.sync(this); _la = this._input.LA(1); while(_la===24) { - this.state = 316; + this.state = 323; this.match(NaviParser.Or); - this.state = 317; + this.state = 324; this.logicalAndExpression(); - this.state = 322; + this.state = 329; this._errHandler.sync(this); _la = this._input.LA(1); } @@ -1408,10 +1445,10 @@ export default class NaviParser extends antlr4.Parser { expression() { let localctx = new ExpressionContext(this, this._ctx, this.state); - this.enterRule(localctx, 56, NaviParser.RULE_expression); + this.enterRule(localctx, 58, NaviParser.RULE_expression); try { this.enterOuterAlt(localctx, 1); - this.state = 323; + this.state = 330; this.logicalOrExpression(); } catch (re) { if(re instanceof antlr4.error.RecognitionException) { @@ -1431,36 +1468,36 @@ export default class NaviParser extends antlr4.Parser { args() { let localctx = new ArgsContext(this, this._ctx, this.state); - this.enterRule(localctx, 58, NaviParser.RULE_args); + this.enterRule(localctx, 60, NaviParser.RULE_args); var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 336; + this.state = 343; this._errHandler.sync(this); _la = this._input.LA(1); if((((_la) & ~0x1f) === 0 && ((1 << _la) & 3771203656) !== 0) || ((((_la - 32)) & ~0x1f) === 0 && ((1 << (_la - 32)) & 127) !== 0)) { - this.state = 325; + this.state = 332; this.expression(); - this.state = 330; + this.state = 337; this._errHandler.sync(this); - var _alt = this._interp.adaptivePredict(this._input,31,this._ctx) + var _alt = this._interp.adaptivePredict(this._input,32,this._ctx) while(_alt!=2 && _alt!=antlr4.atn.ATN.INVALID_ALT_NUMBER) { if(_alt===1) { - this.state = 326; + this.state = 333; this.match(NaviParser.T__3); - this.state = 327; + this.state = 334; this.expression(); } - this.state = 332; + this.state = 339; this._errHandler.sync(this); - _alt = this._interp.adaptivePredict(this._input,31,this._ctx); + _alt = this._interp.adaptivePredict(this._input,32,this._ctx); } - this.state = 334; + this.state = 341; this._errHandler.sync(this); _la = this._input.LA(1); if(_la===4) { - this.state = 333; + this.state = 340; this.match(NaviParser.T__3); } @@ -1484,44 +1521,44 @@ export default class NaviParser extends antlr4.Parser { fields() { let localctx = new FieldsContext(this, this._ctx, this.state); - this.enterRule(localctx, 60, NaviParser.RULE_fields); + this.enterRule(localctx, 62, NaviParser.RULE_fields); var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 338; + this.state = 345; this.match(NaviParser.T__2); - this.state = 350; + this.state = 357; this._errHandler.sync(this); _la = this._input.LA(1); if(_la===37) { - this.state = 339; + this.state = 346; this.field(); - this.state = 344; + this.state = 351; this._errHandler.sync(this); - var _alt = this._interp.adaptivePredict(this._input,34,this._ctx) + var _alt = this._interp.adaptivePredict(this._input,35,this._ctx) while(_alt!=2 && _alt!=antlr4.atn.ATN.INVALID_ALT_NUMBER) { if(_alt===1) { - this.state = 340; + this.state = 347; this.match(NaviParser.T__3); - this.state = 341; + this.state = 348; this.field(); } - this.state = 346; + this.state = 353; this._errHandler.sync(this); - _alt = this._interp.adaptivePredict(this._input,34,this._ctx); + _alt = this._interp.adaptivePredict(this._input,35,this._ctx); } - this.state = 348; + this.state = 355; this._errHandler.sync(this); _la = this._input.LA(1); if(_la===4) { - this.state = 347; + this.state = 354; this.match(NaviParser.T__3); } } - this.state = 352; + this.state = 359; this.match(NaviParser.T__4); } catch (re) { if(re instanceof antlr4.error.RecognitionException) { @@ -1541,65 +1578,65 @@ export default class NaviParser extends antlr4.Parser { fieldsSpread() { let localctx = new FieldsSpreadContext(this, this._ctx, this.state); - this.enterRule(localctx, 62, NaviParser.RULE_fieldsSpread); + this.enterRule(localctx, 64, NaviParser.RULE_fieldsSpread); var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 354; + this.state = 361; this.match(NaviParser.T__2); - this.state = 392; + this.state = 399; this._errHandler.sync(this); switch(this._input.LA(1)) { - case 48: - this.state = 355; + case 49: + this.state = 362; this.spread(); - this.state = 360; + this.state = 367; this._errHandler.sync(this); - var _alt = this._interp.adaptivePredict(this._input,37,this._ctx) + var _alt = this._interp.adaptivePredict(this._input,38,this._ctx) while(_alt!=2 && _alt!=antlr4.atn.ATN.INVALID_ALT_NUMBER) { if(_alt===1) { - this.state = 356; + this.state = 363; this.match(NaviParser.T__3); - this.state = 357; + this.state = 364; this.spread(); } - this.state = 362; + this.state = 369; this._errHandler.sync(this); - _alt = this._interp.adaptivePredict(this._input,37,this._ctx); + _alt = this._interp.adaptivePredict(this._input,38,this._ctx); } - this.state = 377; + this.state = 384; this._errHandler.sync(this); _la = this._input.LA(1); if(_la===4) { - this.state = 363; + this.state = 370; this.match(NaviParser.T__3); - this.state = 375; + this.state = 382; this._errHandler.sync(this); _la = this._input.LA(1); if(_la===37) { - this.state = 364; + this.state = 371; this.fieldMaybeAssert(); - this.state = 369; + this.state = 376; this._errHandler.sync(this); - var _alt = this._interp.adaptivePredict(this._input,38,this._ctx) + var _alt = this._interp.adaptivePredict(this._input,39,this._ctx) while(_alt!=2 && _alt!=antlr4.atn.ATN.INVALID_ALT_NUMBER) { if(_alt===1) { - this.state = 365; + this.state = 372; this.match(NaviParser.T__3); - this.state = 366; + this.state = 373; this.fieldMaybeAssert(); } - this.state = 371; + this.state = 378; this._errHandler.sync(this); - _alt = this._interp.adaptivePredict(this._input,38,this._ctx); + _alt = this._interp.adaptivePredict(this._input,39,this._ctx); } - this.state = 373; + this.state = 380; this._errHandler.sync(this); _la = this._input.LA(1); if(_la===4) { - this.state = 372; + this.state = 379; this.match(NaviParser.T__3); } @@ -1610,32 +1647,32 @@ export default class NaviParser extends antlr4.Parser { break; case 5: case 37: - this.state = 390; + this.state = 397; this._errHandler.sync(this); _la = this._input.LA(1); if(_la===37) { - this.state = 379; + this.state = 386; this.fieldMaybeAssert(); - this.state = 384; + this.state = 391; this._errHandler.sync(this); - var _alt = this._interp.adaptivePredict(this._input,42,this._ctx) + var _alt = this._interp.adaptivePredict(this._input,43,this._ctx) while(_alt!=2 && _alt!=antlr4.atn.ATN.INVALID_ALT_NUMBER) { if(_alt===1) { - this.state = 380; + this.state = 387; this.match(NaviParser.T__3); - this.state = 381; + this.state = 388; this.fieldMaybeAssert(); } - this.state = 386; + this.state = 393; this._errHandler.sync(this); - _alt = this._interp.adaptivePredict(this._input,42,this._ctx); + _alt = this._interp.adaptivePredict(this._input,43,this._ctx); } - this.state = 388; + this.state = 395; this._errHandler.sync(this); _la = this._input.LA(1); if(_la===4) { - this.state = 387; + this.state = 394; this.match(NaviParser.T__3); } @@ -1645,7 +1682,7 @@ export default class NaviParser extends antlr4.Parser { default: throw new antlr4.error.NoViableAltException(this); } - this.state = 394; + this.state = 401; this.match(NaviParser.T__4); } catch (re) { if(re instanceof antlr4.error.RecognitionException) { @@ -1665,12 +1702,12 @@ export default class NaviParser extends antlr4.Parser { spread() { let localctx = new SpreadContext(this, this._ctx, this.state); - this.enterRule(localctx, 64, NaviParser.RULE_spread); + this.enterRule(localctx, 66, NaviParser.RULE_spread); try { this.enterOuterAlt(localctx, 1); - this.state = 396; + this.state = 403; this.match(NaviParser.OpSpread); - this.state = 397; + this.state = 404; this.expression(); } catch (re) { if(re instanceof antlr4.error.RecognitionException) { @@ -1690,12 +1727,12 @@ export default class NaviParser extends antlr4.Parser { field() { let localctx = new FieldContext(this, this._ctx, this.state); - this.enterRule(localctx, 66, NaviParser.RULE_field); + this.enterRule(localctx, 68, NaviParser.RULE_field); try { this.enterOuterAlt(localctx, 1); - this.state = 399; + this.state = 406; this.match(NaviParser.Identifier); - this.state = 400; + this.state = 407; this.assert(); } catch (re) { if(re instanceof antlr4.error.RecognitionException) { @@ -1715,17 +1752,17 @@ export default class NaviParser extends antlr4.Parser { fieldMaybeAssert() { let localctx = new FieldMaybeAssertContext(this, this._ctx, this.state); - this.enterRule(localctx, 68, NaviParser.RULE_fieldMaybeAssert); + this.enterRule(localctx, 70, NaviParser.RULE_fieldMaybeAssert); var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 402; + this.state = 409; this.match(NaviParser.Identifier); - this.state = 404; + this.state = 411; this._errHandler.sync(this); _la = this._input.LA(1); if(_la===12) { - this.state = 403; + this.state = 410; this.assert(); } @@ -1747,44 +1784,44 @@ export default class NaviParser extends antlr4.Parser { parameters() { let localctx = new ParametersContext(this, this._ctx, this.state); - this.enterRule(localctx, 70, NaviParser.RULE_parameters); + this.enterRule(localctx, 72, NaviParser.RULE_parameters); var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 406; + this.state = 413; this.match(NaviParser.T__5); - this.state = 418; + this.state = 425; this._errHandler.sync(this); _la = this._input.LA(1); if(_la===37) { - this.state = 407; + this.state = 414; this.parameter(); - this.state = 412; + this.state = 419; this._errHandler.sync(this); - var _alt = this._interp.adaptivePredict(this._input,47,this._ctx) + var _alt = this._interp.adaptivePredict(this._input,48,this._ctx) while(_alt!=2 && _alt!=antlr4.atn.ATN.INVALID_ALT_NUMBER) { if(_alt===1) { - this.state = 408; + this.state = 415; this.match(NaviParser.T__3); - this.state = 409; + this.state = 416; this.parameter(); } - this.state = 414; + this.state = 421; this._errHandler.sync(this); - _alt = this._interp.adaptivePredict(this._input,47,this._ctx); + _alt = this._interp.adaptivePredict(this._input,48,this._ctx); } - this.state = 416; + this.state = 423; this._errHandler.sync(this); _la = this._input.LA(1); if(_la===4) { - this.state = 415; + this.state = 422; this.match(NaviParser.T__3); } } - this.state = 420; + this.state = 427; this.match(NaviParser.T__6); } catch (re) { if(re instanceof antlr4.error.RecognitionException) { @@ -1804,66 +1841,66 @@ export default class NaviParser extends antlr4.Parser { varArgParameters() { let localctx = new VarArgParametersContext(this, this._ctx, this.state); - this.enterRule(localctx, 72, NaviParser.RULE_varArgParameters); + this.enterRule(localctx, 74, NaviParser.RULE_varArgParameters); var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 422; + this.state = 429; this.match(NaviParser.T__5); - this.state = 441; + this.state = 448; this._errHandler.sync(this); _la = this._input.LA(1); - if(_la===37 || _la===48) { - this.state = 436; + if(_la===37 || _la===49) { + this.state = 443; this._errHandler.sync(this); switch(this._input.LA(1)) { case 37: - this.state = 423; + this.state = 430; this.parameter(); - this.state = 428; + this.state = 435; this._errHandler.sync(this); - var _alt = this._interp.adaptivePredict(this._input,50,this._ctx) + var _alt = this._interp.adaptivePredict(this._input,51,this._ctx) while(_alt!=2 && _alt!=antlr4.atn.ATN.INVALID_ALT_NUMBER) { if(_alt===1) { - this.state = 424; + this.state = 431; this.match(NaviParser.T__3); - this.state = 425; + this.state = 432; this.parameter(); } - this.state = 430; + this.state = 437; this._errHandler.sync(this); - _alt = this._interp.adaptivePredict(this._input,50,this._ctx); + _alt = this._interp.adaptivePredict(this._input,51,this._ctx); } - this.state = 433; + this.state = 440; this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input,51,this._ctx); + var la_ = this._interp.adaptivePredict(this._input,52,this._ctx); if(la_===1) { - this.state = 431; + this.state = 438; this.match(NaviParser.T__3); - this.state = 432; + this.state = 439; this.varArgParameter(); } break; - case 48: - this.state = 435; + case 49: + this.state = 442; this.varArgParameter(); break; default: throw new antlr4.error.NoViableAltException(this); } - this.state = 439; + this.state = 446; this._errHandler.sync(this); _la = this._input.LA(1); if(_la===4) { - this.state = 438; + this.state = 445; this.match(NaviParser.T__3); } } - this.state = 443; + this.state = 450; this.match(NaviParser.T__6); } catch (re) { if(re instanceof antlr4.error.RecognitionException) { @@ -1883,12 +1920,12 @@ export default class NaviParser extends antlr4.Parser { parameter() { let localctx = new ParameterContext(this, this._ctx, this.state); - this.enterRule(localctx, 74, NaviParser.RULE_parameter); + this.enterRule(localctx, 76, NaviParser.RULE_parameter); try { this.enterOuterAlt(localctx, 1); - this.state = 445; + this.state = 452; this.match(NaviParser.Identifier); - this.state = 446; + this.state = 453; this.assert(); } catch (re) { if(re instanceof antlr4.error.RecognitionException) { @@ -1908,14 +1945,14 @@ export default class NaviParser extends antlr4.Parser { varArgParameter() { let localctx = new VarArgParameterContext(this, this._ctx, this.state); - this.enterRule(localctx, 76, NaviParser.RULE_varArgParameter); + this.enterRule(localctx, 78, NaviParser.RULE_varArgParameter); try { this.enterOuterAlt(localctx, 1); - this.state = 448; + this.state = 455; this.match(NaviParser.OpSpread); - this.state = 449; + this.state = 456; this.match(NaviParser.Identifier); - this.state = 450; + this.state = 457; this.assert(); } catch (re) { if(re instanceof antlr4.error.RecognitionException) { @@ -1935,12 +1972,12 @@ export default class NaviParser extends antlr4.Parser { assert() { let localctx = new AssertContext(this, this._ctx, this.state); - this.enterRule(localctx, 78, NaviParser.RULE_assert); + this.enterRule(localctx, 80, NaviParser.RULE_assert); try { this.enterOuterAlt(localctx, 1); - this.state = 452; + this.state = 459; this.match(NaviParser.T__11); - this.state = 453; + this.state = 460; this.expression(); } catch (re) { if(re instanceof antlr4.error.RecognitionException) { @@ -1960,11 +1997,11 @@ export default class NaviParser extends antlr4.Parser { contextualKeyword() { let localctx = new ContextualKeywordContext(this, this._ctx, this.state); - this.enterRule(localctx, 80, NaviParser.RULE_contextualKeyword); + this.enterRule(localctx, 82, NaviParser.RULE_contextualKeyword); var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 455; + this.state = 462; _la = this._input.LA(1); if(!((((_la) & ~0x1f) === 0 && ((1 << _la) & 25182208) !== 0))) { this._errHandler.recoverInline(this); @@ -1991,35 +2028,35 @@ export default class NaviParser extends antlr4.Parser { name() { let localctx = new NameContext(this, this._ctx, this.state); - this.enterRule(localctx, 82, NaviParser.RULE_name); + this.enterRule(localctx, 84, NaviParser.RULE_name); var _la = 0; try { this.enterOuterAlt(localctx, 1); - this.state = 457; + this.state = 464; this.match(NaviParser.Identifier); - this.state = 465; + this.state = 472; this._errHandler.sync(this); _la = this._input.LA(1); while(_la===13) { - this.state = 458; + this.state = 465; this.match(NaviParser.T__12); - this.state = 461; + this.state = 468; this._errHandler.sync(this); switch(this._input.LA(1)) { case 37: - this.state = 459; + this.state = 466; this.match(NaviParser.Identifier); break; case 14: case 23: case 24: - this.state = 460; + this.state = 467; this.contextualKeyword(); break; default: throw new antlr4.error.NoViableAltException(this); } - this.state = 467; + this.state = 474; this._errHandler.sync(this); _la = this._input.LA(1); } @@ -2082,16 +2119,17 @@ NaviParser.OpMinus = 38; NaviParser.OpPlus = 39; NaviParser.OpMult = 40; NaviParser.OpDiv = 41; -NaviParser.OpEqual = 42; -NaviParser.OpNotEqual = 43; -NaviParser.OpGt = 44; -NaviParser.OpLt = 45; -NaviParser.OpGte = 46; -NaviParser.OpLte = 47; -NaviParser.OpSpread = 48; -NaviParser.Space = 49; -NaviParser.LineComment = 50; -NaviParser.BlockComment = 51; +NaviParser.OpPow = 42; +NaviParser.OpEqual = 43; +NaviParser.OpNotEqual = 44; +NaviParser.OpGt = 45; +NaviParser.OpLt = 46; +NaviParser.OpGte = 47; +NaviParser.OpLte = 48; +NaviParser.OpSpread = 49; +NaviParser.Space = 50; +NaviParser.LineComment = 51; +NaviParser.BlockComment = 52; NaviParser.RULE_definitionDocument = 0; NaviParser.RULE_expressionDocument = 1; @@ -2112,29 +2150,30 @@ NaviParser.RULE_structExpression = 15; NaviParser.RULE_scopeExpression = 16; NaviParser.RULE_ifExpression = 17; NaviParser.RULE_fieldAccessExpression = 18; -NaviParser.RULE_negateExpression = 19; -NaviParser.RULE_multiplicativeExpression = 20; -NaviParser.RULE_additiveExpression = 21; -NaviParser.RULE_intersectionExpression = 22; -NaviParser.RULE_unionExpression = 23; -NaviParser.RULE_comparisonExpression = 24; -NaviParser.RULE_logicalNotExpression = 25; -NaviParser.RULE_logicalAndExpression = 26; -NaviParser.RULE_logicalOrExpression = 27; -NaviParser.RULE_expression = 28; -NaviParser.RULE_args = 29; -NaviParser.RULE_fields = 30; -NaviParser.RULE_fieldsSpread = 31; -NaviParser.RULE_spread = 32; -NaviParser.RULE_field = 33; -NaviParser.RULE_fieldMaybeAssert = 34; -NaviParser.RULE_parameters = 35; -NaviParser.RULE_varArgParameters = 36; -NaviParser.RULE_parameter = 37; -NaviParser.RULE_varArgParameter = 38; -NaviParser.RULE_assert = 39; -NaviParser.RULE_contextualKeyword = 40; -NaviParser.RULE_name = 41; +NaviParser.RULE_powExpression = 19; +NaviParser.RULE_negateExpression = 20; +NaviParser.RULE_multiplicativeExpression = 21; +NaviParser.RULE_additiveExpression = 22; +NaviParser.RULE_intersectionExpression = 23; +NaviParser.RULE_unionExpression = 24; +NaviParser.RULE_comparisonExpression = 25; +NaviParser.RULE_logicalNotExpression = 26; +NaviParser.RULE_logicalAndExpression = 27; +NaviParser.RULE_logicalOrExpression = 28; +NaviParser.RULE_expression = 29; +NaviParser.RULE_args = 30; +NaviParser.RULE_fields = 31; +NaviParser.RULE_fieldsSpread = 32; +NaviParser.RULE_spread = 33; +NaviParser.RULE_field = 34; +NaviParser.RULE_fieldMaybeAssert = 35; +NaviParser.RULE_parameters = 36; +NaviParser.RULE_varArgParameters = 37; +NaviParser.RULE_parameter = 38; +NaviParser.RULE_varArgParameter = 39; +NaviParser.RULE_assert = 40; +NaviParser.RULE_contextualKeyword = 41; +NaviParser.RULE_name = 42; class DefinitionDocumentContext extends antlr4.ParserRuleContext { @@ -3069,6 +3108,52 @@ class FieldAccessExpressionContext extends antlr4.ParserRuleContext { +class PowExpressionContext extends antlr4.ParserRuleContext { + + constructor(parser, parent, invokingState) { + if(parent===undefined) { + parent = null; + } + if(invokingState===undefined || invokingState===null) { + invokingState = -1; + } + super(parent, invokingState); + this.parser = parser; + this.ruleIndex = NaviParser.RULE_powExpression; + } + + fieldAccessExpression = function(i) { + if(i===undefined) { + i = null; + } + if(i===null) { + return this.getTypedRuleContexts(FieldAccessExpressionContext); + } else { + return this.getTypedRuleContext(FieldAccessExpressionContext,i); + } + }; + + OpPow() { + return this.getToken(NaviParser.OpPow, 0); + }; + + enterRule(listener) { + if(listener instanceof NaviListener ) { + listener.enterPowExpression(this); + } + } + + exitRule(listener) { + if(listener instanceof NaviListener ) { + listener.exitPowExpression(this); + } + } + + +} + + + class NegateExpressionContext extends antlr4.ParserRuleContext { constructor(parser, parent, invokingState) { @@ -3083,8 +3168,8 @@ class NegateExpressionContext extends antlr4.ParserRuleContext { this.ruleIndex = NaviParser.RULE_negateExpression; } - fieldAccessExpression() { - return this.getTypedRuleContext(FieldAccessExpressionContext,0); + powExpression() { + return this.getTypedRuleContext(PowExpressionContext,0); }; OpMinus() { @@ -4156,6 +4241,7 @@ NaviParser.StructExpressionContext = StructExpressionContext; NaviParser.ScopeExpressionContext = ScopeExpressionContext; NaviParser.IfExpressionContext = IfExpressionContext; NaviParser.FieldAccessExpressionContext = FieldAccessExpressionContext; +NaviParser.PowExpressionContext = PowExpressionContext; NaviParser.NegateExpressionContext = NegateExpressionContext; NaviParser.MultiplicativeExpressionContext = MultiplicativeExpressionContext; NaviParser.AdditiveExpressionContext = AdditiveExpressionContext; diff --git a/src/parse.ts b/src/parse.ts index b9bb9f7..c49b788 100644 --- a/src/parse.ts +++ b/src/parse.ts @@ -367,6 +367,7 @@ class AstConverter { | Contexts['AdditiveExpressionContext'] | Contexts['MultiplicativeExpressionContext'] | Contexts['NegateExpressionContext'] + | Contexts['PowExpressionContext'] | Contexts['FieldAccessExpressionContext'] | Contexts['PrimaryExpressionContext'] | Contexts['FunctionCallContext'] @@ -465,12 +466,30 @@ class AstConverter { ); } if (context instanceof NaviParser.NegateExpressionContext) { - const expr = this.toExpression(getRequired(context, 'fieldAccessExpression')); + const powContext = getRequired(context, 'powExpression'); + const expr = this.toExpression(powContext); + if (getOptionalToken(context, 'OpMinus')) { + if (getOptionalToken(powContext, 'OpPow')) { + // error: -a ** b is not allowed + throw new ConversionError( + context, + 'Negation cannot be applied to exponentiation. -a**b is not allowed. Write either -(a**b) or (-a)**b instead.' + ); + } return new FunctionCallExpression('number::neg', [expr]); } + return expr; } + if (context instanceof NaviParser.PowExpressionContext) { + const expressions = getMultiple(context, 'fieldAccessExpression').map( + this.toExpression + ); + if (expressions.length === 1) return expressions[0]; + const [x, y] = expressions; + return new FunctionCallExpression('number::pow', [x, y]); + } if (context instanceof NaviParser.FieldAccessExpressionContext) { const ofExpression = this.toExpression(getRequired(context, 'primaryExpression')); const fields = getMultipleTokens(context, 'Identifier').map((t) => t.getText()); diff --git a/tests/__snapshots__/parse.test.ts.snap b/tests/__snapshots__/parse.test.ts.snap index ed2a0d5..03ab1c6 100644 --- a/tests/__snapshots__/parse.test.ts.snap +++ b/tests/__snapshots__/parse.test.ts.snap @@ -458,6 +458,18 @@ number::add(-100, number::neg(-100)) >>> a---100 number::add(a, number::neg(number::neg(-100))) +>>> a**b +number::pow(a, b) + +>>> (-a)**b +number::pow(number::neg(a), b) + +>>> -(a**b) +number::neg(number::pow(a, b)) + +>>> a*b**c*d +number::mul(a, number::pow(b, c), d) + >>> not a and b or c bool::or(bool::and(bool::not(a), b), c) @@ -844,8 +856,11 @@ SyntaxError: At 1:3: extraneous input '-' expecting {'{', '(', 'if', 'match', In >>> a++a SyntaxError: At 1:2: extraneous input '+' expecting {'{', '(', 'if', 'match', IntInterval, NonIntInterval, IntervalInclusive, IntervalMinExclusive, IntervalMaxExclusive, IntervalExclusive, Number, String, Identifier, '-'} ->>> a**a -SyntaxError: At 1:2: extraneous input '*' expecting {'{', '(', 'if', 'match', IntInterval, NonIntInterval, IntervalInclusive, IntervalMinExclusive, IntervalMaxExclusive, IntervalExclusive, Number, String, Identifier, '-'} +>>> a* *a +SyntaxError: At 1:3: extraneous input '*' expecting {'{', '(', 'if', 'match', IntInterval, NonIntInterval, IntervalInclusive, IntervalMinExclusive, IntervalMaxExclusive, IntervalExclusive, Number, String, Identifier, '-'} + +>>> -a**a +Error: Unable to convert \`-a**a\`: Negation cannot be applied to exponentiation. -a**b is not allowed. Write either -(a**b) or (-a)**b instead. >>> a-100 SyntaxError: At 1:1: extraneous input '-100' expecting diff --git a/tests/parse.test.ts b/tests/parse.test.ts index de6118e..9b3c2d3 100644 --- a/tests/parse.test.ts +++ b/tests/parse.test.ts @@ -165,6 +165,10 @@ const expressionSnippets: string[] = [ String.raw`a + b * c`, String.raw`-100 - -100`, String.raw`a---100`, + String.raw`a**b`, + String.raw`(-a)**b`, + String.raw`-(a**b)`, + String.raw`a*b**c*d`, // logical String.raw`not a and b or c`, @@ -308,7 +312,8 @@ const invalidExpressionSnippets: string[] = [ String.raw`--a`, String.raw`a+--a`, String.raw`a++a`, - String.raw`a**a`, + String.raw`a* *a`, + String.raw`-a**a`, String.raw`a-100`, // logical