|
39 | 39 | import com.semmle.js.ast.XMLAttributeSelector; |
40 | 40 | import com.semmle.js.ast.XMLDotDotExpression; |
41 | 41 | import com.semmle.js.ast.XMLFilterExpression; |
42 | | -import com.semmle.js.ast.XMLQualifiedIdentifier; |
43 | 42 | import com.semmle.util.data.Either; |
44 | 43 | import com.semmle.util.data.Pair; |
45 | 44 |
|
46 | 45 | /** |
47 | 46 | * An extension of the standard jcorn parser with support for Mozilla-specific |
48 | | - * language extension (most of JavaScript 1.8.5) and JScript language extensions. |
| 47 | + * language extension (most of JavaScript 1.8.5 and E4X) and JScript language extensions. |
49 | 48 | */ |
50 | 49 | public class CustomParser extends FlowParser { |
51 | 50 | public CustomParser(Options options, String input, int startPos) { |
@@ -460,27 +459,7 @@ protected Expression parsePropertyIdentifierOrIdentifier() { |
460 | 459 | // attribute identifier |
461 | 460 | return parseAttributeIdentifier(new SourceLocation(start)); |
462 | 461 | } else { |
463 | | - return parsePossiblyQualifiedIdentifier(); |
464 | | - } |
465 | | - } |
466 | | - |
467 | | - /** |
468 | | - * Parse a wildcard identifier, a qualified identifier, or a plain identifier. |
469 | | - */ |
470 | | - protected Expression parsePossiblyQualifiedIdentifier() { |
471 | | - SourceLocation start = new SourceLocation(startLoc); |
472 | | - Expression res = parsePropertySelector(start); |
473 | | - |
474 | | - if (!this.eat(doubleColon)) |
475 | | - return res; |
476 | | - |
477 | | - if (this.eat(TokenType.bracketL)) { |
478 | | - Expression e = parseExpression(false, null); |
479 | | - this.expect(TokenType.bracketR); |
480 | | - return this.finishNode(new XMLQualifiedIdentifier(start, res, e, true)); |
481 | | - } else { |
482 | | - Expression e = parsePropertySelector(new SourceLocation(startLoc)); |
483 | | - return this.finishNode(new XMLQualifiedIdentifier(start, res, e, false)); |
| 462 | + return parsePropertySelector(new SourceLocation(startLoc)); |
484 | 463 | } |
485 | 464 | } |
486 | 465 |
|
@@ -508,7 +487,7 @@ protected Expression parseAttributeIdentifier(SourceLocation start) { |
508 | 487 | this.expect(TokenType.bracketR); |
509 | 488 | return this.finishNode(new XMLAttributeSelector(start, idx, true)); |
510 | 489 | } else { |
511 | | - return this.finishNode(new XMLAttributeSelector(start, parsePossiblyQualifiedIdentifier(), false)); |
| 490 | + return this.finishNode(new XMLAttributeSelector(start, parsePropertySelector(new SourceLocation(startLoc)), false)); |
512 | 491 | } |
513 | 492 | } |
514 | 493 |
|
|
0 commit comments