Repository navigation
Parse CMake generator expressions to a tree, evaluate it separately - #368
Merged
Merged
Conversation
Generator expressions were evaluated as they were read: the text was split at colons and commas on the way to a value. `cmake/generator_syntax.py` parses text to a `Template` of literal parts and `Expression`s, each with its name and the rest after its first colon, as written and where it is; `generator_expressions` evaluates that tree. The rest is not split by the parser: what a comma means is the expression's (`$<IF:c,a,b>` takes three arguments, `$<1:a,b>` the value `a,b`), so its evaluation splits it. The evaluation's tests are unchanged, and pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #368 +/- ##
=======================================
Coverage 99.68% 99.68%
=======================================
Files 311 312 +1
Lines 19734 19768 +34
Branches 2303 2307 +4
=======================================
+ Hits 19672 19706 +34
Misses 62 62 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Part of #300 (principle 1: parse to a tree, evaluate separately; the last reader that evaluated as it read)
Generator expressions were evaluated as they were read: the text was split at colons and commas on the way to a value. They're now parsed and evaluated in two layers, as #300's step 6 did for GitHub expressions and CMake
if().cmake/generator_syntax.py): text becomes aTemplateof literal parts andExpressions. Each expression has its name, the rest after its first colon outside nested expressions, its text as written, and where it is in the text.$<IF:c,a,b>takes three arguments, while$<1:a,b>is the valuea,b. The evaluator splits it.$<is text to the end, as before.cmake/generator_expressions.py): walks that tree. Its public functions (generated,test) and their tests are unchanged.Verified:
🤖 Generated with Claude Code
https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt