2018-04-25 16:06:33 +00:00
|
|
|
from lark import Lark
|
|
|
|
|
2018-04-25 18:28:12 +00:00
|
|
|
parser = Lark(open('examples/lark.lark'), parser="lalr")
|
2018-04-25 16:06:33 +00:00
|
|
|
|
|
|
|
grammar_files = [
|
2018-04-25 18:28:12 +00:00
|
|
|
'examples/python2.lark',
|
|
|
|
'examples/python3.lark',
|
|
|
|
'examples/lark.lark',
|
2019-03-03 15:02:40 +00:00
|
|
|
'examples/relative-imports/multiples.lark',
|
|
|
|
'examples/relative-imports/multiple2.lark',
|
|
|
|
'examples/relative-imports/multiple3.lark',
|
2018-04-25 18:28:12 +00:00
|
|
|
'lark/grammars/common.lark',
|
2018-04-25 16:06:33 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
def test():
|
|
|
|
for grammar_file in grammar_files:
|
|
|
|
tree = parser.parse(open(grammar_file).read())
|
|
|
|
print("All grammars parsed successfully")
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
test()
|