Fixed first token recognition when creating bnf concepts
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user