WIP: Attribute system improvements + \K regex fix#423
Merged
Conversation
Implement \K (keep left) assertion in s/// and m// operators. Previously \K was silently stripped from patterns, causing incorrect substitution behavior. Now \K correctly preserves text before the assertion point during replacement. Implementation: - RegexPreprocessorHelper: Convert \K to named capture group that marks the keep position - RuntimeRegex: In substitution, replace only from \K position to match end instead of full match. In match, adjust match vars accordingly - Propagate hasBackslashK flag through getReplacementRegex copies - Adjust capture group numbering to skip the internal perlK group With \K working, restore variable attribute validation: - OperatorParser: Re-add compile-time error for our variables without MODIFY_*_ATTRIBUTES handler - Attributes.java: Re-add runtime error for my/state variables without handler Test improvements (+27 tests): - attrs.t: 148->156 (+8), uni/attrs.t: 30->33 (+3) - decl-refs.t: 330->346 (+16) Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
When my ($x,$y) : attr is parsed, the 'attributes' annotation is placed on the parent OperatorNode but was not propagated to individual variable nodes during list expansion. This caused runtime attribute dispatch to silently skip list variable declarations. Fix in both backends: - JVM emitter (EmitVariable.java): propagate parent attribute annotations to each child my/state node in list expansion - Interpreter (BytecodeCompiler.java): call emitVarAttrsIfNeeded for each variable in list declarations Test improvements (+4): - attrs.t: 156->158 (only TODO test 155 remains) - uni/attrs.t: 33->35/35 (fully passing) Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Attribute test suite is now at 97.6% pass rate (248/254): - attrs.t: 158/159 (only TODO test remains) - uni/attrs.t: 35/35 (fully passing) - attrproto.t: 51/52 - attrhand.t: 4/4 Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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
Continuation of attribute system work from PR #420. This PR focuses on:
\K Regex Assertion Fix
s///andm//operators$&,\``,@-,@+` for \K-affected matches$1,$2, etc.Attribute Validation Restored
ourvariables without handlermy/statevariables without handlerTest Improvements (+27 tests)
All other attribute tests unchanged.
makepasses.Next Steps (from dev/design/attributes.md)
Test plan
makepasses (all unit tests)Generated with Devin