2022-07-17 20:24:55 +00:00
|
|
|
from lark import Lark
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
# Define the Grammar File.
|
2022-07-21 21:31:19 +00:00
|
|
|
grammar_file_path = Path(__file__).parent.joinpath('grammar.js.lark')
|
2022-07-17 20:24:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
def get_parser():
|
|
|
|
""" Helper, to generate a parser.
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
A lark parser
|
|
|
|
"""
|
|
|
|
return Lark.open(grammar_file_path,debug = True, maybe_placeholders=True)
|