refactor: Applicative parsers - #2532
Merged
Merged
Conversation
rprospero
force-pushed
the
applicative_parser
branch
from
June 23, 2026 17:10
ee5ab59 to
db3c467
Compare
rprospero
force-pushed
the
applicative_parser
branch
from
June 24, 2026 08:30
db3c467 to
e8869c5
Compare
rprospero
force-pushed
the
applicative_parser
branch
from
June 24, 2026 11:25
57273be to
026c85c
Compare
rprospero
marked this pull request as ready for review
June 24, 2026 12:38
trisyoungs
requested changes
Jun 24, 2026
trisyoungs
left a comment
Member
There was a problem hiding this comment.
I really like this. My only minor concern is that the expression of the parser takes a bit of getting used to with << and >> flying around everywhere. But it is cool!
A handful of suggestions sprinkled around the place, mostly flagging the usage of snake_case vs camelCase vs PascalCase.
Co-authored-by: Tristan Youngs <tristan.youngs@stfc.ac.uk>
Co-authored-by: Tristan Youngs <tristan.youngs@stfc.ac.uk>
Co-authored-by: Tristan Youngs <tristan.youngs@stfc.ac.uk>
Co-authored-by: Tristan Youngs <tristan.youngs@stfc.ac.uk>
Co-authored-by: Tristan Youngs <tristan.youngs@stfc.ac.uk>
Co-authored-by: Tristan Youngs <tristan.youngs@stfc.ac.uk>
Co-authored-by: Tristan Youngs <tristan.youngs@stfc.ac.uk>
Co-authored-by: Tristan Youngs <tristan.youngs@stfc.ac.uk>
trisyoungs
approved these changes
Jun 26, 2026
trisyoungs
left a comment
Member
There was a problem hiding this comment.
Love it. One added comment line.
Co-authored-by: Tristan Youngs <tristan.youngs@stfc.ac.uk>
Co-authored-by: Tristan Youngs <tristan.youngs@stfc.ac.uk>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds an applicative parsing library. Additionally, as a proof of concept, the ImportXYZStructure Node and ImportXYZTrajectory Node are both updates to use an applicative parser and remove the dependency on LineParser. If this code looks like a worthwhile avenue, other instances of LineParser can be converted to use the parsers.
Currently, the parser does not return error messages on failed parses, but it's possible to allow for more informative messages in the future if we change
to
As a simple tutorial on how to use the parsers, it's worth starting by looking at tests/io/applicative.cpp, as the tests build up the different combinators.