Skip to content

Feat/cleanup parser #52

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

Draft
wants to merge 33 commits into
base: main
Choose a base branch
from
Draft

Feat/cleanup parser #52

wants to merge 33 commits into from

Conversation

janbridley
Copy link
Collaborator

@janbridley janbridley commented Aug 22, 2025

Description

  • The following syntax is now supported:
_my_data_label
'my data entry on a newline'
  • Citations for particular features of the CIF spec have been added to parsnip/patterns.py
  • Errors when parsing tables are now handled with helpful messages, preventing confusion for end users.
  • Keys on the final line of a file are now processed correctly
  • Text strings containing "#" (which are not allowed by the spec, but are included in some cases) are now properly processed.
  • CIF 2.0 """ and ''' strings are now tested and handled correctly
  • Comments on loop keyword lines are properly handled

Motivation and Context

As several group members are using COD CIF files, I wanted to make sure we were correctly parsing those cases. This PR handles a few new parsing patterns that did not appear in AFLOW files, and significantly cleans up the regular expression backend of the parser. In particular, I've removed all but one case that could result in backtracking, and have aligned a few patterns to match the CIF spec more precisely.

Types of Changes

  • Documentation update
  • Bug fix
  • New feature
  • Breaking change1

1The change breaks (or has the potential to break) existing functionality and should be merged into the breaking branch

Checklist:

  • I am familiar with the Development Guidelines
  • The changes introduced by this pull request are covered by existing or newly introduced tests.
  • I have updated the changelog and added my name to the credits.

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.

1 participant