feat: add suppressive captures (@_ syntax)#243
Merged
Conversation
Suppressive captures match structurally but don't contribute to output. Syntax: - @_ : anonymous suppressive (bare underscore) - @_name : named suppressive (underscore prefix) Implementation: - Lexer: SuppressiveCapture token (@_[a-zA-Z0-9_]*) - Parser: handled in try_parse_capture() - Compiler: SuppressBegin/SuppressEnd effects bracket inner - VM: depth counter skips effects when depth > 0 - Trace: diamond symbols for suppressed effects Also unifies capture token lexing: - Regular captures (@name) now single CaptureToken (was At + Id) - Symmetric with SuppressiveCapture - Simplifies parser, call sites strip @ with [1..]
448a728 to
51c38e7
Compare
@_ syntax)
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.
Summary
Adds suppressive captures (
@_and@_namesyntax) for matching patterns structurally without contributing to output.Changes
SuppressiveCapturetoken (@_[a-zA-Z0-9_]*) withis_suppressive()AST methodTypeFlow::Void(no fields created)SuppressBegin/SuppressEndopcodes bracket suppressed regionssuppress_depthcounter skips effect emission when > 0, restored on backtrack⬥for entering/exiting suppression,⬦for suppressed effectsExample
Output only includes
nameandbody, not the parameters.Testing