| 9541 | */ |
| 9542 | |
| 9543 | static void |
| 9544 | xmlXPathCompPathExpr(xmlXPathParserContextPtr ctxt) { |
| 9545 | int lc = 1; /* Should we branch to LocationPath ? */ |
| 9546 | xmlChar *name = NULL; /* we may have to preparse a name to find out */ |
| 9547 | |
| 9548 | SKIP_BLANKS; |
| 9549 | if ((CUR == '$') || (CUR == '(') || |
| 9550 | (IS_ASCII_DIGIT(CUR)) || |
| 9551 | (CUR == '\'') || (CUR == '"') || |
| 9552 | (CUR == '.' && IS_ASCII_DIGIT(NXT(1)))) { |
| 9553 | lc = 0; |
| 9554 | } else if (CUR == '*') { |
| 9555 | /* relative or absolute location path */ |
| 9556 | lc = 1; |
| 9557 | } else if (CUR == '/') { |
| 9558 | /* relative or absolute location path */ |
| 9559 | lc = 1; |
| 9560 | } else if (CUR == '@') { |
| 9561 | /* relative abbreviated attribute location path */ |
| 9562 | lc = 1; |
| 9563 | } else if (CUR == '.') { |
| 9564 | /* relative abbreviated attribute location path */ |
| 9565 | lc = 1; |
| 9566 | } else { |
| 9567 | /* |
| 9568 | * Problem is finding if we have a name here whether it's: |
| 9569 | * - a nodetype |
| 9570 | * - a function call in which case it's followed by '(' |
| 9571 | * - an axis in which case it's followed by ':' |
| 9572 | * - a element name |
| 9573 | * We do an a priori analysis here rather than having to |
| 9574 | * maintain parsed token content through the recursive function |
| 9575 | * calls. This looks uglier but makes the code easier to |
| 9576 | * read/write/debug. |
| 9577 | */ |
| 9578 | SKIP_BLANKS; |
| 9579 | name = xmlXPathScanName(ctxt); |
| 9580 | if ((name != NULL) && (xmlStrstr(name, (xmlChar *) "::") != NULL)) { |
| 9581 | lc = 1; |
| 9582 | xmlFree(name); |
| 9583 | } else if (name != NULL) { |
| 9584 | int len =xmlStrlen(name); |
| 9585 | |
| 9586 | |
| 9587 | while (NXT(len) != 0) { |
| 9588 | if (NXT(len) == '/') { |
| 9589 | /* element name */ |
| 9590 | lc = 1; |
| 9591 | break; |
| 9592 | } else if (IS_BLANK_CH(NXT(len))) { |
| 9593 | /* ignore blanks */ |
| 9594 | ; |
| 9595 | } else if (NXT(len) == ':') { |
| 9596 | lc = 1; |
| 9597 | break; |
| 9598 | } else if ((NXT(len) == '(')) { |
| 9599 | /* Node Type or Function */ |
| 9600 | if (xmlXPathIsNodeType(name)) { |
no test coverage detected