intermediate commit

This commit is contained in:
2024-09-22 09:27:20 +02:00
parent a729d98a0d
commit 3be854d34c
14 changed files with 441 additions and 108 deletions
+15
View File
@@ -100,5 +100,20 @@ class ParserInput:
return res
@staticmethod
def from_tokens(tokens, text=None):
"""
returns a parser input, given already computed tokens
:param tokens:
:param text:
:return:
"""
res = ParserInput(None)
res.all_tokens = tokens
res.original_text = text or get_text_from_tokens(tokens)
res.pos = -1
res.end = len(res.all_tokens)
return res
def __repr__(self):
return f"ParserInput('{self.original_text}', len={len(self.all_tokens)})"