Repository navigation
Match symbols as whole names and validate block structure - #13
Merged
Merged
Conversation
Behavior changes: - #if names are compared exactly instead of via an unescaped substring regex: DEBUG no longer matches DEBUG_X, symbols with regex metacharacters (e.g. C++) work, and an empty symbol matches nothing (previously it matched every #if) - Malformed blocks raise ConditionSyntaxError with the line number, also under python -O. Nesting, stray #else/#endif, and duplicate #else are now detected instead of silently mis-rendering. ConditionSyntaxError subclasses AssertionError for compatibility. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012pKTVb5TrGn27R29rHHNck
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012pKTVb5TrGn27R29rHHNck
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012pKTVb5TrGn27R29rHHNck
This was referenced Oct 26, 2026
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.
Closes #7
Summary
User-visible behavior changes — release as 0.2.0.
symbol: DEBUG,#if DEBUG_X/#if MY_DEBUGsymbol: THAT,#if THIS | THAT | OTHER/#if THIS|THAT|OTHER(#7)|is now an official name separator, alongside whitespacesymbol: C++re.errorcrashsymbolconfigured#iftrue#iffalse#if, extra#endifAssertionError(skipped underpython -O)ConditionSyntaxErrorwith line number, always#if,#elseoutside a block, duplicate#elseConditionSyntaxErrorConditionSyntaxErrorsubclasses bothValueErrorandAssertionError, so existingexcept AssertionErrorcallers keep workingmd_condition; README gains a "Rules" section; CLAUDE.md updatedTest plan
uv run pytest— 23 passed (new: whole-name matching incl. regex metachars and empty symbol,|separators with/without spaces and at the edges, each malformed-block case with line number, AssertionError compatibility)python -O🤖 Generated with Claude Code
https://claude.ai/code/session_012pKTVb5TrGn27R29rHHNck