Skip to content

Implement vars, choose/when, and expressions#32

Merged
kailan merged 49 commits intomainfrom
tyler/vars
Jan 15, 2025
Merged

Implement vars, choose/when, and expressions#32
kailan merged 49 commits intomainfrom
tyler/vars

Conversation

@tyler
Copy link
Member

@tyler tyler commented Dec 4, 2024

  • Basic variable assignment (esi:assign)
  • Short form esi:vars
  • Long form esi:vars
  • Expression parsing and evaluation
  • esi:choose & esi:when
    • parse
    • interpret
  • matches operator
    • also matches_i
    • implement regex matching
    • expose captures (requires map vars)
    • respect matchname parameter
  • triple tick strings
  • minimal stdlib
    • function calls
    • implement library calls
      • lower
      • html_encode
      • replace
  • map variables
  • request metadata
    • host, method, querystring
    • headers in general? (what else is needed here in the short term?)

Cleanup tasks

  • revamp the parser to identify expressions in raw text (I think this is ultimately a separate parser from the expression parser. They're similar but not identical.)
  • identify function calls correctly (i.e. $fn($(var), ...) is valid in raw text ESI contexts
  • make sure we're interpolating in the right contexts (i.e. inside a vars, when, try, long form assign, etc) and not others
  • refactor EvalContext and Variables
  • differentiate interpreter errors (they all come out as Parse errors right now)
  • make the messages in those interp errors actually useful
  • make sure errors in the interpreter all bubble out of Value::Error, rather than real errors
    • returning a Value::Error should log, but otherwise be interpreted as a Null (I think?!)
  • fix all todo!() calls

@tyler tyler changed the title Implement ESI Vars Implement a vars, choose/when, and expressions Dec 5, 2024
@tyler tyler changed the title Implement a vars, choose/when, and expressions Implement vars, choose/when, and expressions Dec 5, 2024
@tyler tyler marked this pull request as ready for review December 10, 2024 21:34
vagetman
vagetman previously approved these changes Dec 15, 2024
Copy link
Member

@kailan kailan left a comment

Choose a reason for hiding this comment

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

Really pleased with this, thanks so much both for your hard work and for your patience while I get it reviewed. Just a few areas to address in regards to error handling but I'm happy for this to be released once the printlns are gone.

Copy link
Member

@kailan kailan left a comment

Choose a reason for hiding this comment

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

This is good to go! Thanks again. Really pleased about this.

@kailan kailan merged commit f7ac889 into main Jan 15, 2025
1 check passed
@kailan kailan deleted the tyler/vars branch January 15, 2025 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants