File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -551,11 +551,13 @@ protected Token readToken(int code) {
551551 // chunk of E4X content and a Flow type annotation (both can start with `<?`)
552552 // hence if we can't find the closing `?>` of a putative XML processing instruction
553553 // we backtrack and try lexing as something else
554+ // to avoid frequent backtracking, we only consider `<?xml ...?>` processing instructions;
555+ // while other processing instructions are technically possible, they are unlikely in practice
554556 if (this .options .e4x ()) {
555557 while (code == '<' ) {
556- if (charAt (this .pos +1 ) == '?' ) {
558+ if (inputSubstring (this .pos +1 , this . pos + 5 ). equals ( "?xml" ) ) {
557559 int oldPos = this .pos ;
558- this .pos += 2 ;
560+ this .pos += 5 ;
559561 if (!jsx_readUntil ("?>" )) {
560562 // didn't find a closing `?>`, so backtrack
561563 this .pos = oldPos ;
You can’t perform that action at this time.
0 commit comments