Fixed first token recognition when creating bnf concepts

This commit is contained in:
2020-05-29 08:52:06 +02:00
parent 479461c0a4
commit c498b394e3
11 changed files with 125 additions and 24 deletions
+7 -1
View File
@@ -162,11 +162,17 @@ class BaseParser:
if len(self.error_sink) == 1 and isinstance(self.error_sink[0], Concept):
return self.error_sink[0]
if self.has_error:
return sheerka.new(
BuiltinConcepts.ERROR,
body=self.error_sink
)
return sheerka.new(
BuiltinConcepts.PARSER_RESULT,
parser=self,
source=source,
body=self.error_sink if self.has_error else tree,
body=tree,
try_parsed=try_parse)
def get_input_as_text(self, parser_input, custom_switcher=None, tracker=None):