diff --git a/src/JobShopParser/jobshop1_parser.py b/src/JobShopParser/jobshop1_parser.py index a064077..90e44d7 100644 --- a/src/JobShopParser/jobshop1_parser.py +++ b/src/JobShopParser/jobshop1_parser.py @@ -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))