update grammar comments syntax to arpeggio-1.9.0

This commit is contained in:
Trolli Schmittlauch 2022-03-19 03:05:21 +01:00
parent 03c5fb612d
commit 412b572afb

View file

@ -6,33 +6,33 @@ from collections.abc import Mapping
__all__ = ["js1_style", "js2_style"] __all__ = ["js1_style", "js2_style"]
grammar = """ grammar = """
# starting point for jobshop1 input file // starting point for jobshop1 input file
job_shop1 = skip_preface job_shop1 = skip_preface
# eat away lines of preface, until first problem_instance is // eat away lines of preface, until first problem_instance is
# encountered; then the list of instances start // encountered; then the list of instances start
skip_preface = (!problem_instance r"[^\n]+" skip_preface) / (eol skip_preface) / instance_list 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 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 problem_instance = trim_ws "instance" ' ' instance_name trim_ws eol trim_ws eol sep_line description eol problem_data
description = r"[^\n]*" description = r"[^\n]*"
instance_name = r"\w+" instance_name = r"\w+"
sep_line = trim_ws plus_line trim_ws eol sep_line = trim_ws plus_line trim_ws eol
# lines out of multiple + signs // lines out of multiple + signs
plus_line = r"\+\+\++" 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 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 job_shop2 = problem_data EOF
problem_data = trim_ws num_jobs ' ' num_machines eol job_data+ 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]*' 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" eol = "\n" / "\r\n"
nonneg_num = r'\d+' nonneg_num = r'\d+'
num_jobs = nonneg_num num_jobs = nonneg_num
num_machines = nonneg_num num_machines = nonneg_num
machine = nonneg_num machine = nonneg_num
duration = nonneg_num duration = nonneg_num
# task data for 1 job // task data for 1 job
job_data = ' '* machine ' '+ duration (' '+ machine ' '+ duration)* trim_ws eol job_data = ' '* machine ' '+ duration (' '+ machine ' '+ duration)* trim_ws eol
""" """