interactive icon indicating copy to clipboard operation
interactive copied to clipboard

Support for escaping curly braces in embedded expression

Open bleaphar opened this issue 8 months ago • 0 comments

This pull request introduces support for escaped character sequences in HTTP syntax parsing, enabling the handling of complex scenarios such as escaped curly braces within variable values. Key changes include the addition of a new syntax node for escaped characters, updates to parsing logic, and corresponding tests.

Parsing Enhancements:

  • Added HttpEscapedCharacterSequenceNode to represent escaped character sequences in the syntax tree. This node trims escape characters (`This pull request introduces support for escaped character sequences in HTTP syntax parsing, enabling the handling of complex scenarios such as escaped curly braces within variable values. Key changes include the addition of a new syntax node for escaped characters, updates to parsing logic, and corresponding tests.

Parsing Enhancements:

) from the text. (src/Microsoft.DotNet.Interactive.Http.Parsing/Parsing/HttpEscapedCharacterSequenceNode.cs)

  • Updated HttpRequestParser to detect and parse escaped character sequences using the new ParseEscapedCharacterSequence method. (src/Microsoft.DotNet.Interactive.Http.Parsing/Parsing/HttpRequestParser.cs) [1] [2] [3] [4]

Syntax Tree Updates:

  • Modified HttpVariableValueNode to support adding HttpEscapedCharacterSequenceNode as a child node. (src/Microsoft.DotNet.Interactive.Http.Parsing/Parsing/HttpVariableValueNode.cs)
  • Enhanced HttpRootSyntaxNode to process escaped character sequences when resolving variable values, ensuring proper handling of escaped braces. (src/Microsoft.DotNet.Interactive.Http.Parsing/Parsing/HttpRootSyntaxNode.cs)

Testing:

  • Added unit tests to validate support for escaped curly braces and triple-escaped curly braces in variable values. (src/Microsoft.DotNet.Interactive.Http.Tests/ParserTests.Variables.cs)

bleaphar avatar Jun 05 '25 23:06 bleaphar