Skip to content

Commit

Permalink
Updated typing statement and removed main part
Browse files Browse the repository at this point in the history
  • Loading branch information
NikosDelijohn committed Oct 18, 2024
1 parent 6364561 commit 4bc2bbd
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions src/testcrush/grammars/transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,9 @@ class FaultReportTransformerFactory:
"Coverage": (FaultReportCoverageTransformer, _current_directory / "frpt_coverage.lark")
}

def __call__(self, section_string: str) -> Union[tuple[FaultReportFaultListTransformer, str]]:
def __call__(self, section_string: str) -> Union[tuple[FaultReportFaultListTransformer, str],
tuple[FaultReportStatusGroupsTransformer, str],
tuple[FaultReportCoverageTransformer, str]]:

transformer, grammar = self._transformers.get(section_string, (None, None))

Expand All @@ -480,18 +482,3 @@ def __call__(self, section_string: str) -> Union[tuple[FaultReportFaultListTrans
lark_grammar = src.read()

return transformer(), lark_grammar


if __name__ == "__main__":

parser = lark.Lark(grammar=open("frpt_coverage.lark").read(),
start="start",
parser="lalr",
transformer=FaultReportCoverageTransformer())

dummy_text = r""" Coverage {
"Diagnostic Coverage" = "INT( AA + BB + CC )";
DEARF ASDF = "(DD + DN)/(NA + DA + DN + DD + SU)";
}
"""
parser.parse(dummy_text)

0 comments on commit 4bc2bbd

Please sign in to comment.