Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modeler 4.4: expression parsing [ANT-2313] #2471

Merged
merged 95 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
31736c5
New grammar
payetvin Oct 23, 2024
ed21c96
Generated new C++ files
payetvin Oct 23, 2024
9886e9b
Use antlr 4.13
payetvin Oct 23, 2024
b47d32b
Add files
payetvin Oct 23, 2024
17ab474
Remove WITH_ANTLR4 cmake option
payetvin Oct 23, 2024
9cccbc7
Compile OK
payetvin Oct 24, 2024
2d61969
format
payetvin Oct 24, 2024
2fc3265
find package antlr-runtime in main cmakelists
payetvin Oct 24, 2024
1b7316d
add antlr to vcpkg
payetvin Oct 24, 2024
4a0f5fa
move functions to cpp
payetvin Oct 25, 2024
35f9f80
add node to expression
payetvin Oct 25, 2024
19f5f6b
remove warning
payetvin Oct 25, 2024
6070294
Add function and base antlr convert
payetvin Oct 26, 2024
030b34e
More c
payetvin Oct 26, 2024
5375148
Try to convert, virtual class
payetvin Oct 26, 2024
7e0cbdf
format
payetvin Oct 28, 2024
e52b8b8
remove unused function
payetvin Oct 28, 2024
33b88f8
override all functions of ExprVisitor
payetvin Oct 28, 2024
dd1989b
functions body
payetvin Oct 28, 2024
2fb2846
compile ok for tests
payetvin Oct 28, 2024
35aaaad
function in header
payetvin Oct 28, 2024
a4236e4
use std::any instead of antlr::any
payetvin Oct 28, 2024
96e35ad
c
payetvin Oct 28, 2024
47b2932
Try parsing a mult
payetvin Oct 28, 2024
1ef4f27
visitchildren
payetvin Oct 28, 2024
79eaddd
return std any
payetvin Oct 28, 2024
72a0ff6
number context, atom context
payetvin Oct 28, 2024
804725e
OK
payetvin Oct 28, 2024
0080386
format
payetvin Oct 28, 2024
349a0bb
remove functions
payetvin Oct 29, 2024
b2d7246
operator for muldiv
payetvin Oct 29, 2024
950c4ab
check for empty string, test value for mul and div
payetvin Oct 29, 2024
7b39d93
check for empty string
payetvin Oct 29, 2024
13249f3
ternery return
payetvin Oct 29, 2024
14f8bff
negation
payetvin Oct 29, 2024
06ce508
add sub
payetvin Oct 29, 2024
a8b4ca6
expression, right expr
payetvin Oct 29, 2024
689a16b
expression, right exprc
payetvin Oct 30, 2024
8fbe1a8
signed atom
payetvin Oct 30, 2024
a6d74c2
use tonodeptr
payetvin Oct 30, 2024
9138c21
remove warnings
payetvin Oct 30, 2024
d0729a8
comparison
payetvin Oct 30, 2024
24b8cb6
test comparison
payetvin Oct 30, 2024
e24612e
visitFullexpr
payetvin Oct 30, 2024
e00b6fb
medium expression
payetvin Oct 30, 2024
dd9686b
test identifier
payetvin Oct 30, 2024
d36ebf8
format
payetvin Oct 30, 2024
30e2bc0
use model parser
payetvin Oct 31, 2024
29d129c
format
payetvin Oct 31, 2024
cbe5ce4
expression constructor
payetvin Oct 31, 2024
af42591
remove Antares::Solver
payetvin Oct 31, 2024
ee4ebe4
use registry in all functions
payetvin Nov 4, 2024
dc865bd
Use simpler expressions in test_full
payetvin Nov 4, 2024
5da3115
format
payetvin Nov 4, 2024
55799d2
Merge branch 'develop' into feature/4.4-expression-parsing
payetvin Nov 4, 2024
602851e
check for param AND variable
payetvin Nov 4, 2024
795543e
add error log
payetvin Nov 4, 2024
a408926
format
payetvin Nov 4, 2024
847bc0a
Throw runtime for not implemented node
payetvin Nov 5, 2024
def6253
Add exception if no param or var found
payetvin Nov 5, 2024
2fe9db9
ast dot vonst
payetvin Nov 5, 2024
6956bef
remove cucumber behave
payetvin Nov 6, 2024
5579806
Message for exception
payetvin Nov 6, 2024
225cd63
update sonarcloud properties
payetvin Nov 6, 2024
8405111
test exception
payetvin Nov 6, 2024
78b6c51
remove yuni logs
payetvin Nov 7, 2024
c8733fc
medium expr compare
payetvin Nov 8, 2024
b4dd0f8
format
payetvin Nov 8, 2024
7a3412b
Fix build errors caused by conflicts between windows.h and antlr4-run…
a-zakir Nov 15, 2024
d4768d5
Merge remote-tracking branch 'github/develop' into feature/4.4-expres…
flomnes Nov 20, 2024
7594a48
Remove unused CMakeList.txt
flomnes Nov 20, 2024
95c04b5
Fix comments
flomnes Nov 20, 2024
5e7d0c8
Rename Fixture -> FixtureConvertVisitor to avoid possible linking con…
flomnes Nov 20, 2024
fb290dd
Add BOOST_REQUIRE where needed
flomnes Nov 20, 2024
38b7c6b
Split test cases
flomnes Nov 20, 2024
80f3e4d
Fix build
flomnes Nov 21, 2024
7d916c2
Remove "type" from Parameter (unused)
flomnes Nov 21, 2024
f779d73
Use std::runtime_error instead of std::exception
flomnes Nov 21, 2024
4b84e2e
sonar-project.properties goes multiline
flomnes Nov 21, 2024
079167f
Remove unused headers, variables, NS info
flomnes Nov 21, 2024
bfa97c8
Remove toNodePtr
flomnes Nov 21, 2024
ab8dec6
Naming
flomnes Nov 21, 2024
3a58f35
Fix & clean
flomnes Nov 21, 2024
4feaec7
Remove fixture where not needed
flomnes Nov 21, 2024
98b80e8
Simplify model
flomnes Nov 21, 2024
1bb1874
Adapt fixture
flomnes Nov 21, 2024
4b94fd5
Fix
flomnes Nov 21, 2024
4746079
Fix `identifier` test case
flomnes Nov 21, 2024
63136e7
Sonar
flomnes Nov 22, 2024
df22fc0
Fix
flomnes Nov 22, 2024
4bb7cc5
Fix headers
flomnes Nov 22, 2024
3e01802
Don't pass a registry to ModelConverter::convert (#2501)
flomnes Nov 22, 2024
98c4b98
Merge remote-tracking branch 'github/develop' into feature/4.4-expres…
flomnes Nov 22, 2024
d963517
Code smells
flomnes Nov 25, 2024
3c77ee6
Move class definition to .cpp
flomnes Nov 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,19 @@ sonar.projectVersion=9.2.0
sonar.sources=src
sonar.tests=src/tests
sonar.sourceEncoding=UTF-8
sonar.exclusions=src/ext/**,src/tests/**,src/ui/**
sonar.coverage.exclusions=src/ext/**,src/tests/**,src/analyzer/**,src/distrib/**,src/tools/**,src/ui/**

sonar.exclusions=src/ext/**,\
src/tests/**,\
src/ui/**,\
src/libs/antares/antlr-interface/**

sonar.coverage.exclusions=src/ext/**,\
src/tests/**,\
src/analyzer/**,\
src/distrib/**,\
src/tools/**,\
src/ui/**,\
src/libs/antares/antlr-interface/**

sonar.coverageReportPaths=coverage.xml
sonar.cfamily.threads=4
5 changes: 2 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,6 @@ message(STATUS "Build antares tools: ${BUILD_TOOLS}")
option(BUILD_ORTOOLS "Build OR-Tools" OFF)
message(STATUS "Build OR-Tools: ${BUILD_ORTOOLS}")

option(WITH_ANTLR4 "With antlr4" OFF)
message(STATUS "With antlr4: ${WITH_ANTLR4}")

option(BUILD_MERSENNE_TWISTER_PYBIND11 "Build pybind11 bindings for Mersenne-Twister" OFF)
if (${BUILD_MERSENNE_TWISTER_PYBIND11})
find_package(pybind11 REQUIRED)
Expand All @@ -194,6 +191,8 @@ endif()
#Boost header libraries
find_package(Boost REQUIRED)

find_package(antlr4-runtime REQUIRED)

#Sirius solver
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
Expand Down
4 changes: 1 addition & 3 deletions src/libs/antares/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ add_subdirectory(study-loader)
add_subdirectory(sys)
add_subdirectory(utils)
add_subdirectory(writer)
if(WITH_ANTLR4)
add_subdirectory(antlr-interface)
endif()
add_subdirectory(antlr-interface)

add_subdirectory(optimization-options)

Expand Down
1 change: 0 additions & 1 deletion src/libs/antares/antlr-interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ ExprLexer.cpp
ExprParser.cpp
ExprVisitor.cpp
)
find_package(antlr4-runtime CONFIG REQUIRED)

add_library(${PROJ} ${SRCS})
add_library(Antares::${PROJ} ALIAS ${PROJ})
Expand Down
66 changes: 47 additions & 19 deletions src/libs/antares/antlr-interface/Expr.g4
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,55 @@ grammar Expr;
/* To match the whole input */
fullexpr: expr EOF;

shift: TIME (op=('+' | '-') expr)?;

expr: '-' expr # negation
| expr op=('/' | '*') expr # muldiv
| expr op=('+' | '-') expr # addsub
| expr COMPARISON expr # comparison
| IDENTIFIER # identifier
| IDENTIFIER '.' IDENTIFIER # portField
| NUMBER # number
| '(' expr ')' # expression
| IDENTIFIER '(' expr ')' # function
| IDENTIFIER '[' shift (',' shift)* ']' # timeShift
| IDENTIFIER '[' expr (',' expr )* ']' # timeIndex
| IDENTIFIER '[' shift1=shift '..' shift2=shift ']' # timeShiftRange
| IDENTIFIER '[' expr '..' expr ']' # timeRange
expr
: atom # unsignedAtom
| IDENTIFIER '.' IDENTIFIER # portField
| '-' expr # negation
| '(' expr ')' # expression
| expr op=('/' | '*') expr # muldiv
| expr op=('+' | '-') expr # addsub
| expr COMPARISON expr # comparison
| 'sum' '(' expr ')' # allTimeSum
| 'sum' '(' from=shift '..' to=shift ',' expr ')' # timeSum
| IDENTIFIER '(' expr ')' # function
| IDENTIFIER '[' shift ']' # timeShift
| IDENTIFIER '[' expr ']' # timeIndex
;

atom
: NUMBER # number
| IDENTIFIER # identifier
;

// a shift is required to be either "t" or "t + ..." or "t - ..."
// Note: simply defining it as "shift: TIME ('+' | '-') expr" won't work
// because the minus sign will not have the expected precedence:
// "t - d + 1" would be equivalent to "t - (d + 1)"
shift: TIME shift_expr?;

// Because the shift MUST start with + or -, we need
// to differentiate it from generic "expr".
// A shift expression can only be extended to the right by a
// "right_expr" which cannot start with a + or -,
// unlike shift_expr itself.
// TODO: the grammar is still a little weird, because we
// allow more things in the "expr" parts of those
// shift expressions than on their left-most part
// (port fields, nested time shifts and so on).
shift_expr
: shift_expr op=('*' | '/') right_expr # shiftMuldiv
| shift_expr op=('+' | '-') right_expr # shiftAddsub
| op=('+' | '-') atom # signedAtom
| op=('+' | '-') '(' expr ')' # signedExpression
;

right_expr
: right_expr op=('/' | '*') right_expr # rightMuldiv
| '(' expr ')' # rightExpression
| atom # rightAtom
;


fragment DIGIT : [0-9] ;
fragment CHAR : [a-zA-Z_];
fragment CHAR_OR_DIGIT : (CHAR | DIGIT);
Expand All @@ -42,9 +74,5 @@ NUMBER : DIGIT+ ('.' DIGIT+)?;
TIME : 't';
IDENTIFIER : CHAR CHAR_OR_DIGIT*;
COMPARISON : ( '=' | '>=' | '<=' );
ADDSUB : ( '+' | '-' );
MULDIV : ( '*' | '/' );
LBRACKET: '[';
RBRACKET: ']';

WS: (' ' | '\t' | '\r'| '\n') -> skip;
31 changes: 16 additions & 15 deletions src/libs/antares/antlr-interface/Expr.interp
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
token literal names:
null
'+'
'-'
'/'
'*'
'.'
'-'
'('
')'
','
'/'
'*'
'+'
'sum'
'..'
','
'['
']'
null
't'
null
null
null
null
'['
']'
null

token symbolic names:
null
Expand All @@ -30,21 +29,23 @@ null
null
null
null
null
null
null
NUMBER
TIME
IDENTIFIER
COMPARISON
ADDSUB
MULDIV
LBRACKET
RBRACKET
WS

rule names:
fullexpr
shift
expr
atom
shift
shift_expr
right_expr


atn:
[4, 1, 18, 86, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 3, 1, 13, 8, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 37, 8, 2, 10, 2, 12, 2, 40, 9, 2, 1, 2, 1, 2, 1, 2, 1,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38, 1, 0, 0, 0, 41, 42, 5, 17, 0, 0, 42, 70, 1, 0, 0, 0, 43, 44, 5, 12, 0, 0, 44, 45, 5, 16, 0, 0, 45, 50, 3, 4, 2, 0, 46, 47, 5, 8, 0, 0, 47, 49, 3, 4, 2, 0, 48, 46, 1, 0, 0, 0, 49, 52, 1, 0, 0, 0, 50, 48, 1, 0, 0, 0, 50, 51, 1, 0, 0, 0, 51, 53, 1, 0, 0, 0, 52, 50, 1, 0, 0, 0, 53, 54, 5, 17, 0, 0, 54, 70, 1, 0, 0, 0, 55, 56, 5, 12, 0, 0, 56, 57, 5, 16, 0, 0, 57, 58, 3, 2, 1, 0, 58, 59, 5, 9, 0, 0, 59, 60, 3, 2, 1, 0, 60, 61, 5, 17, 0, 0, 61, 70, 1, 0, 0, 0, 62, 63, 5, 12, 0, 0, 63, 64, 5, 16, 0, 0, 64, 65, 3, 4, 2, 0, 65, 66, 5, 9, 0, 0, 66, 67, 3, 4, 2, 0, 67, 68, 5, 17, 0, 0, 68, 70, 1, 0, 0, 0, 69, 14, 1, 0, 0, 0, 69, 17, 1, 0, 0, 0, 69, 18, 1, 0, 0, 0, 69, 21, 1, 0, 0, 0, 69, 22, 1, 0, 0, 0, 69, 26, 1, 0, 0, 0, 69, 31, 1, 0, 0, 0, 69, 43, 1, 0, 0, 0, 69, 55, 1, 0, 0, 0, 69, 62, 1, 0, 0, 0, 70, 82, 1, 0, 0, 0, 71, 72, 10, 12, 0, 0, 72, 73, 7, 1, 0, 0, 73, 81, 3, 4, 2, 13, 74, 75, 10, 11, 0, 0, 75, 76, 7, 0, 0, 0, 76, 81, 3, 4, 2, 12, 77, 78, 10, 10, 0, 0, 78, 79, 5, 13, 0, 0, 79, 81, 3, 4, 2, 11, 80, 71, 1, 0, 0, 0, 80, 74, 1, 0, 0, 0, 80, 77, 1, 0, 0, 0, 81, 84, 1, 0, 0, 0, 82, 80, 1, 0, 0, 0, 82, 83, 1, 0, 0, 0, 83, 5, 1, 0, 0, 0, 84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, 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]
38 changes: 19 additions & 19 deletions src/libs/antares/antlr-interface/Expr.tokens
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@ T__5=6
T__6=7
T__7=8
T__8=9
NUMBER=10
TIME=11
IDENTIFIER=12
COMPARISON=13
ADDSUB=14
MULDIV=15
LBRACKET=16
RBRACKET=17
WS=18
'+'=1
T__9=10
T__10=11
T__11=12
NUMBER=13
TIME=14
IDENTIFIER=15
COMPARISON=16
WS=17
'.'=1
'-'=2
'/'=3
'*'=4
'.'=5
'('=6
')'=7
','=8
'('=3
')'=4
'/'=5
'*'=6
'+'=7
'sum'=8
'..'=9
't'=11
'['=16
']'=17
','=10
'['=11
']'=12
't'=14
2 changes: 1 addition & 1 deletion src/libs/antares/antlr-interface/ExprBaseVisitor.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

// Generated from Expr.g4 by ANTLR 4.13.1
// Generated from Expr.g4 by ANTLR 4.13.2


#include "ExprBaseVisitor.h"
Expand Down
50 changes: 41 additions & 9 deletions src/libs/antares/antlr-interface/ExprBaseVisitor.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

// Generated from Expr.g4 by ANTLR 4.13.1
// Generated from Expr.g4 by ANTLR 4.13.2

#pragma once

Expand All @@ -19,26 +19,42 @@ class ExprBaseVisitor : public ExprVisitor {
return visitChildren(ctx);
}

virtual std::any visitShift(ExprParser::ShiftContext *ctx) override {
virtual std::any visitTimeSum(ExprParser::TimeSumContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitIdentifier(ExprParser::IdentifierContext *ctx) override {
virtual std::any visitNegation(ExprParser::NegationContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitNegation(ExprParser::NegationContext *ctx) override {
virtual std::any visitUnsignedAtom(ExprParser::UnsignedAtomContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitExpression(ExprParser::ExpressionContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitTimeIndex(ExprParser::TimeIndexContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitComparison(ExprParser::ComparisonContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitAllTimeSum(ExprParser::AllTimeSumContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitTimeShift(ExprParser::TimeShiftContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitFunction(ExprParser::FunctionContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitAddsub(ExprParser::AddsubContext *ctx) override {
return visitChildren(ctx);
}
Expand All @@ -55,23 +71,39 @@ class ExprBaseVisitor : public ExprVisitor {
return visitChildren(ctx);
}

virtual std::any visitTimeIndex(ExprParser::TimeIndexContext *ctx) override {
virtual std::any visitIdentifier(ExprParser::IdentifierContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitTimeShift(ExprParser::TimeShiftContext *ctx) override {
virtual std::any visitShift(ExprParser::ShiftContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitFunction(ExprParser::FunctionContext *ctx) override {
virtual std::any visitSignedAtom(ExprParser::SignedAtomContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitSignedExpression(ExprParser::SignedExpressionContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitShiftMuldiv(ExprParser::ShiftMuldivContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitShiftAddsub(ExprParser::ShiftAddsubContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitRightExpression(ExprParser::RightExpressionContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitTimeShiftRange(ExprParser::TimeShiftRangeContext *ctx) override {
virtual std::any visitRightMuldiv(ExprParser::RightMuldivContext *ctx) override {
return visitChildren(ctx);
}

virtual std::any visitTimeRange(ExprParser::TimeRangeContext *ctx) override {
virtual std::any visitRightAtom(ExprParser::RightAtomContext *ctx) override {
return visitChildren(ctx);
}

Expand Down
Loading
Loading