diff --git a/src/Parser/__init__.py b/src/Parser/__init__.py index d42e09c..59d2edf 100644 --- a/src/Parser/__init__.py +++ b/src/Parser/__init__.py @@ -6,33 +6,33 @@ from collections.abc import Mapping __all__ = ["js1_style", "js2_style"] grammar = """ - # starting point for jobshop1 input file + // starting point for jobshop1 input file job_shop1 = skip_preface - # eat away lines of preface, until first problem_instance is - # encountered; then the list of instances start + // eat away lines of preface, until first problem_instance is + // encountered; then the list of instances start skip_preface = (!problem_instance r"[^\n]+" skip_preface) / (eol skip_preface) / instance_list instance_list = problem_instance (sep_line trim_ws eol problem_instance eol?)* eof_sep problem_instance = trim_ws "instance" ' ' instance_name trim_ws eol trim_ws eol sep_line description eol problem_data description = r"[^\n]*" instance_name = r"\w+" sep_line = trim_ws plus_line trim_ws eol - # lines out of multiple + signs + // lines out of multiple + signs plus_line = r"\+\+\++" - # EOF is a builtin rule matching end of file + // EOF is a builtin rule matching end of file eof_sep = trim_ws plus_line " EOF " plus_line trim_ws eol* EOF - # entry point for jobshop2 input files + // entry point for jobshop2 input files job_shop2 = problem_data EOF problem_data = trim_ws num_jobs ' ' num_machines eol job_data+ - # used for skipping arbitrary number of non-breaking whitespace + // used for skipping arbitrary number of non-breaking whitespace trim_ws = r'[ \t]*' - # git may change line-endings on windows, so we have to match on both + // git may change line-endings on windows, so we have to match on both eol = "\n" / "\r\n" nonneg_num = r'\d+' num_jobs = nonneg_num num_machines = nonneg_num machine = nonneg_num duration = nonneg_num - # task data for 1 job + // task data for 1 job job_data = ' '* machine ' '+ duration (' '+ machine ' '+ duration)* trim_ws eol """