[77] NodeTest ::= KindTest | NameTest
[78] NameTest ::= QName | Wildcard
[79] Wildcard ::= "*" | (NCName ":" "*") | ("*" ":" NCName)
************************************************************************/
final public NodeTest parseNodeTest(int axis) throws ParseException, XQueryException {
final NodeTest nt;
NodeType kind = null;
switch(jj_nt.kind) {
case ElementType:
case AttributeType:
case SchemaElementType:
case SchemaAttributeType:
case CommentLparRpar:
case TextLparRpar:
case NodeLparRpar:
case DocumentLpar:
case ProcessingInstructionLpar:
case ElementTypeForKindTest:
case AttributeTypeForKindTest:
case SchemaElementTypeForKindTest:
case SchemaAttributeTypeForKindTest:
case CommentLparRparForKindTest:
case TextLparRparForKindTest:
case NodeLparRparForKindTest:
case DocumentLparForKindTest:
case ProcessingInstructionLparForKindTest:
case ElementTypeForDocumentTest:
case SchemaElementTypeForDocumentTest:
kind = parseKindTest();
nt = new NodeTest(kind);
break;
default:
jj_la1[129] = jj_gen;
if(jj_2_2(3)) {
switch(jj_nt.kind) {
case QName:
//NameTest
currentToken = jj_consume_token(QName);
QualifiedName name = QNameUtil.parse(currentToken.image, namespaceContext, staticContext.getDefaultElementNamespace());
nt = new NodeTest(axis, name);
break;
case NCNameColonStar:
case StarColonNCName:
case Star:
switch(jj_nt.kind) {
case Star:
//Wildcard
currentToken = jj_consume_token(Star);
nt = new NodeTest(axis);
break;
case NCNameColonStar:
//NCName ":" "*"
currentToken = jj_consume_token(NCNameColonStar);
String prefix = currentToken.image.substring(0, currentToken.image.indexOf(':'));
String uri = namespaceContext.getNamespaceURI(prefix);
if(uri == null) {
error("err:XPST0081");
}
name = QNameTable.instantiate(uri, NodeTest.ANY, prefix);
nt = new NodeTest(axis, name);
break;
case StarColonNCName:
//"*" ":" NCName
currentToken = jj_consume_token(StarColonNCName);
String ncname = currentToken.image.substring(currentToken.image.indexOf(':') + 1);
name = QNameTable.instantiate(XMLConstants.NULL_NS_URI, ncname, NodeTest.ANY);
nt = new NodeTest(axis, name);
break;
default:
jj_la1[127] = jj_gen;
jj_consume_token(-1);
throw new ParseException();