Fixed first token recognition when creating bnf concepts
This commit is contained in:
@@ -84,6 +84,8 @@ class TestBnfParser(TestUsingMemoryBasedSheerka):
|
||||
("('a'*=x 'b'+=y)=z", Sequence(
|
||||
ZeroOrMore(StrMatch("a"), rule_name="x"),
|
||||
OneOrMore(StrMatch("b"), rule_name="y"), rule_name="z")),
|
||||
("'--filter'",
|
||||
Sequence(StrMatch("-", skip_whitespace=False), StrMatch("-", skip_whitespace=False), StrMatch("filter")))
|
||||
])
|
||||
def test_i_can_parse_regex(self, expression, expected):
|
||||
sheerka, context, parser = self.init_parser()
|
||||
@@ -141,8 +143,9 @@ class TestBnfParser(TestUsingMemoryBasedSheerka):
|
||||
sheerka, context, parser = self.init_parser()
|
||||
|
||||
res = parser.parse(context, Tokenizer(expression))
|
||||
ret_value = res.value.value
|
||||
ret_value = res.body.body
|
||||
assert parser.has_error
|
||||
assert sheerka.isinstance(res.body, BuiltinConcepts.ERROR)
|
||||
assert not res.status
|
||||
assert ret_value[0] == error
|
||||
|
||||
|
||||
Reference in New Issue
Block a user