Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise specification after section #121

Merged
merged 3 commits into from
Jun 24, 2024
Merged

Conversation

leonlan
Copy link
Member

@leonlan leonlan commented Jun 24, 2024

This PR raises a ValueError when a specification is introduced after a section. Closes #118.

@leonlan leonlan changed the title Raise section before specification Raise specification after section Jun 24, 2024
@leonlan leonlan requested a review from N-Wouda June 24, 2024 19:08
@leonlan
Copy link
Member Author

leonlan commented Jun 24, 2024

This is probably the last thing I want to include with the current parser because it's getting too messy 😅. I'll have a go at a VRPLIB grammar soon.

@N-Wouda
Copy link
Member

N-Wouda commented Jun 24, 2024

This also closes #118, right?

@@ -79,6 +77,9 @@ def group_specifications_and_sections(lines: list[str]):
end_section = start + 1

for next_line in lines[start + 1 :]:
if ":" in next_line:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a sufficient test for a specification? (probably yes but can there ever be data in a section with a colon in it?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot think of any data section that must include :'s. Only thing I can think of are strings but we should probably avoid strings in data sections as they can often be mapped to numerical values. I think we're OK if we define the VRPLIB standard to reserve : as a specifications identifier.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am excited about having a grammar for this so we can definitively say what's OK and what's not 😆.

@leonlan leonlan linked an issue Jun 24, 2024 that may be closed by this pull request
@leonlan
Copy link
Member Author

leonlan commented Jun 24, 2024

This also closes #118, right?

Yea, linked it to the PR!

@leonlan leonlan merged commit 3c9e2f4 into main Jun 24, 2024
5 checks passed
@leonlan leonlan deleted the raise-section-before-specification branch June 24, 2024 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ordering issue in VRPLIB files
2 participants