Working on #48 : Fixed first version of ExpressionParser.py
This commit is contained in:
@@ -907,19 +907,6 @@ class FN:
|
||||
if isinstance(other, FN):
|
||||
return self.first == other.first and self.last == other.last and self.parameters == other.parameters
|
||||
|
||||
# if isinstance(other, FunctionNode):
|
||||
# if self.first != other.first.value or self.last != other.last.value:
|
||||
# return False
|
||||
# if len(self.parameters) != len(other.parameters):
|
||||
# return False
|
||||
# for self_parameter, other_parameter in zip(self.parameters, other.parameters):
|
||||
# value = other_parameter.value.value if isinstance(self_parameter[0], str) else other_parameter.value
|
||||
# sep = other_parameter.separator.value if other_parameter.separator else None
|
||||
# if self_parameter[0] != value or self_parameter[1] != sep:
|
||||
# return False
|
||||
#
|
||||
# return True
|
||||
|
||||
return False
|
||||
|
||||
def __hash__(self):
|
||||
|
||||
@@ -3,11 +3,11 @@ import pytest
|
||||
from core.builtin_concepts_ids import BuiltinConcepts
|
||||
from core.sheerka.services.SheerkaExecute import ParserInput
|
||||
from core.tokenizer import Tokenizer
|
||||
from parsers.BaseExpressionParser import VariableNode
|
||||
from parsers.BaseParser import ErrorSink
|
||||
from parsers.ExpressionParser import ExpressionParser
|
||||
from parsers.BaseExpressionParser import VariableNode
|
||||
from tests.TestUsingMemoryBasedSheerka import TestUsingMemoryBasedSheerka
|
||||
from tests.parsers.parsers_utils import get_expr_node_from_test_node, VAR, EXPR, AND, OR, NOT, GT, GTE, LT, LTE, EQ, \
|
||||
from tests.parsers.parsers_utils import get_expr_node_from_test_node, VAR, EXPR, FN, AND, NOT, OR, GT, GTE, LT, LTE, EQ, \
|
||||
NEQ, IN, NIN
|
||||
|
||||
|
||||
@@ -47,7 +47,10 @@ class TestExpressionParser(TestUsingMemoryBasedSheerka):
|
||||
("var1 != var2", NEQ(VAR("var1"), VAR("var2"))),
|
||||
("var1 in (var2.attr2, var3.attr3)", IN(VAR("var1"), EXPR("var2.attr2, var3.attr3"))),
|
||||
("var1 not in (var2.attr2, var3.attr3)", NIN(VAR("var1"), EXPR("var2.attr2, var3.attr3"))),
|
||||
|
||||
("var1 < var2 and var3 > var4", AND(LT(VAR("var1"), VAR("var2")), GT(VAR("var3"), VAR("var4")))),
|
||||
("func1(one, 1 + 2, func2(3))", FN("func1(", (")", 1), [(VAR("one"), ", "),
|
||||
(EXPR("1 + 2"), ", "),
|
||||
FN("func2(", ")", [EXPR("3")])])),
|
||||
])
|
||||
def test_i_can_parse_input(self, expression, expected):
|
||||
sheerka, context, parser, parser_input, error_sink = self.init_parser_with_source(expression)
|
||||
|
||||
Reference in New Issue
Block a user