Make Parser faster!
I believe we can use several grammars to speed up the parsing of the OpenFOAM tutorials. As we generalize the parser, it becomes slower.
here = Path(__file__).absolute().parent
file_name = Path(__file__).absolute().name
specific_grammars = ["fvSolution", "blockMeshDict"]
if file_name in specific_grammars:
grammar = (here / f"{file_name}_grammar.lark").read_text()
else:
grammar = (here / "grammar.lark").read_text()
lark_parser = Lark(grammar, start="value", lexer="basic")