diff --git a/grammar/Expr.g4 b/grammar/Expr.g4 index f1775951..73e4d0ba 100644 --- a/grammar/Expr.g4 +++ b/grammar/Expr.g4 @@ -13,19 +13,20 @@ This file is part of the Antares project. */ grammar Expr; - +portFieldExpr : IDENTIFIER '.' IDENTIFIER; /* To match the whole input */ fullexpr: expr EOF; expr : atom # unsignedAtom - | IDENTIFIER '.' IDENTIFIER # portField + | portFieldExpr # portField | '-' expr # negation | '(' expr ')' # expression | expr op=('/' | '*') expr # muldiv | expr op=('+' | '-') expr # addsub | expr COMPARISON expr # comparison - | 'sum' '(' expr ')' # allTimeSum + | 'sum' '(' expr ')' # allTimeSum + | 'sum_connections' '(' portFieldExpr ')' # portFieldSum | 'sum' '(' from=shift '..' to=shift ',' expr ')' # timeSum | IDENTIFIER '(' expr ')' # function | IDENTIFIER '[' shift ']' # timeShift diff --git a/src/andromede/expression/parsing/antlr/Expr.interp b/src/andromede/expression/parsing/antlr/Expr.interp index d4189d97..94f1370f 100644 --- a/src/andromede/expression/parsing/antlr/Expr.interp +++ b/src/andromede/expression/parsing/antlr/Expr.interp @@ -8,6 +8,7 @@ null '*' '+' 'sum' +'sum_connections' '..' ',' '[' @@ -32,6 +33,7 @@ null null null null +null NUMBER TIME IDENTIFIER @@ -39,6 +41,7 @@ COMPARISON WS rule names: +portFieldExpr fullexpr expr atom @@ -48,4 +51,4 @@ right_expr atn: -[4, 1, 17, 117, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 56, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 67, 8, 1, 10, 1, 12, 1, 70, 9, 1, 1, 2, 1, 2, 3, 2, 74, 8, 2, 1, 3, 1, 3, 3, 3, 78, 8, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 88, 8, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 5, 4, 96, 8, 4, 10, 4, 12, 4, 99, 9, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 107, 8, 5, 1, 5, 1, 5, 1, 5, 5, 5, 112, 8, 5, 10, 5, 12, 5, 115, 9, 5, 1, 5, 0, 3, 2, 8, 10, 6, 0, 2, 4, 6, 8, 10, 0, 2, 1, 0, 5, 6, 2, 0, 2, 2, 7, 7, 128, 0, 12, 1, 0, 0, 0, 2, 55, 1, 0, 0, 0, 4, 73, 1, 0, 0, 0, 6, 75, 1, 0, 0, 0, 8, 87, 1, 0, 0, 0, 10, 106, 1, 0, 0, 0, 12, 13, 3, 2, 1, 0, 13, 14, 5, 0, 0, 1, 14, 1, 1, 0, 0, 0, 15, 16, 6, 1, -1, 0, 16, 56, 3, 4, 2, 0, 17, 18, 5, 15, 0, 0, 18, 19, 5, 1, 0, 0, 19, 56, 5, 15, 0, 0, 20, 21, 5, 2, 0, 0, 21, 56, 3, 2, 1, 10, 22, 23, 5, 3, 0, 0, 23, 24, 3, 2, 1, 0, 24, 25, 5, 4, 0, 0, 25, 56, 1, 0, 0, 0, 26, 27, 5, 8, 0, 0, 27, 28, 5, 3, 0, 0, 28, 29, 3, 2, 1, 0, 29, 30, 5, 4, 0, 0, 30, 56, 1, 0, 0, 0, 31, 32, 5, 8, 0, 0, 32, 33, 5, 3, 0, 0, 33, 34, 3, 6, 3, 0, 34, 35, 5, 9, 0, 0, 35, 36, 3, 6, 3, 0, 36, 37, 5, 10, 0, 0, 37, 38, 3, 2, 1, 0, 38, 39, 5, 4, 0, 0, 39, 56, 1, 0, 0, 0, 40, 41, 5, 15, 0, 0, 41, 42, 5, 3, 0, 0, 42, 43, 3, 2, 1, 0, 43, 44, 5, 4, 0, 0, 44, 56, 1, 0, 0, 0, 45, 46, 5, 15, 0, 0, 46, 47, 5, 11, 0, 0, 47, 48, 3, 6, 3, 0, 48, 49, 5, 12, 0, 0, 49, 56, 1, 0, 0, 0, 50, 51, 5, 15, 0, 0, 51, 52, 5, 11, 0, 0, 52, 53, 3, 2, 1, 0, 53, 54, 5, 12, 0, 0, 54, 56, 1, 0, 0, 0, 55, 15, 1, 0, 0, 0, 55, 17, 1, 0, 0, 0, 55, 20, 1, 0, 0, 0, 55, 22, 1, 0, 0, 0, 55, 26, 1, 0, 0, 0, 55, 31, 1, 0, 0, 0, 55, 40, 1, 0, 0, 0, 55, 45, 1, 0, 0, 0, 55, 50, 1, 0, 0, 0, 56, 68, 1, 0, 0, 0, 57, 58, 10, 8, 0, 0, 58, 59, 7, 0, 0, 0, 59, 67, 3, 2, 1, 9, 60, 61, 10, 7, 0, 0, 61, 62, 7, 1, 0, 0, 62, 67, 3, 2, 1, 8, 63, 64, 10, 6, 0, 0, 64, 65, 5, 16, 0, 0, 65, 67, 3, 2, 1, 7, 66, 57, 1, 0, 0, 0, 66, 60, 1, 0, 0, 0, 66, 63, 1, 0, 0, 0, 67, 70, 1, 0, 0, 0, 68, 66, 1, 0, 0, 0, 68, 69, 1, 0, 0, 0, 69, 3, 1, 0, 0, 0, 70, 68, 1, 0, 0, 0, 71, 74, 5, 13, 0, 0, 72, 74, 5, 15, 0, 0, 73, 71, 1, 0, 0, 0, 73, 72, 1, 0, 0, 0, 74, 5, 1, 0, 0, 0, 75, 77, 5, 14, 0, 0, 76, 78, 3, 8, 4, 0, 77, 76, 1, 0, 0, 0, 77, 78, 1, 0, 0, 0, 78, 7, 1, 0, 0, 0, 79, 80, 6, 4, -1, 0, 80, 81, 7, 1, 0, 0, 81, 88, 3, 4, 2, 0, 82, 83, 7, 1, 0, 0, 83, 84, 5, 3, 0, 0, 84, 85, 3, 2, 1, 0, 85, 86, 5, 4, 0, 0, 86, 88, 1, 0, 0, 0, 87, 79, 1, 0, 0, 0, 87, 82, 1, 0, 0, 0, 88, 97, 1, 0, 0, 0, 89, 90, 10, 4, 0, 0, 90, 91, 7, 0, 0, 0, 91, 96, 3, 10, 5, 0, 92, 93, 10, 3, 0, 0, 93, 94, 7, 1, 0, 0, 94, 96, 3, 10, 5, 0, 95, 89, 1, 0, 0, 0, 95, 92, 1, 0, 0, 0, 96, 99, 1, 0, 0, 0, 97, 95, 1, 0, 0, 0, 97, 98, 1, 0, 0, 0, 98, 9, 1, 0, 0, 0, 99, 97, 1, 0, 0, 0, 100, 101, 6, 5, -1, 0, 101, 102, 5, 3, 0, 0, 102, 103, 3, 2, 1, 0, 103, 104, 5, 4, 0, 0, 104, 107, 1, 0, 0, 0, 105, 107, 3, 4, 2, 0, 106, 100, 1, 0, 0, 0, 106, 105, 1, 0, 0, 0, 107, 113, 1, 0, 0, 0, 108, 109, 10, 3, 0, 0, 109, 110, 7, 0, 0, 0, 110, 112, 3, 10, 5, 4, 111, 108, 1, 0, 0, 0, 112, 115, 1, 0, 0, 0, 113, 111, 1, 0, 0, 0, 113, 114, 1, 0, 0, 0, 114, 11, 1, 0, 0, 0, 115, 113, 1, 0, 0, 0, 10, 55, 66, 68, 73, 77, 87, 95, 97, 106, 113] \ No newline at end of file +[4, 1, 18, 140, 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, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 79, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 90, 8, 2, 10, 2, 12, 2, 93, 9, 2, 1, 3, 1, 3, 3, 3, 97, 8, 3, 1, 4, 1, 4, 3, 4, 101, 8, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 111, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 119, 8, 5, 10, 5, 12, 5, 122, 9, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 3, 6, 130, 8, 6, 1, 6, 1, 6, 1, 6, 5, 6, 135, 8, 6, 10, 6, 12, 6, 138, 9, 6, 1, 6, 0, 3, 4, 10, 12, 7, 0, 2, 4, 6, 8, 10, 12, 0, 2, 1, 0, 5, 6, 2, 0, 2, 2, 7, 7, 153, 0, 14, 1, 0, 0, 0, 2, 18, 1, 0, 0, 0, 4, 78, 1, 0, 0, 0, 6, 96, 1, 0, 0, 0, 8, 98, 1, 0, 0, 0, 10, 110, 1, 0, 0, 0, 12, 129, 1, 0, 0, 0, 14, 15, 5, 16, 0, 0, 15, 16, 5, 1, 0, 0, 16, 17, 5, 16, 0, 0, 17, 1, 1, 0, 0, 0, 18, 19, 3, 4, 2, 0, 19, 20, 5, 0, 0, 1, 20, 3, 1, 0, 0, 0, 21, 22, 6, 2, -1, 0, 22, 79, 3, 6, 3, 0, 23, 79, 3, 0, 0, 0, 24, 25, 5, 2, 0, 0, 25, 79, 3, 4, 2, 13, 26, 27, 5, 3, 0, 0, 27, 28, 3, 4, 2, 0, 28, 29, 5, 4, 0, 0, 29, 79, 1, 0, 0, 0, 30, 31, 5, 8, 0, 0, 31, 32, 5, 3, 0, 0, 32, 33, 3, 4, 2, 0, 33, 34, 5, 4, 0, 0, 34, 79, 1, 0, 0, 0, 35, 36, 5, 9, 0, 0, 36, 37, 5, 3, 0, 0, 37, 38, 3, 0, 0, 0, 38, 39, 5, 4, 0, 0, 39, 79, 1, 0, 0, 0, 40, 41, 5, 8, 0, 0, 41, 42, 5, 3, 0, 0, 42, 43, 3, 8, 4, 0, 43, 44, 5, 10, 0, 0, 44, 45, 3, 8, 4, 0, 45, 46, 5, 11, 0, 0, 46, 47, 3, 4, 2, 0, 47, 48, 5, 4, 0, 0, 48, 79, 1, 0, 0, 0, 49, 50, 5, 16, 0, 0, 50, 51, 5, 3, 0, 0, 51, 52, 3, 4, 2, 0, 52, 53, 5, 4, 0, 0, 53, 79, 1, 0, 0, 0, 54, 55, 5, 16, 0, 0, 55, 56, 5, 12, 0, 0, 56, 57, 3, 8, 4, 0, 57, 58, 5, 13, 0, 0, 58, 79, 1, 0, 0, 0, 59, 60, 5, 16, 0, 0, 60, 61, 5, 12, 0, 0, 61, 62, 3, 4, 2, 0, 62, 63, 5, 13, 0, 0, 63, 79, 1, 0, 0, 0, 64, 65, 5, 3, 0, 0, 65, 66, 3, 4, 2, 0, 66, 67, 5, 4, 0, 0, 67, 68, 5, 12, 0, 0, 68, 69, 3, 8, 4, 0, 69, 70, 5, 13, 0, 0, 70, 79, 1, 0, 0, 0, 71, 72, 5, 3, 0, 0, 72, 73, 3, 4, 2, 0, 73, 74, 5, 4, 0, 0, 74, 75, 5, 12, 0, 0, 75, 76, 3, 4, 2, 0, 76, 77, 5, 13, 0, 0, 77, 79, 1, 0, 0, 0, 78, 21, 1, 0, 0, 0, 78, 23, 1, 0, 0, 0, 78, 24, 1, 0, 0, 0, 78, 26, 1, 0, 0, 0, 78, 30, 1, 0, 0, 0, 78, 35, 1, 0, 0, 0, 78, 40, 1, 0, 0, 0, 78, 49, 1, 0, 0, 0, 78, 54, 1, 0, 0, 0, 78, 59, 1, 0, 0, 0, 78, 64, 1, 0, 0, 0, 78, 71, 1, 0, 0, 0, 79, 91, 1, 0, 0, 0, 80, 81, 10, 11, 0, 0, 81, 82, 7, 0, 0, 0, 82, 90, 3, 4, 2, 12, 83, 84, 10, 10, 0, 0, 84, 85, 7, 1, 0, 0, 85, 90, 3, 4, 2, 11, 86, 87, 10, 9, 0, 0, 87, 88, 5, 17, 0, 0, 88, 90, 3, 4, 2, 10, 89, 80, 1, 0, 0, 0, 89, 83, 1, 0, 0, 0, 89, 86, 1, 0, 0, 0, 90, 93, 1, 0, 0, 0, 91, 89, 1, 0, 0, 0, 91, 92, 1, 0, 0, 0, 92, 5, 1, 0, 0, 0, 93, 91, 1, 0, 0, 0, 94, 97, 5, 14, 0, 0, 95, 97, 5, 16, 0, 0, 96, 94, 1, 0, 0, 0, 96, 95, 1, 0, 0, 0, 97, 7, 1, 0, 0, 0, 98, 100, 5, 15, 0, 0, 99, 101, 3, 10, 5, 0, 100, 99, 1, 0, 0, 0, 100, 101, 1, 0, 0, 0, 101, 9, 1, 0, 0, 0, 102, 103, 6, 5, -1, 0, 103, 104, 7, 1, 0, 0, 104, 111, 3, 6, 3, 0, 105, 106, 7, 1, 0, 0, 106, 107, 5, 3, 0, 0, 107, 108, 3, 4, 2, 0, 108, 109, 5, 4, 0, 0, 109, 111, 1, 0, 0, 0, 110, 102, 1, 0, 0, 0, 110, 105, 1, 0, 0, 0, 111, 120, 1, 0, 0, 0, 112, 113, 10, 4, 0, 0, 113, 114, 7, 0, 0, 0, 114, 119, 3, 12, 6, 0, 115, 116, 10, 3, 0, 0, 116, 117, 7, 1, 0, 0, 117, 119, 3, 12, 6, 0, 118, 112, 1, 0, 0, 0, 118, 115, 1, 0, 0, 0, 119, 122, 1, 0, 0, 0, 120, 118, 1, 0, 0, 0, 120, 121, 1, 0, 0, 0, 121, 11, 1, 0, 0, 0, 122, 120, 1, 0, 0, 0, 123, 124, 6, 6, -1, 0, 124, 125, 5, 3, 0, 0, 125, 126, 3, 4, 2, 0, 126, 127, 5, 4, 0, 0, 127, 130, 1, 0, 0, 0, 128, 130, 3, 6, 3, 0, 129, 123, 1, 0, 0, 0, 129, 128, 1, 0, 0, 0, 130, 136, 1, 0, 0, 0, 131, 132, 10, 3, 0, 0, 132, 133, 7, 0, 0, 0, 133, 135, 3, 12, 6, 4, 134, 131, 1, 0, 0, 0, 135, 138, 1, 0, 0, 0, 136, 134, 1, 0, 0, 0, 136, 137, 1, 0, 0, 0, 137, 13, 1, 0, 0, 0, 138, 136, 1, 0, 0, 0, 10, 78, 89, 91, 96, 100, 110, 118, 120, 129, 136] \ No newline at end of file diff --git a/src/andromede/expression/parsing/antlr/Expr.tokens b/src/andromede/expression/parsing/antlr/Expr.tokens index 86857744..c8638328 100644 --- a/src/andromede/expression/parsing/antlr/Expr.tokens +++ b/src/andromede/expression/parsing/antlr/Expr.tokens @@ -10,11 +10,12 @@ T__8=9 T__9=10 T__10=11 T__11=12 -NUMBER=13 -TIME=14 -IDENTIFIER=15 -COMPARISON=16 -WS=17 +T__12=13 +NUMBER=14 +TIME=15 +IDENTIFIER=16 +COMPARISON=17 +WS=18 '.'=1 '-'=2 '('=3 @@ -23,8 +24,9 @@ WS=17 '*'=6 '+'=7 'sum'=8 -'..'=9 -','=10 -'['=11 -']'=12 -'t'=14 +'sum_connections'=9 +'..'=10 +','=11 +'['=12 +']'=13 +'t'=15 diff --git a/src/andromede/expression/parsing/antlr/ExprLexer.interp b/src/andromede/expression/parsing/antlr/ExprLexer.interp index 43521ebb..d761b1f1 100644 --- a/src/andromede/expression/parsing/antlr/ExprLexer.interp +++ b/src/andromede/expression/parsing/antlr/ExprLexer.interp @@ -8,6 +8,7 @@ null '*' '+' 'sum' +'sum_connections' '..' ',' '[' @@ -32,6 +33,7 @@ null null null null +null NUMBER TIME IDENTIFIER @@ -51,6 +53,7 @@ T__8 T__9 T__10 T__11 +T__12 DIGIT CHAR CHAR_OR_DIGIT @@ -68,4 +71,4 @@ mode names: DEFAULT_MODE atn: -[4, 0, 17, 109, 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, 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, 7, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 3, 14, 75, 8, 14, 1, 15, 4, 15, 78, 8, 15, 11, 15, 12, 15, 79, 1, 15, 1, 15, 4, 15, 84, 8, 15, 11, 15, 12, 15, 85, 3, 15, 88, 8, 15, 1, 16, 1, 16, 1, 17, 1, 17, 5, 17, 94, 8, 17, 10, 17, 12, 17, 97, 9, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 3, 18, 104, 8, 18, 1, 19, 1, 19, 1, 19, 1, 19, 0, 0, 20, 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, 0, 27, 0, 29, 0, 31, 13, 33, 14, 35, 15, 37, 16, 39, 17, 1, 0, 3, 1, 0, 48, 57, 3, 0, 65, 90, 95, 95, 97, 122, 3, 0, 9, 10, 13, 13, 32, 32, 112, 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, 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, 1, 41, 1, 0, 0, 0, 3, 43, 1, 0, 0, 0, 5, 45, 1, 0, 0, 0, 7, 47, 1, 0, 0, 0, 9, 49, 1, 0, 0, 0, 11, 51, 1, 0, 0, 0, 13, 53, 1, 0, 0, 0, 15, 55, 1, 0, 0, 0, 17, 59, 1, 0, 0, 0, 19, 62, 1, 0, 0, 0, 21, 64, 1, 0, 0, 0, 23, 66, 1, 0, 0, 0, 25, 68, 1, 0, 0, 0, 27, 70, 1, 0, 0, 0, 29, 74, 1, 0, 0, 0, 31, 77, 1, 0, 0, 0, 33, 89, 1, 0, 0, 0, 35, 91, 1, 0, 0, 0, 37, 103, 1, 0, 0, 0, 39, 105, 1, 0, 0, 0, 41, 42, 5, 46, 0, 0, 42, 2, 1, 0, 0, 0, 43, 44, 5, 45, 0, 0, 44, 4, 1, 0, 0, 0, 45, 46, 5, 40, 0, 0, 46, 6, 1, 0, 0, 0, 47, 48, 5, 41, 0, 0, 48, 8, 1, 0, 0, 0, 49, 50, 5, 47, 0, 0, 50, 10, 1, 0, 0, 0, 51, 52, 5, 42, 0, 0, 52, 12, 1, 0, 0, 0, 53, 54, 5, 43, 0, 0, 54, 14, 1, 0, 0, 0, 55, 56, 5, 115, 0, 0, 56, 57, 5, 117, 0, 0, 57, 58, 5, 109, 0, 0, 58, 16, 1, 0, 0, 0, 59, 60, 5, 46, 0, 0, 60, 61, 5, 46, 0, 0, 61, 18, 1, 0, 0, 0, 62, 63, 5, 44, 0, 0, 63, 20, 1, 0, 0, 0, 64, 65, 5, 91, 0, 0, 65, 22, 1, 0, 0, 0, 66, 67, 5, 93, 0, 0, 67, 24, 1, 0, 0, 0, 68, 69, 7, 0, 0, 0, 69, 26, 1, 0, 0, 0, 70, 71, 7, 1, 0, 0, 71, 28, 1, 0, 0, 0, 72, 75, 3, 27, 13, 0, 73, 75, 3, 25, 12, 0, 74, 72, 1, 0, 0, 0, 74, 73, 1, 0, 0, 0, 75, 30, 1, 0, 0, 0, 76, 78, 3, 25, 12, 0, 77, 76, 1, 0, 0, 0, 78, 79, 1, 0, 0, 0, 79, 77, 1, 0, 0, 0, 79, 80, 1, 0, 0, 0, 80, 87, 1, 0, 0, 0, 81, 83, 5, 46, 0, 0, 82, 84, 3, 25, 12, 0, 83, 82, 1, 0, 0, 0, 84, 85, 1, 0, 0, 0, 85, 83, 1, 0, 0, 0, 85, 86, 1, 0, 0, 0, 86, 88, 1, 0, 0, 0, 87, 81, 1, 0, 0, 0, 87, 88, 1, 0, 0, 0, 88, 32, 1, 0, 0, 0, 89, 90, 5, 116, 0, 0, 90, 34, 1, 0, 0, 0, 91, 95, 3, 27, 13, 0, 92, 94, 3, 29, 14, 0, 93, 92, 1, 0, 0, 0, 94, 97, 1, 0, 0, 0, 95, 93, 1, 0, 0, 0, 95, 96, 1, 0, 0, 0, 96, 36, 1, 0, 0, 0, 97, 95, 1, 0, 0, 0, 98, 104, 5, 61, 0, 0, 99, 100, 5, 62, 0, 0, 100, 104, 5, 61, 0, 0, 101, 102, 5, 60, 0, 0, 102, 104, 5, 61, 0, 0, 103, 98, 1, 0, 0, 0, 103, 99, 1, 0, 0, 0, 103, 101, 1, 0, 0, 0, 104, 38, 1, 0, 0, 0, 105, 106, 7, 2, 0, 0, 106, 107, 1, 0, 0, 0, 107, 108, 6, 19, 0, 0, 108, 40, 1, 0, 0, 0, 7, 0, 74, 79, 85, 87, 95, 103, 1, 6, 0, 0] \ No newline at end of file +[4, 0, 18, 127, 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, 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, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15, 3, 15, 93, 8, 15, 1, 16, 4, 16, 96, 8, 16, 11, 16, 12, 16, 97, 1, 16, 1, 16, 4, 16, 102, 8, 16, 11, 16, 12, 16, 103, 3, 16, 106, 8, 16, 1, 17, 1, 17, 1, 18, 1, 18, 5, 18, 112, 8, 18, 10, 18, 12, 18, 115, 9, 18, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 3, 19, 122, 8, 19, 1, 20, 1, 20, 1, 20, 1, 20, 0, 0, 21, 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, 0, 29, 0, 31, 0, 33, 14, 35, 15, 37, 16, 39, 17, 41, 18, 1, 0, 3, 1, 0, 48, 57, 3, 0, 65, 90, 95, 95, 97, 122, 3, 0, 9, 10, 13, 13, 32, 32, 130, 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, 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, 1, 43, 1, 0, 0, 0, 3, 45, 1, 0, 0, 0, 5, 47, 1, 0, 0, 0, 7, 49, 1, 0, 0, 0, 9, 51, 1, 0, 0, 0, 11, 53, 1, 0, 0, 0, 13, 55, 1, 0, 0, 0, 15, 57, 1, 0, 0, 0, 17, 61, 1, 0, 0, 0, 19, 77, 1, 0, 0, 0, 21, 80, 1, 0, 0, 0, 23, 82, 1, 0, 0, 0, 25, 84, 1, 0, 0, 0, 27, 86, 1, 0, 0, 0, 29, 88, 1, 0, 0, 0, 31, 92, 1, 0, 0, 0, 33, 95, 1, 0, 0, 0, 35, 107, 1, 0, 0, 0, 37, 109, 1, 0, 0, 0, 39, 121, 1, 0, 0, 0, 41, 123, 1, 0, 0, 0, 43, 44, 5, 46, 0, 0, 44, 2, 1, 0, 0, 0, 45, 46, 5, 45, 0, 0, 46, 4, 1, 0, 0, 0, 47, 48, 5, 40, 0, 0, 48, 6, 1, 0, 0, 0, 49, 50, 5, 41, 0, 0, 50, 8, 1, 0, 0, 0, 51, 52, 5, 47, 0, 0, 52, 10, 1, 0, 0, 0, 53, 54, 5, 42, 0, 0, 54, 12, 1, 0, 0, 0, 55, 56, 5, 43, 0, 0, 56, 14, 1, 0, 0, 0, 57, 58, 5, 115, 0, 0, 58, 59, 5, 117, 0, 0, 59, 60, 5, 109, 0, 0, 60, 16, 1, 0, 0, 0, 61, 62, 5, 115, 0, 0, 62, 63, 5, 117, 0, 0, 63, 64, 5, 109, 0, 0, 64, 65, 5, 95, 0, 0, 65, 66, 5, 99, 0, 0, 66, 67, 5, 111, 0, 0, 67, 68, 5, 110, 0, 0, 68, 69, 5, 110, 0, 0, 69, 70, 5, 101, 0, 0, 70, 71, 5, 99, 0, 0, 71, 72, 5, 116, 0, 0, 72, 73, 5, 105, 0, 0, 73, 74, 5, 111, 0, 0, 74, 75, 5, 110, 0, 0, 75, 76, 5, 115, 0, 0, 76, 18, 1, 0, 0, 0, 77, 78, 5, 46, 0, 0, 78, 79, 5, 46, 0, 0, 79, 20, 1, 0, 0, 0, 80, 81, 5, 44, 0, 0, 81, 22, 1, 0, 0, 0, 82, 83, 5, 91, 0, 0, 83, 24, 1, 0, 0, 0, 84, 85, 5, 93, 0, 0, 85, 26, 1, 0, 0, 0, 86, 87, 7, 0, 0, 0, 87, 28, 1, 0, 0, 0, 88, 89, 7, 1, 0, 0, 89, 30, 1, 0, 0, 0, 90, 93, 3, 29, 14, 0, 91, 93, 3, 27, 13, 0, 92, 90, 1, 0, 0, 0, 92, 91, 1, 0, 0, 0, 93, 32, 1, 0, 0, 0, 94, 96, 3, 27, 13, 0, 95, 94, 1, 0, 0, 0, 96, 97, 1, 0, 0, 0, 97, 95, 1, 0, 0, 0, 97, 98, 1, 0, 0, 0, 98, 105, 1, 0, 0, 0, 99, 101, 5, 46, 0, 0, 100, 102, 3, 27, 13, 0, 101, 100, 1, 0, 0, 0, 102, 103, 1, 0, 0, 0, 103, 101, 1, 0, 0, 0, 103, 104, 1, 0, 0, 0, 104, 106, 1, 0, 0, 0, 105, 99, 1, 0, 0, 0, 105, 106, 1, 0, 0, 0, 106, 34, 1, 0, 0, 0, 107, 108, 5, 116, 0, 0, 108, 36, 1, 0, 0, 0, 109, 113, 3, 29, 14, 0, 110, 112, 3, 31, 15, 0, 111, 110, 1, 0, 0, 0, 112, 115, 1, 0, 0, 0, 113, 111, 1, 0, 0, 0, 113, 114, 1, 0, 0, 0, 114, 38, 1, 0, 0, 0, 115, 113, 1, 0, 0, 0, 116, 122, 5, 61, 0, 0, 117, 118, 5, 62, 0, 0, 118, 122, 5, 61, 0, 0, 119, 120, 5, 60, 0, 0, 120, 122, 5, 61, 0, 0, 121, 116, 1, 0, 0, 0, 121, 117, 1, 0, 0, 0, 121, 119, 1, 0, 0, 0, 122, 40, 1, 0, 0, 0, 123, 124, 7, 2, 0, 0, 124, 125, 1, 0, 0, 0, 125, 126, 6, 20, 0, 0, 126, 42, 1, 0, 0, 0, 7, 0, 92, 97, 103, 105, 113, 121, 1, 6, 0, 0] \ No newline at end of file diff --git a/src/andromede/expression/parsing/antlr/ExprLexer.py b/src/andromede/expression/parsing/antlr/ExprLexer.py index b78b3c77..60c2d135 100644 --- a/src/andromede/expression/parsing/antlr/ExprLexer.py +++ b/src/andromede/expression/parsing/antlr/ExprLexer.py @@ -14,8 +14,8 @@ def serializedATN(): return [ 4, 0, - 17, - 109, + 18, + 127, 6, -1, 2, @@ -98,6 +98,10 @@ def serializedATN(): 19, 7, 19, + 2, + 20, + 7, + 20, 1, 0, 1, @@ -141,6 +145,34 @@ def serializedATN(): 1, 8, 1, + 8, + 1, + 8, + 1, + 8, + 1, + 8, + 1, + 8, + 1, + 8, + 1, + 8, + 1, + 8, + 1, + 8, + 1, + 8, + 1, + 8, + 1, + 8, + 1, + 8, + 1, + 9, + 1, 9, 1, 9, @@ -164,76 +196,65 @@ def serializedATN(): 14, 1, 14, - 3, - 14, - 75, - 8, - 14, 1, 15, - 4, + 1, 15, - 78, + 3, + 15, + 93, 8, 15, + 1, + 16, + 4, + 16, + 96, + 8, + 16, 11, - 15, + 16, 12, - 15, - 79, + 16, + 97, 1, - 15, + 16, 1, - 15, + 16, 4, - 15, - 84, + 16, + 102, 8, - 15, + 16, 11, - 15, + 16, 12, - 15, - 85, + 16, + 103, 3, - 15, - 88, - 8, - 15, - 1, 16, - 1, + 106, + 8, 16, 1, 17, 1, 17, - 5, - 17, - 94, - 8, - 17, - 10, - 17, - 12, - 17, - 97, - 9, - 17, 1, 18, 1, 18, - 1, + 5, 18, - 1, + 112, + 8, 18, - 1, + 10, 18, - 3, + 12, 18, - 104, - 8, + 115, + 9, 18, 1, 19, @@ -243,9 +264,24 @@ def serializedATN(): 19, 1, 19, + 1, + 19, + 3, + 19, + 122, + 8, + 19, + 1, + 20, + 1, + 20, + 1, + 20, + 1, + 20, 0, 0, - 20, + 21, 1, 1, 3, @@ -271,13 +307,13 @@ def serializedATN(): 23, 12, 25, - 0, + 13, 27, 0, 29, 0, 31, - 13, + 0, 33, 14, 35, @@ -286,6 +322,8 @@ def serializedATN(): 16, 39, 17, + 41, + 18, 1, 0, 3, @@ -309,7 +347,7 @@ def serializedATN(): 13, 32, 32, - 112, + 130, 0, 1, 1, @@ -383,7 +421,7 @@ def serializedATN(): 0, 0, 0, - 31, + 25, 1, 0, 0, @@ -412,134 +450,134 @@ def serializedATN(): 0, 0, 0, - 1, + 0, 41, 1, 0, 0, 0, - 3, + 1, 43, 1, 0, 0, 0, - 5, + 3, 45, 1, 0, 0, 0, - 7, + 5, 47, 1, 0, 0, 0, - 9, + 7, 49, 1, 0, 0, 0, - 11, + 9, 51, 1, 0, 0, 0, - 13, + 11, 53, 1, 0, 0, 0, - 15, + 13, 55, 1, 0, 0, 0, + 15, + 57, + 1, + 0, + 0, + 0, 17, - 59, + 61, 1, 0, 0, 0, 19, - 62, + 77, 1, 0, 0, 0, 21, - 64, + 80, 1, 0, 0, 0, 23, - 66, + 82, 1, 0, 0, 0, 25, - 68, + 84, 1, 0, 0, 0, 27, - 70, + 86, 1, 0, 0, 0, 29, - 74, + 88, 1, 0, 0, 0, 31, - 77, + 92, 1, 0, 0, 0, 33, - 89, + 95, 1, 0, 0, 0, 35, - 91, + 107, 1, 0, 0, 0, 37, - 103, + 109, 1, 0, 0, 0, 39, - 105, + 121, 1, 0, 0, 0, 41, - 42, - 5, - 46, - 0, - 0, - 42, - 2, + 123, 1, 0, 0, @@ -547,11 +585,11 @@ def serializedATN(): 43, 44, 5, - 45, + 46, 0, 0, 44, - 4, + 2, 1, 0, 0, @@ -559,11 +597,11 @@ def serializedATN(): 45, 46, 5, - 40, + 45, 0, 0, 46, - 6, + 4, 1, 0, 0, @@ -571,11 +609,11 @@ def serializedATN(): 47, 48, 5, - 41, + 40, 0, 0, 48, - 8, + 6, 1, 0, 0, @@ -583,11 +621,11 @@ def serializedATN(): 49, 50, 5, - 47, + 41, 0, 0, 50, - 10, + 8, 1, 0, 0, @@ -595,11 +633,11 @@ def serializedATN(): 51, 52, 5, - 42, + 47, 0, 0, 52, - 12, + 10, 1, 0, 0, @@ -607,11 +645,11 @@ def serializedATN(): 53, 54, 5, - 43, + 42, 0, 0, 54, - 14, + 12, 1, 0, 0, @@ -619,377 +657,485 @@ def serializedATN(): 55, 56, 5, - 115, + 43, 0, 0, 56, - 57, - 5, - 117, + 14, + 1, + 0, 0, 0, 57, 58, 5, - 109, + 115, 0, 0, 58, - 16, - 1, - 0, + 59, + 5, + 117, 0, 0, 59, 60, 5, - 46, + 109, 0, 0, 60, - 61, - 5, - 46, + 16, + 1, 0, 0, - 61, - 18, - 1, 0, + 61, + 62, + 5, + 115, 0, 0, 62, 63, 5, - 44, + 117, 0, 0, 63, - 20, - 1, - 0, + 64, + 5, + 109, 0, 0, 64, 65, 5, - 91, + 95, 0, 0, 65, - 22, - 1, - 0, + 66, + 5, + 99, 0, 0, 66, 67, 5, - 93, + 111, 0, 0, 67, + 68, + 5, + 110, + 0, + 0, + 68, + 69, + 5, + 110, + 0, + 0, + 69, + 70, + 5, + 101, + 0, + 0, + 70, + 71, + 5, + 99, + 0, + 0, + 71, + 72, + 5, + 116, + 0, + 0, + 72, + 73, + 5, + 105, + 0, + 0, + 73, + 74, + 5, + 111, + 0, + 0, + 74, + 75, + 5, + 110, + 0, + 0, + 75, + 76, + 5, + 115, + 0, + 0, + 76, + 18, + 1, + 0, + 0, + 0, + 77, + 78, + 5, + 46, + 0, + 0, + 78, + 79, + 5, + 46, + 0, + 0, + 79, + 20, + 1, + 0, + 0, + 0, + 80, + 81, + 5, + 44, + 0, + 0, + 81, + 22, + 1, + 0, + 0, + 0, + 82, + 83, + 5, + 91, + 0, + 0, + 83, 24, 1, 0, 0, 0, - 68, - 69, + 84, + 85, + 5, + 93, + 0, + 0, + 85, + 26, + 1, + 0, + 0, + 0, + 86, + 87, 7, 0, 0, 0, - 69, - 26, + 87, + 28, 1, 0, 0, 0, - 70, - 71, + 88, + 89, 7, 1, 0, 0, - 71, - 28, + 89, + 30, 1, 0, 0, 0, - 72, - 75, + 90, + 93, 3, - 27, - 13, + 29, + 14, 0, - 73, - 75, + 91, + 93, 3, - 25, - 12, + 27, + 13, 0, - 74, - 72, + 92, + 90, 1, 0, 0, 0, - 74, - 73, + 92, + 91, 1, 0, 0, 0, - 75, - 30, + 93, + 32, 1, 0, 0, 0, - 76, - 78, + 94, + 96, 3, - 25, - 12, + 27, + 13, 0, - 77, - 76, + 95, + 94, 1, 0, 0, 0, - 78, - 79, + 96, + 97, 1, 0, 0, 0, - 79, - 77, + 97, + 95, 1, 0, 0, 0, - 79, - 80, + 97, + 98, 1, 0, 0, 0, - 80, - 87, + 98, + 105, 1, 0, 0, 0, - 81, - 83, + 99, + 101, 5, 46, 0, 0, - 82, - 84, + 100, + 102, 3, - 25, - 12, + 27, + 13, 0, - 83, - 82, + 101, + 100, 1, 0, 0, 0, - 84, - 85, + 102, + 103, 1, 0, 0, 0, - 85, - 83, + 103, + 101, 1, 0, 0, 0, - 85, - 86, + 103, + 104, 1, 0, 0, 0, - 86, - 88, + 104, + 106, 1, 0, 0, 0, - 87, - 81, + 105, + 99, 1, 0, 0, 0, - 87, - 88, + 105, + 106, 1, 0, 0, 0, - 88, - 32, + 106, + 34, 1, 0, 0, 0, - 89, - 90, + 107, + 108, 5, 116, 0, 0, - 90, - 34, + 108, + 36, 1, 0, 0, 0, - 91, - 95, - 3, - 27, - 13, - 0, - 92, - 94, + 109, + 113, 3, 29, 14, 0, - 93, - 92, + 110, + 112, + 3, + 31, + 15, + 0, + 111, + 110, 1, 0, 0, 0, - 94, - 97, + 112, + 115, 1, 0, 0, 0, - 95, - 93, + 113, + 111, 1, 0, 0, 0, - 95, - 96, + 113, + 114, 1, 0, 0, 0, - 96, - 36, + 114, + 38, 1, 0, 0, 0, - 97, - 95, + 115, + 113, 1, 0, 0, 0, - 98, - 104, + 116, + 122, 5, 61, 0, 0, - 99, - 100, + 117, + 118, 5, 62, 0, 0, - 100, - 104, + 118, + 122, 5, 61, 0, 0, - 101, - 102, + 119, + 120, 5, 60, 0, 0, - 102, - 104, + 120, + 122, 5, 61, 0, 0, - 103, - 98, + 121, + 116, 1, 0, 0, 0, - 103, - 99, + 121, + 117, 1, 0, 0, 0, - 103, - 101, + 121, + 119, 1, 0, 0, 0, - 104, - 38, + 122, + 40, 1, 0, 0, 0, - 105, - 106, + 123, + 124, 7, 2, 0, 0, - 106, - 107, + 124, + 125, 1, 0, 0, 0, - 107, - 108, + 125, + 126, 6, - 19, + 20, 0, 0, - 108, - 40, + 126, + 42, 1, 0, 0, 0, 7, 0, - 74, - 79, - 85, - 87, - 95, + 92, + 97, 103, + 105, + 113, + 121, 1, 6, 0, @@ -1014,11 +1160,12 @@ class ExprLexer(Lexer): T__9 = 10 T__10 = 11 T__11 = 12 - NUMBER = 13 - TIME = 14 - IDENTIFIER = 15 - COMPARISON = 16 - WS = 17 + T__12 = 13 + NUMBER = 14 + TIME = 15 + IDENTIFIER = 16 + COMPARISON = 17 + WS = 18 channelNames = ["DEFAULT_TOKEN_CHANNEL", "HIDDEN"] @@ -1034,6 +1181,7 @@ class ExprLexer(Lexer): "'*'", "'+'", "'sum'", + "'sum_connections'", "'..'", "','", "'['", @@ -1056,6 +1204,7 @@ class ExprLexer(Lexer): "T__9", "T__10", "T__11", + "T__12", "DIGIT", "CHAR", "CHAR_OR_DIGIT", diff --git a/src/andromede/expression/parsing/antlr/ExprLexer.tokens b/src/andromede/expression/parsing/antlr/ExprLexer.tokens index 86857744..c8638328 100644 --- a/src/andromede/expression/parsing/antlr/ExprLexer.tokens +++ b/src/andromede/expression/parsing/antlr/ExprLexer.tokens @@ -10,11 +10,12 @@ T__8=9 T__9=10 T__10=11 T__11=12 -NUMBER=13 -TIME=14 -IDENTIFIER=15 -COMPARISON=16 -WS=17 +T__12=13 +NUMBER=14 +TIME=15 +IDENTIFIER=16 +COMPARISON=17 +WS=18 '.'=1 '-'=2 '('=3 @@ -23,8 +24,9 @@ WS=17 '*'=6 '+'=7 'sum'=8 -'..'=9 -','=10 -'['=11 -']'=12 -'t'=14 +'sum_connections'=9 +'..'=10 +','=11 +'['=12 +']'=13 +'t'=15 diff --git a/src/andromede/expression/parsing/antlr/ExprParser.py b/src/andromede/expression/parsing/antlr/ExprParser.py index 085c5390..859d23dc 100644 --- a/src/andromede/expression/parsing/antlr/ExprParser.py +++ b/src/andromede/expression/parsing/antlr/ExprParser.py @@ -15,8 +15,8 @@ def serializedATN(): return [ 4, 1, - 17, - 117, + 18, + 140, 2, 0, 7, @@ -41,6 +41,10 @@ def serializedATN(): 5, 7, 5, + 2, + 6, + 7, + 6, 1, 0, 1, @@ -48,6 +52,7 @@ def serializedATN(): 1, 0, 1, + 0, 1, 1, 1, @@ -55,121 +60,153 @@ def serializedATN(): 1, 1, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, + 2, 3, - 1, - 56, + 2, + 79, 8, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, + 2, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, + 2, 5, - 1, - 67, + 2, + 90, 8, - 1, - 10, - 1, - 12, - 1, - 70, - 9, - 1, - 1, 2, - 1, + 10, 2, - 3, + 12, 2, - 74, - 8, + 93, + 9, 2, 1, 3, @@ -177,54 +214,22 @@ def serializedATN(): 3, 3, 3, - 78, + 97, 8, 3, 1, 4, 1, 4, - 1, - 4, - 1, - 4, - 1, - 4, - 1, - 4, - 1, - 4, - 1, - 4, 3, 4, - 88, + 101, 8, 4, 1, - 4, - 1, - 4, - 1, - 4, - 1, - 4, - 1, - 4, + 5, 1, - 4, 5, - 4, - 96, - 8, - 4, - 10, - 4, - 12, - 4, - 99, - 9, - 4, 1, 5, 1, @@ -239,7 +244,7 @@ def serializedATN(): 5, 3, 5, - 107, + 111, 8, 5, 1, @@ -248,32 +253,74 @@ def serializedATN(): 5, 1, 5, + 1, + 5, + 1, + 5, + 1, 5, 5, - 112, + 5, + 119, 8, 5, 10, 5, 12, 5, - 115, + 122, 9, 5, 1, - 5, - 0, + 6, + 1, + 6, + 1, + 6, + 1, + 6, + 1, + 6, + 1, + 6, 3, - 2, + 6, + 130, + 8, + 6, + 1, + 6, + 1, + 6, + 1, + 6, + 5, + 6, + 135, 8, + 6, 10, 6, + 12, + 6, + 138, + 9, + 6, + 1, + 6, + 0, + 3, + 4, + 10, + 12, + 7, 0, 2, 4, 6, 8, 10, + 12, 0, 2, 1, @@ -286,198 +333,192 @@ def serializedATN(): 2, 7, 7, - 128, + 153, 0, - 12, + 14, 1, 0, 0, 0, 2, - 55, + 18, 1, 0, 0, 0, 4, - 73, + 78, 1, 0, 0, 0, 6, - 75, + 96, 1, 0, 0, 0, 8, - 87, + 98, 1, 0, 0, 0, 10, - 106, + 110, 1, 0, 0, 0, 12, - 13, - 3, - 2, + 129, 1, 0, - 13, - 14, - 5, 0, 0, - 1, 14, - 1, - 1, - 0, + 15, + 5, + 16, 0, 0, 15, 16, - 6, + 5, 1, - -1, 0, - 16, - 56, - 3, - 4, - 2, 0, + 16, 17, - 18, 5, - 15, + 16, 0, 0, - 18, - 19, - 5, + 17, + 1, 1, 0, 0, + 0, + 18, 19, - 56, + 3, + 4, + 2, + 0, + 19, + 20, 5, - 15, 0, 0, + 1, 20, - 21, - 5, - 2, + 3, + 1, + 0, 0, 0, 21, - 56, - 3, + 22, + 6, 2, - 1, - 10, + -1, + 0, 22, - 23, - 5, + 79, + 3, + 6, 3, - 0, 0, 23, - 24, + 79, 3, - 2, - 1, + 0, + 0, 0, 24, 25, 5, - 4, + 2, 0, 0, 25, - 56, - 1, - 0, - 0, - 0, + 79, + 3, + 4, + 2, + 13, 26, 27, 5, - 8, - 0, - 0, - 27, - 28, - 5, 3, 0, 0, + 27, 28, - 29, 3, + 4, 2, - 1, 0, + 28, 29, - 30, 5, 4, 0, 0, - 30, - 56, + 29, + 79, 1, 0, 0, 0, + 30, 31, - 32, 5, 8, 0, 0, + 31, 32, - 33, 5, 3, 0, 0, + 32, 33, - 34, - 3, - 6, 3, + 4, + 2, 0, + 33, 34, - 35, 5, - 9, + 4, + 0, + 0, + 34, + 79, + 1, + 0, 0, 0, 35, 36, - 3, - 6, - 3, + 5, + 9, + 0, 0, 36, 37, 5, - 10, + 3, 0, 0, 37, 38, 3, - 2, - 1, + 0, + 0, 0, 38, 39, @@ -486,7 +527,7 @@ def serializedATN(): 0, 0, 39, - 56, + 79, 1, 0, 0, @@ -494,7 +535,7 @@ def serializedATN(): 40, 41, 5, - 15, + 8, 0, 0, 41, @@ -506,566 +547,722 @@ def serializedATN(): 42, 43, 3, - 2, - 1, + 8, + 4, 0, 43, 44, 5, - 4, + 10, 0, 0, 44, - 56, - 1, - 0, - 0, + 45, + 3, + 8, + 4, 0, 45, 46, 5, - 15, + 11, 0, 0, 46, 47, + 3, + 4, + 2, + 0, + 47, + 48, 5, - 11, + 4, 0, 0, - 47, 48, + 79, + 1, + 0, + 0, + 0, + 49, + 50, + 5, + 16, + 0, + 0, + 50, + 51, + 5, 3, - 6, + 0, + 0, + 51, + 52, 3, + 4, + 2, 0, - 48, - 49, + 52, + 53, + 5, + 4, + 0, + 0, + 53, + 79, + 1, + 0, + 0, + 0, + 54, + 55, + 5, + 16, + 0, + 0, + 55, + 56, 5, 12, 0, 0, - 49, 56, + 57, + 3, + 8, + 4, + 0, + 57, + 58, + 5, + 13, + 0, + 0, + 58, + 79, 1, 0, 0, 0, - 50, - 51, + 59, + 60, 5, - 15, + 16, 0, 0, - 51, - 52, + 60, + 61, 5, - 11, + 12, 0, 0, - 52, - 53, + 61, + 62, 3, + 4, 2, + 0, + 62, + 63, + 5, + 13, + 0, + 0, + 63, + 79, 1, 0, - 53, - 54, + 0, + 0, + 64, + 65, + 5, + 3, + 0, + 0, + 65, + 66, + 3, + 4, + 2, + 0, + 66, + 67, + 5, + 4, + 0, + 0, + 67, + 68, 5, 12, 0, 0, - 54, - 56, + 68, + 69, + 3, + 8, + 4, + 0, + 69, + 70, + 5, + 13, + 0, + 0, + 70, + 79, 1, 0, 0, 0, - 55, - 15, + 71, + 72, + 5, + 3, + 0, + 0, + 72, + 73, + 3, + 4, + 2, + 0, + 73, + 74, + 5, + 4, + 0, + 0, + 74, + 75, + 5, + 12, + 0, + 0, + 75, + 76, + 3, + 4, + 2, + 0, + 76, + 77, + 5, + 13, + 0, + 0, + 77, + 79, 1, 0, 0, 0, - 55, - 17, + 78, + 21, 1, 0, 0, 0, - 55, - 20, + 78, + 23, 1, 0, 0, 0, - 55, - 22, + 78, + 24, 1, 0, 0, 0, - 55, + 78, 26, 1, 0, 0, 0, - 55, - 31, + 78, + 30, 1, 0, 0, 0, - 55, + 78, + 35, + 1, + 0, + 0, + 0, + 78, 40, 1, 0, 0, 0, - 55, - 45, + 78, + 49, 1, 0, 0, 0, - 55, - 50, + 78, + 54, 1, 0, 0, 0, - 56, - 68, + 78, + 59, 1, 0, 0, 0, - 57, - 58, + 78, + 64, + 1, + 0, + 0, + 0, + 78, + 71, + 1, + 0, + 0, + 0, + 79, + 91, + 1, + 0, + 0, + 0, + 80, + 81, 10, - 8, + 11, 0, 0, - 58, - 59, + 81, + 82, 7, 0, 0, 0, - 59, - 67, + 82, + 90, 3, + 4, 2, - 1, - 9, - 60, - 61, + 12, + 83, + 84, + 10, 10, - 7, 0, 0, - 61, - 62, + 84, + 85, 7, 1, 0, 0, - 62, - 67, + 85, + 90, 3, + 4, 2, - 1, - 8, - 63, - 64, + 11, + 86, + 87, 10, - 6, + 9, 0, 0, - 64, - 65, + 87, + 88, 5, - 16, + 17, 0, 0, - 65, - 67, + 88, + 90, 3, + 4, 2, - 1, - 7, - 66, - 57, + 10, + 89, + 80, 1, 0, 0, 0, - 66, - 60, + 89, + 83, 1, 0, 0, 0, - 66, - 63, + 89, + 86, 1, 0, 0, 0, - 67, - 70, + 90, + 93, 1, 0, 0, 0, - 68, - 66, + 91, + 89, 1, 0, 0, - 0, - 68, - 69, + 0, + 91, + 92, 1, 0, 0, 0, - 69, - 3, + 92, + 5, 1, 0, 0, 0, - 70, - 68, + 93, + 91, 1, 0, 0, 0, - 71, - 74, + 94, + 97, 5, - 13, + 14, 0, 0, - 72, - 74, + 95, + 97, 5, - 15, + 16, 0, 0, - 73, - 71, + 96, + 94, 1, 0, 0, 0, - 73, - 72, + 96, + 95, 1, 0, 0, 0, - 74, - 5, + 97, + 7, 1, 0, 0, 0, - 75, - 77, + 98, + 100, 5, - 14, + 15, 0, 0, - 76, - 78, + 99, + 101, 3, - 8, - 4, + 10, + 5, 0, - 77, - 76, + 100, + 99, 1, 0, 0, 0, - 77, - 78, + 100, + 101, 1, 0, 0, 0, - 78, - 7, + 101, + 9, 1, 0, 0, 0, - 79, - 80, + 102, + 103, 6, - 4, + 5, -1, 0, - 80, - 81, + 103, + 104, 7, 1, 0, 0, - 81, - 88, + 104, + 111, + 3, + 6, 3, - 4, - 2, 0, - 82, - 83, + 105, + 106, 7, 1, 0, 0, - 83, - 84, + 106, + 107, 5, 3, 0, 0, - 84, - 85, + 107, + 108, 3, + 4, 2, - 1, 0, - 85, - 86, + 108, + 109, 5, 4, 0, 0, - 86, - 88, + 109, + 111, 1, 0, 0, 0, - 87, - 79, + 110, + 102, 1, 0, 0, 0, - 87, - 82, + 110, + 105, 1, 0, 0, 0, - 88, - 97, + 111, + 120, 1, 0, 0, 0, - 89, - 90, + 112, + 113, 10, 4, 0, 0, - 90, - 91, + 113, + 114, 7, 0, 0, 0, - 91, - 96, + 114, + 119, 3, - 10, - 5, + 12, + 6, 0, - 92, - 93, + 115, + 116, 10, 3, 0, 0, - 93, - 94, + 116, + 117, 7, 1, 0, 0, - 94, - 96, + 117, + 119, 3, - 10, - 5, + 12, + 6, 0, - 95, - 89, + 118, + 112, 1, 0, 0, 0, - 95, - 92, + 118, + 115, 1, 0, 0, 0, - 96, - 99, + 119, + 122, 1, 0, 0, 0, - 97, - 95, + 120, + 118, 1, 0, 0, 0, - 97, - 98, + 120, + 121, 1, 0, 0, 0, - 98, - 9, + 121, + 11, 1, 0, 0, 0, - 99, - 97, + 122, + 120, 1, 0, 0, 0, - 100, - 101, + 123, + 124, + 6, 6, - 5, -1, 0, - 101, - 102, + 124, + 125, 5, 3, 0, 0, - 102, - 103, + 125, + 126, 3, + 4, 2, - 1, 0, - 103, - 104, + 126, + 127, 5, 4, 0, 0, - 104, - 107, + 127, + 130, 1, 0, 0, 0, - 105, - 107, + 128, + 130, + 3, + 6, 3, - 4, - 2, 0, - 106, - 100, + 129, + 123, 1, 0, 0, 0, - 106, - 105, + 129, + 128, 1, 0, 0, 0, - 107, - 113, + 130, + 136, 1, 0, 0, 0, - 108, - 109, + 131, + 132, 10, 3, 0, 0, - 109, - 110, + 132, + 133, 7, 0, 0, 0, - 110, - 112, + 133, + 135, 3, - 10, - 5, + 12, + 6, 4, - 111, - 108, + 134, + 131, 1, 0, 0, 0, - 112, - 115, + 135, + 138, 1, 0, 0, 0, - 113, - 111, + 136, + 134, 1, 0, 0, 0, - 113, - 114, + 136, + 137, 1, 0, 0, 0, - 114, - 11, + 137, + 13, 1, 0, 0, 0, - 115, - 113, + 138, + 136, 1, 0, 0, 0, 10, - 55, - 66, - 68, - 73, - 77, - 87, - 95, - 97, - 106, - 113, + 78, + 89, + 91, + 96, + 100, + 110, + 118, + 120, + 129, + 136, ] @@ -1088,6 +1285,7 @@ class ExprParser(Parser): "'*'", "'+'", "'sum'", + "'sum_connections'", "'..'", "','", "'['", @@ -1110,6 +1308,7 @@ class ExprParser(Parser): "", "", "", + "", "NUMBER", "TIME", "IDENTIFIER", @@ -1117,14 +1316,23 @@ class ExprParser(Parser): "WS", ] - RULE_fullexpr = 0 - RULE_expr = 1 - RULE_atom = 2 - RULE_shift = 3 - RULE_shift_expr = 4 - RULE_right_expr = 5 - - ruleNames = ["fullexpr", "expr", "atom", "shift", "shift_expr", "right_expr"] + RULE_portFieldExpr = 0 + RULE_fullexpr = 1 + RULE_expr = 2 + RULE_atom = 3 + RULE_shift = 4 + RULE_shift_expr = 5 + RULE_right_expr = 6 + + ruleNames = [ + "portFieldExpr", + "fullexpr", + "expr", + "atom", + "shift", + "shift_expr", + "right_expr", + ] EOF = Token.EOF T__0 = 1 @@ -1139,11 +1347,12 @@ class ExprParser(Parser): T__9 = 10 T__10 = 11 T__11 = 12 - NUMBER = 13 - TIME = 14 - IDENTIFIER = 15 - COMPARISON = 16 - WS = 17 + T__12 = 13 + NUMBER = 14 + TIME = 15 + IDENTIFIER = 16 + COMPARISON = 17 + WS = 18 def __init__(self, input: TokenStream, output: TextIO = sys.stdout): super().__init__(input, output) @@ -1153,6 +1362,49 @@ def __init__(self, input: TokenStream, output: TextIO = sys.stdout): ) self._predicates = None + class PortFieldExprContext(ParserRuleContext): + __slots__ = "parser" + + def __init__( + self, parser, parent: ParserRuleContext = None, invokingState: int = -1 + ): + super().__init__(parent, invokingState) + self.parser = parser + + def IDENTIFIER(self, i: int = None): + if i is None: + return self.getTokens(ExprParser.IDENTIFIER) + else: + return self.getToken(ExprParser.IDENTIFIER, i) + + def getRuleIndex(self): + return ExprParser.RULE_portFieldExpr + + def accept(self, visitor: ParseTreeVisitor): + if hasattr(visitor, "visitPortFieldExpr"): + return visitor.visitPortFieldExpr(self) + else: + return visitor.visitChildren(self) + + def portFieldExpr(self): + localctx = ExprParser.PortFieldExprContext(self, self._ctx, self.state) + self.enterRule(localctx, 0, self.RULE_portFieldExpr) + try: + self.enterOuterAlt(localctx, 1) + self.state = 14 + self.match(ExprParser.IDENTIFIER) + self.state = 15 + self.match(ExprParser.T__0) + self.state = 16 + self.match(ExprParser.IDENTIFIER) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + class FullexprContext(ParserRuleContext): __slots__ = "parser" @@ -1179,12 +1431,12 @@ def accept(self, visitor: ParseTreeVisitor): def fullexpr(self): localctx = ExprParser.FullexprContext(self, self._ctx, self.state) - self.enterRule(localctx, 0, self.RULE_fullexpr) + self.enterRule(localctx, 2, self.RULE_fullexpr) try: self.enterOuterAlt(localctx, 1) - self.state = 12 + self.state = 18 self.expr(0) - self.state = 13 + self.state = 19 self.match(ExprParser.EOF) except RecognitionException as re: localctx.exception = re @@ -1209,27 +1461,19 @@ def getRuleIndex(self): def copyFrom(self, ctx: ParserRuleContext): super().copyFrom(ctx) - class TimeSumContext(ExprContext): + class PortFieldSumContext(ExprContext): def __init__( self, parser, ctx: ParserRuleContext ): # actually a ExprParser.ExprContext super().__init__(parser) - self.from_ = None # ShiftContext - self.to = None # ShiftContext self.copyFrom(ctx) - def expr(self): - return self.getTypedRuleContext(ExprParser.ExprContext, 0) - - def shift(self, i: int = None): - if i is None: - return self.getTypedRuleContexts(ExprParser.ShiftContext) - else: - return self.getTypedRuleContext(ExprParser.ShiftContext, i) + def portFieldExpr(self): + return self.getTypedRuleContext(ExprParser.PortFieldExprContext, 0) def accept(self, visitor: ParseTreeVisitor): - if hasattr(visitor, "visitTimeSum"): - return visitor.visitTimeSum(self) + if hasattr(visitor, "visitPortFieldSum"): + return visitor.visitPortFieldSum(self) else: return visitor.visitChildren(self) @@ -1281,26 +1525,45 @@ def accept(self, visitor: ParseTreeVisitor): else: return visitor.visitChildren(self) - class TimeIndexContext(ExprContext): + class ComparisonContext(ExprContext): def __init__( self, parser, ctx: ParserRuleContext ): # actually a ExprParser.ExprContext super().__init__(parser) self.copyFrom(ctx) - def IDENTIFIER(self): - return self.getToken(ExprParser.IDENTIFIER, 0) + def expr(self, i: int = None): + if i is None: + return self.getTypedRuleContexts(ExprParser.ExprContext) + else: + return self.getTypedRuleContext(ExprParser.ExprContext, i) + + def COMPARISON(self): + return self.getToken(ExprParser.COMPARISON, 0) + + def accept(self, visitor: ParseTreeVisitor): + if hasattr(visitor, "visitComparison"): + return visitor.visitComparison(self) + else: + return visitor.visitChildren(self) + + class AllTimeSumContext(ExprContext): + def __init__( + self, parser, ctx: ParserRuleContext + ): # actually a ExprParser.ExprContext + super().__init__(parser) + self.copyFrom(ctx) def expr(self): return self.getTypedRuleContext(ExprParser.ExprContext, 0) def accept(self, visitor: ParseTreeVisitor): - if hasattr(visitor, "visitTimeIndex"): - return visitor.visitTimeIndex(self) + if hasattr(visitor, "visitAllTimeSum"): + return visitor.visitAllTimeSum(self) else: return visitor.visitChildren(self) - class ComparisonContext(ExprContext): + class TimeIndexExprContext(ExprContext): def __init__( self, parser, ctx: ParserRuleContext ): # actually a ExprParser.ExprContext @@ -1313,70 +1576,68 @@ def expr(self, i: int = None): else: return self.getTypedRuleContext(ExprParser.ExprContext, i) - def COMPARISON(self): - return self.getToken(ExprParser.COMPARISON, 0) - def accept(self, visitor: ParseTreeVisitor): - if hasattr(visitor, "visitComparison"): - return visitor.visitComparison(self) + if hasattr(visitor, "visitTimeIndexExpr"): + return visitor.visitTimeIndexExpr(self) else: return visitor.visitChildren(self) - class AllTimeSumContext(ExprContext): + class AddsubContext(ExprContext): def __init__( self, parser, ctx: ParserRuleContext ): # actually a ExprParser.ExprContext super().__init__(parser) + self.op = None # Token self.copyFrom(ctx) - def expr(self): - return self.getTypedRuleContext(ExprParser.ExprContext, 0) + def expr(self, i: int = None): + if i is None: + return self.getTypedRuleContexts(ExprParser.ExprContext) + else: + return self.getTypedRuleContext(ExprParser.ExprContext, i) def accept(self, visitor: ParseTreeVisitor): - if hasattr(visitor, "visitAllTimeSum"): - return visitor.visitAllTimeSum(self) + if hasattr(visitor, "visitAddsub"): + return visitor.visitAddsub(self) else: return visitor.visitChildren(self) - class TimeShiftContext(ExprContext): + class TimeShiftExprContext(ExprContext): def __init__( self, parser, ctx: ParserRuleContext ): # actually a ExprParser.ExprContext super().__init__(parser) self.copyFrom(ctx) - def IDENTIFIER(self): - return self.getToken(ExprParser.IDENTIFIER, 0) + def expr(self): + return self.getTypedRuleContext(ExprParser.ExprContext, 0) def shift(self): return self.getTypedRuleContext(ExprParser.ShiftContext, 0) def accept(self, visitor: ParseTreeVisitor): - if hasattr(visitor, "visitTimeShift"): - return visitor.visitTimeShift(self) + if hasattr(visitor, "visitTimeShiftExpr"): + return visitor.visitTimeShiftExpr(self) else: return visitor.visitChildren(self) - class FunctionContext(ExprContext): + class PortFieldContext(ExprContext): def __init__( self, parser, ctx: ParserRuleContext ): # actually a ExprParser.ExprContext super().__init__(parser) self.copyFrom(ctx) - def IDENTIFIER(self): - return self.getToken(ExprParser.IDENTIFIER, 0) - - def expr(self): - return self.getTypedRuleContext(ExprParser.ExprContext, 0) + def portFieldExpr(self): + return self.getTypedRuleContext(ExprParser.PortFieldExprContext, 0) def accept(self, visitor: ParseTreeVisitor): - if hasattr(visitor, "visitFunction"): - return visitor.visitFunction(self) + if hasattr(visitor, "visitPortField"): + return visitor.visitPortField(self) else: return visitor.visitChildren(self) - class AddsubContext(ExprContext): + class MuldivContext(ExprContext): def __init__( self, parser, ctx: ParserRuleContext ): # actually a ExprParser.ExprContext @@ -1391,47 +1652,89 @@ def expr(self, i: int = None): return self.getTypedRuleContext(ExprParser.ExprContext, i) def accept(self, visitor: ParseTreeVisitor): - if hasattr(visitor, "visitAddsub"): - return visitor.visitAddsub(self) + if hasattr(visitor, "visitMuldiv"): + return visitor.visitMuldiv(self) else: return visitor.visitChildren(self) - class PortFieldContext(ExprContext): + class TimeSumContext(ExprContext): def __init__( self, parser, ctx: ParserRuleContext ): # actually a ExprParser.ExprContext super().__init__(parser) + self.from_ = None # ShiftContext + self.to = None # ShiftContext self.copyFrom(ctx) - def IDENTIFIER(self, i: int = None): + def expr(self): + return self.getTypedRuleContext(ExprParser.ExprContext, 0) + + def shift(self, i: int = None): if i is None: - return self.getTokens(ExprParser.IDENTIFIER) + return self.getTypedRuleContexts(ExprParser.ShiftContext) else: - return self.getToken(ExprParser.IDENTIFIER, i) + return self.getTypedRuleContext(ExprParser.ShiftContext, i) def accept(self, visitor: ParseTreeVisitor): - if hasattr(visitor, "visitPortField"): - return visitor.visitPortField(self) + if hasattr(visitor, "visitTimeSum"): + return visitor.visitTimeSum(self) else: return visitor.visitChildren(self) - class MuldivContext(ExprContext): + class TimeIndexContext(ExprContext): def __init__( self, parser, ctx: ParserRuleContext ): # actually a ExprParser.ExprContext super().__init__(parser) - self.op = None # Token self.copyFrom(ctx) - def expr(self, i: int = None): - if i is None: - return self.getTypedRuleContexts(ExprParser.ExprContext) + def IDENTIFIER(self): + return self.getToken(ExprParser.IDENTIFIER, 0) + + def expr(self): + return self.getTypedRuleContext(ExprParser.ExprContext, 0) + + def accept(self, visitor: ParseTreeVisitor): + if hasattr(visitor, "visitTimeIndex"): + return visitor.visitTimeIndex(self) else: - return self.getTypedRuleContext(ExprParser.ExprContext, i) + return visitor.visitChildren(self) + + class TimeShiftContext(ExprContext): + def __init__( + self, parser, ctx: ParserRuleContext + ): # actually a ExprParser.ExprContext + super().__init__(parser) + self.copyFrom(ctx) + + def IDENTIFIER(self): + return self.getToken(ExprParser.IDENTIFIER, 0) + + def shift(self): + return self.getTypedRuleContext(ExprParser.ShiftContext, 0) def accept(self, visitor: ParseTreeVisitor): - if hasattr(visitor, "visitMuldiv"): - return visitor.visitMuldiv(self) + if hasattr(visitor, "visitTimeShift"): + return visitor.visitTimeShift(self) + else: + return visitor.visitChildren(self) + + class FunctionContext(ExprContext): + def __init__( + self, parser, ctx: ParserRuleContext + ): # actually a ExprParser.ExprContext + super().__init__(parser) + self.copyFrom(ctx) + + def IDENTIFIER(self): + return self.getToken(ExprParser.IDENTIFIER, 0) + + def expr(self): + return self.getTypedRuleContext(ExprParser.ExprContext, 0) + + def accept(self, visitor: ParseTreeVisitor): + if hasattr(visitor, "visitFunction"): + return visitor.visitFunction(self) else: return visitor.visitChildren(self) @@ -1440,12 +1743,12 @@ def expr(self, _p: int = 0): _parentState = self.state localctx = ExprParser.ExprContext(self, self._ctx, _parentState) _prevctx = localctx - _startState = 2 - self.enterRecursionRule(localctx, 2, self.RULE_expr, _p) + _startState = 4 + self.enterRecursionRule(localctx, 4, self.RULE_expr, _p) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 55 + self.state = 78 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input, 0, self._ctx) if la_ == 1: @@ -1453,7 +1756,7 @@ def expr(self, _p: int = 0): self._ctx = localctx _prevctx = localctx - self.state = 16 + self.state = 22 self.atom() pass @@ -1461,33 +1764,29 @@ def expr(self, _p: int = 0): localctx = ExprParser.PortFieldContext(self, localctx) self._ctx = localctx _prevctx = localctx - self.state = 17 - self.match(ExprParser.IDENTIFIER) - self.state = 18 - self.match(ExprParser.T__0) - self.state = 19 - self.match(ExprParser.IDENTIFIER) + self.state = 23 + self.portFieldExpr() pass elif la_ == 3: localctx = ExprParser.NegationContext(self, localctx) self._ctx = localctx _prevctx = localctx - self.state = 20 + self.state = 24 self.match(ExprParser.T__1) - self.state = 21 - self.expr(10) + self.state = 25 + self.expr(13) pass elif la_ == 4: localctx = ExprParser.ExpressionContext(self, localctx) self._ctx = localctx _prevctx = localctx - self.state = 22 + self.state = 26 self.match(ExprParser.T__2) - self.state = 23 + self.state = 27 self.expr(0) - self.state = 24 + self.state = 28 self.match(ExprParser.T__3) pass @@ -1495,82 +1794,132 @@ def expr(self, _p: int = 0): localctx = ExprParser.AllTimeSumContext(self, localctx) self._ctx = localctx _prevctx = localctx - self.state = 26 + self.state = 30 self.match(ExprParser.T__7) - self.state = 27 + self.state = 31 self.match(ExprParser.T__2) - self.state = 28 + self.state = 32 self.expr(0) - self.state = 29 + self.state = 33 self.match(ExprParser.T__3) pass elif la_ == 6: - localctx = ExprParser.TimeSumContext(self, localctx) + localctx = ExprParser.PortFieldSumContext(self, localctx) self._ctx = localctx _prevctx = localctx - self.state = 31 - self.match(ExprParser.T__7) - self.state = 32 - self.match(ExprParser.T__2) - self.state = 33 - localctx.from_ = self.shift() - self.state = 34 - self.match(ExprParser.T__8) self.state = 35 - localctx.to = self.shift() + self.match(ExprParser.T__8) self.state = 36 - self.match(ExprParser.T__9) + self.match(ExprParser.T__2) self.state = 37 - self.expr(0) + self.portFieldExpr() self.state = 38 self.match(ExprParser.T__3) pass elif la_ == 7: - localctx = ExprParser.FunctionContext(self, localctx) + localctx = ExprParser.TimeSumContext(self, localctx) self._ctx = localctx _prevctx = localctx self.state = 40 - self.match(ExprParser.IDENTIFIER) + self.match(ExprParser.T__7) self.state = 41 self.match(ExprParser.T__2) self.state = 42 - self.expr(0) + localctx.from_ = self.shift() self.state = 43 + self.match(ExprParser.T__9) + self.state = 44 + localctx.to = self.shift() + self.state = 45 + self.match(ExprParser.T__10) + self.state = 46 + self.expr(0) + self.state = 47 self.match(ExprParser.T__3) pass elif la_ == 8: + localctx = ExprParser.FunctionContext(self, localctx) + self._ctx = localctx + _prevctx = localctx + self.state = 49 + self.match(ExprParser.IDENTIFIER) + self.state = 50 + self.match(ExprParser.T__2) + self.state = 51 + self.expr(0) + self.state = 52 + self.match(ExprParser.T__3) + pass + + elif la_ == 9: localctx = ExprParser.TimeShiftContext(self, localctx) self._ctx = localctx _prevctx = localctx - self.state = 45 + self.state = 54 self.match(ExprParser.IDENTIFIER) - self.state = 46 - self.match(ExprParser.T__10) - self.state = 47 - self.shift() - self.state = 48 + self.state = 55 self.match(ExprParser.T__11) + self.state = 56 + self.shift() + self.state = 57 + self.match(ExprParser.T__12) pass - elif la_ == 9: + elif la_ == 10: localctx = ExprParser.TimeIndexContext(self, localctx) self._ctx = localctx _prevctx = localctx - self.state = 50 + self.state = 59 self.match(ExprParser.IDENTIFIER) - self.state = 51 - self.match(ExprParser.T__10) - self.state = 52 + self.state = 60 + self.match(ExprParser.T__11) + self.state = 61 + self.expr(0) + self.state = 62 + self.match(ExprParser.T__12) + pass + + elif la_ == 11: + localctx = ExprParser.TimeShiftExprContext(self, localctx) + self._ctx = localctx + _prevctx = localctx + self.state = 64 + self.match(ExprParser.T__2) + self.state = 65 + self.expr(0) + self.state = 66 + self.match(ExprParser.T__3) + self.state = 67 + self.match(ExprParser.T__11) + self.state = 68 + self.shift() + self.state = 69 + self.match(ExprParser.T__12) + pass + + elif la_ == 12: + localctx = ExprParser.TimeIndexExprContext(self, localctx) + self._ctx = localctx + _prevctx = localctx + self.state = 71 + self.match(ExprParser.T__2) + self.state = 72 self.expr(0) - self.state = 53 + self.state = 73 + self.match(ExprParser.T__3) + self.state = 74 self.match(ExprParser.T__11) + self.state = 75 + self.expr(0) + self.state = 76 + self.match(ExprParser.T__12) pass self._ctx.stop = self._input.LT(-1) - self.state = 68 + self.state = 91 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 2, self._ctx) while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER: @@ -1578,7 +1927,7 @@ def expr(self, _p: int = 0): if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx - self.state = 66 + self.state = 89 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input, 1, self._ctx) if la_ == 1: @@ -1588,14 +1937,14 @@ def expr(self, _p: int = 0): self.pushNewRecursionContext( localctx, _startState, self.RULE_expr ) - self.state = 57 - if not self.precpred(self._ctx, 8): + self.state = 80 + if not self.precpred(self._ctx, 11): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( - self, "self.precpred(self._ctx, 8)" + self, "self.precpred(self._ctx, 11)" ) - self.state = 58 + self.state = 81 localctx.op = self._input.LT(1) _la = self._input.LA(1) if not (_la == 5 or _la == 6): @@ -1603,8 +1952,8 @@ def expr(self, _p: int = 0): else: self._errHandler.reportMatch(self) self.consume() - self.state = 59 - self.expr(9) + self.state = 82 + self.expr(12) pass elif la_ == 2: @@ -1614,14 +1963,14 @@ def expr(self, _p: int = 0): self.pushNewRecursionContext( localctx, _startState, self.RULE_expr ) - self.state = 60 - if not self.precpred(self._ctx, 7): + self.state = 83 + if not self.precpred(self._ctx, 10): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( - self, "self.precpred(self._ctx, 7)" + self, "self.precpred(self._ctx, 10)" ) - self.state = 61 + self.state = 84 localctx.op = self._input.LT(1) _la = self._input.LA(1) if not (_la == 2 or _la == 7): @@ -1629,8 +1978,8 @@ def expr(self, _p: int = 0): else: self._errHandler.reportMatch(self) self.consume() - self.state = 62 - self.expr(8) + self.state = 85 + self.expr(11) pass elif la_ == 3: @@ -1640,20 +1989,20 @@ def expr(self, _p: int = 0): self.pushNewRecursionContext( localctx, _startState, self.RULE_expr ) - self.state = 63 - if not self.precpred(self._ctx, 6): + self.state = 86 + if not self.precpred(self._ctx, 9): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( - self, "self.precpred(self._ctx, 6)" + self, "self.precpred(self._ctx, 9)" ) - self.state = 64 + self.state = 87 self.match(ExprParser.COMPARISON) - self.state = 65 - self.expr(7) + self.state = 88 + self.expr(10) pass - self.state = 70 + self.state = 93 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 2, self._ctx) @@ -1714,21 +2063,21 @@ def accept(self, visitor: ParseTreeVisitor): def atom(self): localctx = ExprParser.AtomContext(self, self._ctx, self.state) - self.enterRule(localctx, 4, self.RULE_atom) + self.enterRule(localctx, 6, self.RULE_atom) try: - self.state = 73 + self.state = 96 self._errHandler.sync(self) token = self._input.LA(1) - if token in [13]: + if token in [14]: localctx = ExprParser.NumberContext(self, localctx) self.enterOuterAlt(localctx, 1) - self.state = 71 + self.state = 94 self.match(ExprParser.NUMBER) pass - elif token in [15]: + elif token in [16]: localctx = ExprParser.IdentifierContext(self, localctx) self.enterOuterAlt(localctx, 2) - self.state = 72 + self.state = 95 self.match(ExprParser.IDENTIFIER) pass else: @@ -1768,17 +2117,17 @@ def accept(self, visitor: ParseTreeVisitor): def shift(self): localctx = ExprParser.ShiftContext(self, self._ctx, self.state) - self.enterRule(localctx, 6, self.RULE_shift) + self.enterRule(localctx, 8, self.RULE_shift) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 75 + self.state = 98 self.match(ExprParser.TIME) - self.state = 77 + self.state = 100 self._errHandler.sync(self) _la = self._input.LA(1) if _la == 2 or _la == 7: - self.state = 76 + self.state = 99 self.shift_expr(0) except RecognitionException as re: @@ -1883,12 +2232,12 @@ def shift_expr(self, _p: int = 0): _parentState = self.state localctx = ExprParser.Shift_exprContext(self, self._ctx, _parentState) _prevctx = localctx - _startState = 8 - self.enterRecursionRule(localctx, 8, self.RULE_shift_expr, _p) + _startState = 10 + self.enterRecursionRule(localctx, 10, self.RULE_shift_expr, _p) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 87 + self.state = 110 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input, 5, self._ctx) if la_ == 1: @@ -1896,7 +2245,7 @@ def shift_expr(self, _p: int = 0): self._ctx = localctx _prevctx = localctx - self.state = 80 + self.state = 103 localctx.op = self._input.LT(1) _la = self._input.LA(1) if not (_la == 2 or _la == 7): @@ -1904,7 +2253,7 @@ def shift_expr(self, _p: int = 0): else: self._errHandler.reportMatch(self) self.consume() - self.state = 81 + self.state = 104 self.atom() pass @@ -1912,7 +2261,7 @@ def shift_expr(self, _p: int = 0): localctx = ExprParser.SignedExpressionContext(self, localctx) self._ctx = localctx _prevctx = localctx - self.state = 82 + self.state = 105 localctx.op = self._input.LT(1) _la = self._input.LA(1) if not (_la == 2 or _la == 7): @@ -1920,16 +2269,16 @@ def shift_expr(self, _p: int = 0): else: self._errHandler.reportMatch(self) self.consume() - self.state = 83 + self.state = 106 self.match(ExprParser.T__2) - self.state = 84 + self.state = 107 self.expr(0) - self.state = 85 + self.state = 108 self.match(ExprParser.T__3) pass self._ctx.stop = self._input.LT(-1) - self.state = 97 + self.state = 120 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 7, self._ctx) while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER: @@ -1937,7 +2286,7 @@ def shift_expr(self, _p: int = 0): if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx - self.state = 95 + self.state = 118 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input, 6, self._ctx) if la_ == 1: @@ -1950,14 +2299,14 @@ def shift_expr(self, _p: int = 0): self.pushNewRecursionContext( localctx, _startState, self.RULE_shift_expr ) - self.state = 89 + self.state = 112 if not self.precpred(self._ctx, 4): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 4)" ) - self.state = 90 + self.state = 113 localctx.op = self._input.LT(1) _la = self._input.LA(1) if not (_la == 5 or _la == 6): @@ -1965,7 +2314,7 @@ def shift_expr(self, _p: int = 0): else: self._errHandler.reportMatch(self) self.consume() - self.state = 91 + self.state = 114 self.right_expr(0) pass @@ -1979,14 +2328,14 @@ def shift_expr(self, _p: int = 0): self.pushNewRecursionContext( localctx, _startState, self.RULE_shift_expr ) - self.state = 92 + self.state = 115 if not self.precpred(self._ctx, 3): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 3)" ) - self.state = 93 + self.state = 116 localctx.op = self._input.LT(1) _la = self._input.LA(1) if not (_la == 2 or _la == 7): @@ -1994,11 +2343,11 @@ def shift_expr(self, _p: int = 0): else: self._errHandler.reportMatch(self) self.consume() - self.state = 94 + self.state = 117 self.right_expr(0) pass - self.state = 99 + self.state = 122 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 7, self._ctx) @@ -2082,12 +2431,12 @@ def right_expr(self, _p: int = 0): _parentState = self.state localctx = ExprParser.Right_exprContext(self, self._ctx, _parentState) _prevctx = localctx - _startState = 10 - self.enterRecursionRule(localctx, 10, self.RULE_right_expr, _p) + _startState = 12 + self.enterRecursionRule(localctx, 12, self.RULE_right_expr, _p) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 106 + self.state = 129 self._errHandler.sync(self) token = self._input.LA(1) if token in [3]: @@ -2095,25 +2444,25 @@ def right_expr(self, _p: int = 0): self._ctx = localctx _prevctx = localctx - self.state = 101 + self.state = 124 self.match(ExprParser.T__2) - self.state = 102 + self.state = 125 self.expr(0) - self.state = 103 + self.state = 126 self.match(ExprParser.T__3) pass - elif token in [13, 15]: + elif token in [14, 16]: localctx = ExprParser.RightAtomContext(self, localctx) self._ctx = localctx _prevctx = localctx - self.state = 105 + self.state = 128 self.atom() pass else: raise NoViableAltException(self) self._ctx.stop = self._input.LT(-1) - self.state = 113 + self.state = 136 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 9, self._ctx) while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER: @@ -2128,14 +2477,14 @@ def right_expr(self, _p: int = 0): self.pushNewRecursionContext( localctx, _startState, self.RULE_right_expr ) - self.state = 108 + self.state = 131 if not self.precpred(self._ctx, 3): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 3)" ) - self.state = 109 + self.state = 132 localctx.op = self._input.LT(1) _la = self._input.LA(1) if not (_la == 5 or _la == 6): @@ -2143,9 +2492,9 @@ def right_expr(self, _p: int = 0): else: self._errHandler.reportMatch(self) self.consume() - self.state = 110 + self.state = 133 self.right_expr(4) - self.state = 115 + self.state = 138 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 9, self._ctx) @@ -2160,9 +2509,9 @@ def right_expr(self, _p: int = 0): def sempred(self, localctx: RuleContext, ruleIndex: int, predIndex: int): if self._predicates == None: self._predicates = dict() - self._predicates[1] = self.expr_sempred - self._predicates[4] = self.shift_expr_sempred - self._predicates[5] = self.right_expr_sempred + self._predicates[2] = self.expr_sempred + self._predicates[5] = self.shift_expr_sempred + self._predicates[6] = self.right_expr_sempred pred = self._predicates.get(ruleIndex, None) if pred is None: raise Exception("No predicate with index:" + str(ruleIndex)) @@ -2171,13 +2520,13 @@ def sempred(self, localctx: RuleContext, ruleIndex: int, predIndex: int): def expr_sempred(self, localctx: ExprContext, predIndex: int): if predIndex == 0: - return self.precpred(self._ctx, 8) + return self.precpred(self._ctx, 11) if predIndex == 1: - return self.precpred(self._ctx, 7) + return self.precpred(self._ctx, 10) if predIndex == 2: - return self.precpred(self._ctx, 6) + return self.precpred(self._ctx, 9) def shift_expr_sempred(self, localctx: Shift_exprContext, predIndex: int): if predIndex == 3: diff --git a/src/andromede/expression/parsing/antlr/ExprVisitor.py b/src/andromede/expression/parsing/antlr/ExprVisitor.py index db080cbf..a98fbbaf 100644 --- a/src/andromede/expression/parsing/antlr/ExprVisitor.py +++ b/src/andromede/expression/parsing/antlr/ExprVisitor.py @@ -10,12 +10,16 @@ class ExprVisitor(ParseTreeVisitor): + # Visit a parse tree produced by ExprParser#portFieldExpr. + def visitPortFieldExpr(self, ctx: ExprParser.PortFieldExprContext): + return self.visitChildren(ctx) + # Visit a parse tree produced by ExprParser#fullexpr. def visitFullexpr(self, ctx: ExprParser.FullexprContext): return self.visitChildren(ctx) - # Visit a parse tree produced by ExprParser#timeSum. - def visitTimeSum(self, ctx: ExprParser.TimeSumContext): + # Visit a parse tree produced by ExprParser#portFieldSum. + def visitPortFieldSum(self, ctx: ExprParser.PortFieldSumContext): return self.visitChildren(ctx) # Visit a parse tree produced by ExprParser#negation. @@ -30,10 +34,6 @@ def visitUnsignedAtom(self, ctx: ExprParser.UnsignedAtomContext): def visitExpression(self, ctx: ExprParser.ExpressionContext): return self.visitChildren(ctx) - # Visit a parse tree produced by ExprParser#timeIndex. - def visitTimeIndex(self, ctx: ExprParser.TimeIndexContext): - return self.visitChildren(ctx) - # Visit a parse tree produced by ExprParser#comparison. def visitComparison(self, ctx: ExprParser.ComparisonContext): return self.visitChildren(ctx) @@ -42,18 +42,18 @@ def visitComparison(self, ctx: ExprParser.ComparisonContext): def visitAllTimeSum(self, ctx: ExprParser.AllTimeSumContext): return self.visitChildren(ctx) - # Visit a parse tree produced by ExprParser#timeShift. - def visitTimeShift(self, ctx: ExprParser.TimeShiftContext): - return self.visitChildren(ctx) - - # Visit a parse tree produced by ExprParser#function. - def visitFunction(self, ctx: ExprParser.FunctionContext): + # Visit a parse tree produced by ExprParser#timeIndexExpr. + def visitTimeIndexExpr(self, ctx: ExprParser.TimeIndexExprContext): return self.visitChildren(ctx) # Visit a parse tree produced by ExprParser#addsub. def visitAddsub(self, ctx: ExprParser.AddsubContext): return self.visitChildren(ctx) + # Visit a parse tree produced by ExprParser#timeShiftExpr. + def visitTimeShiftExpr(self, ctx: ExprParser.TimeShiftExprContext): + return self.visitChildren(ctx) + # Visit a parse tree produced by ExprParser#portField. def visitPortField(self, ctx: ExprParser.PortFieldContext): return self.visitChildren(ctx) @@ -62,6 +62,22 @@ def visitPortField(self, ctx: ExprParser.PortFieldContext): def visitMuldiv(self, ctx: ExprParser.MuldivContext): return self.visitChildren(ctx) + # Visit a parse tree produced by ExprParser#timeSum. + def visitTimeSum(self, ctx: ExprParser.TimeSumContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by ExprParser#timeIndex. + def visitTimeIndex(self, ctx: ExprParser.TimeIndexContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by ExprParser#timeShift. + def visitTimeShift(self, ctx: ExprParser.TimeShiftContext): + return self.visitChildren(ctx) + + # Visit a parse tree produced by ExprParser#function. + def visitFunction(self, ctx: ExprParser.FunctionContext): + return self.visitChildren(ctx) + # Visit a parse tree produced by ExprParser#number. def visitNumber(self, ctx: ExprParser.NumberContext): return self.visitChildren(ctx) diff --git a/src/andromede/expression/parsing/parse_expression.py b/src/andromede/expression/parsing/parse_expression.py index add7544e..1dc3c3e4 100644 --- a/src/andromede/expression/parsing/parse_expression.py +++ b/src/andromede/expression/parsing/parse_expression.py @@ -17,7 +17,12 @@ from andromede.expression import ExpressionNode, literal, param, var from andromede.expression.equality import expressions_equal -from andromede.expression.expression import Comparator, ComparisonNode, PortFieldNode +from andromede.expression.expression import ( + Comparator, + ComparisonNode, + PortFieldAggregatorNode, + PortFieldNode, +) from andromede.expression.parsing.antlr.ExprLexer import ExprLexer from andromede.expression.parsing.antlr.ExprParser import ExprParser from andromede.expression.parsing.antlr.ExprVisitor import ExprVisitor @@ -47,6 +52,15 @@ class ExpressionNodeBuilderVisitor(ExprVisitor): identifiers: ModelIdentifiers + # Visit a parse tree produced by ExprParser#portFieldExpr. + def visitPortFieldExpr( + self, ctx: ExprParser.PortFieldExprContext + ) -> ExpressionNode: + return PortFieldNode( + port_name=ctx.IDENTIFIER(0).getText(), # type: ignore + field_name=ctx.IDENTIFIER(1).getText(), # type: ignore + ) + def visitFullexpr(self, ctx: ExprParser.FullexprContext) -> ExpressionNode: return ctx.expr().accept(self) # type: ignore @@ -101,10 +115,7 @@ def _convert_identifier(self, identifier: str) -> ExpressionNode: # Visit a parse tree produced by ExprParser#portField. def visitPortField(self, ctx: ExprParser.PortFieldContext) -> ExpressionNode: - return PortFieldNode( - port_name=ctx.IDENTIFIER(0).getText(), # type: ignore - field_name=ctx.IDENTIFIER(1).getText(), # type: ignore - ) + return ctx.portFieldExpr().accept(self) # type: ignore # Visit a parse tree produced by ExprParser#comparison. def visitComparison(self, ctx: ExprParser.ComparisonContext) -> ExpressionNode: @@ -118,6 +129,10 @@ def visitComparison(self, ctx: ExprParser.ComparisonContext) -> ExpressionNode: }[op] return ComparisonNode(exp1, exp2, comp) + # Visit a parse tree produced by ExprParser#portFieldSum. + def visitPortFieldSum(self, ctx: ExprParser.PortFieldSumContext) -> ExpressionNode: + return PortFieldAggregatorNode(ctx.portFieldExpr().accept(self), "PortSum") # type: ignore + # Visit a parse tree produced by ExprParser#timeShift. def visitTimeIndex(self, ctx: ExprParser.TimeIndexContext) -> ExpressionNode: expr = self._convert_identifier(ctx.IDENTIFIER().getText()) # type: ignore @@ -219,7 +234,6 @@ def visitRightAtom(self, ctx: ExprParser.RightAtomContext) -> ExpressionNode: _FUNCTIONS = { - "sum_connections": ExpressionNode.sum_connections, "expec": ExpressionNode.expec, }