Skip to content

Conversation

@sebastienros
Copy link
Owner

No description provided.

@sebastienros sebastienros requested a review from Copilot October 25, 2025 22:43
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR optimizes quoted string parsing by eliminating an unnecessary TextSpan allocation. The changes introduce a new overload of DecodeString that accepts string, offset, and length parameters directly, allowing the code to avoid creating an intermediate TextSpan object when the string contains no escape sequences.

Key changes:

  • Added DecodeString(string, int, int) overload to avoid allocating TextSpan when no escapes are present
  • Refactored escape sequence processing into DecodeStringInternal to share logic across overloads
  • Updated StringLiteral parser to use the new optimized method signature

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/Parlot/Character.cs Adds new DecodeString overload and refactors internal logic for string decoding
src/Parlot/Fluent/StringLiteral.cs Updates to use the new DecodeString(string, int, int) method signature
test/Parlot.Tests/CharacterTests.cs Adds tests for the new DecodeString overload with offset/length parameters
test/Parlot.Tests/CompileTests.cs Adds test coverage for both compiled and non-compiled string literal parsing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sebastienros sebastienros merged commit 0d4d8e5 into main Oct 25, 2025
1 check passed
@sebastienros sebastienros deleted the sebros/decode branch October 25, 2025 22:47
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.

2 participants