rules now successfully parsed, but too deep recursion
This commit is contained in:
parent
608af7d2ff
commit
b89de0e6cb
|
@ -1,10 +1,10 @@
|
|||
from parsomonious.grammar import Grammar
|
||||
from parsimonious.grammar import Grammar
|
||||
|
||||
grammar = Grammar(
|
||||
"""
|
||||
r"""
|
||||
start = skip_preface
|
||||
skip_preface = instance_list / ~"."s skip_preface
|
||||
eol = \n / \r\n
|
||||
skip_preface = instance_list / (~"."s skip_preface)
|
||||
eol = "\n" / "\r\n"
|
||||
_ = " "
|
||||
instance_list = problem_instance (sep_line problem_instance eol)* eof
|
||||
problem_instance = strip_whitespace "instance" _ instance_name eol eol sep_line description eol job_data
|
||||
|
@ -17,3 +17,6 @@ grammar = Grammar(
|
|||
job_data = ~"[ \r\n0-9]*"s
|
||||
""")
|
||||
|
||||
with open("./inputdata/jobshop1.txt") as datafile:
|
||||
inputdata : str = datafile.read()
|
||||
print(grammar.parse(inputdata))
|
||||
|
|
Loading…
Reference in a new issue