Skip to content

Commit

Permalink
Modeler 4.4: expression parsing [ANT-2313] (#2471)
Browse files Browse the repository at this point in the history
This pull request includes several updates and improvements to the ANTLR
grammar and related files for the `Expr` language. The changes involve
modifications to the grammar rules, updates to the CMake configuration,
and synchronization with a newer version of ANTLR.

### Grammar and Parsing Improvements:
* Refactored `Expr.g4` grammar to introduce new rules and improve
parsing capabilities, including the addition of `atom`, `shift_expr`,
and `right_expr` rules.
[[1]](diffhunk://#diff-9904320a1807a7a3514cd161403920248cbde82e6c2dbc9cf855c5c134dd62dcL20-R68)
[[2]](diffhunk://#diff-9904320a1807a7a3514cd161403920248cbde82e6c2dbc9cf855c5c134dd62dcL45-L48)
* Updated `Expr.tokens` to reflect new token definitions and changes in
the grammar.
* Removed redundant rules and tokens from `Expr.g4` and `Expr.tokens`.
[[1]](diffhunk://#diff-9904320a1807a7a3514cd161403920248cbde82e6c2dbc9cf855c5c134dd62dcL45-L48)
[[2]](diffhunk://#diff-cb10c1b9428e9e48c48e524757dfc48dcc6ae8dd2ad921eff65851cbc3c2e5c1L10-R30)

### Build Configuration Updates:
* Updated `sonar-project.properties` to exclude
`src/libs/antares/antlr-interface` from Sonar analysis. antlr-interface
contains generated code that trigger defect in analysis
* Modified `CMakeLists.txt` to always include the `antlr-interface`
directory and removed conditional logic for building with ANTLR4.
[[1]](diffhunk://#diff-148715d6ea0c0ea0a346af3f6bd610d010d490eca35ac6a9b408748f7ca9e3f4L186-L188)
[[2]](diffhunk://#diff-148715d6ea0c0ea0a346af3f6bd610d010d490eca35ac6a9b408748f7ca9e3f4R194-R195)
[[3]](diffhunk://#diff-9e299f60c14464c86511d6c9a4e7c081765abb4840b57ea4dc25238311006ce9L31-L33)

### Synchronization with ANTLR 4.13.2:
* Updated generated files to be compatible with ANTLR 4.13.2, including
`ExprBaseVisitor.cpp`, `ExprBaseVisitor.h`, and `ExprLexer.cpp`.
[[1]](diffhunk://#diff-bda2e00a884ff4b113d535c8239b493bfc88c5c4f1d38c4687c2f28e44cdfde8L2-R2)
[[2]](diffhunk://#diff-abcc97c1794721be0f33a540339645ac1d5d9d3dd6cbe941235200bad3dcacb9L2-R2)
[[3]](diffhunk://#diff-6adabe5fce15f2c6367db67aa33a2e02bb220796c9ff4e143160752a637ca3c0L2-R2)
* Adjusted `ExprLexer.cpp` to use `std::unique_ptr` for static data
initialization.
[[1]](diffhunk://#diff-6adabe5fce15f2c6367db67aa33a2e02bb220796c9ff4e143160752a637ca3c0L48-R48)
[[2]](diffhunk://#diff-6adabe5fce15f2c6367db67aa33a2e02bb220796c9ff4e143160752a637ca3c0L61-R62)

### Visitor Pattern Enhancements:
* Updated `ExprBaseVisitor` to include new visit methods for the added
grammar rules.
[[1]](diffhunk://#diff-abcc97c1794721be0f33a540339645ac1d5d9d3dd6cbe941235200bad3dcacb9L22-R57)
[[2]](diffhunk://#diff-abcc97c1794721be0f33a540339645ac1d5d9d3dd6cbe941235200bad3dcacb9L58-R106)

These changes collectively enhance the flexibility and maintainability
of the grammar and build configuration, while ensuring compatibility
with the latest ANTLR version.

---------

Co-authored-by: Abdoulbari Zaher <[email protected]>
Co-authored-by: Florian OMNES <[email protected]>
Co-authored-by: Florian OMNES <[email protected]>
  • Loading branch information
4 people authored Nov 25, 2024
1 parent 427c395 commit 0d9e6d4
Show file tree
Hide file tree
Showing 46 changed files with 2,068 additions and 825 deletions.
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, 2, 1, 2, 1, 2, 1, 2, 5, 2, 49, 8, 2, 10, 2, 12, 2, 52, 9, 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, 70, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 81, 8, 2, 10, 2, 12, 2, 84, 9, 2, 1, 2, 0, 1, 4, 3, 0, 2, 4, 0, 2, 1, 0, 1, 2, 1, 0, 3, 4, 97, 0, 6, 1, 0, 0, 0, 2, 9, 1, 0, 0, 0, 4, 69, 1, 0, 0, 0, 6, 7, 3, 4, 2, 0, 7, 8, 5, 0, 0, 1, 8, 1, 1, 0, 0, 0, 9, 12, 5, 11, 0, 0, 10, 11, 7, 0, 0, 0, 11, 13, 3, 4, 2, 0, 12, 10, 1, 0, 0, 0, 12, 13, 1, 0, 0, 0, 13, 3, 1, 0, 0, 0, 14, 15, 6, 2, -1, 0, 15, 16, 5, 2, 0, 0, 16, 70, 3, 4, 2, 13, 17, 70, 5, 12, 0, 0, 18, 19, 5, 12, 0, 0, 19, 20, 5, 5, 0, 0, 20, 70, 5, 12, 0, 0, 21, 70, 5, 10, 0, 0, 22, 23, 5, 6, 0, 0, 23, 24, 3, 4, 2, 0, 24, 25, 5, 7, 0, 0, 25, 70, 1, 0, 0, 0, 26, 27, 5, 12, 0, 0, 27, 28, 5, 6, 0, 0, 28, 29, 3, 4, 2, 0, 29, 30, 5, 7, 0, 0, 30, 70, 1, 0, 0, 0, 31, 32, 5, 12, 0, 0, 32, 33, 5, 16, 0, 0, 33, 38, 3, 2, 1, 0, 34, 35, 5, 8, 0, 0, 35, 37, 3, 2, 1, 0, 36, 34, 1, 0, 0, 0, 37, 40, 1, 0, 0, 0, 38, 36, 1, 0, 0, 0, 38, 39, 1, 0, 0, 0, 39, 41, 1, 0, 0, 0, 40, 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, 82, 1, 0, 0, 0, 6, 12, 38, 50, 69, 80, 82]
[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]
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

0 comments on commit 0d9e6d4

Please sign in to comment.