Skip to content

[codex] Fix multi-line string tokenization#28

Merged
kjonescertinia merged 1 commit into
mainfrom
codex-fix-multiline-string-tokenizer
May 12, 2026
Merged

[codex] Fix multi-line string tokenization#28
kjonescertinia merged 1 commit into
mainfrom
codex-fix-multiline-string-tokenizer

Conversation

@nawforce

Copy link
Copy Markdown
Contributor

Summary

Fixes #27.

Adds explicit support for Summer '26 Apex multi-line string literals that begin with triple single quotes followed by a newline. The outline parser now consumes the literal through the matching closing triple quote instead of treating body apostrophes as regular string delimiters.

Root Cause

consumeStringLiteral handled every single quote as the start or end of a regular Apex string. For triple-quoted literals, an odd number of apostrophes in the body could leave a quote unmatched and make scanning run to EOF.

Changes

  • Detect valid triple-quoted openings only when followed by a newline, preserving legacy handling for malformed same-line patterns.
  • Consume multi-line string bodies until a matching closing triple quote while preserving existing escape handling.
  • Update newline position tracking while consuming multi-line strings so method/body locations remain correct.
  • Add smoke tests for balanced bodies, odd apostrophe counts, doubled quotes, unbalanced braces in the string body, and malformed triple-quote fallback.

Validation

  • sbt "parserJVM/testOnly io.github.apexdevtools.oparser.SmokeTest"

@nawforce nawforce requested a review from kjonescertinia May 12, 2026 09:04
@kjonescertinia kjonescertinia marked this pull request as ready for review May 12, 2026 10:22
@kjonescertinia kjonescertinia merged commit 8c7c580 into main May 12, 2026
1 check passed
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.

Summer '26 multi-line strings break tokenizer when body contains an odd number of single quotes

2 participants