sortSpec.collation = env.getDefaultCollationName(); if (isKeyword("ascending")) { nextToken(); } else if (isKeyword("descending")) { sortSpec.ascending = false; nextToken(); if (isKeyword("empty")) { nextToken(); if (isKeyword("greatest")) { sortSpec.emptyLeast = false; nextToken(); } else if (isKeyword("least")) { sortSpec.emptyLeast = true; nextToken(); if (isKeyword("collation")) { sortSpec.collation = readCollationName();
sortSpec.collation = env.getDefaultCollationName(); if (isKeyword("ascending")) { nextToken(); } else if (isKeyword("descending")) { sortSpec.ascending = false; nextToken(); if (isKeyword("empty")) { nextToken(); if (isKeyword("greatest")) { sortSpec.emptyLeast = false; nextToken(); } else if (isKeyword("least")) { sortSpec.emptyLeast = true; nextToken(); if (isKeyword("collation")) { sortSpec.collation = readCollationName();
/** * Parse "declare default order empty (least|greatest)" * * @throws XPathException if parsing fails */ private void parseDefaultOrder() throws XPathException { if (foundEmptyOrderingDeclaration) { grumble("empty ordering declaration appears more than once", "XQST0069"); } foundEmptyOrderingDeclaration = true; nextToken(); if (!isKeyword("empty")) { grumble("After 'declare default order', expected keyword 'empty'"); } nextToken(); if (isKeyword("least")) { ((QueryModule) env).setEmptyLeast(true); } else if (isKeyword("greatest")) { ((QueryModule) env).setEmptyLeast(false); } else { grumble("After 'declare default order empty', expected keyword 'least' or 'greatest'"); } nextToken(); }
/** * Parse "declare default order empty (least|greatest)" * * @throws XPathException if parsing fails */ private void parseDefaultOrder() throws XPathException { if (foundEmptyOrderingDeclaration) { grumble("empty ordering declaration appears more than once", "XQST0069"); } foundEmptyOrderingDeclaration = true; nextToken(); if (!isKeyword("empty")) { grumble("After 'declare default order', expected keyword 'empty'"); } nextToken(); if (isKeyword("least")) { ((QueryModule) env).setEmptyLeast(true); } else if (isKeyword("greatest")) { ((QueryModule) env).setEmptyLeast(false); } else { grumble("After 'declare default order empty', expected keyword 'least' or 'greatest'"); } nextToken(); }
sImport.locationURIs = new ArrayList<>(5); nextToken(); if (isKeyword("namespace")) { prefix = readNamespaceBinding(); } else if (isKeyword("default")) { nextToken(); if (!isKeyword("element")) { grumble("In 'import schema', expected 'element namespace'"); if (!isKeyword("namespace")) { grumble("In 'import schema', expected keyword 'namespace'"); sImport.namespaceURI = uri; nextToken(); if (isKeyword("at")) { nextToken(); expect(Token.STRING_LITERAL);
sImport.locationURIs = new ArrayList<>(5); nextToken(); if (isKeyword("namespace")) { prefix = readNamespaceBinding(); } else if (isKeyword("default")) { nextToken(); if (!isKeyword("element")) { grumble("In 'import schema', expected 'element namespace'"); if (!isKeyword("namespace")) { grumble("In 'import schema', expected keyword 'namespace'"); sImport.namespaceURI = uri; nextToken(); if (isKeyword("at")) { nextToken(); expect(Token.STRING_LITERAL);
} else if (t.currentToken == Token.FOR_TUMBLING || t.currentToken == Token.FOR_SLIDING) { parseWindowClause(flwor, clauseList); } else if (t.currentToken == Token.WHERE || isKeyword("where")) { nextToken(); Expression condition = parseExprSingle(); clauseList.add(clause); foundWhere = true; } else if (isKeyword("stable") || isKeyword("order")) { if (isKeyword("stable")) { nextToken(); if (!isKeyword("order")) { grumble("'stable' must be followed by 'order by'"); t.setState(Tokenizer.BARE_NAME_STATE); nextToken(); if (!isKeyword("by")) { grumble("'order' must be followed by 'by'");
((QueryModule) env).addImportedNamespace(mImport.namespaceURI); nextToken(); if (isKeyword("at")) { do { nextToken();
((QueryModule) env).addImportedNamespace(mImport.namespaceURI); nextToken(); if (isKeyword("at")) { do { nextToken();
if (isKeyword("collation")) { nextToken(); expect(Token.STRING_LITERAL);
if (isKeyword("collation")) { nextToken(); expect(Token.STRING_LITERAL);
boolean foundOneCatch = false; List<QNameTest> tests = new ArrayList<>(); while (isKeyword("catch")) { tests.clear(); foundOneCatch = true;
clause.setIsSlidingWindow(t.currentToken == Token.FOR_SLIDING); nextToken(); if (!isKeyword("window")) { grumble("after 'sliding' or 'tumbling', expected 'window', but found " + currentTokenDisplay()); nextToken(); clause.initSequence(flwor, parseExprSingle()); if (!isKeyword("start")) { grumble("in window clause, expected 'start', but found " + currentTokenDisplay()); if (isKeyword("at")) { nextToken(); LocalVariableBinding startPositionVar = new LocalVariableBinding(readVariableName(), SequenceType.SINGLE_INTEGER); if (isKeyword("previous")) { nextToken(); LocalVariableBinding startPreviousItemVar = new LocalVariableBinding(readVariableName(), windowItemTypeOptional); if (isKeyword("next")) { nextToken(); LocalVariableBinding startNextItemVar = new LocalVariableBinding(readVariableName(), windowItemTypeOptional); if (!isKeyword("when")) { grumble("Expected 'when' condition for window start, but found " + currentTokenDisplay()); nextToken(); clause.initStartCondition(flwor, parseExprSingle()); if (isKeyword("only")) { clause.setIncludeUnclosedWindows(false);
clause.setIsSlidingWindow(t.currentToken == Token.FOR_SLIDING); nextToken(); if (!isKeyword("window")) { grumble("after 'sliding' or 'tumbling', expected 'window', but found " + currentTokenDisplay()); nextToken(); clause.initSequence(flwor, parseExprSingle()); if (!isKeyword("start")) { grumble("in window clause, expected 'start', but found " + currentTokenDisplay()); if (isKeyword("at")) { nextToken(); LocalVariableBinding startPositionVar = new LocalVariableBinding(readVariableName(), SequenceType.SINGLE_INTEGER); if (isKeyword("previous")) { nextToken(); LocalVariableBinding startPreviousItemVar = new LocalVariableBinding(readVariableName(), windowItemTypeOptional); if (isKeyword("next")) { nextToken(); LocalVariableBinding startNextItemVar = new LocalVariableBinding(readVariableName(), windowItemTypeOptional); if (!isKeyword("when")) { grumble("Expected 'when' condition for window start, but found " + currentTokenDisplay()); nextToken(); clause.initStartCondition(flwor, parseExprSingle()); if (isKeyword("only")) { clause.setIncludeUnclosedWindows(false);
boolean foundOneCatch = false; List<QNameTest> tests = new ArrayList<>(); while (isKeyword("catch")) { tests.clear(); foundOneCatch = true;
func.setResultType(parseSequenceType()); if (isKeyword("external")) { external = true; } else {
int offset = t.currentTokenStartOffset; nextToken(); if (!isKeyword("item")) { grumble("After 'declare context', expected 'item'");
int offset = t.currentTokenStartOffset; nextToken(); if (!isKeyword("item")) { grumble("After 'declare context', expected 'item'");