Skip to content

Conversation

@cawalch
Copy link
Collaborator

@cawalch cawalch commented Mar 8, 2025

This commit introduces the ternary operator (? :) to the expression language.

The following changes were made:

  • Added TernaryNode to AST.type.ts
  • Added TOK_QUESTION to Lexer.ts and Lexer.type.ts
  • Updated Parser.ts to handle the ternary operator
  • Updated TreeInterpreter.ts to evaluate ternary expressions
  • Updated compliance tests (points to feature/ternary-operator branch for now)

refs: jmespath-community/jmespath.spec#179

@cawalch cawalch force-pushed the feature/ternary-operator branch 2 times, most recently from d7cc730 to 469a04e Compare March 8, 2025 21:01
@cawalch cawalch added the enhancement New feature or request label Mar 8, 2025
@cawalch cawalch requested a review from springcomp April 19, 2025 12:54
Copy link
Contributor

@springcomp springcomp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@cawalch cawalch force-pushed the feature/ternary-operator branch 2 times, most recently from 2c54d64 to d561f71 Compare May 11, 2025 12:58
This commit introduces the ternary operator (? :) to the expression language.

The following changes were made:
- Added TernaryNode to AST.type.ts
- Added TOK_QUESTION to Lexer.ts and Lexer.type.ts
- Updated Parser.ts to handle the ternary operator
- Updated TreeInterpreter.ts to evaluate ternary expressions
- Updated compliance tests (points to `feature/ternary-operator` branch for now)

<!-- ps-id: 23d6602d-719c-495d-8421-97a050351f6f -->
@cawalch cawalch force-pushed the feature/ternary-operator branch from d561f71 to 6f69c7d Compare May 11, 2025 13:07
@cawalch cawalch marked this pull request as ready for review May 11, 2025 13:19
@springcomp
Copy link
Contributor

@cawalch

I made some slight changes to the compliance tests to clarify operator precedence and updated the code accordingly.
I’m happy for the code to be merged at your convenience.

@cawalch cawalch merged commit 9e12bf3 into main May 24, 2025
7 checks passed
@springcomp springcomp deleted the feature/ternary-operator branch May 24, 2025 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants