Conversation
This reverts commit a192159.
`vector<subrange<...>>` needs special handling
saki7
reviewed
Mar 5, 2026
saki7
reviewed
Mar 5, 2026
This comment has been minimized.
This comment has been minimized.
This reverts commit 6c7a2e8.
This comment has been minimized.
This comment has been minimized.
This comment was marked as off-topic.
This comment was marked as off-topic.
saki7
approved these changes
Mar 6, 2026
Member
|
𝑺𝒖𝒑𝒆𝒓 𝑻𝒉𝒂𝒏𝒌𝒔 |
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.
partially addresses #25
supersedes and closes #50
including:
is_substitutetocan_holdparse_into_containerwith constexpr ifraw,_whereand subrange-related stuff from the entire codebaseTodo
pass_attibute_as_is->pass_attribute_as_isbuild_containertodefault_containerfix-swapped-template-argumentrawdirectiveRemoveAfter some investigation, I think it's impossibleunused_containerandassume_containerif possibleMoveI think this can be placed undercan_holdtocoretraitsRemoval of the
rawdirectiveWhat
rawdoesThe
rawdirective wraps an inner parser and produces the iterator range (begin/end pair) of the successfully matched input as its attribute, instead of the semantic value that the inner parser would normally yield.Use cases
A typical use case is extracting the raw matched substring from the input. For example, while
int_produces anintas its attribute,raw[int_]produces the iterator pair corresponding to the matched portion of the input. This can be useful for retaining the original string representation of parsed content or recording source positions for error reporting.The problem
Internally, the library needs to determine whether a parser's attribute is compatible with container types (e.g.,
std::vector) when resolving exposed attributes. Withrawin the picture, the attribute type becomes an iterator pair, which means the iterator type must be known to perform this compatibility check accurately.However, the iterator type depends on the input source and is not available at parser definition time. This fundamentally conflicts with the design goal of determining attribute compatibility statically from the parser definition alone. Supporting
rawcorrectly would require propagating the iterator type as a template parameter throughout the attribute compatibility logic, significantly complicating the library's internals.Rationale for removal
The use cases for
raware relatively niche, and most of them can be addressed by creating a custom parser class that deals with the actual iterator and sentinel positions directly. Note that_where, which is already deprecated in favor ofraw, should also be fully removed as part of this change. Given the disproportionate complexityrawintroduces into the type system, its removal is a reasonable trade-off in favor of a cleaner and more consistent internal design.