Skip to content
2 changes: 2 additions & 0 deletions grammar/Expr.g4
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ expr
| IDENTIFIER '[' expr ']' # timeIndex
| '(' expr ')' '[' shift ']' # timeShiftExpr
| '(' expr ')' '[' expr ']' # timeIndexExpr
| MAX '(' expr (',' expr)* ')' # maxExpr
;

atom
Expand Down Expand Up @@ -74,6 +75,7 @@ fragment CHAR : [a-zA-Z_];
fragment CHAR_OR_DIGIT : (CHAR | DIGIT);

NUMBER : DIGIT+ ('.' DIGIT+)?;
MAX : 'max';
TIME : 't';
IDENTIFIER : CHAR CHAR_OR_DIGIT*;
COMPARISON : ( '=' | '>=' | '<=' );
Expand Down
3 changes: 3 additions & 0 deletions src/gems/expression/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
NegationNode,
ParameterNode,
VariableNode,
MaxNode,
TimeShiftNode,
max_expr,
literal,
param,
sum_expressions,
Expand Down
7 changes: 5 additions & 2 deletions src/gems/expression/degree.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
TimeEvalNode,
TimeShiftNode,
TimeSumNode,
MaxNode,
)

from .expression import (
Expand Down Expand Up @@ -52,8 +53,7 @@ def negation(self, node: NegationNode) -> int:

# TODO: Take into account simplification that can occur with literal coefficient for add, sub, mult, div
def addition(self, node: AdditionNode) -> int:
degrees = [visit(o, self) for o in node.operands]
return max(degrees)
return max([visit(o, self) for o in node.operands])

def multiplication(self, node: MultiplicationNode) -> int:
return visit(node.left, self) + visit(node.right, self)
Expand Down Expand Up @@ -108,6 +108,9 @@ def port_field(self, node: PortFieldNode) -> int:
def port_field_aggregator(self, node: PortFieldAggregatorNode) -> int:
return visit(node.operand, self)

def max_node(self, node: MaxNode) -> int:
return max([visit(o, self) for o in node.operands])


def compute_degree(expression: ExpressionNode) -> int:
return visit(expression, ExpressionDegreeVisitor())
Expand Down
10 changes: 10 additions & 0 deletions src/gems/expression/equality.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
NegationNode,
ParameterNode,
VariableNode,
MaxNode,
)
from gems.expression.expression import (
AllTimeSumNode,
Expand Down Expand Up @@ -111,6 +112,8 @@ def visit(self, left: ExpressionNode, right: ExpressionNode) -> bool:
right, PortFieldAggregatorNode
):
return self.port_field_aggregator(left, right)
if isinstance(left, MaxNode) and isinstance(right, MaxNode):
return self.max_node(left, right)
raise NotImplementedError(f"Equality not implemented for {left.__class__}")

def literal(self, left: LiteralNode, right: LiteralNode) -> bool:
Expand All @@ -133,6 +136,13 @@ def addition(self, left: AdditionNode, right: AdditionNode) -> bool:
self.visit(l, r) for l, r in zip(left_ops, right_ops)
)

def max_node(self, left: MaxNode, right: MaxNode) -> bool:
if len(left.operands) != len(right.operands):
return False
return all(
self.visit(l_op, r_op) for l_op, r_op in zip(left.operands, right.operands)
)

def multiplication(
self, left: MultiplicationNode, right: MultiplicationNode
) -> bool:
Expand Down
4 changes: 4 additions & 0 deletions src/gems/expression/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
AllTimeSumNode,
ComponentParameterNode,
ComponentVariableNode,
MaxNode,
PortFieldAggregatorNode,
PortFieldNode,
ProblemParameterNode,
Expand Down Expand Up @@ -139,6 +140,9 @@ def port_field(self, node: PortFieldNode) -> float:
def port_field_aggregator(self, node: PortFieldAggregatorNode) -> float:
raise NotImplementedError()

def max_node(self, node: MaxNode) -> float: # type: ignore
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need type : ignore ?

return max(visit(op, self) for op in node.operands)


def evaluate(expression: ExpressionNode, value_provider: ValueProvider) -> float:
return visit(expression, EvaluationVisitor(value_provider))
76 changes: 76 additions & 0 deletions src/gems/expression/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"""
Defines the model for generic expressions.
"""

import enum
import inspect
from dataclasses import dataclass
Expand Down Expand Up @@ -150,6 +151,81 @@ def var(name: str) -> VariableNode:
return VariableNode(name)


@dataclass(frozen=True, eq=False)
class MaxNode(ExpressionNode):
operands: List[ExpressionNode]

def __post_init__(self) -> None:
if len(self.operands) < 2:
raise ValueError("MaxNode requires at least two operands")
for operand in self.operands:
if self._contains_forbidden_node(operand):
raise ValueError(f"Node {operand} is not allowed in this structure.")

def _contains_forbidden_node(self, node: ExpressionNode) -> bool:
match node:
case (
VariableNode()
| ComponentVariableNode()
| ProblemVariableNode()
| ComparisonNode()
| PortFieldNode()
| PortFieldAggregatorNode()
):
return True

case MaxNode(operands=ops):
return any(self._contains_forbidden_node(op) for op in ops)

case TimeShiftNode(operand=op, time_shift=ts):
return self._contains_forbidden_node(
op
) or self._contains_forbidden_node(ts)

case AdditionNode(operands=ops):
return any(self._contains_forbidden_node(op) for op in ops)

case DivisionNode(left=l, right=r) | MultiplicationNode(left=l, right=r):
return self._contains_forbidden_node(
l
) or self._contains_forbidden_node(r)

case (
AllTimeSumNode(operand=op)
| NegationNode(operand=op)
| ScenarioOperatorNode(operand=op)
):
return self._contains_forbidden_node(op)

case TimeEvalNode(operand=op, eval_time=et):
return self._contains_forbidden_node(
op
) or self._contains_forbidden_node(et)

case TimeSumNode(operand=op, from_time=ft, to_time=tt):
return (
self._contains_forbidden_node(op)
or self._contains_forbidden_node(ft)
or self._contains_forbidden_node(tt)
)

case (
ComponentParameterNode()
| ProblemParameterNode()
| ParameterNode()
| LiteralNode()
):
return False

case _:
# By default for each new Node, we reject the "max" operation
return True


def max_expr(*operands: Any) -> MaxNode:
return MaxNode(operands=[_wrap_in_node(op) for op in operands])


@dataclass(frozen=True, eq=False)
class PortFieldNode(ExpressionNode):
"""
Expand Down
4 changes: 4 additions & 0 deletions src/gems/expression/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
DivisionNode,
ExpressionNode,
LiteralNode,
MaxNode,
MultiplicationNode,
NegationNode,
ParameterNode,
Expand Down Expand Up @@ -159,6 +160,9 @@ def port_field_aggregator(self, node: PortFieldAggregatorNode) -> IndexingStruct
"Port fields aggregators must be resolved before computing indexing structure."
)

def max_node(self, node: MaxNode) -> IndexingStructure:
return self._combine(node.operands)


def compute_indexation(
expression: ExpressionNode, provider: IndexingStructureProvider
Expand Down
4 changes: 3 additions & 1 deletion src/gems/expression/parsing/antlr/Expr.interp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ null
'['
']'
null
'max'
't'
null
null
Expand All @@ -35,6 +36,7 @@ null
null
null
NUMBER
MAX
TIME
IDENTIFIER
COMPARISON
Expand All @@ -51,4 +53,4 @@ right_expr


atn:
[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]
[4, 1, 19, 152, 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, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 84, 8, 2, 10, 2, 12, 2, 87, 9, 2, 1, 2, 1, 2, 3, 2, 91, 8, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 2, 102, 8, 2, 10, 2, 12, 2, 105, 9, 2, 1, 3, 1, 3, 3, 3, 109, 8, 3, 1, 4, 1, 4, 3, 4, 113, 8, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 123, 8, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 131, 8, 5, 10, 5, 12, 5, 134, 9, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 3, 6, 142, 8, 6, 1, 6, 1, 6, 1, 6, 5, 6, 147, 8, 6, 10, 6, 12, 6, 150, 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, 167, 0, 14, 1, 0, 0, 0, 2, 18, 1, 0, 0, 0, 4, 90, 1, 0, 0, 0, 6, 108, 1, 0, 0, 0, 8, 110, 1, 0, 0, 0, 10, 122, 1, 0, 0, 0, 12, 141, 1, 0, 0, 0, 14, 15, 5, 17, 0, 0, 15, 16, 5, 1, 0, 0, 16, 17, 5, 17, 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, 91, 3, 6, 3, 0, 23, 91, 3, 0, 0, 0, 24, 25, 5, 2, 0, 0, 25, 91, 3, 4, 2, 14, 26, 27, 5, 3, 0, 0, 27, 28, 3, 4, 2, 0, 28, 29, 5, 4, 0, 0, 29, 91, 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, 91, 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, 91, 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, 91, 1, 0, 0, 0, 49, 50, 5, 17, 0, 0, 50, 51, 5, 3, 0, 0, 51, 52, 3, 4, 2, 0, 52, 53, 5, 4, 0, 0, 53, 91, 1, 0, 0, 0, 54, 55, 5, 17, 0, 0, 55, 56, 5, 12, 0, 0, 56, 57, 3, 8, 4, 0, 57, 58, 5, 13, 0, 0, 58, 91, 1, 0, 0, 0, 59, 60, 5, 17, 0, 0, 60, 61, 5, 12, 0, 0, 61, 62, 3, 4, 2, 0, 62, 63, 5, 13, 0, 0, 63, 91, 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, 91, 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, 91, 1, 0, 0, 0, 78, 79, 5, 15, 0, 0, 79, 80, 5, 3, 0, 0, 80, 85, 3, 4, 2, 0, 81, 82, 5, 11, 0, 0, 82, 84, 3, 4, 2, 0, 83, 81, 1, 0, 0, 0, 84, 87, 1, 0, 0, 0, 85, 83, 1, 0, 0, 0, 85, 86, 1, 0, 0, 0, 86, 88, 1, 0, 0, 0, 87, 85, 1, 0, 0, 0, 88, 89, 5, 4, 0, 0, 89, 91, 1, 0, 0, 0, 90, 21, 1, 0, 0, 0, 90, 23, 1, 0, 0, 0, 90, 24, 1, 0, 0, 0, 90, 26, 1, 0, 0, 0, 90, 30, 1, 0, 0, 0, 90, 35, 1, 0, 0, 0, 90, 40, 1, 0, 0, 0, 90, 49, 1, 0, 0, 0, 90, 54, 1, 0, 0, 0, 90, 59, 1, 0, 0, 0, 90, 64, 1, 0, 0, 0, 90, 71, 1, 0, 0, 0, 90, 78, 1, 0, 0, 0, 91, 103, 1, 0, 0, 0, 92, 93, 10, 12, 0, 0, 93, 94, 7, 0, 0, 0, 94, 102, 3, 4, 2, 13, 95, 96, 10, 11, 0, 0, 96, 97, 7, 1, 0, 0, 97, 102, 3, 4, 2, 12, 98, 99, 10, 10, 0, 0, 99, 100, 5, 18, 0, 0, 100, 102, 3, 4, 2, 11, 101, 92, 1, 0, 0, 0, 101, 95, 1, 0, 0, 0, 101, 98, 1, 0, 0, 0, 102, 105, 1, 0, 0, 0, 103, 101, 1, 0, 0, 0, 103, 104, 1, 0, 0, 0, 104, 5, 1, 0, 0, 0, 105, 103, 1, 0, 0, 0, 106, 109, 5, 14, 0, 0, 107, 109, 5, 17, 0, 0, 108, 106, 1, 0, 0, 0, 108, 107, 1, 0, 0, 0, 109, 7, 1, 0, 0, 0, 110, 112, 5, 16, 0, 0, 111, 113, 3, 10, 5, 0, 112, 111, 1, 0, 0, 0, 112, 113, 1, 0, 0, 0, 113, 9, 1, 0, 0, 0, 114, 115, 6, 5, -1, 0, 115, 116, 7, 1, 0, 0, 116, 123, 3, 6, 3, 0, 117, 118, 7, 1, 0, 0, 118, 119, 5, 3, 0, 0, 119, 120, 3, 4, 2, 0, 120, 121, 5, 4, 0, 0, 121, 123, 1, 0, 0, 0, 122, 114, 1, 0, 0, 0, 122, 117, 1, 0, 0, 0, 123, 132, 1, 0, 0, 0, 124, 125, 10, 4, 0, 0, 125, 126, 7, 0, 0, 0, 126, 131, 3, 12, 6, 0, 127, 128, 10, 3, 0, 0, 128, 129, 7, 1, 0, 0, 129, 131, 3, 12, 6, 0, 130, 124, 1, 0, 0, 0, 130, 127, 1, 0, 0, 0, 131, 134, 1, 0, 0, 0, 132, 130, 1, 0, 0, 0, 132, 133, 1, 0, 0, 0, 133, 11, 1, 0, 0, 0, 134, 132, 1, 0, 0, 0, 135, 136, 6, 6, -1, 0, 136, 137, 5, 3, 0, 0, 137, 138, 3, 4, 2, 0, 138, 139, 5, 4, 0, 0, 139, 142, 1, 0, 0, 0, 140, 142, 3, 6, 3, 0, 141, 135, 1, 0, 0, 0, 141, 140, 1, 0, 0, 0, 142, 148, 1, 0, 0, 0, 143, 144, 10, 3, 0, 0, 144, 145, 7, 0, 0, 0, 145, 147, 3, 12, 6, 4, 146, 143, 1, 0, 0, 0, 147, 150, 1, 0, 0, 0, 148, 146, 1, 0, 0, 0, 148, 149, 1, 0, 0, 0, 149, 13, 1, 0, 0, 0, 150, 148, 1, 0, 0, 0, 11, 85, 90, 101, 103, 108, 112, 122, 130, 132, 141, 148]
12 changes: 7 additions & 5 deletions src/gems/expression/parsing/antlr/Expr.tokens
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ T__10=11
T__11=12
T__12=13
NUMBER=14
TIME=15
IDENTIFIER=16
COMPARISON=17
WS=18
MAX=15
TIME=16
IDENTIFIER=17
COMPARISON=18
WS=19
'.'=1
'-'=2
'('=3
Expand All @@ -29,4 +30,5 @@ WS=18
','=11
'['=12
']'=13
't'=15
'max'=15
't'=16
Loading
Loading