Repository navigation
fix(parser): end processing instructions at a NUL like Angular - #755
Merged
Brooooooklyn merged 2 commits intoDec 4, 2026
Merged
Conversation
eintim
force-pushed
the
fix/processing-instructions-simple
branch
from
December 4, 2026 06:23
c48b4d8 to
a64b1ea
Compare
eintim
force-pushed
the
fix/processing-instructions-simple
branch
from
December 4, 2026 06:36
a64b1ea to
1339676
Compare
Angular's cursor peeks a NUL as EOF, so `_attemptUntilIgnoreQuotes` stops
there and the instruction ends at the NUL: `<?x\0y?>z` is the instruction
`x` and then the text `y?>z`. We kept scanning to the `?>`. In an escaped
string an escaped NUL (`\0`, `\x00`, `\u0000`, `\u{0}`) does the same; we
also lost the text after it there.
Also port upstream's processing instruction lexer and parser tests, with
extra cases checked against Angular 22.3.0.
eintim
force-pushed
the
fix/processing-instructions-simple
branch
from
December 4, 2026 06:44
1339676 to
2928bb4
Compare
…ing instruction In an escaped string a lone backslash at the end peeks as NUL, so the instruction scan stopped there and `<?x\` became the instruction `x` with no error. Angular moves past the backslash to the end of the input and reports `Unexpected character "EOF"`. `at_nul` is now false there and at the end of the input. Also port the upstream `should store the location of a processing instruction` test, give the ported tests their upstream names with only the upstream cases, move our extra cases into their own tests, check spans in the NUL tests, and move the escape-length docs to `code_point_escape_value_at`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#756 added processing instruction support to the HTML lexer. One case still differs from Angular: a NUL inside the instruction.
Angular's cursor peeks a NUL as EOF but moves past it, so
_attemptUntilIgnoreQuotesstops at the NUL and the instruction ends there. We kept scanning to the?>.<?x\0y?>zx, texty?>zx\0y, textz<?x\\0y?>zin an escaped string (\0,\000,\x00,\u0000,\u{0})x, texty?>zx, andy?>zis lost<?x\in an escaped string (lone trailing backslash)Unexpected character "EOF"Changes
scan_processing_instructionalso stops at a NUL: a raw NUL, or, in an escaped string, an escaped NUL (whichpeekreads as U+FFFD).code_point_escape_value_atgives the escape's code point for that check. A backslash that ends an escaped string also peeks as EOF, but it is not a NUL, so the EOF error stays.describe("processing instructions")) and the parser'sshould ignore processing instruction.?without>,<?ending text and interpolations, and the NUL cases with spans (NUL at the end, NUL inside quotes, backslash before a NUL, trailing backslash).Known differences left for later
A fuzz run (23k inputs vs Angular 22.3.0) shows this PR fixes 3272 mismatches and adds none of its own. These older differences remain; they come from shared escape and line-continuation code, not from the processing instruction scan:
<?"\0"?>z) still loses the text after the instruction (the escaped-string pass cuts the tokens at any NUL; Angular keeps going).<?x\0\u{y): Angular drops the instruction, we keep it.\+ newline) before a quote or a NUL is read differently from Angular.?, an escaped NUL is reported asUnexpected character "�"instead of"EOF".