1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the QtXmlPatterns module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40//
41// W A R N I N G
42// -------------
43//
44// This file is not part of the Qt API. It exists purely as an
45// implementation detail. This header file may change from version to
46// version without notice, or even be removed.
47//
48// We mean it.
49
50/* A Bison parser, made by GNU Bison 3.3.2. */
51
52/* Bison implementation for Yacc-like parsers in C
53
54 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
55 Inc.
56
57 This program is free software: you can redistribute it and/or modify
58 it under the terms of the GNU General Public License as published by
59 the Free Software Foundation, either version 3 of the License, or
60 (at your option) any later version.
61
62 This program is distributed in the hope that it will be useful,
63 but WITHOUT ANY WARRANTY; without even the implied warranty of
64 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
65 GNU General Public License for more details.
66
67 You should have received a copy of the GNU General Public License
68 along with this program. If not, see <http://www.gnu.org/licenses/>. */
69
70/* As a special exception, you may create a larger work that contains
71 part or all of the Bison parser skeleton and distribute that work
72 under terms of your choice, so long as that work isn't itself a
73 parser generator using the skeleton or a modified version thereof
74 as a parser skeleton. Alternatively, if you modify or redistribute
75 the parser skeleton itself, you may (at your option) remove this
76 special exception, which will cause the skeleton and the resulting
77 Bison output files to be licensed under the GNU General Public
78 License without this special exception.
79
80 This special exception was added by the Free Software Foundation in
81 version 2.2 of Bison. */
82
83/* C LALR(1) parser skeleton written by Richard Stallman, by
84 simplifying the original so-called "semantic" parser. */
85
86/* All symbols defined below should begin with yy or YY, to avoid
87 infringing on user name space. This should be done even for local
88 variables, as they might otherwise be expanded by user macros.
89 There are some unavoidable exceptions within include files to
90 define necessary library symbols; they are noted "INFRINGES ON
91 USER NAME SPACE" below. */
92
93/* Undocumented macros, especially those whose name start with YY_,
94 are private implementation details. Do not rely on them. */
95
96/* Identify Bison output. */
97#define YYBISON 1
98
99/* Bison version. */
100#define YYBISON_VERSION "3.3.2"
101
102/* Skeleton name. */
103#define YYSKELETON_NAME "yacc.c"
104
105/* Pure parsers. */
106#define YYPURE 1
107
108/* Push parsers. */
109#define YYPUSH 0
110
111/* Pull parsers. */
112#define YYPULL 1
113
114/* Substitute the type names. */
115#define YYSTYPE XPATHSTYPE
116#define YYLTYPE XPATHLTYPE
117/* Substitute the variable and function names. */
118#define yyparse XPathparse
119#define yylex XPathlex
120#define yyerror XPatherror
121#define yydebug XPathdebug
122#define yynerrs XPathnerrs
123
124
125/* First part of user prologue. */
126#line 50 "querytransformparser.ypp" /* yacc.c:337 */
127
128/****************************************************************************
129**
130** Copyright (C) 2016 The Qt Company Ltd.
131** Contact: https://www.qt.io/licensing/
132**
133** This file is part of the QtXmlPatterns module of the Qt Toolkit.
134**
135** $QT_BEGIN_LICENSE:LGPL$
136** Commercial License Usage
137** Licensees holding valid commercial Qt licenses may use this file in
138** accordance with the commercial license agreement provided with the
139** Software or, alternatively, in accordance with the terms contained in
140** a written agreement between you and The Qt Company. For licensing terms
141** and conditions see https://www.qt.io/terms-conditions. For further
142** information use the contact form at https://www.qt.io/contact-us.
143**
144** GNU Lesser General Public License Usage
145** Alternatively, this file may be used under the terms of the GNU Lesser
146** General Public License version 3 as published by the Free Software
147** Foundation and appearing in the file LICENSE.LGPL3 included in the
148** packaging of this file. Please review the following information to
149** ensure the GNU Lesser General Public License version 3 requirements
150** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
151**
152** GNU General Public License Usage
153** Alternatively, this file may be used under the terms of the GNU
154** General Public License version 2.0 or (at your option) the GNU General
155** Public license version 3 or any later version approved by the KDE Free
156** Qt Foundation. The licenses are as published by the Free Software
157** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
158** included in the packaging of this file. Please review the following
159** information to ensure the GNU General Public License requirements will
160** be met: https://www.gnu.org/licenses/gpl-2.0.html and
161** https://www.gnu.org/licenses/gpl-3.0.html.
162**
163** $QT_END_LICENSE$
164**
165****************************************************************************/
166
167//
168// W A R N I N G
169// -------------
170//
171// This file is not part of the Qt API. It exists purely as an
172// implementation detail. This header file may change from version to
173// version without notice, or even be removed.
174//
175// We mean it.
176
177#include <limits>
178
179#include <QUrl>
180
181#include <private/qabstractfloat_p.h>
182#include <private/qandexpression_p.h>
183#include <private/qanyuri_p.h>
184#include <private/qapplytemplate_p.h>
185#include <private/qargumentreference_p.h>
186#include <private/qarithmeticexpression_p.h>
187#include <private/qatomicstring_p.h>
188#include <private/qattributeconstructor_p.h>
189#include <private/qattributenamevalidator_p.h>
190#include <private/qaxisstep_p.h>
191#include <private/qbuiltintypes_p.h>
192#include <private/qcalltemplate_p.h>
193#include <private/qcastableas_p.h>
194#include <private/qcastas_p.h>
195#include <private/qcombinenodes_p.h>
196#include <private/qcommentconstructor_p.h>
197#include <private/qcommonnamespaces_p.h>
198#include <private/qcommonsequencetypes_p.h>
199#include <private/qcommonvalues_p.h>
200#include <private/qcomputednamespaceconstructor_p.h>
201#include <private/qcontextitem_p.h>
202#include <private/qcopyof_p.h>
203#include <private/qcurrentitemstore_p.h>
204#include <private/qdebug_p.h>
205#include <private/qdelegatingnamespaceresolver_p.h>
206#include <private/qdocumentconstructor_p.h>
207#include <private/qelementconstructor_p.h>
208#include <private/qemptysequence_p.h>
209#include <private/qemptysequencetype_p.h>
210#include <private/qevaluationcache_p.h>
211#include <private/qexpressionfactory_p.h>
212#include <private/qexpressionsequence_p.h>
213#include <private/qexpressionvariablereference_p.h>
214#include <private/qexternalvariablereference_p.h>
215#include <private/qforclause_p.h>
216#include <private/qfunctioncall_p.h>
217#include <private/qfunctionfactory_p.h>
218#include <private/qfunctionsignature_p.h>
219#include <private/qgeneralcomparison_p.h>
220#include <private/qgenericpredicate_p.h>
221#include <private/qgenericsequencetype_p.h>
222#include <private/qifthenclause_p.h>
223#include <private/qinstanceof_p.h>
224#include <private/qletclause_p.h>
225#include <private/qliteral_p.h>
226#include <private/qlocalnametest_p.h>
227#include <private/qnamespaceconstructor_p.h>
228#include <private/qnamespacenametest_p.h>
229#include <private/qncnameconstructor_p.h>
230#include <private/qnodecomparison_p.h>
231#include <private/qnodesort_p.h>
232#include <private/qorderby_p.h>
233#include <private/qorexpression_p.h>
234#include <private/qparsercontext_p.h>
235#include <private/qpath_p.h>
236#include <private/qpatternistlocale_p.h>
237#include <private/qpositionalvariablereference_p.h>
238#include <private/qprocessinginstructionconstructor_p.h>
239#include <private/qqnameconstructor_p.h>
240#include <private/qqnametest_p.h>
241#include <private/qqnamevalue_p.h>
242#include <private/qquantifiedexpression_p.h>
243#include <private/qrangeexpression_p.h>
244#include <private/qrangevariablereference_p.h>
245#include <private/qreturnorderby_p.h>
246#include <private/qschemanumeric_p.h>
247#include <private/qschematypefactory_p.h>
248#include <private/qsimplecontentconstructor_p.h>
249#include <private/qstaticbaseuristore_p.h>
250#include <private/qstaticcompatibilitystore_p.h>
251#include <private/qtemplateparameterreference_p.h>
252#include <private/qtemplate_p.h>
253#include <private/qtextnodeconstructor_p.h>
254#include <private/qtokenizer_p.h>
255#include <private/qtreatas_p.h>
256#include <private/qtypechecker_p.h>
257#include <private/qunaryexpression_p.h>
258#include <private/qunresolvedvariablereference_p.h>
259#include <private/quserfunctioncallsite_p.h>
260#include <private/qvaluecomparison_p.h>
261#include <private/qxpathhelper_p.h>
262#include <private/qxsltsimplecontentconstructor_p.h>
263
264/*
265 * The cpp generated with bison 2.1 wants to
266 * redeclare the C-like prototypes of 'malloc' and 'free', so we avoid that.
267 */
268#define YYMALLOC malloc
269#define YYFREE free
270
271QT_BEGIN_NAMESPACE
272
273/* Due to Qt's QT_BEGIN_NAMESPACE magic, we can't use `using namespace', for some
274 * undocumented reason. */
275namespace QPatternist
276{
277
278/**
279 * "Macro that you define with #define in the Bison declarations
280 * section to request verbose, specific error message strings when
281 * yyerror is called."
282 */
283#define YYERROR_VERBOSE 1
284
285#define YYLTYPE_IS_TRIVIAL 0
286#define YYINITDEPTH 1
287#define yyoverflow parseInfo->handleStackOverflow
288
289/* Suppresses `warning: "YYENABLE_NLS" is not defined`
290 * @c YYENABLE_NLS enables Bison internationalization, and we don't
291 * use that, so disable it. See the Bison Manual, section 4.5 Parser Internationalization.
292 */
293#define YYENABLE_NLS 0
294
295static inline QSourceLocation fromYYLTYPE(const YYLTYPE &sourceLocator,
296 const ParserContext *const parseInfo)
297{
298 return QSourceLocation(parseInfo->tokenizer->queryURI(),
299 sourceLocator.first_line,
300 sourceLocator.first_column);
301}
302
303/**
304 * @internal
305 * @relates QXmlQuery
306 */
307typedef QFlags<QXmlQuery::QueryLanguage> QueryLanguages;
308
309/**
310 * @short Flags invalid expressions and declarations in the currently
311 * parsed language.
312 *
313 * Since this grammar is used for several languages: XQuery 1.0, XSL-T 2.0, and
314 * XPath 2.0 inside XSL-T, and field and selector patterns in W3C XML Schema's
315 * identity constraints, it is the union of all the constructs in these
316 * languages. However, when dealing with each language individually, we
317 * regularly need to disallow some expressions, such as direct element
318 * constructors when parsing XSL-T, or the typeswitch when parsing XPath.
319 *
320 * This is further complicated by that XSLTTokenizer sometimes generates code
321 * which is allowed in XQuery but not in XPath. For that reason the token
322 * INTERNAL is sometimes generated, which signals that an expression, for
323 * instance the @c let clause, should not be flagged as an error, because it's
324 * used for internal purposes.
325 *
326 * Hence, this function is called from each expression and declaration with @p
327 * allowedLanguages stating what languages it is allowed in.
328 *
329 * If @p isInternal is @c true, no error is raised. Otherwise, if the current
330 * language is not in @p allowedLanguages, an error is raised.
331 */
332static void allowedIn(const QueryLanguages allowedLanguages,
333 const ParserContext *const parseInfo,
334 const YYLTYPE &sourceLocator,
335 const bool isInternal = false)
336{
337 /* We treat XPath 2.0 as a subset of XSL-T 2.0, so if XPath 2.0 is allowed
338 * and XSL-T is the language, it's ok. */
339 if(!isInternal &&
340 (!allowedLanguages.testFlag(flag: parseInfo->languageAccent) && !(allowedLanguages.testFlag(flag: QXmlQuery::XPath20) && parseInfo->languageAccent == QXmlQuery::XSLT20)))
341 {
342
343 QString langName;
344
345 switch(parseInfo->languageAccent)
346 {
347 case QXmlQuery::XPath20:
348 langName = QLatin1String("XPath 2.0");
349 break;
350 case QXmlQuery::XSLT20:
351 langName = QLatin1String("XSL-T 2.0");
352 break;
353 case QXmlQuery::XQuery10:
354 langName = QLatin1String("XQuery 1.0");
355 break;
356 case QXmlQuery::XmlSchema11IdentityConstraintSelector:
357 langName = QtXmlPatterns::tr(sourceText: "W3C XML Schema identity constraint selector");
358 break;
359 case QXmlQuery::XmlSchema11IdentityConstraintField:
360 langName = QtXmlPatterns::tr(sourceText: "W3C XML Schema identity constraint field");
361 break;
362 }
363
364 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "A construct was encountered "
365 "which is disallowed in the current language(%1).").arg(a: langName),
366 errorCode: ReportContext::XPST0003,
367 sourceLocation: fromYYLTYPE(sourceLocator, parseInfo));
368
369 }
370}
371
372static inline bool isVariableReference(const Expression::ID id)
373{
374 return id == Expression::IDExpressionVariableReference
375 || id == Expression::IDRangeVariableReference
376 || id == Expression::IDArgumentReference;
377}
378
379class ReflectYYLTYPE : public SourceLocationReflection
380{
381public:
382 inline ReflectYYLTYPE(const YYLTYPE &sourceLocator,
383 const ParserContext *const pi) : m_sl(sourceLocator)
384 , m_parseInfo(pi)
385 {
386 }
387
388 virtual const SourceLocationReflection *actualReflection() const
389 {
390 return this;
391 }
392
393 virtual QSourceLocation sourceLocation() const
394 {
395 return fromYYLTYPE(sourceLocator: m_sl, parseInfo: m_parseInfo);
396 }
397
398 virtual QString description() const
399 {
400 Q_ASSERT(false);
401 return QString();
402 }
403
404private:
405 const YYLTYPE &m_sl;
406 const ParserContext *const m_parseInfo;
407};
408
409/**
410 * @short Centralizes a translation string for the purpose of increasing consistency.
411 */
412static inline QString unknownType()
413{
414 return QtXmlPatterns::tr(sourceText: "%1 is an unknown schema type.");
415}
416
417static inline Expression::Ptr create(Expression *const expr,
418 const YYLTYPE &sourceLocator,
419 const ParserContext *const parseInfo)
420{
421 parseInfo->staticContext->addLocation(reflection: expr, location: fromYYLTYPE(sourceLocator, parseInfo));
422 return Expression::Ptr(expr);
423}
424
425static inline Template::Ptr create(Template *const expr,
426 const YYLTYPE &sourceLocator,
427 const ParserContext *const parseInfo)
428{
429 parseInfo->staticContext->addLocation(reflection: expr, location: fromYYLTYPE(sourceLocator, parseInfo));
430 return Template::Ptr(expr);
431}
432
433static inline Expression::Ptr create(const Expression::Ptr &expr,
434 const YYLTYPE &sourceLocator,
435 const ParserContext *const parseInfo)
436{
437 parseInfo->staticContext->addLocation(reflection: expr.data(), location: fromYYLTYPE(sourceLocator, parseInfo));
438 return expr;
439}
440
441static Expression::Ptr createSimpleContent(const Expression::Ptr &source,
442 const YYLTYPE &sourceLocator,
443 const ParserContext *const parseInfo)
444{
445 return create(expr: parseInfo->isXSLT() ? new XSLTSimpleContentConstructor(source) : new SimpleContentConstructor(source),
446 sourceLocator,
447 parseInfo);
448}
449
450static void loadPattern(const Expression::Ptr &matchPattern,
451 TemplatePattern::Vector &ourPatterns,
452 const TemplatePattern::ID id,
453 const PatternPriority priority,
454 const Template::Ptr &temp)
455{
456 Q_ASSERT(temp);
457
458 const PatternPriority effectivePriority = qIsNaN(d: priority) ? matchPattern->patternPriority() : priority;
459
460 ourPatterns.append(t: TemplatePattern::Ptr(new TemplatePattern(matchPattern, effectivePriority, id, temp)));
461}
462
463static Expression::Ptr typeCheckTemplateBody(const Expression::Ptr &body,
464 const SequenceType::Ptr &reqType,
465 const ParserContext *const parseInfo)
466{
467 return TypeChecker::applyFunctionConversion(operand: body, reqType,
468 context: parseInfo->staticContext,
469 code: ReportContext::XTTE0505,
470 TypeChecker::Options(TypeChecker::AutomaticallyConvert | TypeChecker::GeneratePromotion));
471}
472
473static void registerNamedTemplate(const QXmlName &name,
474 const Expression::Ptr &body,
475 ParserContext *const parseInfo,
476 const YYLTYPE &sourceLocator,
477 const Template::Ptr &temp)
478{
479 Template::Ptr &e = parseInfo->namedTemplates[name];
480
481 if(e)
482 {
483 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "A template with name %1 "
484 "has already been declared.")
485 .arg(a: formatKeyword(np: parseInfo->staticContext->namePool(),
486 name)),
487 errorCode: ReportContext::XTSE0660,
488 sourceLocation: fromYYLTYPE(sourceLocator, parseInfo));
489 }
490 else
491 {
492 e = temp;
493 e->body = body;
494 }
495}
496
497/**
498 * @short Centralizes code for creating numeric literals.
499 */
500template<typename TNumberClass>
501Expression::Ptr createNumericLiteral(const QString &in,
502 const YYLTYPE &sl,
503 const ParserContext *const parseInfo)
504{
505 const Item num(TNumberClass::fromLexical(in));
506
507 if(num.template as<AtomicValue>()->hasError())
508 {
509 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "%1 is not a valid numeric literal.")
510 .arg(a: formatData(data: in)),
511 errorCode: ReportContext::XPST0003, sourceLocation: fromYYLTYPE(sourceLocator: sl, parseInfo));
512 return Expression::Ptr(); /* Avoid compiler warning. */
513 }
514 else
515 return create(expr: new Literal(num), sourceLocator: sl, parseInfo);
516}
517
518/**
519 * @short The generated Bison parser calls this function when there is a parse error.
520 *
521 * It is not called, nor should be, for logical errors(which the Bison not know about). For those,
522 * ReportContext::error() is called.
523 */
524static int XPatherror(YYLTYPE *sourceLocator, const ParserContext *const parseInfo, const char *const msg)
525{
526 Q_UNUSED(sourceLocator);
527 Q_ASSERT(parseInfo);
528
529 parseInfo->staticContext->error(message: escape(input: QLatin1String(msg)), errorCode: ReportContext::XPST0003, sourceLocation: fromYYLTYPE(sourceLocator: *sourceLocator, parseInfo));
530 return 1;
531}
532
533/**
534 * When we want to connect the OrderBy and ReturnOrderBy, it might be that we have other expressions, such
535 * as @c where and @c let inbetween. We need to continue through them. This function does that.
536 */
537static ReturnOrderBy *locateReturnClause(const Expression::Ptr &expr)
538{
539 Q_ASSERT(expr);
540
541 const Expression::ID id = expr->id();
542 if(id == Expression::IDLetClause || id == Expression::IDIfThenClause || id == Expression::IDForClause)
543 return locateReturnClause(expr: expr->operands()[1]);
544 else if(id == Expression::IDReturnOrderBy)
545 return expr->as<ReturnOrderBy>();
546 else
547 return 0;
548}
549
550static inline bool isPredicate(const Expression::ID id)
551{
552 return id == Expression::IDGenericPredicate ||
553 id == Expression::IDFirstItemPredicate;
554}
555
556/**
557 * Assumes expr is an AxisStep wrapped in some kind of predicates or paths. Filters
558 * through the predicates and returns the AxisStep.
559 */
560static Expression::Ptr findAxisStep(const Expression::Ptr &expr,
561 const bool throughStructures = true)
562{
563 Q_ASSERT(expr);
564
565 if(!throughStructures)
566 return expr;
567
568 Expression *candidate = expr.data();
569 Expression::ID id = candidate->id();
570
571 while(isPredicate(id) || id == Expression::IDPath)
572 {
573 const Expression::List &children = candidate->operands();
574 if(children.isEmpty())
575 return Expression::Ptr();
576 else
577 {
578 candidate = children.first().data();
579 id = candidate->id();
580 }
581 }
582
583 if(id == Expression::IDEmptySequence)
584 return Expression::Ptr();
585 else
586 {
587 Q_ASSERT(candidate->is(Expression::IDAxisStep));
588 return Expression::Ptr(candidate);
589 }
590}
591
592static void changeToTopAxis(const Expression::Ptr &op)
593{
594 /* This axis must have been written away by now. */
595 Q_ASSERT(op->as<AxisStep>()->axis() != QXmlNodeModelIndex::AxisChild);
596
597 if(op->as<AxisStep>()->axis() != QXmlNodeModelIndex::AxisSelf)
598 op->as<AxisStep>()->setAxis(QXmlNodeModelIndex::AxisAttributeOrTop);
599}
600
601/**
602 * @short Writes @p operand1 and @p operand2, two operands in an XSL-T pattern,
603 * into an equivalent XPath expression.
604 *
605 * Essentially, the following rewrite is done:
606 *
607 * <tt>
608 * axis1::test1(a)/axis2::test2(b)
609 * =>
610 * child-or-top::test2(b)[parent::test1(a)]
611 * </tt>
612 *
613 * Section 5.5.3 The Meaning of a Pattern talks about rewrites that are applied to
614 * only the first step in a pattern, but since we're doing rewrites more radically,
615 * its line of reasoning cannot be followed.
616 *
617 * Keep in mind the rewrites that non-terminal PatternStep do.
618 *
619 * @see createIdPatternPath()
620 */
621static inline Expression::Ptr createPatternPath(const Expression::Ptr &operand1,
622 const Expression::Ptr &operand2,
623 const QXmlNodeModelIndex::Axis axis,
624 const YYLTYPE &sl,
625 const ParserContext *const parseInfo)
626{
627 const Expression::Ptr operandL(findAxisStep(expr: operand1, throughStructures: false));
628
629 if(operandL->is(i: Expression::IDAxisStep))
630 operandL->as<AxisStep>()->setAxis(axis);
631 else
632 findAxisStep(expr: operand1)->as<AxisStep>()->setAxis(axis);
633
634 return create(expr: GenericPredicate::create(sourceExpression: operand2, predicateExpression: operandL,
635 context: parseInfo->staticContext, location: fromYYLTYPE(sourceLocator: sl, parseInfo)), sourceLocator: sl, parseInfo);
636}
637
638/**
639 * @short Performs the same role as createPatternPath(), but is tailored
640 * for @c fn:key() and @c fn:id().
641 *
642 * @c fn:key() and @c fn:id() can be part of path patterns(only as the first step,
643 * to be precise) and that poses a challenge to rewriting because what
644 * createPatternPath() is not possible to express, since the functions cannot be
645 * node tests. E.g, this rewrite is not possible:
646 *
647 * <tt>
648 * id-or-key/abc
649 * =>
650 * child-or-top::abc[parent::id-or-key]
651 * </tt>
652 *
653 * Our approach is to rewrite like this:
654 *
655 * <tt>
656 * id-or-key/abc
657 * =>
658 * child-or-top::abc[parent::node is id-or-key]
659 * </tt>
660 *
661 * @p operand1 is the call to @c fn:key() or @c fn:id(), @p operand2
662 * the right operand, and @p axis the target axis to rewrite to.
663 *
664 * @see createPatternPath()
665 */
666static inline Expression::Ptr createIdPatternPath(const Expression::Ptr &operand1,
667 const Expression::Ptr &operand2,
668 const QXmlNodeModelIndex::Axis axis,
669 const YYLTYPE &sl,
670 const ParserContext *const parseInfo)
671{
672 const Expression::Ptr operandR(findAxisStep(expr: operand2));
673 Q_ASSERT(operandR);
674 changeToTopAxis(op: operandR);
675
676 const Expression::Ptr parentStep(create(expr: new AxisStep(axis, BuiltinTypes::node),
677 sourceLocator: sl,
678 parseInfo));
679 const Expression::Ptr isComp(create(expr: new NodeComparison(parentStep,
680 QXmlNodeModelIndex::Is,
681 operand1),
682 sourceLocator: sl,
683 parseInfo));
684
685 return create(expr: GenericPredicate::create(sourceExpression: operandR, predicateExpression: isComp,
686 context: parseInfo->staticContext, location: fromYYLTYPE(sourceLocator: sl, parseInfo)), sourceLocator: sl, parseInfo);
687}
688
689/**
690 * @short Centralizes a translation message, for the
691 * purpose of consistency and modularization.
692 */
693static inline QString prologMessage(const char *const msg)
694{
695 Q_ASSERT(msg);
696 return QtXmlPatterns::tr(sourceText: "Only one %1 declaration can occur in the query prolog.").arg(a: formatKeyword(keyword: msg));
697}
698
699/**
700 * @short Resolves against the static base URI and checks that @p collation
701 * is a supported Unicode Collation.
702 *
703 * "If a default collation declaration specifies a collation by a
704 * relative URI, that relative URI is resolved to an absolute
705 * URI using the base URI in the static context."
706 *
707 * @returns the Unicode Collation properly resolved, if @p collation is a valid collation
708 */
709template<const ReportContext::ErrorCode errorCode>
710static QUrl resolveAndCheckCollation(const QString &collation,
711 const ParserContext *const parseInfo,
712 const YYLTYPE &sl)
713{
714 Q_ASSERT(parseInfo);
715 const ReflectYYLTYPE ryy(sl, parseInfo);
716
717 QUrl uri(AnyURI::toQUrl<ReportContext::XQST0046>(value: collation, context: parseInfo->staticContext, r: &ryy));
718
719 if(uri.isRelative())
720 uri = parseInfo->staticContext->baseURI().resolved(relative: uri);
721
722 XPathHelper::checkCollationSupport<errorCode>(uri.toString(), parseInfo->staticContext, &ryy);
723
724 return uri;
725}
726
727/* The Bison generated parser declares macros that aren't used
728 * so suppress the warnings by fake usage of them.
729 *
730 * We do the same for some more defines in the first action. */
731#if defined(YYLSP_NEEDED) \
732 || defined(YYBISON) \
733 || defined(YYBISON_VERSION) \
734 || defined(YYPURE) \
735 || defined(yydebug) \
736 || defined(YYSKELETON_NAME)
737#endif
738
739/**
740 * Wraps @p operand with a CopyOf in case it makes any difference.
741 *
742 * There is no need to wrap the return value in a call to create(), it's
743 * already done.
744 */
745static Expression::Ptr createCopyOf(const Expression::Ptr &operand,
746 const ParserContext *const parseInfo,
747 const YYLTYPE &sl)
748{
749 return create(expr: new CopyOf(operand, parseInfo->inheritNamespacesMode,
750 parseInfo->preserveNamespacesMode), sourceLocator: sl, parseInfo);
751}
752
753static Expression::Ptr createCompatStore(const Expression::Ptr &expr,
754 const YYLTYPE &sourceLocator,
755 const ParserContext *const parseInfo)
756{
757 return create(expr: new StaticCompatibilityStore(expr), sourceLocator, parseInfo);
758}
759
760/**
761 * @short Creates an Expression that corresponds to <tt>/</tt>. This is literally
762 * <tt>fn:root(self::node()) treat as document-node()</tt>.
763 */
764static Expression::Ptr createRootExpression(const ParserContext *const parseInfo,
765 const YYLTYPE &sl)
766{
767 Q_ASSERT(parseInfo);
768 const QXmlName name(StandardNamespaces::fn, StandardLocalNames::root);
769
770 Expression::List args;
771 args.append(t: create(expr: new ContextItem(), sourceLocator: sl, parseInfo));
772
773 const ReflectYYLTYPE ryy(sl, parseInfo);
774
775 const Expression::Ptr fnRoot(parseInfo->staticContext->functionSignatures()
776 ->createFunctionCall(name, arguments: args, context: parseInfo->staticContext, r: &ryy));
777 Q_ASSERT(fnRoot);
778
779 return create(expr: new TreatAs(create(expr: fnRoot, sourceLocator: sl, parseInfo), CommonSequenceTypes::ExactlyOneDocumentNode), sourceLocator: sl, parseInfo);
780}
781
782static int XPathlex(YYSTYPE *lexVal, YYLTYPE *sourceLocator, const ParserContext *const parseInfo)
783{
784#ifdef Patternist_DEBUG_PARSER
785 /**
786 * "External integer variable set to zero by default. If yydebug
787 * is given a nonzero value, the parser will output information on
788 * input symbols and parser action. See section Debugging Your Parser."
789 */
790# define YYDEBUG 1
791
792 extern int XPathdebug;
793 XPathdebug = 1;
794#endif
795
796 Q_ASSERT(parseInfo);
797
798 const Tokenizer::Token tok(parseInfo->tokenizer->nextToken(sourceLocator));
799
800 (*lexVal).sval = tok.value;
801
802 return static_cast<int>(tok.type);
803}
804
805/**
806 * @short Creates a path expression which contains the step <tt>//</tt> between
807 * @p begin and and @p end.
808 *
809 * <tt>begin//end</tt> is a short form for: <tt>begin/descendant-or-self::node()/end</tt>
810 *
811 * This will be compiled as two-path expression: <tt>(/)/(//.)/step/</tt>
812 */
813static Expression::Ptr createSlashSlashPath(const Expression::Ptr &begin,
814 const Expression::Ptr &end,
815 const YYLTYPE &sourceLocator,
816 const ParserContext *const parseInfo)
817{
818 const Expression::Ptr twoSlash(create(expr: new AxisStep(QXmlNodeModelIndex::AxisDescendantOrSelf, BuiltinTypes::node), sourceLocator, parseInfo));
819 const Expression::Ptr p1(create(expr: new Path(begin, twoSlash), sourceLocator, parseInfo));
820
821 return create(expr: new Path(p1, end), sourceLocator, parseInfo);
822}
823
824/**
825 * @short Creates a call to <tt>fn:concat()</tt> with @p args as the arguments.
826 */
827static inline Expression::Ptr createConcatFN(const ParserContext *const parseInfo,
828 const Expression::List &args,
829 const YYLTYPE &sourceLocator)
830{
831 Q_ASSERT(parseInfo);
832 const QXmlName name(StandardNamespaces::fn, StandardLocalNames::concat);
833 const ReflectYYLTYPE ryy(sourceLocator, parseInfo);
834
835 return create(expr: parseInfo->staticContext->functionSignatures()->createFunctionCall(name, arguments: args, context: parseInfo->staticContext, r: &ryy),
836 sourceLocator, parseInfo);
837}
838
839static inline Expression::Ptr createDirAttributeValue(const Expression::List &content,
840 const ParserContext *const parseInfo,
841 const YYLTYPE &sourceLocator)
842{
843 if(content.isEmpty())
844 return create(expr: new EmptySequence(), sourceLocator, parseInfo);
845 else if(content.size() == 1)
846 return content.first();
847 else
848 return createConcatFN(parseInfo, args: content, sourceLocator);
849}
850
851/**
852 * @short Checks for variable initialization circularity.
853 *
854 * "A recursive function that checks for recursion is full of ironies."
855 *
856 * -- The Salsa Master
857 *
858 * Issues an error via @p parseInfo's StaticContext if the initialization
859 * expression @p checkee for the global variable @p var, contains a variable
860 * reference to @p var. That is, if there's a circularity.
861 *
862 * @see <a href="http://www.w3.org/TR/xquery/#ERRXQST0054">XQuery 1.0: An XML
863 * Query Language, err:XQST0054</a>
864 */
865static void checkVariableCircularity(const VariableDeclaration::Ptr &var,
866 const Expression::Ptr &checkee,
867 const VariableDeclaration::Type type,
868 FunctionSignature::List &signList,
869 const ParserContext *const parseInfo)
870{
871 Q_ASSERT(var);
872 Q_ASSERT(checkee);
873 Q_ASSERT(parseInfo);
874
875 const Expression::ID id = checkee->id();
876
877 if(id == Expression::IDExpressionVariableReference)
878 {
879 const ExpressionVariableReference *const ref =
880 static_cast<const ExpressionVariableReference *>(checkee.data());
881
882 if(var->slot == ref->slot() && type == ref->variableDeclaration()->type)
883 {
884 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "The initialization of variable %1 "
885 "depends on itself").arg(a: formatKeyword(var, np: parseInfo->staticContext->namePool())),
886 errorCode: parseInfo->isXSLT() ? ReportContext::XTDE0640 : ReportContext::XQST0054, reflection: ref);
887 return;
888 }
889 else
890 {
891 /* If the variable we're checking is below another variable, it can be a recursive
892 * dependency through functions, so we need to check variable references too. */
893 checkVariableCircularity(var, checkee: ref->sourceExpression(), type, signList, parseInfo);
894 return;
895 }
896 }
897 else if(id == Expression::IDUserFunctionCallsite)
898 {
899 const UserFunctionCallsite::Ptr callsite(checkee);
900 const FunctionSignature::Ptr sign(callsite->callTargetDescription());
901 const FunctionSignature::List::const_iterator end(signList.constEnd());
902 FunctionSignature::List::const_iterator it(signList.constBegin());
903 bool noMatch = true;
904
905 for(; it != end; ++it)
906 {
907 if(*it == sign)
908 {
909 /* The variable we're checking is depending on a function that's recursive. The
910 * user has written a weird query, in other words. Since it's the second time
911 * we've encountered a callsite, we now skip it. */
912 noMatch = false;
913 break;
914 }
915 }
916
917 if(noMatch)
918 {
919 signList.append(t: sign);
920 /* Check the body of the function being called. */
921 checkVariableCircularity(var, checkee: callsite->body(), type, signList, parseInfo);
922 }
923 /* Continue with the operands, such that we also check the arguments of the callsite. */
924 }
925 else if(id == Expression::IDUnresolvedVariableReference)
926 {
927 /* We're called before it has rewritten itself. */
928 checkVariableCircularity(var, checkee: checkee->as<UnresolvedVariableReference>()->replacement(), type, signList, parseInfo);
929 }
930
931 /* Check the operands. */
932 const Expression::List ops(checkee->operands());
933 if(ops.isEmpty())
934 return;
935
936 const Expression::List::const_iterator end(ops.constEnd());
937 Expression::List::const_iterator it(ops.constBegin());
938
939 for(; it != end; ++it)
940 checkVariableCircularity(var, checkee: *it, type, signList, parseInfo);
941}
942
943static void variableUnavailable(const QXmlName &variableName,
944 const ParserContext *const parseInfo,
945 const YYLTYPE &location)
946{
947 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "No variable with name %1 exists")
948 .arg(a: formatKeyword(np: parseInfo->staticContext->namePool(), name: variableName)),
949 errorCode: ReportContext::XPST0008, sourceLocation: fromYYLTYPE(sourceLocator: location, parseInfo));
950}
951
952/**
953 * The Cardinality in a TypeDeclaration for a variable in a quantification has no effect,
954 * and this function ensures this by changing @p type to Cardinality Cardinality::zeroOrMore().
955 *
956 * @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=3305">Bugzilla Bug 3305
957 * Cardinality + on range variables</a>
958 * @see ParserContext::finalizePushedVariable()
959 */
960static inline SequenceType::Ptr quantificationType(const SequenceType::Ptr &type)
961{
962 Q_ASSERT(type);
963 return makeGenericSequenceType(itemType: type->itemType(), cardinality: Cardinality::zeroOrMore());
964}
965
966/**
967 * @p seqType and @p expr may be @c null.
968 */
969static Expression::Ptr pushVariable(const QXmlName name,
970 const SequenceType::Ptr &seqType,
971 const Expression::Ptr &expr,
972 const VariableDeclaration::Type type,
973 const YYLTYPE &sourceLocator,
974 ParserContext *const parseInfo,
975 const bool checkSource = true)
976{
977 Q_ASSERT(!name.isNull());
978 Q_ASSERT(parseInfo);
979
980 /* -2 will cause Q_ASSERTs to trigger if it isn't changed. */
981 VariableSlotID slot = -2;
982
983 switch(type)
984 {
985 case VariableDeclaration::FunctionArgument:
986 case VariableDeclaration::ExpressionVariable:
987 {
988 slot = parseInfo->allocateExpressionSlot();
989 break;
990 }
991 case VariableDeclaration::GlobalVariable:
992 {
993 slot = parseInfo->allocateGlobalVariableSlot();
994 break;
995 }
996 case VariableDeclaration::RangeVariable:
997 {
998 slot = parseInfo->staticContext->allocateRangeSlot();
999 break;
1000 }
1001 case VariableDeclaration::PositionalVariable:
1002 {
1003 slot = parseInfo->allocatePositionalSlot();
1004 break;
1005 }
1006 case VariableDeclaration::TemplateParameter:
1007 /* Fallthrough. We do nothing, template parameters
1008 * doesn't use context slots at all, they're hashed
1009 * on the name. */
1010 case VariableDeclaration::ExternalVariable:
1011 /* We do nothing, external variables doesn't use
1012 *context slots/stack frames at all. */
1013 ;
1014 }
1015
1016 const VariableDeclaration::Ptr var(new VariableDeclaration(name, slot, type, seqType));
1017
1018 Expression::Ptr checked;
1019
1020 if(checkSource && seqType)
1021 {
1022 if(expr)
1023 {
1024 /* We only want to add conversion for function arguments, and variables
1025 * if we're XSL-T.
1026 *
1027 * We unconditionally skip TypeChecker::CheckFocus because the StaticContext we
1028 * pass hasn't set up the focus yet, since that's the parent's responsibility. */
1029 const TypeChecker::Options options(( type == VariableDeclaration::FunctionArgument
1030 || type == VariableDeclaration::TemplateParameter
1031 || parseInfo->isXSLT())
1032 ? TypeChecker::AutomaticallyConvert : TypeChecker::Options());
1033
1034 checked = TypeChecker::applyFunctionConversion(operand: expr, reqType: seqType, context: parseInfo->staticContext,
1035 code: parseInfo->isXSLT() ? ReportContext::XTTE0570 : ReportContext::XPTY0004,
1036 options);
1037 }
1038 }
1039 else
1040 checked = expr;
1041
1042 /* Add an evaluation cache for all expression variables. No EvaluationCache is needed for
1043 * positional variables because in the end they are calls to Iterator::position(). Similarly,
1044 * no need to cache range variables either because they are calls to DynamicContext::rangeVariable().
1045 *
1046 * We don't do it for function arguments because the Expression being cached depends -- it depends
1047 * on the callsite. UserFunctionCallsite is responsible for the evaluation caches in that case.
1048 *
1049 * In some cases the EvaluationCache instance isn't necessary, but in those cases EvaluationCache
1050 * optimizes itself away. */
1051 if(type == VariableDeclaration::ExpressionVariable)
1052 checked = create(expr: new EvaluationCache<false>(checked, var, parseInfo->allocateCacheSlot()), sourceLocator, parseInfo);
1053 else if(type == VariableDeclaration::GlobalVariable)
1054 checked = create(expr: new EvaluationCache<true>(checked, var, parseInfo->allocateCacheSlot()), sourceLocator, parseInfo);
1055
1056 var->setExpression(checked);
1057
1058 parseInfo->variables.push(t: var);
1059 return checked;
1060}
1061
1062static inline VariableDeclaration::Ptr variableByName(const QXmlName name,
1063 const ParserContext *const parseInfo)
1064{
1065 Q_ASSERT(!name.isNull());
1066 Q_ASSERT(parseInfo);
1067
1068 /* We walk the list backwards. */
1069 const VariableDeclaration::Stack::const_iterator start(parseInfo->variables.constBegin());
1070 VariableDeclaration::Stack::const_iterator it(parseInfo->variables.constEnd());
1071
1072 while(it != start)
1073 {
1074 --it;
1075 Q_ASSERT(*it);
1076 if((*it)->name == name)
1077 return *it;
1078 }
1079
1080 return VariableDeclaration::Ptr();
1081}
1082
1083static Expression::Ptr resolveVariable(const QXmlName &name,
1084 const YYLTYPE &sourceLocator,
1085 ParserContext *const parseInfo,
1086 const bool raiseErrorOnUnavailability)
1087{
1088 const VariableDeclaration::Ptr var(variableByName(name, parseInfo));
1089 Expression::Ptr retval;
1090
1091 if(var && var->type != VariableDeclaration::ExternalVariable)
1092 {
1093 switch(var->type)
1094 {
1095 case VariableDeclaration::RangeVariable:
1096 {
1097 retval = create(expr: new RangeVariableReference(var->expression(), var->slot), sourceLocator, parseInfo);
1098 break;
1099 }
1100 case VariableDeclaration::GlobalVariable:
1101 /* Fallthrough. From the perspective of an ExpressionVariableReference, it can't tell
1102 * a difference between a global and a local expression variable. However, the cache
1103 * mechanism must. */
1104 case VariableDeclaration::ExpressionVariable:
1105 {
1106 retval = create(expr: new ExpressionVariableReference(var->slot, var.data()), sourceLocator, parseInfo);
1107 break;
1108 }
1109 case VariableDeclaration::FunctionArgument:
1110 {
1111 retval = create(expr: new ArgumentReference(var->sequenceType, var->slot), sourceLocator, parseInfo);
1112 break;
1113 }
1114 case VariableDeclaration::PositionalVariable:
1115 {
1116 retval = create(expr: new PositionalVariableReference(var->slot), sourceLocator, parseInfo);
1117 break;
1118 }
1119 case VariableDeclaration::TemplateParameter:
1120 {
1121 retval = create(expr: new TemplateParameterReference(var.data()), sourceLocator, parseInfo);
1122 break;
1123 }
1124 case VariableDeclaration::ExternalVariable:
1125 /* This code path will never be hit, but the case
1126 * label silences a warning. See above. */
1127 ;
1128 }
1129 Q_ASSERT(retval);
1130 var->references.append(t: retval);
1131 }
1132 else
1133 {
1134 /* Let's see if your external variable loader can provide us with one. */
1135 const SequenceType::Ptr varType(parseInfo->staticContext->
1136 externalVariableLoader()->announceExternalVariable(name, declaredType: CommonSequenceTypes::ZeroOrMoreItems));
1137
1138 if(varType)
1139 {
1140 const Expression::Ptr extRef(create(expr: new ExternalVariableReference(name, varType), sourceLocator, parseInfo));
1141 const Expression::Ptr checked(TypeChecker::applyFunctionConversion(operand: extRef, reqType: varType, context: parseInfo->staticContext));
1142 retval = checked;
1143 }
1144 else if(!raiseErrorOnUnavailability && parseInfo->isXSLT())
1145 {
1146 /* In XSL-T, global variables are in scope for the whole
1147 * stylesheet, so we must resolve this first at the end. */
1148 retval = create(expr: new UnresolvedVariableReference(name), sourceLocator, parseInfo);
1149 parseInfo->unresolvedVariableReferences.insert(akey: name, avalue: retval);
1150 }
1151 else
1152 variableUnavailable(variableName: name, parseInfo, location: sourceLocator);
1153 }
1154
1155 return retval;
1156}
1157
1158static Expression::Ptr createReturnOrderBy(const OrderSpecTransfer::List &orderSpecTransfer,
1159 const Expression::Ptr &returnExpr,
1160 const OrderBy::Stability stability,
1161 const YYLTYPE &sourceLocator,
1162 const ParserContext *const parseInfo)
1163{
1164 // TODO do resize(orderSpec.size() + 1)
1165 Expression::List exprs;
1166 OrderBy::OrderSpec::Vector orderSpecs;
1167
1168 exprs.append(t: returnExpr);
1169
1170 const int len = orderSpecTransfer.size();
1171
1172 for(int i = 0; i < len; ++i)
1173 {
1174 exprs.append(t: orderSpecTransfer.at(i).expression);
1175 orderSpecs.append(t: orderSpecTransfer.at(i).orderSpec);
1176 }
1177
1178 return create(expr: new ReturnOrderBy(stability, orderSpecs, exprs), sourceLocator, parseInfo);
1179}
1180
1181
1182#line 1134 "qquerytransformparser.cpp" /* yacc.c:337 */
1183# ifndef YY_NULLPTR
1184# if defined __cplusplus
1185# if 201103L <= __cplusplus
1186# define YY_NULLPTR nullptr
1187# else
1188# define YY_NULLPTR 0
1189# endif
1190# else
1191# define YY_NULLPTR ((void*)0)
1192# endif
1193# endif
1194
1195/* Enabling verbose error messages. */
1196#ifdef YYERROR_VERBOSE
1197# undef YYERROR_VERBOSE
1198# define YYERROR_VERBOSE 1
1199#else
1200# define YYERROR_VERBOSE 1
1201#endif
1202
1203/* In a future release of Bison, this section will be replaced
1204 by #include "qquerytransformparser_p.h". */
1205#ifndef YY_XPATH_QQUERYTRANSFORMPARSER_P_H_INCLUDED
1206# define YY_XPATH_QQUERYTRANSFORMPARSER_P_H_INCLUDED
1207/* Debug traces. */
1208#ifndef XPATHDEBUG
1209# if defined YYDEBUG
1210# if YYDEBUG
1211# define XPATHDEBUG 1
1212# else
1213# define XPATHDEBUG 0
1214# endif
1215# else /* ! defined YYDEBUG */
1216# define XPATHDEBUG 0
1217# endif /* ! defined YYDEBUG */
1218#endif /* ! defined XPATHDEBUG */
1219#if XPATHDEBUG
1220extern int XPathdebug;
1221#endif
1222
1223/* Token type. */
1224#ifndef XPATHTOKENTYPE
1225# define XPATHTOKENTYPE
1226 enum XPathtokentype
1227 {
1228 T_END_OF_FILE = 0,
1229 T_STRING_LITERAL = 258,
1230 T_NON_BOUNDARY_WS = 259,
1231 T_XPATH2_STRING_LITERAL = 260,
1232 T_QNAME = 261,
1233 T_NCNAME = 262,
1234 T_CLARK_NAME = 263,
1235 T_ANY_LOCAL_NAME = 264,
1236 T_ANY_PREFIX = 265,
1237 T_NUMBER = 266,
1238 T_XPATH2_NUMBER = 267,
1239 T_ANCESTOR = 268,
1240 T_ANCESTOR_OR_SELF = 269,
1241 T_AND = 270,
1242 T_APOS = 271,
1243 T_APPLY_TEMPLATE = 272,
1244 T_AS = 273,
1245 T_ASCENDING = 274,
1246 T_ASSIGN = 275,
1247 T_AT = 276,
1248 T_AT_SIGN = 277,
1249 T_ATTRIBUTE = 278,
1250 T_AVT = 279,
1251 T_BAR = 280,
1252 T_BASEURI = 281,
1253 T_BEGIN_END_TAG = 282,
1254 T_BOUNDARY_SPACE = 283,
1255 T_BY = 284,
1256 T_CALL_TEMPLATE = 285,
1257 T_CASE = 286,
1258 T_CASTABLE = 287,
1259 T_CAST = 288,
1260 T_CHILD = 289,
1261 T_COLLATION = 290,
1262 T_COLONCOLON = 291,
1263 T_COMMA = 292,
1264 T_COMMENT = 293,
1265 T_COMMENT_START = 294,
1266 T_CONSTRUCTION = 295,
1267 T_COPY_NAMESPACES = 296,
1268 T_CURLY_LBRACE = 297,
1269 T_CURLY_RBRACE = 298,
1270 T_DECLARE = 299,
1271 T_DEFAULT = 300,
1272 T_DESCENDANT = 301,
1273 T_DESCENDANT_OR_SELF = 302,
1274 T_DESCENDING = 303,
1275 T_DIV = 304,
1276 T_DOCUMENT = 305,
1277 T_DOCUMENT_NODE = 306,
1278 T_DOLLAR = 307,
1279 T_DOT = 308,
1280 T_DOTDOT = 309,
1281 T_ELEMENT = 310,
1282 T_ELSE = 311,
1283 T_EMPTY = 312,
1284 T_EMPTY_SEQUENCE = 313,
1285 T_ENCODING = 314,
1286 T_END_SORT = 315,
1287 T_EQ = 316,
1288 T_ERROR = 317,
1289 T_EVERY = 318,
1290 T_EXCEPT = 319,
1291 T_EXTERNAL = 320,
1292 T_FOLLOWING = 321,
1293 T_FOLLOWING_SIBLING = 322,
1294 T_FOLLOWS = 323,
1295 T_FOR_APPLY_TEMPLATE = 324,
1296 T_FOR = 325,
1297 T_FUNCTION = 326,
1298 T_GE = 327,
1299 T_G_EQ = 328,
1300 T_G_GE = 329,
1301 T_G_GT = 330,
1302 T_G_LE = 331,
1303 T_G_LT = 332,
1304 T_G_NE = 333,
1305 T_GREATEST = 334,
1306 T_GT = 335,
1307 T_IDIV = 336,
1308 T_IF = 337,
1309 T_IMPORT = 338,
1310 T_INHERIT = 339,
1311 T_IN = 340,
1312 T_INSTANCE = 341,
1313 T_INTERSECT = 342,
1314 T_IS = 343,
1315 T_ITEM = 344,
1316 T_LAX = 345,
1317 T_LBRACKET = 346,
1318 T_LEAST = 347,
1319 T_LE = 348,
1320 T_LET = 349,
1321 T_LPAREN = 350,
1322 T_LT = 351,
1323 T_MAP = 352,
1324 T_MATCHES = 353,
1325 T_MINUS = 354,
1326 T_MODE = 355,
1327 T_MOD = 356,
1328 T_MODULE = 357,
1329 T_NAME = 358,
1330 T_NAMESPACE = 359,
1331 T_NE = 360,
1332 T_NODE = 361,
1333 T_NO_INHERIT = 362,
1334 T_NO_PRESERVE = 363,
1335 T_OF = 364,
1336 T_OPTION = 365,
1337 T_ORDERED = 366,
1338 T_ORDERING = 367,
1339 T_ORDER = 368,
1340 T_OR = 369,
1341 T_PARENT = 370,
1342 T_PI_START = 371,
1343 T_PLUS = 372,
1344 T_POSITION_SET = 373,
1345 T_PRAGMA_END = 374,
1346 T_PRAGMA_START = 375,
1347 T_PRECEDES = 376,
1348 T_PRECEDING = 377,
1349 T_PRECEDING_SIBLING = 378,
1350 T_PRESERVE = 379,
1351 T_PRIORITY = 380,
1352 T_PROCESSING_INSTRUCTION = 381,
1353 T_QUESTION = 382,
1354 T_QUICK_TAG_END = 383,
1355 T_QUOTE = 384,
1356 T_RBRACKET = 385,
1357 T_RETURN = 386,
1358 T_RPAREN = 387,
1359 T_SATISFIES = 388,
1360 T_SCHEMA_ATTRIBUTE = 389,
1361 T_SCHEMA_ELEMENT = 390,
1362 T_SCHEMA = 391,
1363 T_SELF = 392,
1364 T_SEMI_COLON = 393,
1365 T_SLASH = 394,
1366 T_SLASHSLASH = 395,
1367 T_SOME = 396,
1368 T_SORT = 397,
1369 T_STABLE = 398,
1370 T_STAR = 399,
1371 T_STRICT = 400,
1372 T_STRIP = 401,
1373 T_SUCCESS = 402,
1374 T_COMMENT_CONTENT = 403,
1375 T_PI_CONTENT = 404,
1376 T_PI_TARGET = 405,
1377 T_XSLT_VERSION = 406,
1378 T_TEMPLATE = 407,
1379 T_TEXT = 408,
1380 T_THEN = 409,
1381 T_TO = 410,
1382 T_TREAT = 411,
1383 T_TUNNEL = 412,
1384 T_TYPESWITCH = 413,
1385 T_UNION = 414,
1386 T_UNORDERED = 415,
1387 T_VALIDATE = 416,
1388 T_VARIABLE = 417,
1389 T_VERSION = 418,
1390 T_WHERE = 419,
1391 T_XQUERY = 420,
1392 T_INTERNAL = 421,
1393 T_INTERNAL_NAME = 422,
1394 T_CURRENT = 423
1395 };
1396#endif
1397
1398/* Value type. */
1399
1400/* Location type. */
1401#if ! defined XPATHLTYPE && ! defined XPATHLTYPE_IS_DECLARED
1402typedef struct XPATHLTYPE XPATHLTYPE;
1403struct XPATHLTYPE
1404{
1405 int first_line;
1406 int first_column;
1407 int last_line;
1408 int last_column;
1409};
1410# define XPATHLTYPE_IS_DECLARED 1
1411# define XPATHLTYPE_IS_TRIVIAL 1
1412#endif
1413
1414
1415
1416int XPathparse (QT_PREPEND_NAMESPACE(QPatternist)::ParserContext *const parseInfo);
1417
1418#endif /* !YY_XPATH_QQUERYTRANSFORMPARSER_P_H_INCLUDED */
1419
1420
1421
1422#ifdef short
1423# undef short
1424#endif
1425
1426#ifdef YYTYPE_UINT8
1427typedef YYTYPE_UINT8 yytype_uint8;
1428#else
1429typedef unsigned char yytype_uint8;
1430#endif
1431
1432#ifdef YYTYPE_INT8
1433typedef YYTYPE_INT8 yytype_int8;
1434#else
1435typedef signed char yytype_int8;
1436#endif
1437
1438#ifdef YYTYPE_UINT16
1439typedef YYTYPE_UINT16 yytype_uint16;
1440#else
1441typedef unsigned short yytype_uint16;
1442#endif
1443
1444#ifdef YYTYPE_INT16
1445typedef YYTYPE_INT16 yytype_int16;
1446#else
1447typedef short yytype_int16;
1448#endif
1449
1450#ifndef YYSIZE_T
1451# ifdef __SIZE_TYPE__
1452# define YYSIZE_T __SIZE_TYPE__
1453# elif defined size_t
1454# define YYSIZE_T size_t
1455# elif ! defined YYSIZE_T
1456# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1457# define YYSIZE_T size_t
1458# else
1459# define YYSIZE_T unsigned
1460# endif
1461#endif
1462
1463#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
1464
1465#ifndef YY_
1466# if defined YYENABLE_NLS && YYENABLE_NLS
1467# if ENABLE_NLS
1468# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1469# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
1470# endif
1471# endif
1472# ifndef YY_
1473# define YY_(Msgid) Msgid
1474# endif
1475#endif
1476
1477#ifndef YY_ATTRIBUTE
1478# if (defined __GNUC__ \
1479 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
1480 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
1481# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
1482# else
1483# define YY_ATTRIBUTE(Spec) /* empty */
1484# endif
1485#endif
1486
1487#ifndef YY_ATTRIBUTE_PURE
1488# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
1489#endif
1490
1491#ifndef YY_ATTRIBUTE_UNUSED
1492# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
1493#endif
1494
1495/* Suppress unused-variable warnings by "using" E. */
1496#if ! defined lint || defined __GNUC__
1497# define YYUSE(E) ((void) (E))
1498#else
1499# define YYUSE(E) /* empty */
1500#endif
1501
1502#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
1503/* Suppress an incorrect diagnostic about yylval being uninitialized. */
1504# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
1505 _Pragma ("GCC diagnostic push") \
1506 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
1507 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
1508# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
1509 _Pragma ("GCC diagnostic pop")
1510#else
1511# define YY_INITIAL_VALUE(Value) Value
1512#endif
1513#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1514# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1515# define YY_IGNORE_MAYBE_UNINITIALIZED_END
1516#endif
1517#ifndef YY_INITIAL_VALUE
1518# define YY_INITIAL_VALUE(Value) /* Nothing. */
1519#endif
1520
1521
1522#if ! defined yyoverflow || YYERROR_VERBOSE
1523
1524/* The parser invokes alloca or malloc; define the necessary symbols. */
1525
1526# ifdef YYSTACK_USE_ALLOCA
1527# if YYSTACK_USE_ALLOCA
1528# ifdef __GNUC__
1529# define YYSTACK_ALLOC __builtin_alloca
1530# elif defined __BUILTIN_VA_ARG_INCR
1531# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1532# elif defined _AIX
1533# define YYSTACK_ALLOC __alloca
1534# elif defined _MSC_VER
1535# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1536# define alloca _alloca
1537# else
1538# define YYSTACK_ALLOC alloca
1539# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
1540# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1541 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
1542# ifndef EXIT_SUCCESS
1543# define EXIT_SUCCESS 0
1544# endif
1545# endif
1546# endif
1547# endif
1548# endif
1549
1550# ifdef YYSTACK_ALLOC
1551 /* Pacify GCC's 'empty if-body' warning. */
1552# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1553# ifndef YYSTACK_ALLOC_MAXIMUM
1554 /* The OS might guarantee only one guard page at the bottom of the stack,
1555 and a page size can be as small as 4096 bytes. So we cannot safely
1556 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1557 to allow for a few compiler-allocated temporary stack slots. */
1558# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1559# endif
1560# else
1561# define YYSTACK_ALLOC YYMALLOC
1562# define YYSTACK_FREE YYFREE
1563# ifndef YYSTACK_ALLOC_MAXIMUM
1564# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1565# endif
1566# if (defined __cplusplus && ! defined EXIT_SUCCESS \
1567 && ! ((defined YYMALLOC || defined malloc) \
1568 && (defined YYFREE || defined free)))
1569# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1570# ifndef EXIT_SUCCESS
1571# define EXIT_SUCCESS 0
1572# endif
1573# endif
1574# ifndef YYMALLOC
1575# define YYMALLOC malloc
1576# if ! defined malloc && ! defined EXIT_SUCCESS
1577void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1578# endif
1579# endif
1580# ifndef YYFREE
1581# define YYFREE free
1582# if ! defined free && ! defined EXIT_SUCCESS
1583void free (void *); /* INFRINGES ON USER NAME SPACE */
1584# endif
1585# endif
1586# endif
1587#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
1588
1589
1590#if (! defined yyoverflow \
1591 && (! defined __cplusplus \
1592 || (defined XPATHLTYPE_IS_TRIVIAL && XPATHLTYPE_IS_TRIVIAL \
1593 && defined XPATHSTYPE_IS_TRIVIAL && XPATHSTYPE_IS_TRIVIAL)))
1594
1595/* A type that is properly aligned for any stack member. */
1596union yyalloc
1597{
1598 yytype_int16 yyss_alloc;
1599 YYSTYPE yyvs_alloc;
1600 YYLTYPE yyls_alloc;
1601};
1602
1603/* The size of the maximum gap between one aligned stack and the next. */
1604# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
1605
1606/* The size of an array large to enough to hold all stacks, each with
1607 N elements. */
1608# define YYSTACK_BYTES(N) \
1609 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
1610 + 2 * YYSTACK_GAP_MAXIMUM)
1611
1612# define YYCOPY_NEEDED 1
1613
1614/* Relocate STACK from its old location to the new one. The
1615 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1616 elements in the stack, and YYPTR gives the new location of the
1617 stack. Advance YYPTR to a properly aligned location for the next
1618 stack. */
1619# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
1620 do \
1621 { \
1622 YYSIZE_T yynewbytes; \
1623 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
1624 Stack = &yyptr->Stack_alloc; \
1625 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
1626 yyptr += yynewbytes / sizeof (*yyptr); \
1627 } \
1628 while (0)
1629
1630#endif
1631
1632#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
1633/* Copy COUNT objects from SRC to DST. The source and destination do
1634 not overlap. */
1635# ifndef YYCOPY
1636# if defined __GNUC__ && 1 < __GNUC__
1637# define YYCOPY(Dst, Src, Count) \
1638 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
1639# else
1640# define YYCOPY(Dst, Src, Count) \
1641 do \
1642 { \
1643 YYSIZE_T yyi; \
1644 for (yyi = 0; yyi < (Count); yyi++) \
1645 (Dst)[yyi] = (Src)[yyi]; \
1646 } \
1647 while (0)
1648# endif
1649# endif
1650#endif /* !YYCOPY_NEEDED */
1651
1652/* YYFINAL -- State number of the termination state. */
1653#define YYFINAL 5
1654/* YYLAST -- Last index in YYTABLE. */
1655#define YYLAST 2052
1656
1657/* YYNTOKENS -- Number of terminals. */
1658#define YYNTOKENS 169
1659/* YYNNTS -- Number of nonterminals. */
1660#define YYNNTS 237
1661/* YYNRULES -- Number of rules. */
1662#define YYNRULES 472
1663/* YYNSTATES -- Number of states. */
1664#define YYNSTATES 812
1665
1666#define YYUNDEFTOK 2
1667#define YYMAXUTOK 423
1668
1669/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
1670 as returned by yylex, with out-of-bounds checking. */
1671#define YYTRANSLATE(YYX) \
1672 ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
1673
1674/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
1675 as returned by yylex. */
1676static const yytype_uint8 yytranslate[] =
1677{
1678 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1679 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1680 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1681 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1682 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1683 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1684 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1685 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1686 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1687 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1688 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1689 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1690 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1691 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1692 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1693 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1694 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1695 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1696 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1697 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1698 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1699 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1700 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1701 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1702 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1703 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1704 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1705 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1706 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1707 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1708 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1709 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1710 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1711 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
1712 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
1713 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
1714 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
1715 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
1716 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
1717 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
1718 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
1719 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
1720 165, 166, 167, 168
1721};
1722
1723#if XPATHDEBUG
1724 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
1725static const yytype_uint16 yyrline[] =
1726{
1727 0, 1431, 1431, 1432, 1434, 1435, 1466, 1467, 1483, 1581,
1728 1583, 1589, 1591, 1598, 1604, 1610, 1617, 1620, 1624, 1628,
1729 1648, 1662, 1666, 1660, 1729, 1733, 1750, 1753, 1755, 1760,
1730 1761, 1765, 1766, 1770, 1774, 1778, 1780, 1781, 1783, 1785,
1731 1831, 1845, 1850, 1855, 1856, 1858, 1873, 1888, 1898, 1913,
1732 1917, 1922, 1936, 1940, 1945, 1959, 1964, 1969, 1974, 1979,
1733 1995, 2018, 2026, 2027, 2028, 2030, 2047, 2048, 2050, 2051,
1734 2053, 2054, 2056, 2111, 2115, 2121, 2124, 2129, 2143, 2147,
1735 2153, 2152, 2261, 2264, 2270, 2291, 2297, 2301, 2303, 2308,
1736 2318, 2319, 2324, 2325, 2334, 2404, 2415, 2416, 2420, 2425,
1737 2494, 2495, 2499, 2504, 2548, 2549, 2554, 2561, 2567, 2568,
1738 2569, 2570, 2571, 2572, 2578, 2583, 2589, 2592, 2597, 2603,
1739 2609, 2613, 2638, 2639, 2643, 2647, 2641, 2688, 2691, 2686,
1740 2707, 2708, 2709, 2712, 2716, 2724, 2723, 2737, 2736, 2745,
1741 2746, 2747, 2749, 2757, 2768, 2771, 2773, 2778, 2785, 2792,
1742 2798, 2818, 2823, 2829, 2832, 2834, 2835, 2842, 2848, 2852,
1743 2857, 2858, 2861, 2865, 2860, 2875, 2879, 2874, 2887, 2890,
1744 2894, 2889, 2904, 2908, 2903, 2916, 2918, 2946, 2945, 2957,
1745 2965, 2956, 2976, 2977, 2980, 2984, 2989, 2994, 2993, 3009,
1746 3015, 3016, 3022, 3023, 3029, 3030, 3031, 3032, 3034, 3035,
1747 3041, 3042, 3048, 3049, 3051, 3052, 3058, 3059, 3060, 3061,
1748 3063, 3064, 3074, 3075, 3081, 3082, 3084, 3088, 3093, 3094,
1749 3101, 3102, 3108, 3109, 3115, 3116, 3122, 3123, 3129, 3133,
1750 3138, 3139, 3140, 3142, 3148, 3149, 3150, 3151, 3152, 3153,
1751 3155, 3160, 3161, 3162, 3163, 3164, 3165, 3167, 3172, 3173,
1752 3174, 3176, 3190, 3191, 3192, 3194, 3211, 3215, 3220, 3221,
1753 3223, 3228, 3229, 3231, 3237, 3241, 3247, 3250, 3251, 3255,
1754 3264, 3269, 3273, 3274, 3279, 3278, 3293, 3301, 3300, 3316,
1755 3324, 3324, 3333, 3335, 3338, 3343, 3345, 3349, 3415, 3418,
1756 3424, 3427, 3436, 3440, 3444, 3449, 3450, 3455, 3456, 3459,
1757 3458, 3488, 3490, 3491, 3493, 3537, 3538, 3539, 3540, 3541,
1758 3542, 3543, 3544, 3545, 3546, 3547, 3548, 3551, 3550, 3561,
1759 3572, 3577, 3579, 3584, 3585, 3590, 3594, 3596, 3600, 3609,
1760 3616, 3617, 3623, 3624, 3625, 3626, 3627, 3628, 3629, 3630,
1761 3640, 3641, 3646, 3651, 3657, 3663, 3668, 3673, 3678, 3684,
1762 3689, 3694, 3724, 3728, 3735, 3737, 3741, 3746, 3747, 3748,
1763 3782, 3791, 3780, 4032, 4036, 4056, 4059, 4065, 4070, 4075,
1764 4081, 4084, 4094, 4101, 4105, 4111, 4125, 4131, 4148, 4153,
1765 4166, 4167, 4168, 4169, 4170, 4171, 4172, 4174, 4182, 4181,
1766 4221, 4224, 4229, 4244, 4249, 4256, 4268, 4272, 4268, 4278,
1767 4280, 4284, 4286, 4301, 4305, 4314, 4319, 4323, 4329, 4332,
1768 4337, 4342, 4347, 4348, 4349, 4350, 4352, 4353, 4354, 4355,
1769 4360, 4396, 4397, 4398, 4399, 4400, 4401, 4402, 4404, 4409,
1770 4414, 4420, 4421, 4423, 4428, 4433, 4438, 4443, 4459, 4460,
1771 4462, 4467, 4472, 4476, 4488, 4501, 4511, 4516, 4521, 4526,
1772 4540, 4554, 4555, 4557, 4567, 4569, 4574, 4581, 4588, 4590,
1773 4592, 4593, 4595, 4599, 4604, 4605, 4607, 4613, 4615, 4617,
1774 4621, 4626, 4638
1775};
1776#endif
1777
1778#if XPATHDEBUG || YYERROR_VERBOSE || 1
1779/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1780 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1781static const char *const yytname[] =
1782{
1783 "\"end of file\"", "error", "$undefined", "\"<string literal>\"",
1784 "\"<non-boundary text node>\"", "\"<string literal(XPath 2.0)>\"",
1785 "\"QName\"", "\"NCName\"", "\"ClarkName\"", "T_ANY_LOCAL_NAME",
1786 "T_ANY_PREFIX", "\"<number literal>\"",
1787 "\"<number literal(XPath 2.0)>\"", "\"ancestor\"",
1788 "\"ancestor-or-self\"", "\"and\"", "\"'\"", "\"apply-template\"",
1789 "\"as\"", "\"ascending\"", "\":=\"", "\"at\"", "\"@\"", "\"attribute\"",
1790 "T_AVT", "\"|\"", "\"base-uri\"", "\"</\"", "\"boundary-space\"",
1791 "\"by\"", "\"call-template\"", "\"case\"", "\"castable\"", "\"cast\"",
1792 "\"child\"", "\"collation\"", "\"::\"", "\",\"", "\"comment\"",
1793 "\"<!--\"", "\"construction\"", "\"copy-namespaces\"", "\"{\"", "\"}\"",
1794 "\"declare\"", "\"default\"", "\"descendant\"", "\"descendant-or-self\"",
1795 "\"descending\"", "\"div\"", "\"document\"", "\"document-node\"",
1796 "\"$\"", "\".\"", "\"..\"", "\"element\"", "\"else\"", "\"empty\"",
1797 "\"empty-sequence\"", "\"encoding\"", "\"end_sort\"", "\"eq\"",
1798 "\"unknown keyword\"", "\"every\"", "\"except\"", "\"external\"",
1799 "\"following\"", "\"following-sibling\"", "\">>\"",
1800 "\"for-apply-template\"", "\"for\"", "\"function\"", "\"ge\"", "\"=\"",
1801 "\">=\"", "\">\"", "\"<=\"", "\"<\"", "\"!=\"", "\"greatest\"", "\"gt\"",
1802 "\"idiv\"", "\"if\"", "\"import\"", "\"inherit\"", "\"in\"",
1803 "\"instance\"", "\"intersect\"", "\"is\"", "\"item\"", "\"lax\"",
1804 "\"[\"", "\"least\"", "\"le\"", "\"let\"", "\"(\"", "\"lt\"", "\"map\"",
1805 "\"matches\"", "\"-\"", "\"mode\"", "\"mod\"", "\"module\"", "\"name\"",
1806 "\"namespace\"", "\"ne\"", "\"node\"", "\"no-inherit\"",
1807 "\"no-preserve\"", "\"of\"", "\"option\"", "\"ordered\"", "\"ordering\"",
1808 "\"order\"", "\"or\"", "\"parent\"", "\"<?\"", "\"+\"", "T_POSITION_SET",
1809 "\"#)\"", "\"(#\"", "\"<<\"", "\"preceding\"", "\"preceding-sibling\"",
1810 "\"preserve\"", "\"priority\"", "\"processing-instruction\"", "\"?\"",
1811 "\"/>\"", "\"\\\"\"", "\"]\"", "\"return\"", "\")\"", "\"satisfies\"",
1812 "\"schema-attribute\"", "\"schema-element\"", "\"schema\"", "\"self\"",
1813 "\";\"", "\"/\"", "\"//\"", "\"some\"", "\"sort\"", "\"stable\"",
1814 "\"*\"", "\"strict\"", "\"strip\"", "T_SUCCESS", "T_COMMENT_CONTENT",
1815 "T_PI_CONTENT", "T_PI_TARGET", "T_XSLT_VERSION", "\"template\"",
1816 "\"text\"", "\"then\"", "\"to\"", "\"treat\"", "\"tunnel\"",
1817 "\"typeswitch\"", "\"union\"", "\"unordered\"", "\"validate\"",
1818 "\"variable\"", "\"version\"", "\"where\"", "\"xquery\"", "\"internal\"",
1819 "\"internal-name\"", "\"current\"", "$accept", "Module", "VersionDecl",
1820 "Encoding", "MainModule", "LibraryModule", "ModuleDecl", "Prolog",
1821 "TemplateDecl", "$@1", "$@2", "OptionalPriority", "OptionalTemplateName",
1822 "TemplateName", "Setter", "Import", "Separator", "NamespaceDecl",
1823 "BoundarySpaceDecl", "BoundarySpacePolicy", "DefaultNamespaceDecl",
1824 "DeclareDefaultElementNamespace", "DeclareDefaultFunctionNamespace",
1825 "OptionDecl", "OrderingModeDecl", "OrderingMode", "EmptyOrderDecl",
1826 "OrderingEmptySequence", "CopyNamespacesDecl", "PreserveMode",
1827 "InheritMode", "DefaultCollationDecl", "BaseURIDecl", "SchemaImport",
1828 "SchemaPrefix", "ModuleImport", "ModuleNamespaceDecl", "FileLocations",
1829 "FileLocation", "VarDecl", "VariableValue", "OptionalDefaultValue",
1830 "ConstructionDecl", "ConstructionMode", "FunctionDecl", "@3",
1831 "ParamList", "Param", "FunctionBody", "EnclosedExpr", "QueryBody",
1832 "Pattern", "PathPattern", "IdKeyPattern", "RelativePathPattern",
1833 "PatternStep", "Expr", "ExpressionSequence", "ExprSingle",
1834 "OptionalModes", "OptionalMode", "Modes", "Mode", "FLWORExpr",
1835 "ForClause", "@4", "@5", "ForTail", "$@6", "@7", "PositionalVar",
1836 "LetClause", "@8", "LetTail", "@9", "WhereClause", "OrderByClause",
1837 "MandatoryOrderByClause", "OrderSpecList", "OrderSpec",
1838 "DirectionModifier", "EmptynessModifier", "CollationModifier",
1839 "OrderByInputOrder", "QuantifiedExpr", "SomeQuantificationExpr", "$@10",
1840 "@11", "SomeQuantificationTail", "@12", "@13", "EveryQuantificationExpr",
1841 "$@14", "@15", "EveryQuantificationTail", "@16", "@17",
1842 "SatisfiesClause", "TypeswitchExpr", "$@18", "CaseClause", "$@19",
1843 "$@20", "CaseTail", "CaseVariable", "CaseDefault", "$@21", "IfExpr",
1844 "OrExpr", "AndExpr", "ComparisonExpr", "RangeExpr", "AdditiveExpr",
1845 "AdditiveOperator", "MultiplicativeExpr", "MultiplyOperator",
1846 "UnionExpr", "IntersectExceptExpr", "UnionOperator", "IntersectOperator",
1847 "InstanceOfExpr", "TreatExpr", "CastableExpr", "CastExpr", "UnaryExpr",
1848 "UnaryOperator", "ValueExpr", "GeneralComp", "GeneralComparisonOperator",
1849 "ValueComp", "ValueComparisonOperator", "NodeComp", "NodeOperator",
1850 "ValidateExpr", "ValidationMode", "ExtensionExpr",
1851 "EnclosedOptionalExpr", "Pragmas", "Pragma", "PragmaContents",
1852 "PathExpr", "RelativePathExpr", "StepExpr", "@22", "$@23",
1853 "TemplateWithParameters", "$@24", "TemplateParameters",
1854 "OptionalTemplateParameters", "TemplateParameter", "IsTunnel",
1855 "OptionalAssign", "MapOrSlash", "FilteredAxisStep", "AxisStep",
1856 "ForwardStep", "$@25", "NodeTestInAxisStep", "Axis", "AxisToken",
1857 "AbbrevForwardStep", "$@26", "ReverseStep", "AbbrevReverseStep",
1858 "NodeTest", "NameTest", "WildCard", "FilterExpr", "PrimaryExpr",
1859 "Literal", "NumericLiteral", "VarRef", "VarName", "ParenthesizedExpr",
1860 "ContextItemExpr", "OrderingExpr", "FunctionCallExpr",
1861 "FunctionArguments", "Constructor", "DirectConstructor",
1862 "DirElemConstructor", "@27", "@28", "DirElemConstructorTail",
1863 "DirAttributeList", "Attribute", "DirAttributeValue", "AttrValueContent",
1864 "DirElemContent", "DirCommentConstructor", "DirPIConstructor",
1865 "ComputedConstructor", "CompDocConstructor", "CompElemConstructor",
1866 "$@29", "IsInternal", "CompAttrConstructor", "CompTextConstructor",
1867 "CompCommentConstructor", "CompPIConstructor", "CompAttributeName",
1868 "$@30", "$@31", "CompElementName", "CompNameExpr", "CompPIName",
1869 "CompNamespaceConstructor", "SingleType", "TypeDeclaration",
1870 "SequenceType", "OccurrenceIndicator", "ItemType", "AtomicType",
1871 "KindTest", "AnyKindTest", "DocumentTest", "AnyElementTest", "TextTest",
1872 "CommentTest", "PITest", "AnyAttributeTest", "AttributeTest",
1873 "SchemaAttributeTest", "ElementTest", "OptionalQuestionMark",
1874 "SchemaElementTest", "EmptyParanteses", "AttributeName", "ElementName",
1875 "TypeName", "FunctionName", "NCName", "LexicalName", "PragmaName",
1876 "URILiteral", "StringLiteral", "QName", YY_NULLPTR
1877};
1878#endif
1879
1880# ifdef YYPRINT
1881/* YYTOKNUM[NUM] -- (External) token number corresponding to the
1882 (internal) symbol number NUM (which must be that of a token). */
1883static const yytype_uint16 yytoknum[] =
1884{
1885 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1886 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1887 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1888 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
1889 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
1890 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
1891 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
1892 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
1893 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
1894 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
1895 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
1896 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
1897 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
1898 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
1899 395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
1900 405, 406, 407, 408, 409, 410, 411, 412, 413, 414,
1901 415, 416, 417, 418, 419, 420, 421, 422, 423
1902};
1903# endif
1904
1905#define YYPACT_NINF -668
1906
1907#define yypact_value_is_default(Yystate) \
1908 (!!((Yystate) == (-668)))
1909
1910#define YYTABLE_NINF -463
1911
1912#define yytable_value_is_error(Yytable_value) \
1913 0
1914
1915 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1916 STATE-NUM. */
1917static const yytype_int16 yypact[] =
1918{
1919 -63, -28, 185, 86, 337, -668, 117, -668, -668, -668,
1920 734, -668, -668, 181, 253, 156, -668, 213, -668, -668,
1921 -668, -668, -668, -668, -668, 212, -668, -12, 230, 337,
1922 342, -668, -38, 189, 298, -668, -668, 188, 272, 353,
1923 -668, -668, 71, 316, -668, -668, 318, 239, 276, 134,
1924 188, 900, -668, 334, 282, -668, -668, 233, -668, 367,
1925 -668, -668, 133, 290, 295, -668, 1730, 1730, 345, -668,
1926 -668, -38, 305, -668, -36, 396, 334, -668, -668, -668,
1927 -668, -668, -668, -668, -668, -668, -668, 334, -668, -668,
1928 -668, -668, -668, -668, -668, -668, -668, -668, -668, 369,
1929 370, -668, -668, -668, -668, -668, -668, -668, -668, 307,
1930 389, -668, 601, 173, 24, -22, 32, -668, 338, 267,
1931 393, 394, 1398, -668, -668, -668, -668, -668, 334, -668,
1932 59, -668, -668, 166, -668, 339, -668, -668, -668, 395,
1933 -668, -668, -668, -668, -668, -668, 341, -668, -668, -668,
1934 -668, -668, -668, -668, -668, -668, -668, -668, -668, -668,
1935 -668, -668, -668, -668, -668, -668, -668, -668, -668, -668,
1936 -668, -668, -668, -668, -668, -668, -668, -668, -668, -668,
1937 340, -668, -668, 347, 337, 291, 360, 493, 373, 349,
1938 1885, 64, -668, 334, -668, 226, 392, -668, 358, -668,
1939 304, 334, -668, -668, 188, 167, 174, 206, 21, 188,
1940 430, 342, -53, 351, 188, 334, 6, -668, -668, -668,
1941 -668, 79, 287, -668, 353, 353, -668, -668, -668, 1232,
1942 336, 18, 403, 344, -668, 324, 1232, 334, -668, 308,
1943 -668, 337, -668, -668, 23, -668, 416, -668, 342, 342,
1944 166, 166, 353, 334, 334, -668, 1232, -668, -668, -668,
1945 -668, -668, 1232, 1232, 1398, 1398, -668, -668, -668, -668,
1946 -668, -668, -668, -668, -668, -668, -668, -668, -668, -668,
1947 -668, 1398, 1398, 1398, -668, -668, 1398, 1398, -668, -668,
1948 -668, -668, 1398, -668, -668, 1398, -668, -668, 1398, 352,
1949 447, 448, 449, -668, -668, 1066, -668, -668, -668, -668,
1950 -668, 1730, 1564, 1232, 108, -668, 1232, 1232, -668, -668,
1951 -668, 337, 461, -668, -668, -668, -668, 282, 374, 378,
1952 282, -668, -668, -668, 0, 51, -668, -668, 416, 342,
1953 -668, 226, 343, 226, 1232, -668, -668, 337, -668, -668,
1954 291, -668, -668, 291, -668, -668, 437, 337, 372, 376,
1955 421, 26, 408, 337, 291, 342, 384, -1, 431, -668,
1956 355, -668, -668, 52, 69, -668, -668, -668, 466, 466,
1957 -668, 356, 482, 337, 435, 484, 337, 353, 485, -668,
1958 453, -668, -668, 379, -668, 365, 368, -668, 371, 377,
1959 466, -668, -668, 380, -668, -668, 389, -668, -668, -668,
1960 -668, 168, 24, -22, 32, -668, 456, 456, 342, 342,
1961 -668, 459, -668, 191, -668, 375, 404, -668, -668, -668,
1962 383, 369, 370, 386, 291, -668, 442, 388, -6, 342,
1963 -668, 342, -668, -668, -668, -668, -668, -668, 465, 391,
1964 291, -668, -668, 157, 291, 337, 337, 16, 291, -668,
1965 409, -668, 348, 291, -668, -668, 415, -6, 466, 353,
1966 -668, 342, -668, 342, -668, 416, 456, 440, 495, 239,
1967 381, 454, 507, 425, 457, 507, 466, 463, -668, -668,
1968 -668, -668, -668, -668, 462, -668, 282, 282, -668, 121,
1969 -668, -668, -668, -668, -668, -668, 412, -668, -668, 512,
1970 433, 417, 1232, -668, -668, -668, -668, 337, -668, -668,
1971 513, -668, 497, -668, 422, 423, -668, -668, -668, -668,
1972 -668, -668, 291, -668, 291, 291, -668, -668, -668, 504,
1973 515, 188, -668, -668, 83, 416, 466, 432, 432, -668,
1974 -668, 1232, 508, 476, 450, -668, 492, 1232, -668, 337,
1975 291, -668, -668, 291, 547, 566, 1232, 539, -668, -668,
1976 -668, -668, -668, -668, -668, -668, 543, 1730, 62, 536,
1977 -668, 419, 353, -668, -668, -668, -668, -668, 353, 84,
1978 -668, -668, 291, 1804, -668, 291, 46, -668, 445, 446,
1979 -668, 353, 1232, -668, 33, 524, 550, -668, -668, -668,
1980 1232, 515, -668, 537, -668, -668, 528, -668, -668, 421,
1981 1232, -668, 466, 466, 504, -668, 1232, -668, 404, 1899,
1982 1899, 567, -668, 140, 148, -668, 339, -668, -668, 1232,
1983 -668, 573, -668, -668, -668, -668, -668, 92, 226, 226,
1984 -668, 1232, 337, -668, -668, 342, 456, -668, -668, -23,
1985 -668, 574, -668, -668, 466, 552, 148, 148, 1804, 464,
1986 1899, 1899, 1899, 1899, -668, 1232, 291, 11, -668, -668,
1987 -668, -668, 582, 472, -668, -668, 10, 47, 584, -668,
1988 337, 569, -668, 1232, -668, 234, -668, -668, 506, 148,
1989 148, -668, -668, -668, -668, 555, 1232, -668, -668, 63,
1990 250, -668, -668, 556, 1232, -668, -668, -668, -668, 479,
1991 -668, 559, -668, -668, -668, 481, -668, 1232, -668, -668,
1992 291, -668, 373, 488, 353, -668, 562, -668, -668, -668,
1993 -668, -668, 342, -668, -668, -668, 353, 191, 1232, 353,
1994 1232, -668, -668, 578, -668, 337, 521, 466, 353, 542,
1995 466, 487, -668, 466, -668, 373, -668, 466, 534, 466,
1996 -668, 600, 1232, 538, 125, -668, 416, 1232, 495, 1232,
1997 -668, 1232, -2, -668, -668, -668, 291, -668, 544, -668,
1998 -668, 342, 1232, -668, -668, 1232, 10, -668, -668, -668,
1999 11, -668, -668, 47, 490, -668, -668, -668, 1232, 63,
2000 -668, -668
2001};
2002
2003 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
2004 Performed when YYTABLE does not specify something else to do. Zero
2005 means the default is an error. */
2006static const yytype_uint16 yydefact[] =
2007{
2008 4, 0, 0, 11, 0, 1, 0, 3, 2, 11,
2009 0, 469, 470, 6, 0, 9, 471, 457, 472, 328,
2010 329, 343, 342, 306, 305, 116, 317, 390, 0, 0,
2011 0, 308, 390, 0, 0, 310, 309, 390, 0, 0,
2012 349, 322, 390, 0, 311, 313, 0, 0, 0, 0,
2013 390, 0, 229, 0, 0, 49, 315, 0, 228, 0,
2014 312, 314, 0, 0, 0, 316, 265, 0, 0, 327,
2015 274, 390, 0, 50, 252, 0, 0, 16, 13, 15,
2016 14, 29, 12, 43, 44, 19, 33, 0, 34, 35,
2017 30, 31, 36, 37, 17, 32, 18, 8, 89, 105,
2018 104, 109, 122, 123, 110, 160, 161, 111, 112, 108,
2019 190, 192, 194, 198, 200, 204, 210, 212, 218, 220,
2020 222, 224, 0, 226, 196, 195, 197, 230, 0, 232,
2021 0, 259, 231, 266, 267, 271, 295, 297, 299, 0,
2022 301, 298, 321, 319, 323, 326, 272, 330, 332, 340,
2023 333, 334, 335, 337, 336, 338, 355, 357, 358, 359,
2024 356, 380, 381, 382, 383, 384, 385, 386, 324, 427,
2025 421, 426, 425, 424, 320, 438, 439, 422, 423, 325,
2026 0, 460, 341, 458, 0, 0, 0, 0, 0, 0,
2027 0, 0, 391, 396, 440, 370, 0, 457, 0, 458,
2028 0, 0, 434, 378, 390, 0, 0, 0, 0, 390,
2029 0, 0, 0, 26, 390, 0, 0, 429, 345, 344,
2030 346, 0, 0, 446, 0, 0, 465, 464, 360, 0,
2031 66, 62, 0, 0, 348, 0, 0, 0, 428, 0,
2032 466, 261, 467, 403, 0, 404, 0, 435, 0, 0,
2033 263, 264, 0, 0, 0, 433, 0, 254, 253, 463,
2034 273, 350, 0, 0, 0, 0, 241, 250, 243, 234,
2035 236, 237, 238, 239, 235, 244, 248, 245, 246, 242,
2036 249, 0, 0, 0, 203, 202, 0, 0, 207, 208,
2037 209, 206, 0, 215, 214, 0, 217, 216, 0, 0,
2038 0, 0, 0, 227, 251, 0, 255, 258, 294, 293,
2039 292, 0, 0, 0, 0, 304, 0, 352, 7, 38,
2040 5, 0, 0, 121, 117, 120, 280, 0, 0, 0,
2041 0, 318, 455, 454, 0, 0, 456, 402, 0, 0,
2042 399, 370, 0, 370, 0, 280, 394, 0, 42, 41,
2043 0, 79, 78, 0, 56, 55, 0, 0, 0, 0,
2044 0, 0, 0, 0, 0, 0, 0, 285, 0, 387,
2045 0, 431, 432, 0, 0, 388, 401, 400, 408, 408,
2046 365, 0, 0, 0, 0, 0, 0, 0, 0, 347,
2047 0, 405, 379, 0, 262, 0, 0, 395, 0, 0,
2048 408, 275, 393, 0, 107, 106, 191, 193, 233, 240,
2049 247, 199, 201, 205, 211, 213, 0, 0, 0, 0,
2050 256, 0, 270, 0, 268, 0, 0, 300, 302, 303,
2051 0, 354, 353, 0, 0, 468, 0, 0, 282, 0,
2052 441, 0, 442, 392, 397, 371, 113, 372, 0, 0,
2053 0, 40, 77, 0, 0, 0, 0, 0, 0, 462,
2054 0, 461, 0, 0, 48, 28, 0, 282, 408, 0,
2055 430, 0, 447, 0, 448, 0, 0, 0, 133, 361,
2056 0, 0, 68, 0, 0, 68, 408, 0, 88, 260,
2057 436, 437, 445, 453, 0, 177, 0, 0, 219, 412,
2058 416, 417, 418, 420, 221, 223, 406, 225, 257, 0,
2059 0, 0, 0, 296, 331, 351, 10, 0, 339, 289,
2060 281, 283, 0, 459, 0, 0, 398, 276, 279, 60,
2061 57, 58, 0, 59, 0, 0, 53, 52, 51, 82,
2062 469, 390, 47, 21, 0, 0, 408, 451, 451, 389,
2063 409, 0, 0, 0, 0, 366, 0, 0, 67, 0,
2064 0, 63, 64, 0, 0, 0, 0, 0, 411, 419,
2065 413, 415, 414, 410, 407, 159, 0, 0, 150, 146,
2066 148, 288, 0, 444, 443, 54, 45, 46, 0, 0,
2067 83, 277, 0, 0, 286, 0, 0, 452, 0, 0,
2068 169, 0, 0, 365, 0, 0, 69, 70, 65, 61,
2069 0, 0, 162, 184, 178, 158, 0, 151, 152, 153,
2070 0, 284, 408, 408, 0, 80, 0, 39, 307, 93,
2071 0, 22, 90, 96, 92, 100, 103, 99, 20, 0,
2072 73, 75, 450, 449, 170, 134, 124, 0, 370, 370,
2073 367, 0, 0, 135, 163, 0, 0, 269, 154, 155,
2074 147, 290, 85, 84, 408, 0, 94, 95, 0, 0,
2075 0, 0, 0, 0, 74, 0, 0, 0, 125, 373,
2076 363, 362, 0, 0, 189, 71, 144, 0, 0, 179,
2077 0, 0, 149, 0, 287, 0, 278, 91, 114, 97,
2078 98, 101, 102, 76, 72, 0, 0, 171, 175, 144,
2079 0, 369, 368, 0, 0, 140, 141, 136, 139, 0,
2080 145, 0, 164, 168, 185, 0, 156, 0, 291, 86,
2081 0, 87, 0, 24, 0, 176, 0, 131, 126, 132,
2082 130, 376, 0, 377, 374, 375, 0, 144, 0, 0,
2083 0, 157, 81, 115, 118, 0, 285, 408, 0, 0,
2084 408, 0, 142, 408, 180, 0, 25, 408, 0, 408,
2085 364, 0, 0, 0, 0, 119, 0, 0, 133, 0,
2086 143, 0, 0, 182, 181, 183, 0, 172, 0, 137,
2087 165, 0, 0, 23, 173, 0, 144, 166, 187, 186,
2088 0, 127, 138, 0, 0, 174, 128, 167, 0, 144,
2089 188, 129
2090};
2091
2092 /* YYPGOTO[NTERM-NUM]. */
2093static const yytype_int16 yypgoto[] =
2094{
2095 -668, -668, -668, -668, -668, -668, -668, 613, -668, -668,
2096 -668, -668, -668, -668, -668, -668, -285, -668, -668, -668,
2097 -668, -668, -668, -668, -668, 418, -668, 5, -668, -668,
2098 -668, -668, -668, -668, -668, -668, -668, 142, -668, -668,
2099 -668, -668, -668, -668, -668, -668, -668, 4, -668, -51,
2100 -668, -668, -35, -668, -397, -340, -47, 317, -255, -668,
2101 -668, -668, -641, -668, -619, -668, -668, -174, -668, -668,
2102 -142, -583, -668, -159, -668, -657, -109, 216, -668, 27,
2103 -668, -668, -668, -668, -668, -668, -668, -668, -157, -668,
2104 -668, -668, -668, -668, -152, -668, -668, -667, -668, -668,
2105 -125, -668, -668, -668, -668, -668, -668, -668, -668, 387,
2106 385, 131, 366, -668, 397, -668, 361, 359, -668, -668,
2107 362, -668, -668, -668, 535, -668, -668, -668, -668, -668,
2108 -668, -668, -668, -668, -668, -668, -245, -668, 526, -668,
2109 -668, 279, -294, -668, -668, 313, -668, 194, -91, 85,
2110 -668, -668, -668, -87, -668, -668, -668, -668, -668, -668,
2111 -668, -668, -668, -668, -175, -668, -668, -668, -668, -668,
2112 -668, -668, -183, -668, -668, -668, -538, -668, -668, -42,
2113 -668, -668, -668, -668, 67, -668, -668, -327, -668, -668,
2114 -668, -668, -668, -668, -668, 3, -668, -668, -668, -668,
2115 -668, -668, -668, -668, 458, -668, -668, 252, -341, -412,
2116 -668, -668, -55, -394, -668, -668, -668, -668, -668, -668,
2117 -304, -668, -668, 467, 124, 469, -11, -668, -24, -170,
2118 321, -668, 639, -668, -308, 15, -30
2119};
2120
2121 /* YYDEFGOTO[NTERM-NUM]. */
2122static const yytype_int16 yydefgoto[] =
2123{
2124 -1, 2, 3, 185, 7, 8, 9, 10, 77, 593,
2125 669, 756, 366, 367, 78, 79, 320, 80, 81, 350,
2126 82, 83, 84, 85, 86, 87, 88, 458, 89, 356,
2127 532, 90, 91, 92, 386, 93, 383, 560, 606, 94,
2128 641, 676, 95, 353, 96, 664, 589, 590, 730, 341,
2129 97, 631, 632, 633, 634, 635, 98, 99, 100, 733,
2130 189, 753, 324, 101, 102, 678, 709, 738, 806, 809,
2131 553, 103, 686, 717, 796, 718, 719, 720, 579, 580,
2132 619, 659, 692, 512, 104, 105, 654, 687, 722, 797,
2133 803, 106, 644, 677, 707, 794, 800, 708, 107, 567,
2134 614, 725, 774, 784, 656, 785, 804, 108, 109, 110,
2135 111, 112, 113, 287, 114, 292, 115, 116, 295, 298,
2136 117, 118, 119, 120, 121, 122, 123, 124, 281, 125,
2137 282, 126, 283, 127, 128, 129, 306, 130, 131, 393,
2138 132, 133, 134, 253, 626, 437, 438, 520, 468, 521,
2139 522, 694, 312, 135, 136, 137, 314, 427, 138, 139,
2140 140, 190, 141, 142, 143, 144, 145, 146, 147, 148,
2141 149, 150, 219, 151, 152, 153, 154, 433, 155, 156,
2142 157, 380, 554, 681, 479, 555, 650, 342, 710, 158,
2143 159, 160, 161, 162, 475, 193, 163, 164, 165, 166,
2144 338, 339, 526, 375, 340, 246, 167, 505, 477, 498,
2145 573, 499, 500, 168, 169, 170, 370, 171, 172, 173,
2146 174, 175, 176, 177, 598, 178, 194, 335, 179, 524,
2147 180, 181, 556, 241, 541, 182, 183
2148};
2149
2150 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
2151 positive, shift that token. If negative, reduce the rule whose
2152 number is the opposite. If YYTABLE_NINF, syntax error. */
2153static const yytype_int16 yytable[] =
2154{
2155 199, 397, 237, 293, 235, 504, 198, 404, 405, 220,
2156 429, 245, 690, 434, 445, 331, 447, 422, 424, 13,
2157 723, 202, 501, 501, -307, 260, 11, 217, 12, 242,
2158 395, 223, 16, 459, 18, 201, 261, 439, 478, 450,
2159 215, 378, 379, 238, 196, 222, -288, 713, 705, 648,
2160 791, 247, 740, 232, 257, 637, 357, 200, 55, 494,
2161 255, 328, 432, 384, 550, 451, 639, 715, 452, 400,
2162 16, 332, 18, 288, 254, 482, 358, 304, 485, 464,
2163 46, 617, 501, 191, 721, 16, 197, 18, 441, 471,
2164 737, 754, 359, 443, 467, 536, 296, -27, 226, 227,
2165 736, 305, 1, 716, 50, 289, 473, 73, 537, 258,
2166 618, 640, 502, 502, 16, 197, 18, 19, 20, 297,
2167 581, 624, 385, 509, 775, 290, 739, 545, 192, 792,
2168 637, 426, 440, 46, 360, 4, 723, 294, 333, 428,
2169 243, 64, 337, 691, 706, 564, 327, 534, 535, 516,
2170 346, 519, 740, 510, 192, 333, 613, 50, 325, 38,
2171 199, 336, 649, 328, 369, 529, 221, 679, 291, 533,
2172 782, 337, 502, 538, 714, 236, 509, 715, 542, 59,
2173 706, 199, 381, 442, 472, 5, 391, 363, 6, 390,
2174 737, 199, 199, 75, 220, 220, 333, 374, 377, 318,
2175 187, 474, 401, 402, 486, 596, 510, 347, 334, 403,
2176 343, 333, 361, 716, 54, 594, 625, 368, 199, 199,
2177 680, 14, 220, 373, 398, 399, 739, 714, 244, 11,
2178 549, 12, 666, 667, 329, 308, 230, 192, 570, 49,
2179 184, 530, 63, 64, 689, 226, 227, 585, 571, 586,
2180 587, 607, 69, 11, 741, 12, 394, 578, 421, 396,
2181 186, 330, 501, 309, 531, 572, 425, 284, 236, 430,
2182 231, 525, 284, 699, 700, 608, 236, 742, 609, 670,
2183 671, 661, 662, 616, 199, 285, 546, 672, 673, 33,
2184 285, 348, 236, 16, 197, 18, 600, 448, 351, 729,
2185 595, 547, 605, 548, 509, 310, 311, 627, -462, 199,
2186 638, 612, 188, 349, 354, 444, 202, 223, 247, 255,
2187 352, 682, 683, 695, 204, 195, 205, 47, 286, 236,
2188 355, 461, 701, 702, 510, 199, 435, 203, 206, 207,
2189 11, 465, 12, 208, 685, 250, 251, 646, 16, 197,
2190 18, 540, 502, 12, 192, 653, 343, 220, 343, 16,
2191 218, 18, 435, 506, 506, 578, 57, 216, 224, 209,
2192 225, 229, 454, 16, 240, 18, 236, 200, 463, 16,
2193 323, 18, 726, 239, 674, 248, 199, 199, 199, 199,
2194 249, 704, 503, 503, 503, 503, 684, 252, 435, 622,
2195 256, 435, 210, 259, 265, 623, 262, 263, 211, 199,
2196 212, 199, 408, 409, 410, 523, 768, 523, 645, 771,
2197 703, 264, 773, 300, 299, 301, 776, 302, 778, 319,
2198 313, 315, 316, 321, 344, 317, 333, 362, 728, 220,
2199 382, 199, -461, 199, 326, 752, 199, 523, 388, 523,
2200 213, 735, 503, 345, 365, 387, 389, 392, 305, 747,
2201 214, 416, 16, 197, 18, 417, 418, 419, 436, 221,
2202 435, 435, 751, 244, 453, 446, 455, 435, 457, 426,
2203 456, 462, 466, 469, 476, 568, 569, 470, 480, 481,
2204 483, 484, 487, 762, 327, 764, 488, 490, 489, 191,
2205 491, 793, 508, 492, 539, 513, 636, 38, 527, 493,
2206 543, 328, 495, 514, 496, 517, 552, 780, 515, 204,
2207 518, 205, 787, 528, 789, 551, 790, 558, 559, 561,
2208 562, 786, 435, 206, 207, 557, 565, 799, 208, 574,
2209 801, 575, 636, 636, 592, 497, 576, 566, 577, 582,
2210 581, 757, 220, 810, 583, 584, 588, 591, 220, 597,
2211 601, 602, 54, 760, 209, 604, 763, 610, 603, 611,
2212 613, 220, 615, 620, 435, 769, 519, 642, 643, 665,
2213 651, 636, 329, 636, 636, 636, 636, 652, 657, 655,
2214 63, 64, 668, 675, 693, 696, 698, 322, 711, 199,
2215 199, 712, 724, 211, 727, 212, 732, 734, 746, 330,
2216 748, 749, 750, 755, 758, 765, 467, 770, 772, 777,
2217 779, 808, 15, 781, 658, 199, 199, 563, 663, 795,
2218 364, 688, 503, 697, 431, 811, 788, 802, 761, 511,
2219 199, 199, 199, 199, 731, 213, 807, 660, 805, 783,
2220 407, 406, 411, 413, 414, 214, 307, 303, 449, 743,
2221 415, 544, 266, 343, 343, 767, 621, 435, 744, 267,
2222 647, 507, 599, 268, 269, 270, 271, 272, 273, 274,
2223 376, 275, 460, 371, 412, 372, 228, 0, 0, 276,
2224 0, 0, 0, 0, 277, 0, 0, 278, 0, 0,
2225 0, 0, 325, 0, 220, 435, 279, 0, 0, 0,
2226 0, 0, 199, 0, 0, 0, 220, 0, 759, 220,
2227 0, 0, 280, 0, 0, 745, 0, 0, 220, 0,
2228 0, 0, 0, 0, 0, 325, 0, 11, 0, 12,
2229 16, 17, 18, 19, 20, 21, 22, 23, 24, 0,
2230 0, 25, 0, 0, 0, 0, 26, 27, 28, 0,
2231 29, 199, 0, 0, 30, 0, 0, 798, 31, 0,
2232 766, 0, 32, 33, 0, 0, 0, 0, 34, 0,
2233 35, 36, 0, 0, 37, 38, 39, 40, 41, 42,
2234 0, 0, 0, 0, 0, 0, 0, 43, 0, 0,
2235 44, 45, 0, 0, 46, 0, 0, 0, 0, 0,
2236 0, 47, 0, 0, 0, 0, 48, 49, 0, 0,
2237 0, 0, 0, 0, 0, 0, 0, 0, 50, 51,
2238 0, 0, 0, 52, 0, 0, 0, 0, 53, 0,
2239 54, 0, 0, 0, 0, 55, 0, 0, 0, 56,
2240 57, 58, 0, 0, 59, 0, 60, 61, 0, 0,
2241 62, 0, 0, 0, 0, 0, 0, 0, 63, 64,
2242 0, 65, 0, 66, 67, 68, 0, 0, 69, 0,
2243 0, 0, 0, 0, 0, 70, 0, 71, 0, 0,
2244 0, 0, 72, 0, 73, 74, 0, 0, 0, 0,
2245 0, 75, 76, 11, 0, 12, 16, 17, 18, 19,
2246 20, 21, 22, 23, 24, 0, 0, 25, 0, 0,
2247 0, 0, 26, 27, 28, 0, 29, 0, 0, 0,
2248 30, 0, 0, 0, 31, 0, 0, 0, 32, 33,
2249 0, 0, 0, 0, 233, 0, 35, 36, 0, 0,
2250 37, 38, 39, 40, 41, 42, 0, 0, 0, 0,
2251 0, 0, 0, 43, 0, 0, 44, 45, 0, 0,
2252 46, 0, 0, 0, 0, 0, 0, 47, 0, 0,
2253 0, 0, 48, 0, 0, 0, 0, 0, 0, 0,
2254 0, 0, 0, 0, 50, 51, 0, 0, 0, 52,
2255 0, 0, 0, 0, 53, 0, 54, 0, 0, 0,
2256 0, 55, 0, 0, 0, 56, 57, 58, 0, 0,
2257 59, 0, 60, 61, 0, 0, 62, 0, 0, 0,
2258 0, 0, 234, 0, 63, 64, 0, 65, 0, 66,
2259 67, 68, 0, 0, 69, 0, 0, 0, 0, 0,
2260 0, 70, 0, 71, 0, 0, 0, 0, 72, 0,
2261 73, 74, 0, 0, 0, 0, 0, 75, 76, 11,
2262 0, 12, 16, 17, 18, 19, 20, 21, 22, 23,
2263 24, 0, 0, 25, 0, 0, 0, 0, 26, 27,
2264 28, 0, 29, 0, 0, 0, 30, 0, 0, 0,
2265 31, 0, 0, 0, 32, 33, 0, 0, 0, 420,
2266 233, 0, 35, 36, 0, 0, 37, 38, 39, 40,
2267 41, 42, 0, 0, 0, 0, 0, 0, 0, 43,
2268 0, 0, 44, 45, 0, 0, 46, 0, 0, 0,
2269 0, 0, 0, 47, 0, 0, 0, 0, 48, 0,
2270 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2271 50, 51, 0, 0, 0, 52, 0, 0, 0, 0,
2272 53, 0, 54, 0, 0, 0, 0, 55, 0, 0,
2273 0, 56, 57, 58, 0, 0, 59, 0, 60, 61,
2274 0, 0, 62, 0, 0, 0, 0, 0, 0, 0,
2275 63, 64, 0, 65, 0, 66, 67, 68, 0, 0,
2276 69, 0, 0, 0, 0, 0, 0, 70, 0, 71,
2277 0, 0, 0, 0, 72, 0, 73, 74, 0, 0,
2278 0, 0, 0, 75, 76, 11, 0, 12, 16, 17,
2279 18, 19, 20, 21, 22, 23, 24, 0, 0, 25,
2280 0, 0, 0, 0, 26, 27, 28, 0, 29, 0,
2281 0, 0, 30, 0, 0, 0, 31, 0, 0, 0,
2282 32, 33, 0, 0, 0, 0, 233, 0, 35, 36,
2283 0, 0, 37, 38, 39, 40, 41, 42, 0, 0,
2284 0, 0, 0, 0, 0, 43, 0, 0, 44, 45,
2285 0, 0, 46, 0, 0, 0, 0, 0, 0, 47,
2286 0, 0, 0, 0, 48, 0, 0, 0, 0, 0,
2287 0, 0, 0, 0, 0, 0, 50, 51, 0, 0,
2288 0, 52, 0, 0, 0, 0, 53, 0, 54, 0,
2289 0, 0, 0, 55, 0, 0, 0, 56, 57, 58,
2290 0, 0, 59, 0, 60, 61, 0, 0, 62, 0,
2291 0, 0, 0, 0, 0, 0, 63, 64, 0, 65,
2292 0, 66, 67, 68, 0, 0, 69, 0, 0, 0,
2293 0, 0, 0, 70, 0, 71, 0, 0, 0, 0,
2294 72, 0, 73, 74, 0, 0, 0, 0, 0, 75,
2295 76, 11, 0, 12, 16, 17, 18, 19, 20, 21,
2296 22, 23, 24, 0, 0, 25, 0, 0, 0, 0,
2297 26, 27, 0, 0, 29, 0, 0, 0, 30, 0,
2298 0, 0, 31, 0, 0, 0, 32, 33, 0, 0,
2299 0, 0, 233, 0, 35, 36, 0, 0, 37, 38,
2300 39, 40, 41, 42, 0, 0, 0, 0, 0, 0,
2301 0, 0, 0, 0, 44, 45, 0, 0, 0, 0,
2302 0, 0, 0, 0, 0, 47, 0, 0, 0, 0,
2303 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2304 0, 0, 0, 51, 0, 0, 0, 52, 0, 0,
2305 0, 0, 53, 0, 54, 0, 0, 0, 0, 55,
2306 0, 0, 0, 56, 57, 58, 0, 0, 59, 0,
2307 60, 61, 0, 0, 62, 0, 0, 0, 0, 0,
2308 0, 0, 63, 64, 0, 65, 0, 66, 67, 0,
2309 0, 0, 69, 0, 0, 0, 0, 0, 0, 70,
2310 0, 71, 0, 0, 0, 0, 0, 0, 73, 74,
2311 0, 0, 0, 0, 0, 75, 76, 11, 0, 12,
2312 16, 17, 18, 19, 20, 21, 22, 23, 24, 0,
2313 0, 25, 0, 0, 0, 0, 26, 27, 0, 0,
2314 29, 0, 0, 0, 30, 0, 0, 0, 31, 0,
2315 0, 0, 32, 33, 0, 0, 0, 0, 233, 0,
2316 35, 36, 0, 0, 37, 38, 39, 40, 41, 42,
2317 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2318 44, 45, 0, 0, 0, 0, 0, 0, 0, 0,
2319 0, 47, 0, 0, 0, 0, 0, 0, 0, 0,
2320 0, 0, 0, 0, 0, 0, 0, 0, 0, 51,
2321 0, 0, 0, 0, 0, 0, 0, 0, 53, 0,
2322 54, 0, 0, 0, 0, 55, 0, 0, 0, 56,
2323 57, 0, 0, 0, 0, 0, 60, 61, 0, 0,
2324 62, 0, 0, 0, 0, 0, 0, 0, 63, 64,
2325 0, 65, 0, 0, 0, 0, 423, 0, 69, 0,
2326 0, 0, 0, 0, 0, 70, 0, 71, 0, 0,
2327 0, 0, 0, 0, 73, 0, 0, 0, 0, 0,
2328 0, 75, 76, 11, 0, 12, 16, 17, 18, 19,
2329 20, 21, 22, 23, 24, 0, 0, 25, 0, 0,
2330 0, 0, 26, 27, 0, 0, 29, 0, 0, 0,
2331 30, 0, 0, 0, 31, 0, 0, 0, 32, 33,
2332 0, 0, 0, 0, 233, 0, 35, 36, 0, 0,
2333 37, 38, 39, 40, 41, 42, 0, 0, 0, 0,
2334 0, 0, 0, 0, 0, 0, 44, 45, 0, 0,
2335 0, 0, 0, 0, 0, 0, 0, 47, 0, 0,
2336 16, 17, 18, 19, 20, 0, 0, 23, 24, 0,
2337 0, 0, 0, 0, 0, 51, 26, 628, 0, 0,
2338 0, 0, 0, 0, 53, 0, 54, 0, 31, 0,
2339 0, 55, 327, 0, 0, 56, 57, 0, 0, 0,
2340 35, 36, 60, 61, 0, 38, 62, 0, 41, 328,
2341 0, 0, 0, 0, 63, 64, 0, 65, 0, 0,
2342 44, 45, 0, 0, 69, 0, 0, 0, 0, 0,
2343 0, 70, 0, 71, 0, 0, 0, 0, 0, 0,
2344 73, 16, 197, 18, 19, 20, 0, 75, 76, 0,
2345 0, 0, 0, 0, 0, 16, 197, 18, 19, 20,
2346 54, 0, 23, 24, 0, 0, 0, 0, 0, 56,
2347 0, 26, 628, 327, 0, 0, 60, 61, 0, 0,
2348 329, 0, 0, 31, 0, 0, 38, 327, 63, 64,
2349 328, 65, 0, 629, 630, 35, 36, 0, 69, 0,
2350 38, 0, 0, 41, 328, 0, 0, 330, 0, 0,
2351 0, 0, 0, 0, 0, 44, 45, 0, 0, 0,
2352 0, 75, 0, 0, 0, 0, 0, 0, 0, 0,
2353 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2354 0, 54, 0, 0, 0, 0, 0, 0, 0, 0,
2355 0, 0, 0, 0, 0, 54, 0, 0, 0, 0,
2356 0, 329, 0, 0, 56, 0, 0, 0, 0, 0,
2357 64, 60, 61, 0, 0, 329, 0, 0, 0, 69,
2358 0, 0, 0, 63, 64, 0, 65, 0, 330, 0,
2359 0, 0, 0, 69, 0, 0, 0, 0, 0, 0,
2360 0, 0, 330
2361};
2362
2363static const yytype_int16 yycheck[] =
2364{
2365 30, 246, 53, 25, 51, 417, 30, 262, 263, 39,
2366 314, 62, 35, 321, 341, 190, 343, 311, 312, 4,
2367 687, 32, 416, 417, 36, 76, 3, 38, 5, 59,
2368 7, 42, 6, 7, 8, 32, 87, 37, 379, 347,
2369 37, 224, 225, 54, 29, 42, 52, 37, 37, 16,
2370 52, 62, 709, 50, 90, 593, 35, 95, 111, 400,
2371 71, 55, 317, 45, 476, 350, 20, 686, 353, 252,
2372 6, 7, 8, 49, 71, 383, 55, 128, 386, 364,
2373 70, 19, 476, 95, 37, 6, 7, 8, 37, 37,
2374 709, 732, 71, 338, 95, 79, 64, 98, 6, 7,
2375 37, 42, 165, 686, 94, 81, 37, 160, 92, 145,
2376 48, 65, 416, 417, 6, 7, 8, 9, 10, 87,
2377 37, 37, 104, 113, 765, 101, 709, 468, 166, 131,
2378 668, 23, 132, 70, 113, 163, 803, 159, 132, 314,
2379 7, 135, 193, 166, 133, 486, 38, 455, 456, 434,
2380 201, 157, 809, 143, 166, 132, 31, 94, 188, 51,
2381 190, 191, 129, 55, 215, 450, 95, 75, 144, 454,
2382 45, 222, 476, 458, 164, 42, 113, 796, 463, 120,
2383 133, 211, 229, 132, 132, 0, 237, 211, 102, 236,
2384 809, 221, 222, 167, 224, 225, 132, 221, 222, 184,
2385 44, 132, 253, 254, 387, 546, 143, 204, 144, 256,
2386 195, 132, 209, 796, 106, 132, 132, 214, 248, 249,
2387 128, 104, 252, 144, 248, 249, 809, 164, 95, 3,
2388 475, 5, 629, 630, 126, 69, 102, 166, 117, 83,
2389 59, 84, 134, 135, 656, 6, 7, 532, 127, 534,
2390 535, 559, 144, 3, 4, 5, 241, 512, 305, 244,
2391 7, 153, 656, 97, 107, 144, 313, 99, 42, 316,
2392 136, 441, 99, 670, 671, 560, 42, 27, 563, 139,
2393 140, 622, 623, 577, 314, 117, 469, 139, 140, 39,
2394 117, 124, 42, 6, 7, 8, 551, 344, 124, 65,
2395 545, 471, 557, 473, 113, 139, 140, 592, 95, 339,
2396 595, 566, 100, 146, 108, 339, 327, 328, 329, 330,
2397 146, 648, 649, 664, 26, 95, 28, 77, 155, 42,
2398 124, 361, 672, 673, 143, 365, 321, 148, 40, 41,
2399 3, 365, 5, 45, 652, 66, 67, 602, 6, 7,
2400 8, 3, 656, 5, 166, 610, 341, 387, 343, 6,
2401 7, 8, 347, 418, 419, 620, 116, 95, 52, 71,
2402 52, 95, 357, 6, 7, 8, 42, 95, 363, 6,
2403 7, 8, 690, 150, 639, 95, 416, 417, 418, 419,
2404 95, 676, 416, 417, 418, 419, 651, 52, 383, 582,
2405 95, 386, 104, 7, 15, 588, 37, 37, 110, 439,
2406 112, 441, 281, 282, 283, 439, 757, 441, 601, 760,
2407 675, 114, 763, 156, 86, 32, 767, 33, 769, 138,
2408 91, 36, 91, 73, 42, 95, 132, 7, 693, 469,
2409 104, 471, 95, 473, 95, 730, 476, 471, 104, 473,
2410 152, 706, 476, 95, 103, 52, 132, 149, 42, 714,
2411 162, 109, 6, 7, 8, 18, 18, 18, 7, 95,
2412 455, 456, 727, 95, 37, 132, 104, 462, 57, 23,
2413 104, 73, 98, 52, 18, 496, 497, 132, 132, 7,
2414 55, 7, 7, 748, 38, 750, 43, 132, 119, 95,
2415 132, 786, 43, 132, 95, 130, 593, 51, 43, 132,
2416 95, 55, 132, 130, 58, 73, 21, 772, 132, 26,
2417 132, 28, 777, 132, 779, 85, 781, 73, 21, 104,
2418 73, 776, 517, 40, 41, 154, 73, 792, 45, 127,
2419 795, 29, 629, 630, 541, 89, 113, 85, 131, 52,
2420 37, 734, 582, 808, 132, 132, 52, 42, 588, 127,
2421 52, 85, 106, 746, 71, 73, 749, 20, 118, 3,
2422 31, 601, 29, 37, 559, 758, 157, 132, 132, 626,
2423 56, 668, 126, 670, 671, 672, 673, 37, 60, 52,
2424 134, 135, 25, 20, 20, 43, 132, 104, 16, 629,
2425 630, 129, 18, 110, 35, 112, 100, 52, 52, 153,
2426 131, 52, 131, 125, 52, 37, 95, 75, 131, 85,
2427 20, 131, 9, 85, 619, 655, 656, 485, 624, 85,
2428 212, 655, 656, 668, 317, 809, 778, 796, 747, 423,
2429 670, 671, 672, 673, 695, 152, 803, 620, 800, 774,
2430 265, 264, 286, 292, 295, 162, 130, 122, 345, 710,
2431 298, 467, 61, 648, 649, 756, 581, 652, 710, 68,
2432 603, 419, 548, 72, 73, 74, 75, 76, 77, 78,
2433 222, 80, 361, 216, 287, 216, 47, -1, -1, 88,
2434 -1, -1, -1, -1, 93, -1, -1, 96, -1, -1,
2435 -1, -1, 732, -1, 734, 690, 105, -1, -1, -1,
2436 -1, -1, 742, -1, -1, -1, 746, -1, 742, 749,
2437 -1, -1, 121, -1, -1, 710, -1, -1, 758, -1,
2438 -1, -1, -1, -1, -1, 765, -1, 3, -1, 5,
2439 6, 7, 8, 9, 10, 11, 12, 13, 14, -1,
2440 -1, 17, -1, -1, -1, -1, 22, 23, 24, -1,
2441 26, 791, -1, -1, 30, -1, -1, 791, 34, -1,
2442 755, -1, 38, 39, -1, -1, -1, -1, 44, -1,
2443 46, 47, -1, -1, 50, 51, 52, 53, 54, 55,
2444 -1, -1, -1, -1, -1, -1, -1, 63, -1, -1,
2445 66, 67, -1, -1, 70, -1, -1, -1, -1, -1,
2446 -1, 77, -1, -1, -1, -1, 82, 83, -1, -1,
2447 -1, -1, -1, -1, -1, -1, -1, -1, 94, 95,
2448 -1, -1, -1, 99, -1, -1, -1, -1, 104, -1,
2449 106, -1, -1, -1, -1, 111, -1, -1, -1, 115,
2450 116, 117, -1, -1, 120, -1, 122, 123, -1, -1,
2451 126, -1, -1, -1, -1, -1, -1, -1, 134, 135,
2452 -1, 137, -1, 139, 140, 141, -1, -1, 144, -1,
2453 -1, -1, -1, -1, -1, 151, -1, 153, -1, -1,
2454 -1, -1, 158, -1, 160, 161, -1, -1, -1, -1,
2455 -1, 167, 168, 3, -1, 5, 6, 7, 8, 9,
2456 10, 11, 12, 13, 14, -1, -1, 17, -1, -1,
2457 -1, -1, 22, 23, 24, -1, 26, -1, -1, -1,
2458 30, -1, -1, -1, 34, -1, -1, -1, 38, 39,
2459 -1, -1, -1, -1, 44, -1, 46, 47, -1, -1,
2460 50, 51, 52, 53, 54, 55, -1, -1, -1, -1,
2461 -1, -1, -1, 63, -1, -1, 66, 67, -1, -1,
2462 70, -1, -1, -1, -1, -1, -1, 77, -1, -1,
2463 -1, -1, 82, -1, -1, -1, -1, -1, -1, -1,
2464 -1, -1, -1, -1, 94, 95, -1, -1, -1, 99,
2465 -1, -1, -1, -1, 104, -1, 106, -1, -1, -1,
2466 -1, 111, -1, -1, -1, 115, 116, 117, -1, -1,
2467 120, -1, 122, 123, -1, -1, 126, -1, -1, -1,
2468 -1, -1, 132, -1, 134, 135, -1, 137, -1, 139,
2469 140, 141, -1, -1, 144, -1, -1, -1, -1, -1,
2470 -1, 151, -1, 153, -1, -1, -1, -1, 158, -1,
2471 160, 161, -1, -1, -1, -1, -1, 167, 168, 3,
2472 -1, 5, 6, 7, 8, 9, 10, 11, 12, 13,
2473 14, -1, -1, 17, -1, -1, -1, -1, 22, 23,
2474 24, -1, 26, -1, -1, -1, 30, -1, -1, -1,
2475 34, -1, -1, -1, 38, 39, -1, -1, -1, 43,
2476 44, -1, 46, 47, -1, -1, 50, 51, 52, 53,
2477 54, 55, -1, -1, -1, -1, -1, -1, -1, 63,
2478 -1, -1, 66, 67, -1, -1, 70, -1, -1, -1,
2479 -1, -1, -1, 77, -1, -1, -1, -1, 82, -1,
2480 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2481 94, 95, -1, -1, -1, 99, -1, -1, -1, -1,
2482 104, -1, 106, -1, -1, -1, -1, 111, -1, -1,
2483 -1, 115, 116, 117, -1, -1, 120, -1, 122, 123,
2484 -1, -1, 126, -1, -1, -1, -1, -1, -1, -1,
2485 134, 135, -1, 137, -1, 139, 140, 141, -1, -1,
2486 144, -1, -1, -1, -1, -1, -1, 151, -1, 153,
2487 -1, -1, -1, -1, 158, -1, 160, 161, -1, -1,
2488 -1, -1, -1, 167, 168, 3, -1, 5, 6, 7,
2489 8, 9, 10, 11, 12, 13, 14, -1, -1, 17,
2490 -1, -1, -1, -1, 22, 23, 24, -1, 26, -1,
2491 -1, -1, 30, -1, -1, -1, 34, -1, -1, -1,
2492 38, 39, -1, -1, -1, -1, 44, -1, 46, 47,
2493 -1, -1, 50, 51, 52, 53, 54, 55, -1, -1,
2494 -1, -1, -1, -1, -1, 63, -1, -1, 66, 67,
2495 -1, -1, 70, -1, -1, -1, -1, -1, -1, 77,
2496 -1, -1, -1, -1, 82, -1, -1, -1, -1, -1,
2497 -1, -1, -1, -1, -1, -1, 94, 95, -1, -1,
2498 -1, 99, -1, -1, -1, -1, 104, -1, 106, -1,
2499 -1, -1, -1, 111, -1, -1, -1, 115, 116, 117,
2500 -1, -1, 120, -1, 122, 123, -1, -1, 126, -1,
2501 -1, -1, -1, -1, -1, -1, 134, 135, -1, 137,
2502 -1, 139, 140, 141, -1, -1, 144, -1, -1, -1,
2503 -1, -1, -1, 151, -1, 153, -1, -1, -1, -1,
2504 158, -1, 160, 161, -1, -1, -1, -1, -1, 167,
2505 168, 3, -1, 5, 6, 7, 8, 9, 10, 11,
2506 12, 13, 14, -1, -1, 17, -1, -1, -1, -1,
2507 22, 23, -1, -1, 26, -1, -1, -1, 30, -1,
2508 -1, -1, 34, -1, -1, -1, 38, 39, -1, -1,
2509 -1, -1, 44, -1, 46, 47, -1, -1, 50, 51,
2510 52, 53, 54, 55, -1, -1, -1, -1, -1, -1,
2511 -1, -1, -1, -1, 66, 67, -1, -1, -1, -1,
2512 -1, -1, -1, -1, -1, 77, -1, -1, -1, -1,
2513 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2514 -1, -1, -1, 95, -1, -1, -1, 99, -1, -1,
2515 -1, -1, 104, -1, 106, -1, -1, -1, -1, 111,
2516 -1, -1, -1, 115, 116, 117, -1, -1, 120, -1,
2517 122, 123, -1, -1, 126, -1, -1, -1, -1, -1,
2518 -1, -1, 134, 135, -1, 137, -1, 139, 140, -1,
2519 -1, -1, 144, -1, -1, -1, -1, -1, -1, 151,
2520 -1, 153, -1, -1, -1, -1, -1, -1, 160, 161,
2521 -1, -1, -1, -1, -1, 167, 168, 3, -1, 5,
2522 6, 7, 8, 9, 10, 11, 12, 13, 14, -1,
2523 -1, 17, -1, -1, -1, -1, 22, 23, -1, -1,
2524 26, -1, -1, -1, 30, -1, -1, -1, 34, -1,
2525 -1, -1, 38, 39, -1, -1, -1, -1, 44, -1,
2526 46, 47, -1, -1, 50, 51, 52, 53, 54, 55,
2527 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2528 66, 67, -1, -1, -1, -1, -1, -1, -1, -1,
2529 -1, 77, -1, -1, -1, -1, -1, -1, -1, -1,
2530 -1, -1, -1, -1, -1, -1, -1, -1, -1, 95,
2531 -1, -1, -1, -1, -1, -1, -1, -1, 104, -1,
2532 106, -1, -1, -1, -1, 111, -1, -1, -1, 115,
2533 116, -1, -1, -1, -1, -1, 122, 123, -1, -1,
2534 126, -1, -1, -1, -1, -1, -1, -1, 134, 135,
2535 -1, 137, -1, -1, -1, -1, 142, -1, 144, -1,
2536 -1, -1, -1, -1, -1, 151, -1, 153, -1, -1,
2537 -1, -1, -1, -1, 160, -1, -1, -1, -1, -1,
2538 -1, 167, 168, 3, -1, 5, 6, 7, 8, 9,
2539 10, 11, 12, 13, 14, -1, -1, 17, -1, -1,
2540 -1, -1, 22, 23, -1, -1, 26, -1, -1, -1,
2541 30, -1, -1, -1, 34, -1, -1, -1, 38, 39,
2542 -1, -1, -1, -1, 44, -1, 46, 47, -1, -1,
2543 50, 51, 52, 53, 54, 55, -1, -1, -1, -1,
2544 -1, -1, -1, -1, -1, -1, 66, 67, -1, -1,
2545 -1, -1, -1, -1, -1, -1, -1, 77, -1, -1,
2546 6, 7, 8, 9, 10, -1, -1, 13, 14, -1,
2547 -1, -1, -1, -1, -1, 95, 22, 23, -1, -1,
2548 -1, -1, -1, -1, 104, -1, 106, -1, 34, -1,
2549 -1, 111, 38, -1, -1, 115, 116, -1, -1, -1,
2550 46, 47, 122, 123, -1, 51, 126, -1, 54, 55,
2551 -1, -1, -1, -1, 134, 135, -1, 137, -1, -1,
2552 66, 67, -1, -1, 144, -1, -1, -1, -1, -1,
2553 -1, 151, -1, 153, -1, -1, -1, -1, -1, -1,
2554 160, 6, 7, 8, 9, 10, -1, 167, 168, -1,
2555 -1, -1, -1, -1, -1, 6, 7, 8, 9, 10,
2556 106, -1, 13, 14, -1, -1, -1, -1, -1, 115,
2557 -1, 22, 23, 38, -1, -1, 122, 123, -1, -1,
2558 126, -1, -1, 34, -1, -1, 51, 38, 134, 135,
2559 55, 137, -1, 139, 140, 46, 47, -1, 144, -1,
2560 51, -1, -1, 54, 55, -1, -1, 153, -1, -1,
2561 -1, -1, -1, -1, -1, 66, 67, -1, -1, -1,
2562 -1, 167, -1, -1, -1, -1, -1, -1, -1, -1,
2563 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2564 -1, 106, -1, -1, -1, -1, -1, -1, -1, -1,
2565 -1, -1, -1, -1, -1, 106, -1, -1, -1, -1,
2566 -1, 126, -1, -1, 115, -1, -1, -1, -1, -1,
2567 135, 122, 123, -1, -1, 126, -1, -1, -1, 144,
2568 -1, -1, -1, 134, 135, -1, 137, -1, 153, -1,
2569 -1, -1, -1, 144, -1, -1, -1, -1, -1, -1,
2570 -1, -1, 153
2571};
2572
2573 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
2574 symbol of state STATE-NUM. */
2575static const yytype_uint16 yystos[] =
2576{
2577 0, 165, 170, 171, 163, 0, 102, 173, 174, 175,
2578 176, 3, 5, 404, 104, 176, 6, 7, 8, 9,
2579 10, 11, 12, 13, 14, 17, 22, 23, 24, 26,
2580 30, 34, 38, 39, 44, 46, 47, 50, 51, 52,
2581 53, 54, 55, 63, 66, 67, 70, 77, 82, 83,
2582 94, 95, 99, 104, 106, 111, 115, 116, 117, 120,
2583 122, 123, 126, 134, 135, 137, 139, 140, 141, 144,
2584 151, 153, 158, 160, 161, 167, 168, 177, 183, 184,
2585 186, 187, 189, 190, 191, 192, 193, 194, 195, 197,
2586 200, 201, 202, 204, 208, 211, 213, 219, 225, 226,
2587 227, 232, 233, 240, 253, 254, 260, 267, 276, 277,
2588 278, 279, 280, 281, 283, 285, 286, 289, 290, 291,
2589 292, 293, 294, 295, 296, 298, 300, 302, 303, 304,
2590 306, 307, 309, 310, 311, 322, 323, 324, 327, 328,
2591 329, 331, 332, 333, 334, 335, 336, 337, 338, 339,
2592 340, 342, 343, 344, 345, 347, 348, 349, 358, 359,
2593 360, 361, 362, 365, 366, 367, 368, 375, 382, 383,
2594 384, 386, 387, 388, 389, 390, 391, 392, 394, 397,
2595 399, 400, 404, 405, 59, 172, 7, 44, 100, 229,
2596 330, 95, 166, 364, 395, 95, 404, 7, 397, 405,
2597 95, 364, 395, 148, 26, 28, 40, 41, 45, 71,
2598 104, 110, 112, 152, 162, 364, 95, 395, 7, 341,
2599 405, 95, 364, 395, 52, 52, 6, 7, 401, 95,
2600 102, 136, 364, 44, 132, 225, 42, 218, 395, 150,
2601 7, 402, 405, 7, 95, 218, 374, 395, 95, 95,
2602 310, 310, 52, 312, 364, 395, 95, 90, 145, 7,
2603 218, 218, 37, 37, 114, 15, 61, 68, 72, 73,
2604 74, 75, 76, 77, 78, 80, 88, 93, 96, 105,
2605 121, 297, 299, 301, 99, 117, 155, 282, 49, 81,
2606 101, 144, 284, 25, 159, 287, 64, 87, 288, 86,
2607 156, 32, 33, 293, 218, 42, 305, 307, 69, 97,
2608 139, 140, 321, 91, 325, 36, 91, 95, 404, 138,
2609 185, 73, 104, 7, 231, 405, 95, 38, 55, 126,
2610 153, 333, 7, 132, 144, 396, 405, 218, 369, 370,
2611 373, 218, 356, 404, 42, 95, 218, 364, 124, 146,
2612 188, 124, 146, 212, 108, 124, 198, 35, 55, 71,
2613 113, 364, 7, 397, 194, 103, 181, 182, 364, 218,
2614 385, 392, 394, 144, 397, 372, 373, 397, 341, 341,
2615 350, 225, 104, 205, 45, 104, 203, 52, 104, 132,
2616 225, 218, 149, 308, 404, 7, 404, 305, 397, 397,
2617 341, 218, 218, 225, 227, 227, 278, 279, 280, 280,
2618 280, 281, 283, 285, 286, 289, 109, 18, 18, 18,
2619 43, 225, 311, 142, 311, 225, 23, 326, 333, 389,
2620 225, 226, 227, 346, 403, 404, 7, 314, 315, 37,
2621 132, 37, 132, 305, 397, 356, 132, 356, 225, 314,
2622 403, 185, 185, 37, 404, 104, 104, 57, 196, 7,
2623 399, 405, 73, 404, 185, 397, 98, 95, 317, 52,
2624 132, 37, 132, 37, 132, 363, 18, 377, 377, 353,
2625 132, 7, 403, 55, 7, 403, 341, 7, 43, 119,
2626 132, 132, 132, 132, 377, 132, 58, 89, 378, 380,
2627 381, 382, 389, 397, 378, 376, 381, 376, 43, 113,
2628 143, 246, 252, 130, 130, 132, 185, 73, 132, 157,
2629 316, 318, 319, 397, 398, 398, 371, 43, 132, 185,
2630 84, 107, 199, 185, 403, 403, 79, 92, 185, 95,
2631 3, 403, 185, 95, 316, 377, 341, 398, 398, 305,
2632 378, 85, 21, 239, 351, 354, 401, 154, 73, 21,
2633 206, 104, 73, 206, 377, 73, 85, 268, 395, 395,
2634 117, 127, 144, 379, 127, 29, 113, 131, 227, 247,
2635 248, 37, 52, 132, 132, 185, 185, 185, 52, 215,
2636 216, 42, 364, 178, 132, 305, 377, 127, 393, 393,
2637 227, 52, 85, 118, 73, 227, 207, 403, 185, 185,
2638 20, 3, 227, 31, 269, 29, 311, 19, 48, 249,
2639 37, 318, 341, 341, 37, 132, 313, 185, 23, 139,
2640 140, 220, 221, 222, 223, 224, 322, 345, 185, 20,
2641 65, 209, 132, 132, 261, 341, 227, 353, 16, 129,
2642 355, 56, 37, 227, 255, 52, 273, 60, 196, 250,
2643 248, 377, 377, 216, 214, 225, 223, 223, 25, 179,
2644 139, 140, 139, 140, 227, 20, 210, 262, 234, 75,
2645 128, 352, 356, 356, 227, 403, 241, 256, 397, 378,
2646 35, 166, 251, 20, 320, 377, 43, 221, 132, 223,
2647 223, 224, 224, 227, 185, 37, 133, 263, 266, 235,
2648 357, 16, 129, 37, 164, 233, 240, 242, 244, 245,
2649 246, 37, 257, 266, 18, 270, 403, 35, 227, 65,
2650 217, 218, 100, 228, 52, 227, 37, 233, 236, 240,
2651 244, 4, 27, 218, 348, 404, 52, 227, 131, 52,
2652 131, 227, 185, 230, 231, 125, 180, 341, 52, 397,
2653 341, 245, 227, 341, 227, 37, 404, 317, 377, 341,
2654 75, 377, 131, 377, 271, 231, 377, 85, 377, 20,
2655 227, 85, 45, 269, 272, 274, 305, 227, 239, 227,
2656 227, 52, 131, 185, 264, 85, 243, 258, 397, 227,
2657 265, 227, 242, 259, 275, 263, 237, 257, 131, 238,
2658 227, 236
2659};
2660
2661 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
2662static const yytype_uint16 yyr1[] =
2663{
2664 0, 169, 170, 170, 171, 171, 172, 172, 173, 174,
2665 175, 176, 176, 176, 176, 176, 176, 176, 176, 176,
2666 177, 178, 179, 177, 180, 180, 181, 181, 182, 183,
2667 183, 183, 183, 183, 183, 183, 184, 184, 185, 186,
2668 187, 188, 188, 189, 189, 190, 191, 192, 193, 194,
2669 194, 195, 196, 196, 197, 198, 198, 199, 199, 200,
2670 201, 202, 203, 203, 203, 204, 205, 205, 206, 206,
2671 207, 207, 208, 209, 209, 210, 210, 211, 212, 212,
2672 214, 213, 215, 215, 215, 216, 217, 217, 218, 219,
2673 220, 220, 221, 221, 221, 221, 221, 221, 221, 222,
2674 223, 223, 223, 224, 225, 225, 226, 226, 227, 227,
2675 227, 227, 227, 227, 228, 228, 229, 229, 230, 230,
2676 231, 231, 232, 232, 234, 235, 233, 237, 238, 236,
2677 236, 236, 236, 239, 239, 241, 240, 243, 242, 242,
2678 242, 242, 244, 244, 245, 245, 246, 247, 247, 248,
2679 249, 249, 249, 250, 250, 251, 251, 251, 252, 252,
2680 253, 253, 255, 256, 254, 258, 259, 257, 257, 261,
2681 262, 260, 264, 265, 263, 263, 266, 268, 267, 270,
2682 271, 269, 272, 272, 273, 273, 274, 275, 274, 276,
2683 277, 277, 278, 278, 279, 279, 279, 279, 280, 280,
2684 281, 281, 282, 282, 283, 283, 284, 284, 284, 284,
2685 285, 285, 286, 286, 287, 287, 288, 288, 289, 289,
2686 290, 290, 291, 291, 292, 292, 293, 293, 294, 294,
2687 295, 295, 295, 296, 297, 297, 297, 297, 297, 297,
2688 298, 299, 299, 299, 299, 299, 299, 300, 301, 301,
2689 301, 302, 303, 303, 303, 304, 305, 305, 306, 306,
2690 307, 308, 308, 309, 309, 309, 309, 310, 310, 310,
2691 310, 311, 311, 311, 312, 311, 311, 313, 311, 311,
2692 315, 314, 316, 316, 316, 317, 317, 318, 319, 319,
2693 320, 320, 321, 321, 321, 322, 322, 323, 323, 325,
2694 324, 324, 326, 326, 327, 328, 328, 328, 328, 328,
2695 328, 328, 328, 328, 328, 328, 328, 330, 329, 329,
2696 329, 331, 332, 333, 333, 334, 334, 335, 335, 335,
2697 336, 336, 337, 337, 337, 337, 337, 337, 337, 337,
2698 338, 338, 339, 339, 340, 341, 341, 342, 342, 343,
2699 344, 345, 346, 346, 346, 347, 347, 348, 348, 348,
2700 350, 351, 349, 352, 352, 353, 353, 354, 355, 355,
2701 356, 356, 356, 357, 357, 357, 357, 357, 358, 359,
2702 360, 360, 360, 360, 360, 360, 360, 361, 363, 362,
2703 364, 364, 365, 366, 367, 368, 370, 371, 369, 369,
2704 372, 372, 373, 374, 374, 375, 376, 376, 377, 377,
2705 378, 378, 379, 379, 379, 379, 380, 380, 380, 380,
2706 381, 382, 382, 382, 382, 382, 382, 382, 383, 384,
2707 384, 385, 385, 386, 387, 388, 388, 388, 389, 389,
2708 390, 390, 390, 390, 390, 391, 392, 392, 392, 392,
2709 392, 393, 393, 394, 395, 396, 396, 397, 397, 398,
2710 399, 399, 400, 400, 401, 401, 402, 402, 403, 404,
2711 404, 405, 405
2712};
2713
2714 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
2715static const yytype_uint8 yyr2[] =
2716{
2717 0, 2, 2, 2, 0, 5, 0, 2, 2, 2,
2718 6, 0, 2, 2, 2, 2, 2, 2, 2, 2,
2719 7, 0, 0, 15, 0, 2, 0, 1, 2, 1,
2720 1, 1, 1, 1, 1, 1, 1, 1, 1, 7,
2721 4, 1, 1, 1, 1, 6, 6, 5, 4, 1,
2722 1, 5, 2, 2, 6, 1, 1, 1, 1, 5,
2723 5, 6, 0, 3, 3, 6, 0, 3, 0, 2,
2724 1, 3, 9, 1, 2, 0, 2, 4, 1, 1,
2725 0, 11, 0, 1, 3, 3, 1, 1, 3, 1,
2726 1, 3, 1, 1, 2, 2, 1, 3, 3, 1,
2727 1, 3, 3, 1, 1, 1, 3, 3, 1, 1,
2728 1, 1, 1, 4, 0, 2, 0, 2, 1, 3,
2729 1, 1, 1, 1, 0, 0, 10, 0, 0, 10,
2730 1, 1, 1, 0, 3, 0, 9, 0, 8, 1,
2731 1, 1, 3, 5, 0, 1, 2, 3, 1, 4,
2732 0, 1, 1, 0, 1, 0, 2, 3, 3, 2,
2733 1, 1, 0, 0, 9, 0, 0, 9, 1, 0,
2734 0, 9, 0, 0, 9, 1, 2, 0, 6, 0,
2735 0, 8, 1, 1, 0, 3, 3, 0, 6, 8,
2736 1, 3, 1, 3, 1, 1, 1, 1, 1, 3,
2737 1, 3, 1, 1, 1, 3, 1, 1, 1, 1,
2738 1, 3, 1, 3, 1, 1, 1, 1, 1, 4,
2739 1, 4, 1, 4, 1, 4, 1, 2, 1, 1,
2740 1, 1, 1, 3, 1, 1, 1, 1, 1, 1,
2741 3, 1, 1, 1, 1, 1, 1, 3, 1, 1,
2742 1, 2, 1, 2, 2, 2, 2, 3, 2, 1,
2743 4, 0, 1, 2, 2, 1, 1, 1, 3, 7,
2744 3, 1, 1, 2, 0, 3, 5, 0, 9, 5,
2745 0, 2, 0, 1, 3, 0, 3, 5, 0, 1,
2746 0, 2, 1, 1, 1, 1, 4, 1, 1, 0,
2747 3, 1, 1, 1, 2, 1, 1, 1, 1, 1,
2748 1, 1, 1, 1, 1, 1, 1, 0, 3, 1,
2749 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2750 1, 4, 1, 1, 1, 1, 1, 1, 1, 5,
2751 1, 1, 1, 1, 2, 1, 1, 3, 2, 1,
2752 2, 4, 0, 1, 1, 1, 1, 1, 1, 1,
2753 0, 0, 8, 1, 5, 0, 2, 3, 3, 3,
2754 0, 2, 2, 0, 2, 2, 2, 2, 2, 3,
2755 1, 1, 1, 1, 1, 1, 1, 3, 0, 5,
2756 0, 1, 4, 3, 3, 3, 0, 0, 3, 1,
2757 1, 1, 1, 1, 1, 3, 1, 2, 0, 2,
2758 2, 2, 0, 1, 1, 1, 1, 1, 1, 2,
2759 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
2760 4, 1, 1, 2, 2, 2, 4, 4, 1, 1,
2761 2, 4, 4, 6, 6, 4, 2, 4, 4, 7,
2762 7, 0, 1, 4, 2, 1, 1, 1, 1, 1,
2763 1, 1, 1, 2, 1, 1, 1, 1, 1, 1,
2764 1, 1, 1
2765};
2766
2767
2768#define yyerrok (yyerrstatus = 0)
2769#define yyclearin (yychar = YYEMPTY)
2770#define YYEMPTY (-2)
2771#define YYEOF 0
2772
2773#define YYACCEPT goto yyacceptlab
2774#define YYABORT goto yyabortlab
2775#define YYERROR goto yyerrorlab
2776
2777
2778#define YYRECOVERING() (!!yyerrstatus)
2779
2780#define YYBACKUP(Token, Value) \
2781 do \
2782 if (yychar == YYEMPTY) \
2783 { \
2784 yychar = (Token); \
2785 yylval = (Value); \
2786 YYPOPSTACK (yylen); \
2787 yystate = *yyssp; \
2788 goto yybackup; \
2789 } \
2790 else \
2791 { \
2792 yyerror (&yylloc, parseInfo, YY_("syntax error: cannot back up")); \
2793 YYERROR; \
2794 } \
2795 while (0)
2796
2797/* Error token number */
2798#define YYTERROR 1
2799#define YYERRCODE 256
2800
2801
2802/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2803 If N is 0, then set CURRENT to the empty location which ends
2804 the previous symbol: RHS[0] (always defined). */
2805
2806#ifndef YYLLOC_DEFAULT
2807# define YYLLOC_DEFAULT(Current, Rhs, N) \
2808 do \
2809 if (N) \
2810 { \
2811 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
2812 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
2813 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
2814 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
2815 } \
2816 else \
2817 { \
2818 (Current).first_line = (Current).last_line = \
2819 YYRHSLOC (Rhs, 0).last_line; \
2820 (Current).first_column = (Current).last_column = \
2821 YYRHSLOC (Rhs, 0).last_column; \
2822 } \
2823 while (0)
2824#endif
2825
2826#define YYRHSLOC(Rhs, K) ((Rhs)[K])
2827
2828
2829/* Enable debugging if requested. */
2830#if XPATHDEBUG
2831
2832# ifndef YYFPRINTF
2833# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2834# define YYFPRINTF fprintf
2835# endif
2836
2837# define YYDPRINTF(Args) \
2838do { \
2839 if (yydebug) \
2840 YYFPRINTF Args; \
2841} while (0)
2842
2843
2844/* YY_LOCATION_PRINT -- Print the location on the stream.
2845 This macro was not mandated originally: define only if we know
2846 we won't break user code: when these are the locations we know. */
2847
2848#ifndef YY_LOCATION_PRINT
2849# if defined XPATHLTYPE_IS_TRIVIAL && XPATHLTYPE_IS_TRIVIAL
2850
2851/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
2852
2853YY_ATTRIBUTE_UNUSED
2854static int
2855yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
2856{
2857 int res = 0;
2858 int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
2859 if (0 <= yylocp->first_line)
2860 {
2861 res += YYFPRINTF (yyo, "%d", yylocp->first_line);
2862 if (0 <= yylocp->first_column)
2863 res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
2864 }
2865 if (0 <= yylocp->last_line)
2866 {
2867 if (yylocp->first_line < yylocp->last_line)
2868 {
2869 res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
2870 if (0 <= end_col)
2871 res += YYFPRINTF (yyo, ".%d", end_col);
2872 }
2873 else if (0 <= end_col && yylocp->first_column < end_col)
2874 res += YYFPRINTF (yyo, "-%d", end_col);
2875 }
2876 return res;
2877 }
2878
2879# define YY_LOCATION_PRINT(File, Loc) \
2880 yy_location_print_ (File, &(Loc))
2881
2882# else
2883# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2884# endif
2885#endif
2886
2887
2888# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
2889do { \
2890 if (yydebug) \
2891 { \
2892 YYFPRINTF (stderr, "%s ", Title); \
2893 yy_symbol_print (stderr, \
2894 Type, Value, Location, parseInfo); \
2895 YYFPRINTF (stderr, "\n"); \
2896 } \
2897} while (0)
2898
2899
2900/*-----------------------------------.
2901| Print this symbol's value on YYO. |
2902`-----------------------------------*/
2903
2904static void
2905yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, QT_PREPEND_NAMESPACE(QPatternist)::ParserContext *const parseInfo)
2906{
2907 FILE *yyoutput = yyo;
2908 YYUSE (yyoutput);
2909 YYUSE (yylocationp);
2910 YYUSE (parseInfo);
2911 if (!yyvaluep)
2912 return;
2913# ifdef YYPRINT
2914 if (yytype < YYNTOKENS)
2915 YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
2916# endif
2917 YYUSE (yytype);
2918}
2919
2920
2921/*---------------------------.
2922| Print this symbol on YYO. |
2923`---------------------------*/
2924
2925static void
2926yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, QT_PREPEND_NAMESPACE(QPatternist)::ParserContext *const parseInfo)
2927{
2928 YYFPRINTF (yyo, "%s %s (",
2929 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
2930
2931 YY_LOCATION_PRINT (yyo, *yylocationp);
2932 YYFPRINTF (yyo, ": ");
2933 yy_symbol_value_print (yyo, yytype, yyvaluep, yylocationp, parseInfo);
2934 YYFPRINTF (yyo, ")");
2935}
2936
2937/*------------------------------------------------------------------.
2938| yy_stack_print -- Print the state stack from its BOTTOM up to its |
2939| TOP (included). |
2940`------------------------------------------------------------------*/
2941
2942static void
2943yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
2944{
2945 YYFPRINTF (stderr, "Stack now");
2946 for (; yybottom <= yytop; yybottom++)
2947 {
2948 int yybot = *yybottom;
2949 YYFPRINTF (stderr, " %d", yybot);
2950 }
2951 YYFPRINTF (stderr, "\n");
2952}
2953
2954# define YY_STACK_PRINT(Bottom, Top) \
2955do { \
2956 if (yydebug) \
2957 yy_stack_print ((Bottom), (Top)); \
2958} while (0)
2959
2960
2961/*------------------------------------------------.
2962| Report that the YYRULE is going to be reduced. |
2963`------------------------------------------------*/
2964
2965static void
2966yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, QT_PREPEND_NAMESPACE(QPatternist)::ParserContext *const parseInfo)
2967{
2968 unsigned long yylno = yyrline[yyrule];
2969 int yynrhs = yyr2[yyrule];
2970 int yyi;
2971 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
2972 yyrule - 1, yylno);
2973 /* The symbols being reduced. */
2974 for (yyi = 0; yyi < yynrhs; yyi++)
2975 {
2976 YYFPRINTF (stderr, " $%d = ", yyi + 1);
2977 yy_symbol_print (stderr,
2978 yystos[yyssp[yyi + 1 - yynrhs]],
2979 &yyvsp[(yyi + 1) - (yynrhs)]
2980 , &(yylsp[(yyi + 1) - (yynrhs)]) , parseInfo);
2981 YYFPRINTF (stderr, "\n");
2982 }
2983}
2984
2985# define YY_REDUCE_PRINT(Rule) \
2986do { \
2987 if (yydebug) \
2988 yy_reduce_print (yyssp, yyvsp, yylsp, Rule, parseInfo); \
2989} while (0)
2990
2991/* Nonzero means print parse trace. It is left uninitialized so that
2992 multiple parsers can coexist. */
2993int yydebug;
2994#else /* !XPATHDEBUG */
2995# define YYDPRINTF(Args)
2996# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2997# define YY_STACK_PRINT(Bottom, Top)
2998# define YY_REDUCE_PRINT(Rule)
2999#endif /* !XPATHDEBUG */
3000
3001
3002/* YYINITDEPTH -- initial size of the parser's stacks. */
3003#ifndef YYINITDEPTH
3004# define YYINITDEPTH 200
3005#endif
3006
3007/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
3008 if the built-in stack extension method is used).
3009
3010 Do not make this value too large; the results are undefined if
3011 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
3012 evaluated with infinite-precision integer arithmetic. */
3013
3014#ifndef YYMAXDEPTH
3015# define YYMAXDEPTH 10000
3016#endif
3017
3018
3019#if YYERROR_VERBOSE
3020
3021# ifndef yystrlen
3022# if defined __GLIBC__ && defined _STRING_H
3023# define yystrlen strlen
3024# else
3025/* Return the length of YYSTR. */
3026static YYSIZE_T
3027yystrlen (const char *yystr)
3028{
3029 YYSIZE_T yylen;
3030 for (yylen = 0; yystr[yylen]; yylen++)
3031 continue;
3032 return yylen;
3033}
3034# endif
3035# endif
3036
3037# ifndef yystpcpy
3038# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
3039# define yystpcpy stpcpy
3040# else
3041/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
3042 YYDEST. */
3043static char *
3044yystpcpy (char *yydest, const char *yysrc)
3045{
3046 char *yyd = yydest;
3047 const char *yys = yysrc;
3048
3049 while ((*yyd++ = *yys++) != '\0')
3050 continue;
3051
3052 return yyd - 1;
3053}
3054# endif
3055# endif
3056
3057# ifndef yytnamerr
3058/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
3059 quotes and backslashes, so that it's suitable for yyerror. The
3060 heuristic is that double-quoting is unnecessary unless the string
3061 contains an apostrophe, a comma, or backslash (other than
3062 backslash-backslash). YYSTR is taken from yytname. If YYRES is
3063 null, do not copy; instead, return the length of what the result
3064 would have been. */
3065static YYSIZE_T
3066yytnamerr (char *yyres, const char *yystr)
3067{
3068 if (*yystr == '"')
3069 {
3070 YYSIZE_T yyn = 0;
3071 char const *yyp = yystr;
3072
3073 for (;;)
3074 switch (*++yyp)
3075 {
3076 case '\'':
3077 case ',':
3078 goto do_not_strip_quotes;
3079
3080 case '\\':
3081 if (*++yyp != '\\')
3082 goto do_not_strip_quotes;
3083 else
3084 goto append;
3085
3086 append:
3087 default:
3088 if (yyres)
3089 yyres[yyn] = *yyp;
3090 yyn++;
3091 break;
3092
3093 case '"':
3094 if (yyres)
3095 yyres[yyn] = '\0';
3096 return yyn;
3097 }
3098 do_not_strip_quotes: ;
3099 }
3100
3101 if (! yyres)
3102 return yystrlen (s: yystr);
3103
3104 return (YYSIZE_T) (yystpcpy (dest: yyres, src: yystr) - yyres);
3105}
3106# endif
3107
3108/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
3109 about the unexpected token YYTOKEN for the state stack whose top is
3110 YYSSP.
3111
3112 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
3113 not large enough to hold the message. In that case, also set
3114 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
3115 required number of bytes is too large to store. */
3116static int
3117yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
3118 yytype_int16 *yyssp, int yytoken)
3119{
3120 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yystr: yytname[yytoken]);
3121 YYSIZE_T yysize = yysize0;
3122 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3123 /* Internationalized format string. */
3124 const char *yyformat = YY_NULLPTR;
3125 /* Arguments of yyformat. */
3126 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3127 /* Number of reported tokens (one for the "unexpected", one per
3128 "expected"). */
3129 int yycount = 0;
3130
3131 /* There are many possibilities here to consider:
3132 - If this state is a consistent state with a default action, then
3133 the only way this function was invoked is if the default action
3134 is an error action. In that case, don't check for expected
3135 tokens because there are none.
3136 - The only way there can be no lookahead present (in yychar) is if
3137 this state is a consistent state with a default action. Thus,
3138 detecting the absence of a lookahead is sufficient to determine
3139 that there is no unexpected or expected token to report. In that
3140 case, just report a simple "syntax error".
3141 - Don't assume there isn't a lookahead just because this state is a
3142 consistent state with a default action. There might have been a
3143 previous inconsistent state, consistent state with a non-default
3144 action, or user semantic action that manipulated yychar.
3145 - Of course, the expected token list depends on states to have
3146 correct lookahead information, and it depends on the parser not
3147 to perform extra reductions after fetching a lookahead from the
3148 scanner and before detecting a syntax error. Thus, state merging
3149 (from LALR or IELR) and default reductions corrupt the expected
3150 token list. However, the list is correct for canonical LR with
3151 one exception: it will still contain any token that will not be
3152 accepted due to an error action in a later state.
3153 */
3154 if (yytoken != YYEMPTY)
3155 {
3156 int yyn = yypact[*yyssp];
3157 yyarg[yycount++] = yytname[yytoken];
3158 if (!yypact_value_is_default (yyn))
3159 {
3160 /* Start YYX at -YYN if negative to avoid negative indexes in
3161 YYCHECK. In other words, skip the first -YYN actions for
3162 this state because they are default actions. */
3163 int yyxbegin = yyn < 0 ? -yyn : 0;
3164 /* Stay within bounds of both yycheck and yytname. */
3165 int yychecklim = YYLAST - yyn + 1;
3166 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3167 int yyx;
3168
3169 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3170 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
3171 && !yytable_value_is_error (yytable[yyx + yyn]))
3172 {
3173 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3174 {
3175 yycount = 1;
3176 yysize = yysize0;
3177 break;
3178 }
3179 yyarg[yycount++] = yytname[yyx];
3180 {
3181 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yystr: yytname[yyx]);
3182 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
3183 yysize = yysize1;
3184 else
3185 return 2;
3186 }
3187 }
3188 }
3189 }
3190
3191 switch (yycount)
3192 {
3193# define YYCASE_(N, S) \
3194 case N: \
3195 yyformat = S; \
3196 break
3197 default: /* Avoid compiler warnings. */
3198 YYCASE_(0, YY_("syntax error"));
3199 YYCASE_(1, YY_("syntax error, unexpected %s"));
3200 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
3201 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
3202 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
3203 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
3204# undef YYCASE_
3205 }
3206
3207 {
3208 YYSIZE_T yysize1 = yysize + yystrlen (s: yyformat);
3209 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
3210 yysize = yysize1;
3211 else
3212 return 2;
3213 }
3214
3215 if (*yymsg_alloc < yysize)
3216 {
3217 *yymsg_alloc = 2 * yysize;
3218 if (! (yysize <= *yymsg_alloc
3219 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
3220 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
3221 return 1;
3222 }
3223
3224 /* Avoid sprintf, as that infringes on the user's name space.
3225 Don't have undefined behavior even if the translation
3226 produced a string with the wrong number of "%s"s. */
3227 {
3228 char *yyp = *yymsg;
3229 int yyi = 0;
3230 while ((*yyp = *yyformat) != '\0')
3231 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
3232 {
3233 yyp += yytnamerr (yyres: yyp, yystr: yyarg[yyi++]);
3234 yyformat += 2;
3235 }
3236 else
3237 {
3238 yyp++;
3239 yyformat++;
3240 }
3241 }
3242 return 0;
3243}
3244#endif /* YYERROR_VERBOSE */
3245
3246/*-----------------------------------------------.
3247| Release the memory associated to this symbol. |
3248`-----------------------------------------------*/
3249
3250static void
3251yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, QT_PREPEND_NAMESPACE(QPatternist)::ParserContext *const parseInfo)
3252{
3253 YYUSE (yyvaluep);
3254 YYUSE (yylocationp);
3255 YYUSE (parseInfo);
3256 if (!yymsg)
3257 yymsg = "Deleting";
3258 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3259
3260 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
3261 YYUSE (yytype);
3262 YY_IGNORE_MAYBE_UNINITIALIZED_END
3263}
3264
3265
3266
3267
3268/*----------.
3269| yyparse. |
3270`----------*/
3271
3272int
3273yyparse (QT_PREPEND_NAMESPACE(QPatternist)::ParserContext *const parseInfo)
3274{
3275/* The lookahead symbol. */
3276int yychar;
3277
3278
3279/* The semantic value of the lookahead symbol. */
3280/* Default value used for initialization, for pacifying older GCCs
3281 or non-GCC compilers. */
3282YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
3283YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
3284
3285/* Location data for the lookahead symbol. */
3286static YYLTYPE yyloc_default
3287# if defined XPATHLTYPE_IS_TRIVIAL && XPATHLTYPE_IS_TRIVIAL
3288 = { 1, 1, 1, 1 }
3289# endif
3290;
3291YYLTYPE yylloc = yyloc_default;
3292
3293 /* Number of syntax errors so far. */
3294 int yynerrs;
3295
3296 int yystate;
3297 /* Number of tokens to shift before error messages enabled. */
3298 int yyerrstatus;
3299
3300 /* The stacks and their tools:
3301 'yyss': related to states.
3302 'yyvs': related to semantic values.
3303 'yyls': related to locations.
3304
3305 Refer to the stacks through separate pointers, to allow yyoverflow
3306 to reallocate them elsewhere. */
3307
3308 /* The state stack. */
3309 yytype_int16 yyssa[YYINITDEPTH];
3310 yytype_int16 *yyss;
3311 yytype_int16 *yyssp;
3312
3313 /* The semantic value stack. */
3314 YYSTYPE yyvsa[YYINITDEPTH];
3315 YYSTYPE *yyvs;
3316 YYSTYPE *yyvsp;
3317
3318 /* The location stack. */
3319 YYLTYPE yylsa[YYINITDEPTH];
3320 YYLTYPE *yyls;
3321 YYLTYPE *yylsp;
3322
3323 /* The locations where the error started and ended. */
3324 YYLTYPE yyerror_range[3];
3325
3326 YYSIZE_T yystacksize;
3327
3328 int yyn;
3329 int yyresult;
3330 /* Lookahead token as an internal (translated) token number. */
3331 int yytoken = 0;
3332 /* The variables used to return semantic value and location from the
3333 action routines. */
3334 YYSTYPE yyval;
3335 YYLTYPE yyloc;
3336
3337#if YYERROR_VERBOSE
3338 /* Buffer for error messages, and its allocated size. */
3339 char yymsgbuf[128];
3340 char *yymsg = yymsgbuf;
3341 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
3342#endif
3343
3344#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
3345
3346 /* The number of symbols on the RHS of the reduced rule.
3347 Keep to zero when no symbol should be popped. */
3348 int yylen = 0;
3349
3350 yyssp = yyss = yyssa;
3351 yyvsp = yyvs = yyvsa;
3352 yylsp = yyls = yylsa;
3353 yystacksize = YYINITDEPTH;
3354
3355 YYDPRINTF ((stderr, "Starting parse\n"));
3356
3357 yystate = 0;
3358 yyerrstatus = 0;
3359 yynerrs = 0;
3360 yychar = YYEMPTY; /* Cause a token to be read. */
3361 yylsp[0] = yylloc;
3362 goto yysetstate;
3363
3364
3365/*------------------------------------------------------------.
3366| yynewstate -- push a new state, which is found in yystate. |
3367`------------------------------------------------------------*/
3368yynewstate:
3369 /* In all cases, when you get here, the value and location stacks
3370 have just been pushed. So pushing a state here evens the stacks. */
3371 yyssp++;
3372
3373
3374/*--------------------------------------------------------------------.
3375| yynewstate -- set current state (the top of the stack) to yystate. |
3376`--------------------------------------------------------------------*/
3377yysetstate:
3378 *yyssp = (yytype_int16) yystate;
3379
3380 if (yyss + yystacksize - 1 <= yyssp)
3381#if !defined yyoverflow && !defined YYSTACK_RELOCATE
3382 goto yyexhaustedlab;
3383#else
3384 {
3385 /* Get the current used size of the three stacks, in elements. */
3386 YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
3387
3388# if defined yyoverflow
3389 {
3390 /* Give user a chance to reallocate the stack. Use copies of
3391 these so that the &'s don't force the real ones into
3392 memory. */
3393 YYSTYPE *yyvs1 = yyvs;
3394 yytype_int16 *yyss1 = yyss;
3395 YYLTYPE *yyls1 = yyls;
3396
3397 /* Each stack pointer address is followed by the size of the
3398 data in use in that stack, in bytes. This used to be a
3399 conditional around just the two extra args, but that might
3400 be undefined if yyoverflow is a macro. */
3401 yyoverflow (YY_("memory exhausted"),
3402 yyss: &yyss1, yysize * sizeof (*yyssp),
3403 yyvs: &yyvs1, yysize * sizeof (*yyvsp),
3404 yyls: &yyls1, yysize * sizeof (*yylsp),
3405 yystacksize: &yystacksize);
3406 yyss = yyss1;
3407 yyvs = yyvs1;
3408 yyls = yyls1;
3409 }
3410# else /* defined YYSTACK_RELOCATE */
3411 /* Extend the stack our own way. */
3412 if (YYMAXDEPTH <= yystacksize)
3413 goto yyexhaustedlab;
3414 yystacksize *= 2;
3415 if (YYMAXDEPTH < yystacksize)
3416 yystacksize = YYMAXDEPTH;
3417
3418 {
3419 yytype_int16 *yyss1 = yyss;
3420 union yyalloc *yyptr =
3421 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3422 if (! yyptr)
3423 goto yyexhaustedlab;
3424 YYSTACK_RELOCATE (yyss_alloc, yyss);
3425 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
3426 YYSTACK_RELOCATE (yyls_alloc, yyls);
3427# undef YYSTACK_RELOCATE
3428 if (yyss1 != yyssa)
3429 YYSTACK_FREE (yyss1);
3430 }
3431# endif
3432
3433 yyssp = yyss + yysize - 1;
3434 yyvsp = yyvs + yysize - 1;
3435 yylsp = yyls + yysize - 1;
3436
3437 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3438 (unsigned long) yystacksize));
3439
3440 if (yyss + yystacksize - 1 <= yyssp)
3441 YYABORT;
3442 }
3443#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
3444
3445 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3446
3447 if (yystate == YYFINAL)
3448 YYACCEPT;
3449
3450 goto yybackup;
3451
3452
3453/*-----------.
3454| yybackup. |
3455`-----------*/
3456yybackup:
3457 /* Do appropriate processing given the current state. Read a
3458 lookahead token if we need one and don't already have one. */
3459
3460 /* First try to decide what to do without reference to lookahead token. */
3461 yyn = yypact[yystate];
3462 if (yypact_value_is_default (yyn))
3463 goto yydefault;
3464
3465 /* Not known => get a lookahead token if don't already have one. */
3466
3467 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
3468 if (yychar == YYEMPTY)
3469 {
3470 YYDPRINTF ((stderr, "Reading a token: "));
3471 yychar = yylex (lexVal: &yylval, sourceLocator: &yylloc, parseInfo);
3472 }
3473
3474 if (yychar <= YYEOF)
3475 {
3476 yychar = yytoken = YYEOF;
3477 YYDPRINTF ((stderr, "Now at end of input.\n"));
3478 }
3479 else
3480 {
3481 yytoken = YYTRANSLATE (yychar);
3482 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3483 }
3484
3485 /* If the proper action on seeing token YYTOKEN is to reduce or to
3486 detect an error, take that action. */
3487 yyn += yytoken;
3488 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3489 goto yydefault;
3490 yyn = yytable[yyn];
3491 if (yyn <= 0)
3492 {
3493 if (yytable_value_is_error (yyn))
3494 goto yyerrlab;
3495 yyn = -yyn;
3496 goto yyreduce;
3497 }
3498
3499 /* Count tokens shifted since error; after three, turn off error
3500 status. */
3501 if (yyerrstatus)
3502 yyerrstatus--;
3503
3504 /* Shift the lookahead token. */
3505 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3506
3507 /* Discard the shifted token. */
3508 yychar = YYEMPTY;
3509
3510 yystate = yyn;
3511 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
3512 *++yyvsp = yylval;
3513 YY_IGNORE_MAYBE_UNINITIALIZED_END
3514 *++yylsp = yylloc;
3515 goto yynewstate;
3516
3517
3518/*-----------------------------------------------------------.
3519| yydefault -- do the default action for the current state. |
3520`-----------------------------------------------------------*/
3521yydefault:
3522 yyn = yydefact[yystate];
3523 if (yyn == 0)
3524 goto yyerrlab;
3525 goto yyreduce;
3526
3527
3528/*-----------------------------.
3529| yyreduce -- do a reduction. |
3530`-----------------------------*/
3531yyreduce:
3532 /* yyn is the number of a rule to reduce with. */
3533 yylen = yyr2[yyn];
3534
3535 /* If YYLEN is nonzero, implement the default value of the action:
3536 '$$ = $1'.
3537
3538 Otherwise, the following line sets YYVAL to garbage.
3539 This behavior is undocumented and Bison
3540 users should not rely upon it. Assigning to YYVAL
3541 unconditionally makes the parser a bit smaller, and it avoids a
3542 GCC warning that YYVAL may be used uninitialized. */
3543 yyval = yyvsp[1-yylen];
3544
3545 /* Default location. */
3546 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
3547 yyerror_range[1] = yyloc;
3548 YY_REDUCE_PRINT (yyn);
3549 switch (yyn)
3550 {
3551 case 5:
3552#line 1436 "querytransformparser.ypp" /* yacc.c:1652 */
3553 {
3554
3555/* Suppress more compiler warnings about unused defines. */
3556#if defined(YYNNTS) \
3557 || defined(yyerrok) \
3558 || defined(YYNSTATES) \
3559 || defined(YYRHSLOC) \
3560 || defined(YYRECOVERING) \
3561 || defined(YYFAIL) \
3562 || defined(YYERROR) \
3563 || defined(YYNRULES) \
3564 || defined(YYBACKUP) \
3565 || defined(YYMAXDEPTH) \
3566 || defined(yyclearin) \
3567 || defined(YYERRCODE) \
3568 || defined(YY_LOCATION_PRINT) \
3569 || defined(YYLLOC_DEFAULT)
3570#endif
3571
3572 if((yyvsp[-2].sval) != QLatin1String("1.0"))
3573 {
3574 const ReflectYYLTYPE ryy((yyloc), parseInfo);
3575
3576 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "Version %1 is not supported. The supported "
3577 "XQuery version is 1.0.")
3578 .arg(a: formatData(data: (yyvsp[-2].sval))),
3579 errorCode: ReportContext::XQST0031, reflection: &ryy);
3580 }
3581 }
3582#line 3534 "qquerytransformparser.cpp" /* yacc.c:1652 */
3583 break;
3584
3585 case 7:
3586#line 1468 "querytransformparser.ypp" /* yacc.c:1652 */
3587 {
3588 const QRegExp encNameRegExp(QLatin1String("[A-Za-z][A-Za-z0-9._\\-]*"));
3589
3590 if(!encNameRegExp.exactMatch(str: (yyvsp[0].sval)))
3591 {
3592 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "The encoding %1 is invalid. "
3593 "It must contain Latin characters only, "
3594 "must not contain whitespace, and must match "
3595 "the regular expression %2.")
3596 .arg(args: formatKeyword(keyword: (yyvsp[(2) - (2)].sval)),
3597 args: formatExpression(expr: encNameRegExp.pattern())),
3598 errorCode: ReportContext::XQST0087, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
3599 }
3600 }
3601#line 3553 "qquerytransformparser.cpp" /* yacc.c:1652 */
3602 break;
3603
3604 case 8:
3605#line 1484 "querytransformparser.ypp" /* yacc.c:1652 */
3606 {
3607 /* In XSL-T, we can have dangling variable references, so resolve them
3608 * before we proceed with other steps, such as checking circularity. */
3609 if(parseInfo->isXSLT())
3610 {
3611 typedef QHash<QXmlName, Expression::Ptr> Hash;
3612 const Hash::const_iterator end(parseInfo->unresolvedVariableReferences.constEnd());
3613
3614 for(Hash::const_iterator it(parseInfo->unresolvedVariableReferences.constBegin()); it != end; ++it)
3615 {
3616 const Expression::Ptr body(resolveVariable(name: it.key(), sourceLocator: (yyloc), parseInfo, raiseErrorOnUnavailability: true)); // TODO source locations vaise
3617 Q_ASSERT(body);
3618 it.value()->as<UnresolvedVariableReference>()->bindTo(body);
3619 }
3620 }
3621
3622 /* The UserFunction callsites aren't bound yet, so bind them(if possible!). */
3623 {
3624 const UserFunctionCallsite::List::const_iterator cend(parseInfo->userFunctionCallsites.constEnd());
3625 UserFunctionCallsite::List::const_iterator cit(parseInfo->userFunctionCallsites.constBegin());
3626 for(; cit != cend; ++cit) /* For each callsite. */
3627 {
3628 const UserFunctionCallsite::Ptr callsite(*cit);
3629 Q_ASSERT(callsite);
3630 const UserFunction::List::const_iterator end(parseInfo->userFunctions.constEnd());
3631 UserFunction::List::const_iterator it(parseInfo->userFunctions.constBegin());
3632
3633 for(; it != end; ++it) /* For each UserFunction. */
3634 {
3635 const FunctionSignature::Ptr sign((*it)->signature());
3636 Q_ASSERT(sign);
3637
3638 if(callsite->isSignatureValid(sign))
3639 {
3640 callsite->setSource(userFunction: (*it),
3641 cacheSlotOffset: parseInfo->allocateCacheSlots(count: (*it)->argumentDeclarations().count()));
3642 break;
3643 }
3644 }
3645 if(it == end)
3646 {
3647 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "No function with signature %1 is available")
3648 .arg(a: formatFunction(func: callsite)),
3649 errorCode: ReportContext::XPST0017, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
3650 }
3651 }
3652 }
3653
3654 /* Mark callsites in UserFunction bodies as recursive, if they are. */
3655 {
3656 const UserFunction::List::const_iterator fend(parseInfo->userFunctions.constEnd());
3657 UserFunction::List::const_iterator fit(parseInfo->userFunctions.constBegin());
3658 for(; fit != fend; ++fit)
3659 {
3660 CallTargetDescription::List signList;
3661 signList.append(t: (*fit)->signature());
3662 CallTargetDescription::checkCallsiteCircularity(signList, expr: (*fit)->body());
3663 }
3664 }
3665
3666 /* Now, check all global variables for circularity. This is done
3667 * backwards because global variables are only in scope below them,
3668 * in XQuery. */
3669 {
3670 const VariableDeclaration::List::const_iterator start(parseInfo->declaredVariables.constBegin());
3671 VariableDeclaration::List::const_iterator it(parseInfo->declaredVariables.constEnd());
3672
3673 while(it != start)
3674 {
3675 --it;
3676 if((*it)->type != VariableDeclaration::ExpressionVariable && (*it)->type != VariableDeclaration::GlobalVariable)
3677 continue; /* We want to ignore 'external' variables. */
3678
3679 FunctionSignature::List signList;
3680 checkVariableCircularity(var: *it, checkee: (*it)->expression(), type: (*it)->type, signList, parseInfo);
3681 ExpressionFactory::registerLastPath(operand: (*it)->expression());
3682 parseInfo->finalizePushedVariable(amount: 1, shouldPop: false); /* Warn if it's unused. */
3683 }
3684 }
3685
3686 /* Generate code for doing initial template name calling. One problem
3687 * is that we compilation in the initial template name, since we throw away the
3688 * code if we don't have the requested template. */
3689 if(parseInfo->languageAccent == QXmlQuery::XSLT20
3690 && !parseInfo->initialTemplateName.isNull()
3691 && parseInfo->namedTemplates.contains(akey: parseInfo->initialTemplateName))
3692 {
3693 parseInfo->queryBody = create(expr: new CallTemplate(parseInfo->initialTemplateName,
3694 WithParam::Hash()),
3695 sourceLocator: (yyloc), parseInfo);
3696 parseInfo->templateCalls.append(t: parseInfo->queryBody);
3697 /* We just discard the template body that XSLTTokenizer generated. */
3698 }
3699 else
3700 parseInfo->queryBody = (yyvsp[0].expr);
3701 }
3702#line 3654 "qquerytransformparser.cpp" /* yacc.c:1652 */
3703 break;
3704
3705 case 10:
3706#line 1584 "querytransformparser.ypp" /* yacc.c:1652 */
3707 {
3708 // TODO add to namespace context
3709 parseInfo->moduleNamespace = parseInfo->staticContext->namePool()->allocateNamespace(uri: (yyvsp[-3].sval));
3710 }
3711#line 3663 "qquerytransformparser.cpp" /* yacc.c:1652 */
3712 break;
3713
3714 case 12:
3715#line 1592 "querytransformparser.ypp" /* yacc.c:1652 */
3716 {
3717 allowedIn(allowedLanguages: QXmlQuery::XQuery10, parseInfo, sourceLocator: (yyloc));
3718 if(parseInfo->hasSecondPrologPart)
3719 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "A default namespace declaration must occur before function, "
3720 "variable, and option declarations."), errorCode: ReportContext::XPST0003, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
3721 }
3722#line 3674 "qquerytransformparser.cpp" /* yacc.c:1652 */
3723 break;
3724
3725 case 13:
3726#line 1599 "querytransformparser.ypp" /* yacc.c:1652 */
3727 {
3728 if(parseInfo->hasSecondPrologPart)
3729 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "A default namespace declaration must occur before function, "
3730 "variable, and option declarations."), errorCode: ReportContext::XPST0003, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
3731 }
3732#line 3684 "qquerytransformparser.cpp" /* yacc.c:1652 */
3733 break;
3734
3735 case 14:
3736#line 1605 "querytransformparser.ypp" /* yacc.c:1652 */
3737 {
3738 if(parseInfo->hasSecondPrologPart)
3739 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "Namespace declarations must occur before function, "
3740 "variable, and option declarations."), errorCode: ReportContext::XPST0003, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
3741 }
3742#line 3694 "qquerytransformparser.cpp" /* yacc.c:1652 */
3743 break;
3744
3745 case 15:
3746#line 1611 "querytransformparser.ypp" /* yacc.c:1652 */
3747 {
3748 allowedIn(allowedLanguages: QXmlQuery::XQuery10, parseInfo, sourceLocator: (yyloc));
3749 if(parseInfo->hasSecondPrologPart)
3750 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "Module imports must occur before function, "
3751 "variable, and option declarations."), errorCode: ReportContext::XPST0003, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
3752 }
3753#line 3705 "qquerytransformparser.cpp" /* yacc.c:1652 */
3754 break;
3755
3756 case 17:
3757#line 1621 "querytransformparser.ypp" /* yacc.c:1652 */
3758 {
3759 parseInfo->hasSecondPrologPart = true;
3760 }
3761#line 3713 "qquerytransformparser.cpp" /* yacc.c:1652 */
3762 break;
3763
3764 case 18:
3765#line 1625 "querytransformparser.ypp" /* yacc.c:1652 */
3766 {
3767 parseInfo->hasSecondPrologPart = true;
3768 }
3769#line 3721 "qquerytransformparser.cpp" /* yacc.c:1652 */
3770 break;
3771
3772 case 19:
3773#line 1629 "querytransformparser.ypp" /* yacc.c:1652 */
3774 {
3775 allowedIn(allowedLanguages: QXmlQuery::XQuery10, parseInfo, sourceLocator: (yyloc));
3776 parseInfo->hasSecondPrologPart = true;
3777 }
3778#line 3730 "qquerytransformparser.cpp" /* yacc.c:1652 */
3779 break;
3780
3781 case 20:
3782#line 1652 "querytransformparser.ypp" /* yacc.c:1652 */
3783 {
3784 Template::Ptr temp(create(expr: new Template(parseInfo->currentImportPrecedence, (yyvsp[-2].sequenceType)), sourceLocator: (yyloc), parseInfo));
3785
3786 registerNamedTemplate(name: (yyvsp[-4].qName), body: typeCheckTemplateBody(body: (yyvsp[-1].expr), reqType: (yyvsp[-2].sequenceType), parseInfo),
3787 parseInfo, sourceLocator: (yylsp[-6]), temp);
3788 temp->templateParameters = parseInfo->templateParameters;
3789 parseInfo->templateParametersHandled();
3790 }
3791#line 3743 "qquerytransformparser.cpp" /* yacc.c:1652 */
3792 break;
3793
3794 case 21:
3795#line 1662 "querytransformparser.ypp" /* yacc.c:1652 */
3796 {
3797 parseInfo->isParsingPattern = true;
3798 }
3799#line 3751 "qquerytransformparser.cpp" /* yacc.c:1652 */
3800 break;
3801
3802 case 22:
3803#line 1666 "querytransformparser.ypp" /* yacc.c:1652 */
3804 {
3805 parseInfo->isParsingPattern = false;
3806 }
3807#line 3759 "qquerytransformparser.cpp" /* yacc.c:1652 */
3808 break;
3809
3810 case 23:
3811#line 1675 "querytransformparser.ypp" /* yacc.c:1652 */
3812 {
3813 /* In this grammar branch, we're guaranteed to be a template rule, but
3814 * may also be a named template. */
3815
3816 const ImportPrecedence ip = parseInfo->isFirstTemplate() ? 0 : parseInfo->currentImportPrecedence;
3817 Expression::Ptr pattern((yyvsp[-8].expr));
3818 const TemplatePattern::ID templateID = parseInfo->allocateTemplateID();
3819
3820 Template::Ptr templ(create(expr: new Template(ip, (yyvsp[-2].sequenceType)), sourceLocator: (yyloc), parseInfo));
3821 templ->body = typeCheckTemplateBody(body: (yyvsp[-1].expr), reqType: (yyvsp[-2].sequenceType), parseInfo);
3822 templ->templateParameters = parseInfo->templateParameters;
3823 parseInfo->templateParametersHandled();
3824
3825 TemplatePattern::Vector ourPatterns;
3826 /* We do it as per 6.4 Conflict Resolution for Template Rules:
3827 *
3828 * "If the pattern contains multiple alternatives separated by |, then
3829 * the template rule is treated equivalently to a set of template
3830 * rules, one for each alternative. However, it is not an error if a
3831 * node matches more than one of the alternatives." */
3832 while(pattern->is(i: Expression::IDCombineNodes))
3833 {
3834 const Expression::List operands(pattern->operands());
3835 pattern = operands.first();
3836
3837 loadPattern(matchPattern: operands.at(i: 1), ourPatterns, id: templateID, priority: (yyvsp[-4].enums.Double), temp: templ);
3838 }
3839
3840 loadPattern(matchPattern: pattern, ourPatterns, id: templateID, priority: (yyvsp[-4].enums.Double), temp: templ);
3841
3842 if(!(yyvsp[-12].qName).isNull())
3843 registerNamedTemplate(name: (yyvsp[-12].qName), body: (yyvsp[-1].expr), parseInfo, sourceLocator: (yylsp[-14]), temp: templ);
3844
3845 /* Now, let's add it to all the relevant templates. */
3846 for(int i = 0; i < (yyvsp[-5].qNameVector).count(); ++i) /* For each mode. */
3847 {
3848 const QXmlName &modeName = (yyvsp[-5].qNameVector).at(i);
3849
3850 if(modeName == QXmlName(StandardNamespaces::InternalXSLT, StandardLocalNames::all) && (yyvsp[-5].qNameVector).count() > 1)
3851 {
3852 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "The keyword %1 cannot occur with any other mode name.")
3853 .arg(a: formatKeyword(keyword: QLatin1String("#all"))),
3854 errorCode: ReportContext::XTSE0530,
3855 sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
3856 }
3857
3858 /* For each pattern the template use. */
3859 const TemplateMode::Ptr mode(parseInfo->modeFor(modeName));
3860 for(int t = 0; t < ourPatterns.count(); ++t)
3861 mode->templatePatterns.append(t: ourPatterns.at(i: t));
3862 }
3863 }
3864#line 3816 "qquerytransformparser.cpp" /* yacc.c:1652 */
3865 break;
3866
3867 case 24:
3868#line 1729 "querytransformparser.ypp" /* yacc.c:1652 */
3869 {
3870 (yyval.enums.Double) = std::numeric_limits<xsDouble>::quiet_NaN();
3871 }
3872#line 3824 "qquerytransformparser.cpp" /* yacc.c:1652 */
3873 break;
3874
3875 case 25:
3876#line 1734 "querytransformparser.ypp" /* yacc.c:1652 */
3877 {
3878 const AtomicValue::Ptr val(Decimal::fromLexical(strNumeric: (yyvsp[0].sval)));
3879 if(val->hasError())
3880 {
3881 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "The value of attribute %1 must be of type %2, which %3 isn't.")
3882 .arg(args: formatKeyword(keyword: QLatin1String("priority")),
3883 args: formatType(np: parseInfo->staticContext->namePool(), type: BuiltinTypes::xsDecimal),
3884 args: formatData(data: (yyvsp[0].sval))),
3885 errorCode: ReportContext::XTSE0530,
3886 sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
3887 }
3888 else
3889 (yyval.enums.Double) = val->as<Numeric>()->toDouble();
3890 }
3891#line 3843 "qquerytransformparser.cpp" /* yacc.c:1652 */
3892 break;
3893
3894 case 26:
3895#line 1750 "querytransformparser.ypp" /* yacc.c:1652 */
3896 {
3897 (yyval.qName) = QXmlName();
3898 }
3899#line 3851 "qquerytransformparser.cpp" /* yacc.c:1652 */
3900 break;
3901
3902 case 28:
3903#line 1756 "querytransformparser.ypp" /* yacc.c:1652 */
3904 {
3905 (yyval.qName) = (yyvsp[0].qName);
3906 }
3907#line 3859 "qquerytransformparser.cpp" /* yacc.c:1652 */
3908 break;
3909
3910 case 30:
3911#line 1762 "querytransformparser.ypp" /* yacc.c:1652 */
3912 {
3913 allowedIn(allowedLanguages: QXmlQuery::XQuery10, parseInfo, sourceLocator: (yyloc));
3914 }
3915#line 3867 "qquerytransformparser.cpp" /* yacc.c:1652 */
3916 break;
3917
3918 case 32:
3919#line 1767 "querytransformparser.ypp" /* yacc.c:1652 */
3920 {
3921 allowedIn(allowedLanguages: QXmlQuery::XQuery10, parseInfo, sourceLocator: (yyloc));
3922 }
3923#line 3875 "qquerytransformparser.cpp" /* yacc.c:1652 */
3924 break;
3925
3926 case 33:
3927#line 1771 "querytransformparser.ypp" /* yacc.c:1652 */
3928 {
3929 allowedIn(allowedLanguages: QXmlQuery::XQuery10, parseInfo, sourceLocator: (yyloc));
3930 }
3931#line 3883 "qquerytransformparser.cpp" /* yacc.c:1652 */
3932 break;
3933
3934 case 34:
3935#line 1775 "querytransformparser.ypp" /* yacc.c:1652 */
3936 {
3937 allowedIn(allowedLanguages: QXmlQuery::XQuery10, parseInfo, sourceLocator: (yyloc));
3938 }
3939#line 3891 "qquerytransformparser.cpp" /* yacc.c:1652 */
3940 break;
3941
3942 case 39:
3943#line 1786 "querytransformparser.ypp" /* yacc.c:1652 */
3944 {
3945 if(!(yyvsp[-1].enums.Bool))
3946 allowedIn(allowedLanguages: QXmlQuery::XQuery10, parseInfo, sourceLocator: (yyloc));
3947
3948 if((yyvsp[-4].sval) == QLatin1String("xmlns"))
3949 {
3950 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "It is not possible to redeclare prefix %1.")
3951 .arg(a: formatKeyword(keyword: QLatin1String("xmlns"))),
3952 errorCode: ReportContext::XQST0070, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
3953 }
3954 else if ((yyvsp[-2].sval) == CommonNamespaces::XML || (yyvsp[-4].sval) == QLatin1String("xml"))
3955 {
3956 parseInfo->staticContext->error(message: QtXmlPatterns::tr(
3957 sourceText: "The prefix %1 can not be bound. By default, it is already bound "
3958 "to the namespace %2.")
3959 .arg(a: formatKeyword(keyword: "xml"))
3960 .arg(a: formatURI(uri: CommonNamespaces::XML)),
3961 errorCode: ReportContext::XQST0070,
3962 sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
3963 }
3964 else if(parseInfo->declaredPrefixes.contains(str: (yyvsp[-4].sval)))
3965 {
3966 /* This includes the case where the user has bound a default prefix(such
3967 * as 'local') and now tries to do it again. */
3968 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "Prefix %1 is already declared in the prolog.")
3969 .arg(a: formatKeyword(keyword: (yyvsp[-4].sval))),
3970 errorCode: ReportContext::XQST0033, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
3971 }
3972 else
3973 {
3974 parseInfo->declaredPrefixes.append(t: (yyvsp[-4].sval));
3975
3976 if((yyvsp[-2].sval).isEmpty())
3977 {
3978 parseInfo->staticContext->namespaceBindings()->addBinding(nb: QXmlName(StandardNamespaces::UndeclarePrefix,
3979 StandardLocalNames::empty,
3980 parseInfo->staticContext->namePool()->allocatePrefix(prefix: (yyvsp[-4].sval))));
3981 }
3982 else
3983 {
3984 parseInfo->staticContext->namespaceBindings()->addBinding(nb: parseInfo->staticContext->namePool()->allocateBinding(prefix: (yyvsp[-4].sval), uri: (yyvsp[-2].sval)));
3985 }
3986 }
3987 }
3988#line 3940 "qquerytransformparser.cpp" /* yacc.c:1652 */
3989 break;
3990
3991 case 40:
3992#line 1832 "querytransformparser.ypp" /* yacc.c:1652 */
3993 {
3994 if(parseInfo->hasDeclaration(decl: ParserContext::BoundarySpaceDecl))
3995 {
3996 parseInfo->staticContext->error(message: prologMessage(msg: "declare boundary-space"),
3997 errorCode: ReportContext::XQST0068, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
3998 }
3999 else
4000 {
4001 parseInfo->staticContext->setBoundarySpacePolicy((yyvsp[-1].enums.boundarySpacePolicy));
4002 parseInfo->registerDeclaration(decl: ParserContext::BoundarySpaceDecl);
4003 }
4004 }
4005#line 3957 "qquerytransformparser.cpp" /* yacc.c:1652 */
4006 break;
4007
4008 case 41:
4009#line 1846 "querytransformparser.ypp" /* yacc.c:1652 */
4010 {
4011 (yyval.enums.boundarySpacePolicy) = StaticContext::BSPStrip;
4012 }
4013#line 3965 "qquerytransformparser.cpp" /* yacc.c:1652 */
4014 break;
4015
4016 case 42:
4017#line 1851 "querytransformparser.ypp" /* yacc.c:1652 */
4018 {
4019 (yyval.enums.boundarySpacePolicy) = StaticContext::BSPPreserve;
4020 }
4021#line 3973 "qquerytransformparser.cpp" /* yacc.c:1652 */
4022 break;
4023
4024 case 45:
4025#line 1860 "querytransformparser.ypp" /* yacc.c:1652 */
4026 {
4027 if(parseInfo->hasDeclaration(decl: ParserContext::DeclareDefaultElementNamespace))
4028 {
4029 parseInfo->staticContext->error(message: prologMessage(msg: "declare default element namespace"),
4030 errorCode: ReportContext::XQST0066, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4031 }
4032 else
4033 {
4034 parseInfo->staticContext->namespaceBindings()->addBinding(nb: QXmlName(parseInfo->staticContext->namePool()->allocateNamespace(uri: (yyvsp[-1].sval)), StandardLocalNames::empty));
4035 parseInfo->registerDeclaration(decl: ParserContext::DeclareDefaultElementNamespace);
4036 }
4037 }
4038#line 3990 "qquerytransformparser.cpp" /* yacc.c:1652 */
4039 break;
4040
4041 case 46:
4042#line 1875 "querytransformparser.ypp" /* yacc.c:1652 */
4043 {
4044 if(parseInfo->hasDeclaration(decl: ParserContext::DeclareDefaultFunctionNamespace))
4045 {
4046 parseInfo->staticContext->error(message: prologMessage(msg: "declare default function namespace"),
4047 errorCode: ReportContext::XQST0066, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4048 }
4049 else
4050 {
4051 parseInfo->staticContext->setDefaultFunctionNamespace((yyvsp[-1].sval));
4052 parseInfo->registerDeclaration(decl: ParserContext::DeclareDefaultFunctionNamespace);
4053 }
4054 }
4055#line 4007 "qquerytransformparser.cpp" /* yacc.c:1652 */
4056 break;
4057
4058 case 47:
4059#line 1889 "querytransformparser.ypp" /* yacc.c:1652 */
4060 {
4061 if((yyvsp[-2].qName).prefix() == StandardPrefixes::empty)
4062 {
4063 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "The name of an option must have a prefix. "
4064 "There is no default namespace for options."),
4065 errorCode: ReportContext::XPST0081, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4066 }
4067 }
4068#line 4020 "qquerytransformparser.cpp" /* yacc.c:1652 */
4069 break;
4070
4071 case 48:
4072#line 1899 "querytransformparser.ypp" /* yacc.c:1652 */
4073 {
4074 allowedIn(allowedLanguages: QXmlQuery::XQuery10, parseInfo, sourceLocator: (yyloc));
4075 if(parseInfo->hasDeclaration(decl: ParserContext::OrderingModeDecl))
4076 {
4077 parseInfo->staticContext->error(message: prologMessage(msg: "declare ordering"),
4078 errorCode: ReportContext::XQST0065, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4079 }
4080 else
4081 {
4082 parseInfo->registerDeclaration(decl: ParserContext::OrderingModeDecl);
4083 parseInfo->staticContext->setOrderingMode((yyvsp[-1].enums.orderingMode));
4084 }
4085 }
4086#line 4038 "qquerytransformparser.cpp" /* yacc.c:1652 */
4087 break;
4088
4089 case 49:
4090#line 1914 "querytransformparser.ypp" /* yacc.c:1652 */
4091 {
4092 (yyval.enums.orderingMode) = StaticContext::Ordered;
4093 }
4094#line 4046 "qquerytransformparser.cpp" /* yacc.c:1652 */
4095 break;
4096
4097 case 50:
4098#line 1918 "querytransformparser.ypp" /* yacc.c:1652 */
4099 {
4100 (yyval.enums.orderingMode) = StaticContext::Unordered;
4101 }
4102#line 4054 "qquerytransformparser.cpp" /* yacc.c:1652 */
4103 break;
4104
4105 case 51:
4106#line 1923 "querytransformparser.ypp" /* yacc.c:1652 */
4107 {
4108 if(parseInfo->hasDeclaration(decl: ParserContext::EmptyOrderDecl))
4109 {
4110 parseInfo->staticContext->error(message: prologMessage(msg: "declare default order"),
4111 errorCode: ReportContext::XQST0069, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4112 }
4113 else
4114 {
4115 parseInfo->registerDeclaration(decl: ParserContext::EmptyOrderDecl);
4116 parseInfo->staticContext->setOrderingEmptySequence((yyvsp[-1].enums.orderingEmptySequence));
4117 }
4118 }
4119#line 4071 "qquerytransformparser.cpp" /* yacc.c:1652 */
4120 break;
4121
4122 case 52:
4123#line 1937 "querytransformparser.ypp" /* yacc.c:1652 */
4124 {
4125 (yyval.enums.orderingEmptySequence) = StaticContext::Least;
4126 }
4127#line 4079 "qquerytransformparser.cpp" /* yacc.c:1652 */
4128 break;
4129
4130 case 53:
4131#line 1941 "querytransformparser.ypp" /* yacc.c:1652 */
4132 {
4133 (yyval.enums.orderingEmptySequence) = StaticContext::Greatest;
4134 }
4135#line 4087 "qquerytransformparser.cpp" /* yacc.c:1652 */
4136 break;
4137
4138 case 54:
4139#line 1947 "querytransformparser.ypp" /* yacc.c:1652 */
4140 {
4141 if(parseInfo->hasDeclaration(decl: ParserContext::CopyNamespacesDecl))
4142 {
4143 parseInfo->staticContext->error(message: prologMessage(msg: "declare copy-namespaces"),
4144 errorCode: ReportContext::XQST0055, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4145 }
4146 else
4147 {
4148 parseInfo->registerDeclaration(decl: ParserContext::CopyNamespacesDecl);
4149 }
4150 }
4151#line 4103 "qquerytransformparser.cpp" /* yacc.c:1652 */
4152 break;
4153
4154 case 55:
4155#line 1960 "querytransformparser.ypp" /* yacc.c:1652 */
4156 {
4157 parseInfo->preserveNamespacesMode = true;
4158 }
4159#line 4111 "qquerytransformparser.cpp" /* yacc.c:1652 */
4160 break;
4161
4162 case 56:
4163#line 1965 "querytransformparser.ypp" /* yacc.c:1652 */
4164 {
4165 parseInfo->preserveNamespacesMode = false;
4166 }
4167#line 4119 "qquerytransformparser.cpp" /* yacc.c:1652 */
4168 break;
4169
4170 case 57:
4171#line 1970 "querytransformparser.ypp" /* yacc.c:1652 */
4172 {
4173 parseInfo->inheritNamespacesMode = true;
4174 }
4175#line 4127 "qquerytransformparser.cpp" /* yacc.c:1652 */
4176 break;
4177
4178 case 58:
4179#line 1975 "querytransformparser.ypp" /* yacc.c:1652 */
4180 {
4181 parseInfo->inheritNamespacesMode = false;
4182 }
4183#line 4135 "qquerytransformparser.cpp" /* yacc.c:1652 */
4184 break;
4185
4186 case 59:
4187#line 1980 "querytransformparser.ypp" /* yacc.c:1652 */
4188 {
4189 if(parseInfo->hasDeclaration(decl: ParserContext::DefaultCollationDecl))
4190 {
4191 parseInfo->staticContext->error(message: prologMessage(msg: "declare default collation"),
4192 errorCode: ReportContext::XQST0038, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4193 }
4194 else
4195 {
4196 const QUrl coll(resolveAndCheckCollation<ReportContext::XQST0038>(collation: (yyvsp[-1].sval), parseInfo, sl: (yyloc)));
4197
4198 parseInfo->registerDeclaration(decl: ParserContext::DefaultCollationDecl);
4199 parseInfo->staticContext->setDefaultCollation(coll);
4200 }
4201 }
4202#line 4154 "qquerytransformparser.cpp" /* yacc.c:1652 */
4203 break;
4204
4205 case 60:
4206#line 1996 "querytransformparser.ypp" /* yacc.c:1652 */
4207 {
4208 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XSLT20), parseInfo, sourceLocator: (yyloc), isInternal: (yyvsp[-2].enums.Bool));
4209 if(parseInfo->hasDeclaration(decl: ParserContext::BaseURIDecl))
4210 {
4211 parseInfo->staticContext->error(message: prologMessage(msg: "declare base-uri"),
4212 errorCode: ReportContext::XQST0032, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4213 }
4214 else
4215 {
4216 parseInfo->registerDeclaration(decl: ParserContext::BaseURIDecl);
4217 const ReflectYYLTYPE ryy((yyloc), parseInfo);
4218
4219 QUrl toBeBase(AnyURI::toQUrl<ReportContext::XQST0046>(value: (yyvsp[-1].sval), context: parseInfo->staticContext, r: &ryy));
4220 /* Now we're guaranteed that base is a valid lexical representation, but it can still be relative. */
4221
4222 if(toBeBase.isRelative())
4223 toBeBase = parseInfo->staticContext->baseURI().resolved(relative: toBeBase);
4224
4225 parseInfo->staticContext->setBaseURI(toBeBase);
4226 }
4227 }
4228#line 4180 "qquerytransformparser.cpp" /* yacc.c:1652 */
4229 break;
4230
4231 case 61:
4232#line 2019 "querytransformparser.ypp" /* yacc.c:1652 */
4233 {
4234 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "The Schema Import feature is not supported, "
4235 "and therefore %1 declarations cannot occur.")
4236 .arg(a: formatKeyword(keyword: "import schema")),
4237 errorCode: ReportContext::XQST0009, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4238 }
4239#line 4191 "qquerytransformparser.cpp" /* yacc.c:1652 */
4240 break;
4241
4242 case 65:
4243#line 2031 "querytransformparser.ypp" /* yacc.c:1652 */
4244 {
4245 if((yyvsp[-2].sval).isEmpty())
4246 {
4247 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "The target namespace of a %1 cannot be empty.")
4248 .arg(a: formatKeyword(keyword: "module import")),
4249 errorCode: ReportContext::XQST0088, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4250
4251 }
4252 else
4253 {
4254 /* This is temporary until we have implemented it. */
4255 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "The module import feature is not supported"),
4256 errorCode: ReportContext::XQST0016, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4257 }
4258 }
4259#line 4211 "qquerytransformparser.cpp" /* yacc.c:1652 */
4260 break;
4261
4262 case 72:
4263#line 2058 "querytransformparser.ypp" /* yacc.c:1652 */
4264 {
4265 allowedIn(allowedLanguages: QXmlQuery::XQuery10, parseInfo, sourceLocator: (yyloc), isInternal: (yyvsp[-6].enums.Bool));
4266 if(variableByName(name: (yyvsp[-4].qName), parseInfo))
4267 {
4268 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "A variable with name %1 has already "
4269 "been declared.")
4270 .arg(a: formatKeyword(keyword: parseInfo->staticContext->namePool()->toLexical(qName: (yyvsp[-4].qName)))),
4271 errorCode: parseInfo->isXSLT() ? ReportContext::XTSE0630 : ReportContext::XQST0049,
4272 sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4273 }
4274 else
4275 {
4276 if((yyvsp[-2].expr)) /* We got a value assigned. */
4277 {
4278 const Expression::Ptr checked
4279 (TypeChecker::applyFunctionConversion(operand: (yyvsp[-2].expr), reqType: (yyvsp[-3].sequenceType), context: parseInfo->staticContext,
4280 code: (yyvsp[-6].enums.Bool) ? ReportContext::XTTE0570 : ReportContext::XPTY0004,
4281 (yyvsp[-6].enums.Bool) ? TypeChecker::Options(TypeChecker::CheckFocus | TypeChecker::AutomaticallyConvert) : TypeChecker::CheckFocus));
4282
4283 pushVariable(name: (yyvsp[-4].qName), seqType: (yyvsp[-3].sequenceType), expr: checked, type: VariableDeclaration::GlobalVariable, sourceLocator: (yyloc), parseInfo);
4284 parseInfo->declaredVariables.append(t: parseInfo->variables.last());
4285 }
4286 else /* We got an 'external' declaration. */
4287 {
4288 const SequenceType::Ptr varType(parseInfo->staticContext->
4289 externalVariableLoader()->announceExternalVariable(name: (yyvsp[-4].qName), declaredType: (yyvsp[-3].sequenceType)));
4290
4291 if(varType)
4292 {
4293 /* We push the declaration such that we can see name clashes and so on, but we don't use it for tying
4294 * any references to it. */
4295 pushVariable(name: (yyvsp[-4].qName), seqType: varType, expr: Expression::Ptr(), type: VariableDeclaration::ExternalVariable, sourceLocator: (yyloc), parseInfo);
4296 }
4297 else if((yyvsp[-1].expr))
4298 {
4299 /* Ok, the xsl:param got a default value, we make it
4300 * available as a regular variable declaration. */
4301 // TODO turn into checked
4302 pushVariable(name: (yyvsp[-4].qName), seqType: (yyvsp[-3].sequenceType), expr: (yyvsp[-1].expr), type: VariableDeclaration::GlobalVariable, sourceLocator: (yyloc), parseInfo);
4303 // TODO ensure that duplicates are trapped.
4304 }
4305 else
4306 {
4307 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "No value is available for the external "
4308 "variable with name %1.")
4309 .arg(a: formatKeyword(np: parseInfo->staticContext->namePool(), name: (yyvsp[-4].qName))),
4310 errorCode: parseInfo->isXSLT() ? ReportContext::XTDE0050 : ReportContext::XPDY0002,
4311 sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4312 }
4313 }
4314 }
4315 }
4316#line 4268 "qquerytransformparser.cpp" /* yacc.c:1652 */
4317 break;
4318
4319 case 73:
4320#line 2112 "querytransformparser.ypp" /* yacc.c:1652 */
4321 {
4322 (yyval.expr).reset();
4323 }
4324#line 4276 "qquerytransformparser.cpp" /* yacc.c:1652 */
4325 break;
4326
4327 case 74:
4328#line 2116 "querytransformparser.ypp" /* yacc.c:1652 */
4329 {
4330 (yyval.expr) = (yyvsp[0].expr);
4331 }
4332#line 4284 "qquerytransformparser.cpp" /* yacc.c:1652 */
4333 break;
4334
4335 case 75:
4336#line 2121 "querytransformparser.ypp" /* yacc.c:1652 */
4337 {
4338 (yyval.expr).reset();
4339 }
4340#line 4292 "qquerytransformparser.cpp" /* yacc.c:1652 */
4341 break;
4342
4343 case 76:
4344#line 2125 "querytransformparser.ypp" /* yacc.c:1652 */
4345 {
4346 (yyval.expr) = (yyvsp[0].expr);
4347 }
4348#line 4300 "qquerytransformparser.cpp" /* yacc.c:1652 */
4349 break;
4350
4351 case 77:
4352#line 2130 "querytransformparser.ypp" /* yacc.c:1652 */
4353 {
4354 if(parseInfo->hasDeclaration(decl: ParserContext::ConstructionDecl))
4355 {
4356 parseInfo->staticContext->error(message: prologMessage(msg: "declare ordering"),
4357 errorCode: ReportContext::XQST0067, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4358 }
4359 else
4360 {
4361 parseInfo->registerDeclaration(decl: ParserContext::ConstructionDecl);
4362 parseInfo->staticContext->setConstructionMode((yyvsp[-1].enums.constructionMode));
4363 }
4364 }
4365#line 4317 "qquerytransformparser.cpp" /* yacc.c:1652 */
4366 break;
4367
4368 case 78:
4369#line 2144 "querytransformparser.ypp" /* yacc.c:1652 */
4370 {
4371 (yyval.enums.constructionMode) = StaticContext::CMStrip;
4372 }
4373#line 4325 "qquerytransformparser.cpp" /* yacc.c:1652 */
4374 break;
4375
4376 case 79:
4377#line 2148 "querytransformparser.ypp" /* yacc.c:1652 */
4378 {
4379 (yyval.enums.constructionMode) = StaticContext::CMPreserve;
4380 }
4381#line 4333 "qquerytransformparser.cpp" /* yacc.c:1652 */
4382 break;
4383
4384 case 80:
4385#line 2153 "querytransformparser.ypp" /* yacc.c:1652 */
4386 {
4387 (yyval.enums.slot) = parseInfo->currentExpressionSlot() - (yyvsp[-1].functionArguments).count();
4388 }
4389#line 4341 "qquerytransformparser.cpp" /* yacc.c:1652 */
4390 break;
4391
4392 case 81:
4393#line 2157 "querytransformparser.ypp" /* yacc.c:1652 */
4394 {
4395 if(!(yyvsp[-8].enums.Bool))
4396 allowedIn(allowedLanguages: QXmlQuery::XQuery10, parseInfo, sourceLocator: (yyloc), isInternal: (yyvsp[-8].enums.Bool));
4397
4398 /* If FunctionBody is null, it is 'external', otherwise the value is the body. */
4399 const QXmlName::NamespaceCode ns((yyvsp[-7].qName).namespaceURI());
4400
4401 if(parseInfo->isXSLT() && !(yyvsp[-7].qName).hasPrefix())
4402 {
4403 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "A stylesheet function must have a prefixed name."),
4404 errorCode: ReportContext::XTSE0740,
4405 sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4406 }
4407
4408 if((yyvsp[-1].expr)) /* We got a function body. */
4409 {
4410 if(ns == StandardNamespaces::empty)
4411 {
4412 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "The namespace for a user defined function "
4413 "cannot be empty (try the predefined "
4414 "prefix %1 which exists for cases "
4415 "like this)")
4416 .arg(a: formatKeyword(keyword: "local")),
4417 errorCode: ReportContext::XQST0060, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4418 }
4419 else if(XPathHelper::isReservedNamespace(ns))
4420 {
4421 parseInfo->staticContext->error(message: QtXmlPatterns::tr(
4422 sourceText: "The namespace %1 is reserved; therefore "
4423 "user defined functions may not use it. "
4424 "Try the predefined prefix %2, which "
4425 "exists for these cases.")
4426 .arg(args: formatURI(np: parseInfo->staticContext->namePool(), uri: ns), args: formatKeyword(keyword: "local")),
4427 errorCode: parseInfo->isXSLT() ? ReportContext::XTSE0080 : ReportContext::XQST0045,
4428 sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4429 }
4430 else if(parseInfo->moduleNamespace != StandardNamespaces::empty &&
4431 ns != parseInfo->moduleNamespace)
4432 {
4433 parseInfo->staticContext->error(message: QtXmlPatterns::tr(
4434 sourceText: "The namespace of a user defined "
4435 "function in a library module must be "
4436 "equivalent to the module namespace. "
4437 "In other words, it should be %1 instead "
4438 "of %2")
4439 .arg(args: formatURI(np: parseInfo->staticContext->namePool(), uri: parseInfo->moduleNamespace),
4440 args: formatURI(np: parseInfo->staticContext->namePool(), uri: ns)),
4441 errorCode: ReportContext::XQST0048, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4442 }
4443 else
4444 {
4445 /* Apply function conversion such that the body matches the declared
4446 * return type. */
4447 const Expression::Ptr checked(TypeChecker::applyFunctionConversion(operand: (yyvsp[-1].expr), reqType: (yyvsp[-2].sequenceType),
4448 context: parseInfo->staticContext,
4449 code: ReportContext::XPTY0004,
4450 TypeChecker::Options(TypeChecker::AutomaticallyConvert |
4451 TypeChecker::CheckFocus |
4452 TypeChecker::GeneratePromotion)));
4453
4454 const int argCount = (yyvsp[-5].functionArguments).count();
4455 const FunctionSignature::Ptr sign(new FunctionSignature((yyvsp[-7].qName) /* name */,
4456 argCount /* minArgs */,
4457 argCount /* maxArgs */,
4458 (yyvsp[-2].sequenceType) /* returnType */));
4459 sign->setArguments((yyvsp[-5].functionArguments));
4460 const UserFunction::List::const_iterator end(parseInfo->userFunctions.constEnd());
4461 UserFunction::List::const_iterator it(parseInfo->userFunctions.constBegin());
4462
4463 for(; it != end; ++it)
4464 {
4465 if(*(*it)->signature() == *sign)
4466 {
4467 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "A function already exists with "
4468 "the signature %1.")
4469 .arg(a: formatFunction(np: parseInfo->staticContext->namePool(), func: sign)),
4470 errorCode: parseInfo->isXSLT() ? ReportContext::XTSE0770 : ReportContext::XQST0034, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4471 }
4472 }
4473
4474 VariableDeclaration::List argDecls;
4475
4476 for(int i = 0; i < argCount; ++i)
4477 argDecls.append(t: parseInfo->variables.at(i));
4478
4479 if((yyvsp[-3].enums.slot) > -1)
4480 {
4481 /* We have allocated slots, so now push them out of scope. */
4482 parseInfo->finalizePushedVariable(amount: argCount);
4483 }
4484
4485 parseInfo->userFunctions.append(t: UserFunction::Ptr(new UserFunction(sign, checked, (yyvsp[-3].enums.slot), argDecls)));
4486 }
4487 }
4488 else /* We got an 'external' declaration. */
4489 {
4490 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "No external functions are supported. "
4491 "All supported functions can be used directly, "
4492 "without first declaring them as external"),
4493 errorCode: ReportContext::XPST0017, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4494 }
4495 }
4496#line 4448 "qquerytransformparser.cpp" /* yacc.c:1652 */
4497 break;
4498
4499 case 82:
4500#line 2261 "querytransformparser.ypp" /* yacc.c:1652 */
4501 {
4502 (yyval.functionArguments) = FunctionArgument::List();
4503 }
4504#line 4456 "qquerytransformparser.cpp" /* yacc.c:1652 */
4505 break;
4506
4507 case 83:
4508#line 2265 "querytransformparser.ypp" /* yacc.c:1652 */
4509 {
4510 FunctionArgument::List l;
4511 l.append(t: (yyvsp[0].functionArgument));
4512 (yyval.functionArguments) = l;
4513 }
4514#line 4466 "qquerytransformparser.cpp" /* yacc.c:1652 */
4515 break;
4516
4517 case 84:
4518#line 2271 "querytransformparser.ypp" /* yacc.c:1652 */
4519 {
4520 FunctionArgument::List::const_iterator it((yyvsp[-2].functionArguments).constBegin());
4521 const FunctionArgument::List::const_iterator end((yyvsp[-2].functionArguments).constEnd());
4522
4523 for(; it != end; ++it)
4524 {
4525 if((*it)->name() == (yyvsp[0].functionArgument)->name())
4526 {
4527 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "An argument with name %1 has already "
4528 "been declared. Every argument name "
4529 "must be unique.")
4530 .arg(a: formatKeyword(np: parseInfo->staticContext->namePool(), name: (yyvsp[0].functionArgument)->name())),
4531 errorCode: ReportContext::XQST0039, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4532 }
4533 }
4534
4535 (yyvsp[-2].functionArguments).append(t: (yyvsp[0].functionArgument));
4536 (yyval.functionArguments) = (yyvsp[-2].functionArguments);
4537 }
4538#line 4490 "qquerytransformparser.cpp" /* yacc.c:1652 */
4539 break;
4540
4541 case 85:
4542#line 2292 "querytransformparser.ypp" /* yacc.c:1652 */
4543 {
4544 pushVariable(name: (yyvsp[-1].qName), seqType: (yyvsp[0].sequenceType), expr: Expression::Ptr(), type: VariableDeclaration::FunctionArgument, sourceLocator: (yyloc), parseInfo);
4545 (yyval.functionArgument) = FunctionArgument::Ptr(new FunctionArgument((yyvsp[-1].qName), (yyvsp[0].sequenceType)));
4546 }
4547#line 4499 "qquerytransformparser.cpp" /* yacc.c:1652 */
4548 break;
4549
4550 case 86:
4551#line 2298 "querytransformparser.ypp" /* yacc.c:1652 */
4552 {
4553 (yyval.expr).reset();
4554 }
4555#line 4507 "qquerytransformparser.cpp" /* yacc.c:1652 */
4556 break;
4557
4558 case 88:
4559#line 2304 "querytransformparser.ypp" /* yacc.c:1652 */
4560 {
4561 (yyval.expr) = (yyvsp[-1].expr);
4562 }
4563#line 4515 "qquerytransformparser.cpp" /* yacc.c:1652 */
4564 break;
4565
4566 case 91:
4567#line 2320 "querytransformparser.ypp" /* yacc.c:1652 */
4568 {
4569 (yyval.expr) = create(expr: new CombineNodes((yyvsp[-2].expr), CombineNodes::Union, (yyvsp[0].expr)), sourceLocator: (yyloc), parseInfo);
4570 }
4571#line 4523 "qquerytransformparser.cpp" /* yacc.c:1652 */
4572 break;
4573
4574 case 93:
4575#line 2326 "querytransformparser.ypp" /* yacc.c:1652 */
4576 {
4577 /* We write this into a node test. The spec says, 5.5.3 The Meaning of a Pattern:
4578 * "Similarly, / matches a document node, and only a document node,
4579 * because the result of the expression root(.)//(/) returns the root
4580 * node of the tree containing the context node if and only if it is a
4581 * document node." */
4582 (yyval.expr) = create(expr: new AxisStep(QXmlNodeModelIndex::AxisSelf, BuiltinTypes::document), sourceLocator: (yyloc), parseInfo);
4583 }
4584#line 4536 "qquerytransformparser.cpp" /* yacc.c:1652 */
4585 break;
4586
4587 case 94:
4588#line 2335 "querytransformparser.ypp" /* yacc.c:1652 */
4589 {
4590 /* /axis::node-test
4591 * =>
4592 * axis::node-test[parent::document-node()]
4593 *
4594 * In practice it looks like this. $2 is:
4595 *
4596 * TruthPredicate
4597 * AxisStep self::element(c)
4598 * TruthPredicate
4599 * AxisStep parent::element(b)
4600 * AxisStep parent::element(a)
4601 *
4602 * and we want this:
4603 *
4604 * TruthPredicate
4605 * AxisStep self::element(c)
4606 * TruthPredicate
4607 * AxisStep self::element(b)
4608 * TruthPredicate
4609 * AxisStep parent::element(a)
4610 * AxisStep parent::document()
4611 *
4612 * So we want to rewrite the predicate deepest down into a
4613 * another TruthPredicate containing the AxisStep.
4614 *
4615 * The simplest case where $2 is only an axis step is special. When $2 is:
4616 *
4617 * AxisStep self::element(a)
4618 *
4619 * we want:
4620 *
4621 * TruthPredicate
4622 * AxisStep self::element(a)
4623 * AxisStep parent::document()
4624 */
4625
4626 /* First, find the target. */
4627 Expression::Ptr target((yyvsp[0].expr));
4628
4629 while(isPredicate(id: target->id()))
4630 {
4631 const Expression::Ptr candidate(target->operands().at(i: 1));
4632
4633 if(isPredicate(id: candidate->id()))
4634 target = candidate;
4635 else
4636 break; /* target is now the last predicate. */
4637 }
4638
4639 if(target->is(i: Expression::IDAxisStep))
4640 {
4641 (yyval.expr) = create(expr: GenericPredicate::create(sourceExpression: (yyvsp[0].expr), predicateExpression: create(expr: new AxisStep(QXmlNodeModelIndex::AxisParent, BuiltinTypes::document), sourceLocator: (yyloc), parseInfo),
4642 context: parseInfo->staticContext, location: fromYYLTYPE(sourceLocator: (yylsp[-1]), parseInfo)), sourceLocator: (yylsp[-1]), parseInfo);
4643 }
4644 else
4645 {
4646 const Expression::List targetOperands(target->operands());
4647 Expression::List newOps;
4648 newOps.append(t: targetOperands.at(i: 0));
4649
4650 newOps.append(t: create(expr: GenericPredicate::create(sourceExpression: targetOperands.at(i: 1),
4651 predicateExpression: create(expr: new AxisStep(QXmlNodeModelIndex::AxisParent, BuiltinTypes::document), sourceLocator: (yyloc), parseInfo),
4652 context: parseInfo->staticContext, location: fromYYLTYPE(sourceLocator: (yylsp[-1]), parseInfo)), sourceLocator: (yylsp[-1]), parseInfo));
4653
4654 target->setOperands(newOps);
4655 (yyval.expr) = (yyvsp[0].expr);
4656 }
4657 }
4658#line 4610 "qquerytransformparser.cpp" /* yacc.c:1652 */
4659 break;
4660
4661 case 95:
4662#line 2405 "querytransformparser.ypp" /* yacc.c:1652 */
4663 {
4664 /* //axis::node-test
4665 * =>
4666 * axis::node-test[parent::node()]
4667 *
4668 * Spec says: "//para matches any para element that has a parent node."
4669 */
4670 (yyval.expr) = create(expr: GenericPredicate::create(sourceExpression: (yyvsp[0].expr), predicateExpression: create(expr: new AxisStep(QXmlNodeModelIndex::AxisParent, BuiltinTypes::node), sourceLocator: (yyloc), parseInfo),
4671 context: parseInfo->staticContext, location: fromYYLTYPE(sourceLocator: (yylsp[-1]), parseInfo)), sourceLocator: (yylsp[-1]), parseInfo);
4672 }
4673#line 4625 "qquerytransformparser.cpp" /* yacc.c:1652 */
4674 break;
4675
4676 case 97:
4677#line 2417 "querytransformparser.ypp" /* yacc.c:1652 */
4678 {
4679 createIdPatternPath(operand1: (yyvsp[-2].expr), operand2: (yyvsp[0].expr), axis: QXmlNodeModelIndex::AxisParent, sl: (yylsp[-1]), parseInfo);
4680 }
4681#line 4633 "qquerytransformparser.cpp" /* yacc.c:1652 */
4682 break;
4683
4684 case 98:
4685#line 2421 "querytransformparser.ypp" /* yacc.c:1652 */
4686 {
4687 createIdPatternPath(operand1: (yyvsp[-2].expr), operand2: (yyvsp[0].expr), axis: QXmlNodeModelIndex::AxisAncestor, sl: (yylsp[-1]), parseInfo);
4688 }
4689#line 4641 "qquerytransformparser.cpp" /* yacc.c:1652 */
4690 break;
4691
4692 case 99:
4693#line 2426 "querytransformparser.ypp" /* yacc.c:1652 */
4694 {
4695 const Expression::List ands((yyvsp[0].expr)->operands());
4696 const FunctionSignature::Ptr signature((yyvsp[0].expr)->as<FunctionCall>()->signature());
4697 const QXmlName name(signature->name());
4698 const QXmlName key(StandardNamespaces::fn, StandardLocalNames::key);
4699 const QXmlName id(StandardNamespaces::fn, StandardLocalNames::id);
4700
4701 if(name == id)
4702 {
4703 const Expression::ID id = ands.first()->id();
4704 if(!isVariableReference(id) && id != Expression::IDStringValue)
4705 {
4706 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "When function %1 is used for matching inside a pattern, "
4707 "the argument must be a variable reference or a string literal.")
4708 .arg(a: formatFunction(np: parseInfo->staticContext->namePool(), func: signature)),
4709 errorCode: ReportContext::XPST0003,
4710 sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4711 }
4712 }
4713 else if(name == key)
4714 {
4715 if(ands.first()->id() != Expression::IDStringValue)
4716 {
4717 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "In an XSL-T pattern, the first argument to function %1 "
4718 "must be a string literal, when used for matching.")
4719 .arg(a: formatFunction(np: parseInfo->staticContext->namePool(), func: signature)),
4720 errorCode: ReportContext::XPST0003,
4721 sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4722 }
4723
4724 const Expression::ID id2 = ands.at(i: 1)->id();
4725 if(!isVariableReference(id: id2) &&
4726 id2 != Expression::IDStringValue &&
4727 id2 != Expression::IDIntegerValue &&
4728 id2 != Expression::IDBooleanValue &&
4729 id2 != Expression::IDFloat)
4730 {
4731 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "In an XSL-T pattern, the first argument to function %1 "
4732 "must be a literal or a variable reference, when used for matching.")
4733 .arg(a: formatFunction(np: parseInfo->staticContext->namePool(), func: signature)),
4734 errorCode: ReportContext::XPST0003,
4735 sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4736 }
4737
4738 if(ands.count() == 3)
4739 {
4740 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "In an XSL-T pattern, function %1 cannot have a third argument.")
4741 .arg(a: formatFunction(np: parseInfo->staticContext->namePool(), func: signature)),
4742 errorCode: ReportContext::XPST0003,
4743 sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4744 }
4745
4746 }
4747 else
4748 {
4749 const FunctionSignature::Hash signs(parseInfo->staticContext->functionSignatures()->functionSignatures());
4750 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "In an XSL-T pattern, only function %1 "
4751 "and %2, not %3, can be used for matching.")
4752 .arg(args: formatFunction(np: parseInfo->staticContext->namePool(), func: signs.value(akey: id)),
4753 args: formatFunction(np: parseInfo->staticContext->namePool(), func: signs.value(akey: key)),
4754 args: formatFunction(np: parseInfo->staticContext->namePool(), func: signature)),
4755 errorCode: ReportContext::XPST0003,
4756 sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4757 }
4758
4759 (yyval.expr) = (yyvsp[0].expr);
4760 }
4761#line 4713 "qquerytransformparser.cpp" /* yacc.c:1652 */
4762 break;
4763
4764 case 101:
4765#line 2496 "querytransformparser.ypp" /* yacc.c:1652 */
4766 {
4767 (yyval.expr) = createPatternPath(operand1: (yyvsp[-2].expr), operand2: (yyvsp[0].expr), axis: QXmlNodeModelIndex::AxisParent, sl: (yylsp[-1]), parseInfo);
4768 }
4769#line 4721 "qquerytransformparser.cpp" /* yacc.c:1652 */
4770 break;
4771
4772 case 102:
4773#line 2500 "querytransformparser.ypp" /* yacc.c:1652 */
4774 {
4775 (yyval.expr) = createPatternPath(operand1: (yyvsp[-2].expr), operand2: (yyvsp[0].expr), axis: QXmlNodeModelIndex::AxisAncestor, sl: (yylsp[-1]), parseInfo);
4776 }
4777#line 4729 "qquerytransformparser.cpp" /* yacc.c:1652 */
4778 break;
4779
4780 case 103:
4781#line 2505 "querytransformparser.ypp" /* yacc.c:1652 */
4782 {
4783 const Expression::Ptr expr(findAxisStep(expr: (yyvsp[0].expr)));
4784
4785 const QXmlNodeModelIndex::Axis axis = expr->as<AxisStep>()->axis();
4786 AxisStep *const axisStep = expr->as<AxisStep>();
4787
4788 /* Here we constrain the possible axes, and we rewrite the axes as according
4789 * to 5.5.3 The Meaning of a Pattern.
4790 *
4791 * However, we also rewrite axis child and attribute to axis self. The
4792 * reason for this is that if we don't, we will match the children of
4793 * the context node, instead of the context node itself. The formal
4794 * definition of a pattern, root(.)//EE is insensitive to context,
4795 * while the way we implement pattern, "the other way of seeing it",
4796 * e.g from right to left, are very much. */
4797
4798 if(axisStep->nodeTest() == BuiltinTypes::document
4799 || axis == QXmlNodeModelIndex::AxisChild)
4800 axisStep->setAxis(QXmlNodeModelIndex::AxisSelf);
4801 else if(axis == QXmlNodeModelIndex::AxisAttribute)
4802 {
4803 axisStep->setAxis(QXmlNodeModelIndex::AxisSelf);
4804 /* Consider that the user write attribute::node(). This is
4805 * semantically equivalent to attribute::attribute(), but since we have changed
4806 * the axis to axis self, we also need to change the node test, such that we
4807 * have self::attribute(). */
4808 if(*axisStep->nodeTest() == *BuiltinTypes::node)
4809 axisStep->setNodeTest(BuiltinTypes::attribute);
4810 }
4811 else
4812 {
4813 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "In an XSL-T pattern, axis %1 cannot be used, "
4814 "only axis %2 or %3 can.")
4815 .arg(args: formatKeyword(keyword: AxisStep::axisName(axis)),
4816 args: formatKeyword(keyword: AxisStep::axisName(axis: QXmlNodeModelIndex::AxisChild)),
4817 args: formatKeyword(keyword: AxisStep::axisName(axis: QXmlNodeModelIndex::AxisAttribute))),
4818 errorCode: ReportContext::XPST0003,
4819 sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4820 }
4821
4822 (yyval.expr) = (yyvsp[0].expr);
4823 }
4824#line 4776 "qquerytransformparser.cpp" /* yacc.c:1652 */
4825 break;
4826
4827 case 105:
4828#line 2550 "querytransformparser.ypp" /* yacc.c:1652 */
4829 {
4830 (yyval.expr) = create(expr: new ExpressionSequence((yyvsp[0].expressionList)), sourceLocator: (yyloc), parseInfo);
4831 }
4832#line 4784 "qquerytransformparser.cpp" /* yacc.c:1652 */
4833 break;
4834
4835 case 106:
4836#line 2555 "querytransformparser.ypp" /* yacc.c:1652 */
4837 {
4838 Expression::List l;
4839 l.append(t: (yyvsp[-2].expr));
4840 l.append(t: (yyvsp[0].expr));
4841 (yyval.expressionList) = l;
4842 }
4843#line 4795 "qquerytransformparser.cpp" /* yacc.c:1652 */
4844 break;
4845
4846 case 107:
4847#line 2562 "querytransformparser.ypp" /* yacc.c:1652 */
4848 {
4849 (yyvsp[-2].expressionList).append(t: (yyvsp[0].expr));
4850 (yyval.expressionList) = (yyvsp[-2].expressionList);
4851 }
4852#line 4804 "qquerytransformparser.cpp" /* yacc.c:1652 */
4853 break;
4854
4855 case 113:
4856#line 2573 "querytransformparser.ypp" /* yacc.c:1652 */
4857 {
4858 (yyval.expr) = createDirAttributeValue(content: (yyvsp[-1].expressionList), parseInfo, sourceLocator: (yyloc));
4859 }
4860#line 4812 "qquerytransformparser.cpp" /* yacc.c:1652 */
4861 break;
4862
4863 case 114:
4864#line 2578 "querytransformparser.ypp" /* yacc.c:1652 */
4865 {
4866 QVector<QXmlName> result;
4867 result.append(t: QXmlName(StandardNamespaces::InternalXSLT, StandardLocalNames::Default));
4868 (yyval.qNameVector) = result;
4869 }
4870#line 4822 "qquerytransformparser.cpp" /* yacc.c:1652 */
4871 break;
4872
4873 case 115:
4874#line 2584 "querytransformparser.ypp" /* yacc.c:1652 */
4875 {
4876 (yyval.qNameVector) = (yyvsp[0].qNameVector);
4877 }
4878#line 4830 "qquerytransformparser.cpp" /* yacc.c:1652 */
4879 break;
4880
4881 case 116:
4882#line 2589 "querytransformparser.ypp" /* yacc.c:1652 */
4883 {
4884 (yyval.qName) = QXmlName(StandardNamespaces::InternalXSLT, StandardLocalNames::Default);
4885 }
4886#line 4838 "qquerytransformparser.cpp" /* yacc.c:1652 */
4887 break;
4888
4889 case 117:
4890#line 2593 "querytransformparser.ypp" /* yacc.c:1652 */
4891 {
4892 (yyval.qName) = (yyvsp[0].qName);
4893 }
4894#line 4846 "qquerytransformparser.cpp" /* yacc.c:1652 */
4895 break;
4896
4897 case 118:
4898#line 2598 "querytransformparser.ypp" /* yacc.c:1652 */
4899 {
4900 QVector<QXmlName> result;
4901 result.append(t: (yyvsp[0].qName));
4902 (yyval.qNameVector) = result;
4903 }
4904#line 4856 "qquerytransformparser.cpp" /* yacc.c:1652 */
4905 break;
4906
4907 case 119:
4908#line 2604 "querytransformparser.ypp" /* yacc.c:1652 */
4909 {
4910 (yyvsp[-2].qNameVector).append(t: (yyvsp[0].qName));
4911 (yyval.qNameVector) = (yyvsp[-2].qNameVector);
4912 }
4913#line 4865 "qquerytransformparser.cpp" /* yacc.c:1652 */
4914 break;
4915
4916 case 120:
4917#line 2610 "querytransformparser.ypp" /* yacc.c:1652 */
4918 {
4919 (yyval.qName) = (yyvsp[0].qName);
4920 }
4921#line 4873 "qquerytransformparser.cpp" /* yacc.c:1652 */
4922 break;
4923
4924 case 121:
4925#line 2614 "querytransformparser.ypp" /* yacc.c:1652 */
4926 {
4927 if((yyvsp[0].sval) == QLatin1String("#current"))
4928 (yyval.qName) = QXmlName(StandardNamespaces::InternalXSLT, StandardLocalNames::current);
4929 else if((yyvsp[0].sval) == QLatin1String("#default"))
4930 (yyval.qName) = QXmlName(StandardNamespaces::InternalXSLT, StandardLocalNames::Default);
4931 else if((yyvsp[0].sval) == QLatin1String("#all"))
4932 (yyval.qName) = QXmlName(StandardNamespaces::InternalXSLT, StandardLocalNames::all);
4933 else
4934 {
4935 const ReflectYYLTYPE ryy((yyloc), parseInfo);
4936
4937 if(!QXmlUtils::isNCName(ncName: (yyvsp[0].sval)))
4938 {
4939 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "%1 is an invalid template mode name.")
4940 .arg(a: formatKeyword(keyword: (yyvsp[0].sval))),
4941 errorCode: ReportContext::XTSE0550,
4942 sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4943 }
4944
4945 (yyval.qName) = parseInfo->staticContext->namePool()->allocateQName(uri: StandardNamespaces::empty, ln: (yyvsp[0].sval));
4946 }
4947 }
4948#line 4900 "qquerytransformparser.cpp" /* yacc.c:1652 */
4949 break;
4950
4951 case 124:
4952#line 2643 "querytransformparser.ypp" /* yacc.c:1652 */
4953 {
4954 /* We're pushing the range variable here, not the positional. */
4955 (yyval.expr) = pushVariable(name: (yyvsp[-4].qName), seqType: quantificationType(type: (yyvsp[-3].sequenceType)), expr: (yyvsp[0].expr), type: VariableDeclaration::RangeVariable, sourceLocator: (yyloc), parseInfo);
4956 }
4957#line 4909 "qquerytransformparser.cpp" /* yacc.c:1652 */
4958 break;
4959
4960 case 125:
4961#line 2647 "querytransformparser.ypp" /* yacc.c:1652 */
4962 {
4963 /* It is ok this appears after PositionalVar, because currentRangeSlot()
4964 * uses a different "channel" than currentPositionSlot(), so they can't trash
4965 * each other. */
4966 (yyval.enums.slot) = parseInfo->staticContext->currentRangeSlot();
4967 }
4968#line 4920 "qquerytransformparser.cpp" /* yacc.c:1652 */
4969 break;
4970
4971 case 126:
4972#line 2654 "querytransformparser.ypp" /* yacc.c:1652 */
4973 {
4974 Q_ASSERT((yyvsp[-3].expr));
4975 Q_ASSERT((yyvsp[0].expr));
4976
4977 /* We want the next last pushed variable, since we push the range variable after the
4978 * positional variable. */
4979 if((yyvsp[-5].enums.slot) != -1 && parseInfo->variables.at(i: parseInfo->variables.count() -2)->name == (yyvsp[-7].qName))
4980 {
4981 /* Ok, a positional variable is used since its slot is not -1, and its name is equal
4982 * to our range variable. This is an error. */
4983 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "The name of a variable bound in a for-expression must be different "
4984 "from the positional variable. Hence, the two variables named %1 collide.")
4985 .arg(a: formatKeyword(np: parseInfo->staticContext->namePool(), name: (yyvsp[-7].qName))),
4986 errorCode: ReportContext::XQST0089,
4987 sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
4988
4989 }
4990
4991 const Expression::Ptr retBody(create(expr: new ForClause((yyvsp[-1].enums.slot), (yyvsp[-2].expr), (yyvsp[0].expr), (yyvsp[-5].enums.slot)), sourceLocator: (yyloc), parseInfo));
4992 ReturnOrderBy *const rob = locateReturnClause(expr: (yyvsp[0].expr));
4993
4994 if(rob)
4995 (yyval.expr) = create(expr: new OrderBy(rob->stability(), rob->orderSpecs(), retBody, rob), sourceLocator: (yyloc), parseInfo);
4996 else
4997 (yyval.expr) = retBody;
4998
4999 parseInfo->finalizePushedVariable();
5000
5001 if((yyvsp[-5].enums.slot) != -1) /* We also have a positional variable to remove from the scope. */
5002 parseInfo->finalizePushedVariable();
5003 }
5004#line 4956 "qquerytransformparser.cpp" /* yacc.c:1652 */
5005 break;
5006
5007 case 127:
5008#line 2688 "querytransformparser.ypp" /* yacc.c:1652 */
5009 {
5010 pushVariable(name: (yyvsp[-4].qName), seqType: quantificationType(type: (yyvsp[-3].sequenceType)), expr: (yyvsp[0].expr), type: VariableDeclaration::RangeVariable, sourceLocator: (yyloc), parseInfo);
5011 }
5012#line 4964 "qquerytransformparser.cpp" /* yacc.c:1652 */
5013 break;
5014
5015 case 128:
5016#line 2691 "querytransformparser.ypp" /* yacc.c:1652 */
5017 {
5018 /* It is ok this appears after PositionalVar, because currentRangeSlot()
5019 * uses a different "channel" than currentPositionSlot(), so they can't trash
5020 * each other. */
5021 (yyval.enums.slot) = parseInfo->staticContext->currentRangeSlot();
5022 }
5023#line 4975 "qquerytransformparser.cpp" /* yacc.c:1652 */
5024 break;
5025
5026 case 129:
5027#line 2698 "querytransformparser.ypp" /* yacc.c:1652 */
5028 {
5029 (yyval.expr) = create(expr: new ForClause((yyvsp[-1].enums.slot), (yyvsp[-3].expr), (yyvsp[0].expr), (yyvsp[-5].enums.slot)), sourceLocator: (yyloc), parseInfo);
5030
5031 parseInfo->finalizePushedVariable();
5032
5033 if((yyvsp[-5].enums.slot) != -1) /* We also have a positional variable to remove from the scope. */
5034 parseInfo->finalizePushedVariable();
5035 }
5036#line 4988 "qquerytransformparser.cpp" /* yacc.c:1652 */
5037 break;
5038
5039 case 133:
5040#line 2712 "querytransformparser.ypp" /* yacc.c:1652 */
5041 {
5042 (yyval.enums.slot) = -1;
5043 }
5044#line 4996 "qquerytransformparser.cpp" /* yacc.c:1652 */
5045 break;
5046
5047 case 134:
5048#line 2717 "querytransformparser.ypp" /* yacc.c:1652 */
5049 {
5050 pushVariable(name: (yyvsp[0].qName), seqType: CommonSequenceTypes::ExactlyOneInteger, expr: Expression::Ptr(),
5051 type: VariableDeclaration::PositionalVariable, sourceLocator: (yyloc), parseInfo);
5052 (yyval.enums.slot) = parseInfo->currentPositionSlot();
5053 }
5054#line 5006 "qquerytransformparser.cpp" /* yacc.c:1652 */
5055 break;
5056
5057 case 135:
5058#line 2724 "querytransformparser.ypp" /* yacc.c:1652 */
5059 {
5060 (yyval.expr) = pushVariable(name: (yyvsp[-3].qName), seqType: quantificationType(type: (yyvsp[-2].sequenceType)), expr: (yyvsp[0].expr), type: VariableDeclaration::ExpressionVariable, sourceLocator: (yyloc), parseInfo);
5061 }
5062#line 5014 "qquerytransformparser.cpp" /* yacc.c:1652 */
5063 break;
5064
5065 case 136:
5066#line 2728 "querytransformparser.ypp" /* yacc.c:1652 */
5067 {
5068 allowedIn(allowedLanguages: QXmlQuery::XQuery10, parseInfo, sourceLocator: (yyloc), isInternal: (yyvsp[-7].enums.Bool));
5069
5070 Q_ASSERT(parseInfo->variables.top()->name == (yyvsp[-5].qName));
5071 (yyval.expr) = create(expr: new LetClause((yyvsp[-1].expr), (yyvsp[0].expr), parseInfo->variables.top()), sourceLocator: (yyloc), parseInfo);
5072 parseInfo->finalizePushedVariable();
5073 }
5074#line 5026 "qquerytransformparser.cpp" /* yacc.c:1652 */
5075 break;
5076
5077 case 137:
5078#line 2737 "querytransformparser.ypp" /* yacc.c:1652 */
5079 { (yyval.expr) = pushVariable(name: (yyvsp[-3].qName), seqType: quantificationType(type: (yyvsp[-2].sequenceType)), expr: (yyvsp[0].expr), type: VariableDeclaration::ExpressionVariable, sourceLocator: (yyloc), parseInfo);}
5080#line 5032 "qquerytransformparser.cpp" /* yacc.c:1652 */
5081 break;
5082
5083 case 138:
5084#line 2739 "querytransformparser.ypp" /* yacc.c:1652 */
5085 {
5086 Q_ASSERT(parseInfo->variables.top()->name == (yyvsp[-5].qName));
5087 (yyval.expr) = create(expr: new LetClause((yyvsp[-1].expr), (yyvsp[0].expr), parseInfo->variables.top()), sourceLocator: (yyloc), parseInfo);
5088 parseInfo->finalizePushedVariable();
5089 }
5090#line 5042 "qquerytransformparser.cpp" /* yacc.c:1652 */
5091 break;
5092
5093 case 142:
5094#line 2750 "querytransformparser.ypp" /* yacc.c:1652 */
5095 {
5096 if((yyvsp[-2].orderSpecs).isEmpty())
5097 (yyval.expr) = (yyvsp[0].expr);
5098 else
5099 (yyval.expr) = createReturnOrderBy(orderSpecTransfer: (yyvsp[-2].orderSpecs), returnExpr: (yyvsp[0].expr), stability: parseInfo->orderStability.pop(), sourceLocator: (yyloc), parseInfo);
5100 }
5101#line 5053 "qquerytransformparser.cpp" /* yacc.c:1652 */
5102 break;
5103
5104 case 143:
5105#line 2758 "querytransformparser.ypp" /* yacc.c:1652 */
5106 {
5107 if((yyvsp[-2].orderSpecs).isEmpty())
5108 (yyval.expr) = create(expr: new IfThenClause((yyvsp[-3].expr), (yyvsp[0].expr), create(expr: new EmptySequence, sourceLocator: (yyloc), parseInfo)), sourceLocator: (yyloc), parseInfo);
5109 else
5110 (yyval.expr) = create(expr: new IfThenClause((yyvsp[-3].expr), createReturnOrderBy(orderSpecTransfer: (yyvsp[-2].orderSpecs), returnExpr: (yyvsp[0].expr), stability: parseInfo->orderStability.pop(), sourceLocator: (yyloc), parseInfo),
5111 create(expr: new EmptySequence, sourceLocator: (yyloc), parseInfo)),
5112 sourceLocator: (yyloc), parseInfo);
5113 }
5114#line 5066 "qquerytransformparser.cpp" /* yacc.c:1652 */
5115 break;
5116
5117 case 144:
5118#line 2768 "querytransformparser.ypp" /* yacc.c:1652 */
5119 {
5120 (yyval.orderSpecs) = OrderSpecTransfer::List();
5121 }
5122#line 5074 "qquerytransformparser.cpp" /* yacc.c:1652 */
5123 break;
5124
5125 case 146:
5126#line 2774 "querytransformparser.ypp" /* yacc.c:1652 */
5127 {
5128 (yyval.orderSpecs) = (yyvsp[0].orderSpecs);
5129 }
5130#line 5082 "qquerytransformparser.cpp" /* yacc.c:1652 */
5131 break;
5132
5133 case 147:
5134#line 2779 "querytransformparser.ypp" /* yacc.c:1652 */
5135 {
5136 OrderSpecTransfer::List list;
5137 list += (yyvsp[-2].orderSpecs);
5138 list.append(t: (yyvsp[0].orderSpec));
5139 (yyval.orderSpecs) = list;
5140 }
5141#line 5093 "qquerytransformparser.cpp" /* yacc.c:1652 */
5142 break;
5143
5144 case 148:
5145#line 2786 "querytransformparser.ypp" /* yacc.c:1652 */
5146 {
5147 OrderSpecTransfer::List list;
5148 list.append(t: (yyvsp[0].orderSpec));
5149 (yyval.orderSpecs) = list;
5150 }
5151#line 5103 "qquerytransformparser.cpp" /* yacc.c:1652 */
5152 break;
5153
5154 case 149:
5155#line 2793 "querytransformparser.ypp" /* yacc.c:1652 */
5156 {
5157 (yyval.orderSpec) = OrderSpecTransfer((yyvsp[-3].expr), OrderBy::OrderSpec((yyvsp[-2].enums.sortDirection), (yyvsp[-1].enums.orderingEmptySequence)));
5158 }
5159#line 5111 "qquerytransformparser.cpp" /* yacc.c:1652 */
5160 break;
5161
5162 case 150:
5163#line 2798 "querytransformparser.ypp" /* yacc.c:1652 */
5164 {
5165 /* Where does the specification state the default value is ascending?
5166 *
5167 * It is implicit, in the first enumerated list in 3.8.3 Order By and Return Clauses:
5168 *
5169 * "If T1 and T2 are two tuples in the tuple stream, and V1 and V2 are the first pair
5170 * of values encountered when evaluating their orderspecs from left to right for
5171 * which one value is greater-than the other (as defined above), then:
5172 *
5173 * 1. If V1 is greater-than V2: If the orderspec specifies descending,
5174 * then T1 precedes T2 in the tuple stream; otherwise, T2 precedes T1 in the tuple stream.
5175 * 2. If V2 is greater-than V1: If the orderspec specifies descending,
5176 * then T2 precedes T1 in the tuple stream; otherwise, T1 precedes T2 in the tuple stream."
5177 *
5178 * which means that if you don't specify anything, or you
5179 * specify ascending, you get the same result.
5180 */
5181 (yyval.enums.sortDirection) = OrderBy::OrderSpec::Ascending;
5182 }
5183#line 5135 "qquerytransformparser.cpp" /* yacc.c:1652 */
5184 break;
5185
5186 case 151:
5187#line 2819 "querytransformparser.ypp" /* yacc.c:1652 */
5188 {
5189 (yyval.enums.sortDirection) = OrderBy::OrderSpec::Ascending;
5190 }
5191#line 5143 "qquerytransformparser.cpp" /* yacc.c:1652 */
5192 break;
5193
5194 case 152:
5195#line 2824 "querytransformparser.ypp" /* yacc.c:1652 */
5196 {
5197 (yyval.enums.sortDirection) = OrderBy::OrderSpec::Descending;
5198 }
5199#line 5151 "qquerytransformparser.cpp" /* yacc.c:1652 */
5200 break;
5201
5202 case 153:
5203#line 2829 "querytransformparser.ypp" /* yacc.c:1652 */
5204 {
5205 (yyval.enums.orderingEmptySequence) = parseInfo->staticContext->orderingEmptySequence();
5206 }
5207#line 5159 "qquerytransformparser.cpp" /* yacc.c:1652 */
5208 break;
5209
5210 case 156:
5211#line 2836 "querytransformparser.ypp" /* yacc.c:1652 */
5212 {
5213 if(parseInfo->isXSLT())
5214 resolveAndCheckCollation<ReportContext::XTDE1035>(collation: (yyvsp[0].sval), parseInfo, sl: (yyloc));
5215 else
5216 resolveAndCheckCollation<ReportContext::XQST0076>(collation: (yyvsp[0].sval), parseInfo, sl: (yyloc));
5217 }
5218#line 5170 "qquerytransformparser.cpp" /* yacc.c:1652 */
5219 break;
5220
5221 case 157:
5222#line 2843 "querytransformparser.ypp" /* yacc.c:1652 */
5223 {
5224 /* We do nothing. We don't use collations, and we have this non-terminal
5225 * in order to accept expressions. */
5226 }
5227#line 5179 "qquerytransformparser.cpp" /* yacc.c:1652 */
5228 break;
5229
5230 case 158:
5231#line 2849 "querytransformparser.ypp" /* yacc.c:1652 */
5232 {
5233 parseInfo->orderStability.push(t: OrderBy::StableOrder);
5234 }
5235#line 5187 "qquerytransformparser.cpp" /* yacc.c:1652 */
5236 break;
5237
5238 case 159:
5239#line 2853 "querytransformparser.ypp" /* yacc.c:1652 */
5240 {
5241 parseInfo->orderStability.push(t: OrderBy::UnstableOrder);
5242 }
5243#line 5195 "qquerytransformparser.cpp" /* yacc.c:1652 */
5244 break;
5245
5246 case 162:
5247#line 2861 "querytransformparser.ypp" /* yacc.c:1652 */
5248 {
5249 pushVariable(name: (yyvsp[-3].qName), seqType: quantificationType(type: (yyvsp[-2].sequenceType)), expr: (yyvsp[0].expr),
5250 type: VariableDeclaration::RangeVariable, sourceLocator: (yyloc), parseInfo);
5251 }
5252#line 5204 "qquerytransformparser.cpp" /* yacc.c:1652 */
5253 break;
5254
5255 case 163:
5256#line 2865 "querytransformparser.ypp" /* yacc.c:1652 */
5257 {(yyval.enums.slot) = parseInfo->staticContext->currentRangeSlot();}
5258#line 5210 "qquerytransformparser.cpp" /* yacc.c:1652 */
5259 break;
5260
5261 case 164:
5262#line 2867 "querytransformparser.ypp" /* yacc.c:1652 */
5263 {
5264 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, sourceLocator: (yyloc));
5265 (yyval.expr) = create(expr: new QuantifiedExpression((yyvsp[-1].enums.slot),
5266 QuantifiedExpression::Some, (yyvsp[-3].expr), (yyvsp[0].expr)), sourceLocator: (yyloc), parseInfo);
5267 parseInfo->finalizePushedVariable();
5268 }
5269#line 5221 "qquerytransformparser.cpp" /* yacc.c:1652 */
5270 break;
5271
5272 case 165:
5273#line 2875 "querytransformparser.ypp" /* yacc.c:1652 */
5274 {
5275 (yyval.expr) = pushVariable(name: (yyvsp[-3].qName), seqType: quantificationType(type: (yyvsp[-2].sequenceType)), expr: (yyvsp[0].expr),
5276 type: VariableDeclaration::RangeVariable, sourceLocator: (yyloc), parseInfo);
5277 }
5278#line 5230 "qquerytransformparser.cpp" /* yacc.c:1652 */
5279 break;
5280
5281 case 166:
5282#line 2879 "querytransformparser.ypp" /* yacc.c:1652 */
5283 {(yyval.enums.slot) = parseInfo->staticContext->currentRangeSlot();}
5284#line 5236 "qquerytransformparser.cpp" /* yacc.c:1652 */
5285 break;
5286
5287 case 167:
5288#line 2881 "querytransformparser.ypp" /* yacc.c:1652 */
5289 {
5290 (yyval.expr) = create(expr: new QuantifiedExpression((yyvsp[-1].enums.slot),
5291 QuantifiedExpression::Some, (yyvsp[-2].expr), (yyvsp[0].expr)), sourceLocator: (yyloc), parseInfo);
5292 parseInfo->finalizePushedVariable();
5293 }
5294#line 5246 "qquerytransformparser.cpp" /* yacc.c:1652 */
5295 break;
5296
5297 case 169:
5298#line 2890 "querytransformparser.ypp" /* yacc.c:1652 */
5299 {
5300 pushVariable(name: (yyvsp[-3].qName), seqType: quantificationType(type: (yyvsp[-2].sequenceType)), expr: (yyvsp[0].expr),
5301 type: VariableDeclaration::RangeVariable, sourceLocator: (yyloc), parseInfo);
5302 }
5303#line 5255 "qquerytransformparser.cpp" /* yacc.c:1652 */
5304 break;
5305
5306 case 170:
5307#line 2894 "querytransformparser.ypp" /* yacc.c:1652 */
5308 {(yyval.enums.slot) = parseInfo->staticContext->currentRangeSlot();}
5309#line 5261 "qquerytransformparser.cpp" /* yacc.c:1652 */
5310 break;
5311
5312 case 171:
5313#line 2896 "querytransformparser.ypp" /* yacc.c:1652 */
5314 {
5315 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, sourceLocator: (yyloc));
5316 (yyval.expr) = create(expr: new QuantifiedExpression((yyvsp[-1].enums.slot),
5317 QuantifiedExpression::Every, (yyvsp[-3].expr), (yyvsp[0].expr)), sourceLocator: (yyloc), parseInfo);
5318 parseInfo->finalizePushedVariable();
5319 }
5320#line 5272 "qquerytransformparser.cpp" /* yacc.c:1652 */
5321 break;
5322
5323 case 172:
5324#line 2904 "querytransformparser.ypp" /* yacc.c:1652 */
5325 {
5326 (yyval.expr) = pushVariable(name: (yyvsp[-3].qName), seqType: quantificationType(type: (yyvsp[-2].sequenceType)), expr: (yyvsp[0].expr),
5327 type: VariableDeclaration::RangeVariable, sourceLocator: (yyloc), parseInfo);
5328 }
5329#line 5281 "qquerytransformparser.cpp" /* yacc.c:1652 */
5330 break;
5331
5332 case 173:
5333#line 2908 "querytransformparser.ypp" /* yacc.c:1652 */
5334 {(yyval.enums.slot) = parseInfo->staticContext->currentRangeSlot();}
5335#line 5287 "qquerytransformparser.cpp" /* yacc.c:1652 */
5336 break;
5337
5338 case 174:
5339#line 2910 "querytransformparser.ypp" /* yacc.c:1652 */
5340 {
5341 (yyval.expr) = create(expr: new QuantifiedExpression((yyvsp[-1].enums.slot),
5342 QuantifiedExpression::Every, (yyvsp[-2].expr), (yyvsp[0].expr)), sourceLocator: (yyloc), parseInfo);
5343 parseInfo->finalizePushedVariable();
5344 }
5345#line 5297 "qquerytransformparser.cpp" /* yacc.c:1652 */
5346 break;
5347
5348 case 176:
5349#line 2919 "querytransformparser.ypp" /* yacc.c:1652 */
5350 {
5351 (yyval.expr) = (yyvsp[0].expr);
5352 }
5353#line 5305 "qquerytransformparser.cpp" /* yacc.c:1652 */
5354 break;
5355
5356 case 177:
5357#line 2946 "querytransformparser.ypp" /* yacc.c:1652 */
5358 {
5359 parseInfo->typeswitchSource.push(t: (yyvsp[-1].expr));
5360 }
5361#line 5313 "qquerytransformparser.cpp" /* yacc.c:1652 */
5362 break;
5363
5364 case 178:
5365#line 2950 "querytransformparser.ypp" /* yacc.c:1652 */
5366 {
5367 allowedIn(allowedLanguages: QXmlQuery::XQuery10, parseInfo, sourceLocator: (yyloc));
5368 parseInfo->typeswitchSource.pop();
5369 (yyval.expr) = (yyvsp[0].expr);
5370 }
5371#line 5323 "qquerytransformparser.cpp" /* yacc.c:1652 */
5372 break;
5373
5374 case 179:
5375#line 2957 "querytransformparser.ypp" /* yacc.c:1652 */
5376 {
5377 if(!(yyvsp[-1].qName).isNull())
5378 {
5379 pushVariable(name: (yyvsp[-1].qName), seqType: (yyvsp[0].sequenceType), expr: parseInfo->typeswitchSource.top(),
5380 type: VariableDeclaration::ExpressionVariable, sourceLocator: (yyloc), parseInfo, checkSource: false);
5381 }
5382 }
5383#line 5335 "qquerytransformparser.cpp" /* yacc.c:1652 */
5384 break;
5385
5386 case 180:
5387#line 2965 "querytransformparser.ypp" /* yacc.c:1652 */
5388 {
5389 /* The variable shouldn't be in-scope for other case branches. */
5390 if(!(yyvsp[-4].qName).isNull())
5391 parseInfo->finalizePushedVariable();
5392 }
5393#line 5345 "qquerytransformparser.cpp" /* yacc.c:1652 */
5394 break;
5395
5396 case 181:
5397#line 2971 "querytransformparser.ypp" /* yacc.c:1652 */
5398 {
5399 const Expression::Ptr instanceOf(create(expr: new InstanceOf(parseInfo->typeswitchSource.top(), (yyvsp[-5].sequenceType)), sourceLocator: (yyloc), parseInfo));
5400 (yyval.expr) = create(expr: new IfThenClause(instanceOf, (yyvsp[-2].expr), (yyvsp[0].expr)), sourceLocator: (yyloc), parseInfo);
5401 }
5402#line 5354 "qquerytransformparser.cpp" /* yacc.c:1652 */
5403 break;
5404
5405 case 184:
5406#line 2980 "querytransformparser.ypp" /* yacc.c:1652 */
5407 {
5408 (yyval.qName) = QXmlName();
5409 }
5410#line 5362 "qquerytransformparser.cpp" /* yacc.c:1652 */
5411 break;
5412
5413 case 185:
5414#line 2985 "querytransformparser.ypp" /* yacc.c:1652 */
5415 {
5416 (yyval.qName) = (yyvsp[-1].qName);
5417 }
5418#line 5370 "qquerytransformparser.cpp" /* yacc.c:1652 */
5419 break;
5420
5421 case 186:
5422#line 2990 "querytransformparser.ypp" /* yacc.c:1652 */
5423 {
5424 (yyval.expr) = (yyvsp[0].expr);
5425 }
5426#line 5378 "qquerytransformparser.cpp" /* yacc.c:1652 */
5427 break;
5428
5429 case 187:
5430#line 2994 "querytransformparser.ypp" /* yacc.c:1652 */
5431 {
5432 if(!(yyvsp[0].qName).isNull())
5433 {
5434 pushVariable(name: (yyvsp[0].qName), seqType: parseInfo->typeswitchSource.top()->staticType(),
5435 expr: parseInfo->typeswitchSource.top(),
5436 type: VariableDeclaration::ExpressionVariable, sourceLocator: (yyloc), parseInfo, checkSource: false);
5437 }
5438 }
5439#line 5391 "qquerytransformparser.cpp" /* yacc.c:1652 */
5440 break;
5441
5442 case 188:
5443#line 3003 "querytransformparser.ypp" /* yacc.c:1652 */
5444 {
5445 if(!(yyvsp[-3].qName).isNull())
5446 parseInfo->finalizePushedVariable();
5447 (yyval.expr) = (yyvsp[0].expr);
5448 }
5449#line 5401 "qquerytransformparser.cpp" /* yacc.c:1652 */
5450 break;
5451
5452 case 189:
5453#line 3010 "querytransformparser.ypp" /* yacc.c:1652 */
5454 {
5455 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, sourceLocator: (yyloc));
5456 (yyval.expr) = create(expr: new IfThenClause((yyvsp[-5].expr), (yyvsp[-2].expr), (yyvsp[0].expr)), sourceLocator: (yyloc), parseInfo);
5457 }
5458#line 5410 "qquerytransformparser.cpp" /* yacc.c:1652 */
5459 break;
5460
5461 case 191:
5462#line 3017 "querytransformparser.ypp" /* yacc.c:1652 */
5463 {
5464 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, sourceLocator: (yyloc));
5465 (yyval.expr) = create(expr: new OrExpression((yyvsp[-2].expr), (yyvsp[0].expr)), sourceLocator: (yyloc), parseInfo);
5466 }
5467#line 5419 "qquerytransformparser.cpp" /* yacc.c:1652 */
5468 break;
5469
5470 case 193:
5471#line 3024 "querytransformparser.ypp" /* yacc.c:1652 */
5472 {
5473 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, sourceLocator: (yyloc));
5474 (yyval.expr) = create(expr: new AndExpression((yyvsp[-2].expr), (yyvsp[0].expr)), sourceLocator: (yyloc), parseInfo);
5475 }
5476#line 5428 "qquerytransformparser.cpp" /* yacc.c:1652 */
5477 break;
5478
5479 case 199:
5480#line 3036 "querytransformparser.ypp" /* yacc.c:1652 */
5481 {
5482 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, sourceLocator: (yyloc));
5483 (yyval.expr) = create(expr: new RangeExpression((yyvsp[-2].expr), (yyvsp[0].expr)), sourceLocator: (yyloc), parseInfo);
5484 }
5485#line 5437 "qquerytransformparser.cpp" /* yacc.c:1652 */
5486 break;
5487
5488 case 201:
5489#line 3043 "querytransformparser.ypp" /* yacc.c:1652 */
5490 {
5491 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, sourceLocator: (yyloc));
5492 (yyval.expr) = create(expr: new ArithmeticExpression((yyvsp[-2].expr), (yyvsp[-1].enums.mathOperator), (yyvsp[0].expr)), sourceLocator: (yyloc), parseInfo);
5493 }
5494#line 5446 "qquerytransformparser.cpp" /* yacc.c:1652 */
5495 break;
5496
5497 case 202:
5498#line 3048 "querytransformparser.ypp" /* yacc.c:1652 */
5499 {(yyval.enums.mathOperator) = AtomicMathematician::Add;}
5500#line 5452 "qquerytransformparser.cpp" /* yacc.c:1652 */
5501 break;
5502
5503 case 203:
5504#line 3049 "querytransformparser.ypp" /* yacc.c:1652 */
5505 {(yyval.enums.mathOperator) = AtomicMathematician::Substract;}
5506#line 5458 "qquerytransformparser.cpp" /* yacc.c:1652 */
5507 break;
5508
5509 case 205:
5510#line 3053 "querytransformparser.ypp" /* yacc.c:1652 */
5511 {
5512 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, sourceLocator: (yyloc));
5513 (yyval.expr) = create(expr: new ArithmeticExpression((yyvsp[-2].expr), (yyvsp[-1].enums.mathOperator), (yyvsp[0].expr)), sourceLocator: (yyloc), parseInfo);
5514 }
5515#line 5467 "qquerytransformparser.cpp" /* yacc.c:1652 */
5516 break;
5517
5518 case 206:
5519#line 3058 "querytransformparser.ypp" /* yacc.c:1652 */
5520 {(yyval.enums.mathOperator) = AtomicMathematician::Multiply;}
5521#line 5473 "qquerytransformparser.cpp" /* yacc.c:1652 */
5522 break;
5523
5524 case 207:
5525#line 3059 "querytransformparser.ypp" /* yacc.c:1652 */
5526 {(yyval.enums.mathOperator) = AtomicMathematician::Div;}
5527#line 5479 "qquerytransformparser.cpp" /* yacc.c:1652 */
5528 break;
5529
5530 case 208:
5531#line 3060 "querytransformparser.ypp" /* yacc.c:1652 */
5532 {(yyval.enums.mathOperator) = AtomicMathematician::IDiv;}
5533#line 5485 "qquerytransformparser.cpp" /* yacc.c:1652 */
5534 break;
5535
5536 case 209:
5537#line 3061 "querytransformparser.ypp" /* yacc.c:1652 */
5538 {(yyval.enums.mathOperator) = AtomicMathematician::Mod;}
5539#line 5491 "qquerytransformparser.cpp" /* yacc.c:1652 */
5540 break;
5541
5542 case 211:
5543#line 3065 "querytransformparser.ypp" /* yacc.c:1652 */
5544 {
5545 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10
5546 | QXmlQuery::XPath20
5547 | QXmlQuery::XmlSchema11IdentityConstraintField
5548 | QXmlQuery::XmlSchema11IdentityConstraintSelector),
5549 parseInfo, sourceLocator: (yyloc));
5550 (yyval.expr) = create(expr: new CombineNodes((yyvsp[-2].expr), CombineNodes::Union, (yyvsp[0].expr)), sourceLocator: (yyloc), parseInfo);
5551 }
5552#line 5504 "qquerytransformparser.cpp" /* yacc.c:1652 */
5553 break;
5554
5555 case 213:
5556#line 3076 "querytransformparser.ypp" /* yacc.c:1652 */
5557 {
5558 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, sourceLocator: (yyloc));
5559 (yyval.expr) = create(expr: new CombineNodes((yyvsp[-2].expr), (yyvsp[-1].enums.combinedNodeOp), (yyvsp[0].expr)), sourceLocator: (yyloc), parseInfo);
5560 }
5561#line 5513 "qquerytransformparser.cpp" /* yacc.c:1652 */
5562 break;
5563
5564 case 216:
5565#line 3085 "querytransformparser.ypp" /* yacc.c:1652 */
5566 {
5567 (yyval.enums.combinedNodeOp) = CombineNodes::Intersect;
5568 }
5569#line 5521 "qquerytransformparser.cpp" /* yacc.c:1652 */
5570 break;
5571
5572 case 217:
5573#line 3089 "querytransformparser.ypp" /* yacc.c:1652 */
5574 {
5575 (yyval.enums.combinedNodeOp) = CombineNodes::Except;
5576 }
5577#line 5529 "qquerytransformparser.cpp" /* yacc.c:1652 */
5578 break;
5579
5580 case 219:
5581#line 3095 "querytransformparser.ypp" /* yacc.c:1652 */
5582 {
5583 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, sourceLocator: (yyloc));
5584 (yyval.expr) = create(expr: new InstanceOf((yyvsp[-3].expr),
5585 SequenceType::Ptr((yyvsp[0].sequenceType))), sourceLocator: (yyloc), parseInfo);
5586 }
5587#line 5539 "qquerytransformparser.cpp" /* yacc.c:1652 */
5588 break;
5589
5590 case 221:
5591#line 3103 "querytransformparser.ypp" /* yacc.c:1652 */
5592 {
5593 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, sourceLocator: (yyloc));
5594 (yyval.expr) = create(expr: new TreatAs((yyvsp[-3].expr), (yyvsp[0].sequenceType)), sourceLocator: (yyloc), parseInfo);
5595 }
5596#line 5548 "qquerytransformparser.cpp" /* yacc.c:1652 */
5597 break;
5598
5599 case 223:
5600#line 3110 "querytransformparser.ypp" /* yacc.c:1652 */
5601 {
5602 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, sourceLocator: (yyloc));
5603 (yyval.expr) = create(expr: new CastableAs((yyvsp[-3].expr), (yyvsp[0].sequenceType)), sourceLocator: (yyloc), parseInfo);
5604 }
5605#line 5557 "qquerytransformparser.cpp" /* yacc.c:1652 */
5606 break;
5607
5608 case 225:
5609#line 3117 "querytransformparser.ypp" /* yacc.c:1652 */
5610 {
5611 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, sourceLocator: (yyloc));
5612 (yyval.expr) = create(expr: new CastAs((yyvsp[-3].expr), (yyvsp[0].sequenceType)), sourceLocator: (yyloc), parseInfo);
5613 }
5614#line 5566 "qquerytransformparser.cpp" /* yacc.c:1652 */
5615 break;
5616
5617 case 227:
5618#line 3124 "querytransformparser.ypp" /* yacc.c:1652 */
5619 {
5620 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, sourceLocator: (yyloc));
5621 (yyval.expr) = create(expr: new UnaryExpression((yyvsp[-1].enums.mathOperator), (yyvsp[0].expr), parseInfo->staticContext), sourceLocator: (yyloc), parseInfo);
5622 }
5623#line 5575 "qquerytransformparser.cpp" /* yacc.c:1652 */
5624 break;
5625
5626 case 228:
5627#line 3130 "querytransformparser.ypp" /* yacc.c:1652 */
5628 {
5629 (yyval.enums.mathOperator) = AtomicMathematician::Add;
5630 }
5631#line 5583 "qquerytransformparser.cpp" /* yacc.c:1652 */
5632 break;
5633
5634 case 229:
5635#line 3134 "querytransformparser.ypp" /* yacc.c:1652 */
5636 {
5637 (yyval.enums.mathOperator) = AtomicMathematician::Substract;
5638 }
5639#line 5591 "qquerytransformparser.cpp" /* yacc.c:1652 */
5640 break;
5641
5642 case 233:
5643#line 3143 "querytransformparser.ypp" /* yacc.c:1652 */
5644 {
5645 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, sourceLocator: (yyloc));
5646 (yyval.expr) = create(expr: new GeneralComparison((yyvsp[-2].expr), (yyvsp[-1].enums.valueOperator), (yyvsp[0].expr), parseInfo->isBackwardsCompat.top()), sourceLocator: (yyloc), parseInfo);
5647 }
5648#line 5600 "qquerytransformparser.cpp" /* yacc.c:1652 */
5649 break;
5650
5651 case 234:
5652#line 3148 "querytransformparser.ypp" /* yacc.c:1652 */
5653 {(yyval.enums.valueOperator) = AtomicComparator::OperatorEqual;}
5654#line 5606 "qquerytransformparser.cpp" /* yacc.c:1652 */
5655 break;
5656
5657 case 235:
5658#line 3149 "querytransformparser.ypp" /* yacc.c:1652 */
5659 {(yyval.enums.valueOperator) = AtomicComparator::OperatorNotEqual;}
5660#line 5612 "qquerytransformparser.cpp" /* yacc.c:1652 */
5661 break;
5662
5663 case 236:
5664#line 3150 "querytransformparser.ypp" /* yacc.c:1652 */
5665 {(yyval.enums.valueOperator) = AtomicComparator::OperatorGreaterOrEqual;}
5666#line 5618 "qquerytransformparser.cpp" /* yacc.c:1652 */
5667 break;
5668
5669 case 237:
5670#line 3151 "querytransformparser.ypp" /* yacc.c:1652 */
5671 {(yyval.enums.valueOperator) = AtomicComparator::OperatorGreaterThan;}
5672#line 5624 "qquerytransformparser.cpp" /* yacc.c:1652 */
5673 break;
5674
5675 case 238:
5676#line 3152 "querytransformparser.ypp" /* yacc.c:1652 */
5677 {(yyval.enums.valueOperator) = AtomicComparator::OperatorLessOrEqual;}
5678#line 5630 "qquerytransformparser.cpp" /* yacc.c:1652 */
5679 break;
5680
5681 case 239:
5682#line 3153 "querytransformparser.ypp" /* yacc.c:1652 */
5683 {(yyval.enums.valueOperator) = AtomicComparator::OperatorLessThan;}
5684#line 5636 "qquerytransformparser.cpp" /* yacc.c:1652 */
5685 break;
5686
5687 case 240:
5688#line 3156 "querytransformparser.ypp" /* yacc.c:1652 */
5689 {
5690 (yyval.expr) = create(expr: new ValueComparison((yyvsp[-2].expr), (yyvsp[-1].enums.valueOperator), (yyvsp[0].expr)), sourceLocator: (yyloc), parseInfo);
5691 }
5692#line 5644 "qquerytransformparser.cpp" /* yacc.c:1652 */
5693 break;
5694
5695 case 241:
5696#line 3160 "querytransformparser.ypp" /* yacc.c:1652 */
5697 {(yyval.enums.valueOperator) = AtomicComparator::OperatorEqual;}
5698#line 5650 "qquerytransformparser.cpp" /* yacc.c:1652 */
5699 break;
5700
5701 case 242:
5702#line 3161 "querytransformparser.ypp" /* yacc.c:1652 */
5703 {(yyval.enums.valueOperator) = AtomicComparator::OperatorNotEqual;}
5704#line 5656 "qquerytransformparser.cpp" /* yacc.c:1652 */
5705 break;
5706
5707 case 243:
5708#line 3162 "querytransformparser.ypp" /* yacc.c:1652 */
5709 {(yyval.enums.valueOperator) = AtomicComparator::OperatorGreaterOrEqual;}
5710#line 5662 "qquerytransformparser.cpp" /* yacc.c:1652 */
5711 break;
5712
5713 case 244:
5714#line 3163 "querytransformparser.ypp" /* yacc.c:1652 */
5715 {(yyval.enums.valueOperator) = AtomicComparator::OperatorGreaterThan;}
5716#line 5668 "qquerytransformparser.cpp" /* yacc.c:1652 */
5717 break;
5718
5719 case 245:
5720#line 3164 "querytransformparser.ypp" /* yacc.c:1652 */
5721 {(yyval.enums.valueOperator) = AtomicComparator::OperatorLessOrEqual;}
5722#line 5674 "qquerytransformparser.cpp" /* yacc.c:1652 */
5723 break;
5724
5725 case 246:
5726#line 3165 "querytransformparser.ypp" /* yacc.c:1652 */
5727 {(yyval.enums.valueOperator) = AtomicComparator::OperatorLessThan;}
5728#line 5680 "qquerytransformparser.cpp" /* yacc.c:1652 */
5729 break;
5730
5731 case 247:
5732#line 3168 "querytransformparser.ypp" /* yacc.c:1652 */
5733 {
5734 (yyval.expr) = create(expr: new NodeComparison((yyvsp[-2].expr), (yyvsp[-1].enums.nodeOperator), (yyvsp[0].expr)), sourceLocator: (yyloc), parseInfo);
5735 }
5736#line 5688 "qquerytransformparser.cpp" /* yacc.c:1652 */
5737 break;
5738
5739 case 248:
5740#line 3172 "querytransformparser.ypp" /* yacc.c:1652 */
5741 {(yyval.enums.nodeOperator) = QXmlNodeModelIndex::Is;}
5742#line 5694 "qquerytransformparser.cpp" /* yacc.c:1652 */
5743 break;
5744
5745 case 249:
5746#line 3173 "querytransformparser.ypp" /* yacc.c:1652 */
5747 {(yyval.enums.nodeOperator) = QXmlNodeModelIndex::Precedes;}
5748#line 5700 "qquerytransformparser.cpp" /* yacc.c:1652 */
5749 break;
5750
5751 case 250:
5752#line 3174 "querytransformparser.ypp" /* yacc.c:1652 */
5753 {(yyval.enums.nodeOperator) = QXmlNodeModelIndex::Follows;}
5754#line 5706 "qquerytransformparser.cpp" /* yacc.c:1652 */
5755 break;
5756
5757 case 251:
5758#line 3177 "querytransformparser.ypp" /* yacc.c:1652 */
5759 {
5760 allowedIn(allowedLanguages: QXmlQuery::XQuery10, parseInfo, sourceLocator: (yyloc));
5761 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "The Schema Validation Feature is not supported. "
5762 "Hence, %1-expressions may not be used.")
5763 .arg(a: formatKeyword(keyword: "validate")),
5764 errorCode: ReportContext::XQST0075, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
5765 /*
5766 $$ = Validate::create($2, $1, parseInfo->staticContext);
5767 */
5768 }
5769#line 5721 "qquerytransformparser.cpp" /* yacc.c:1652 */
5770 break;
5771
5772 case 252:
5773#line 3190 "querytransformparser.ypp" /* yacc.c:1652 */
5774 {(yyval.enums.validationMode) = Validate::Strict;}
5775#line 5727 "qquerytransformparser.cpp" /* yacc.c:1652 */
5776 break;
5777
5778 case 253:
5779#line 3191 "querytransformparser.ypp" /* yacc.c:1652 */
5780 {(yyval.enums.validationMode) = Validate::Strict;}
5781#line 5733 "qquerytransformparser.cpp" /* yacc.c:1652 */
5782 break;
5783
5784 case 254:
5785#line 3192 "querytransformparser.ypp" /* yacc.c:1652 */
5786 {(yyval.enums.validationMode) = Validate::Lax;}
5787#line 5739 "qquerytransformparser.cpp" /* yacc.c:1652 */
5788 break;
5789
5790 case 255:
5791#line 3195 "querytransformparser.ypp" /* yacc.c:1652 */
5792 {
5793 allowedIn(allowedLanguages: QXmlQuery::XQuery10, parseInfo, sourceLocator: (yyloc));
5794 /* We don't support any pragmas, so we only do the
5795 * necessary validation and use the fallback expression. */
5796
5797 if((yyvsp[0].expr))
5798 (yyval.expr) = (yyvsp[0].expr);
5799 else
5800 {
5801 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "None of the pragma expressions are supported. "
5802 "Therefore, a fallback expression "
5803 "must be present"),
5804 errorCode: ReportContext::XQST0079, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
5805 }
5806 }
5807#line 5759 "qquerytransformparser.cpp" /* yacc.c:1652 */
5808 break;
5809
5810 case 256:
5811#line 3212 "querytransformparser.ypp" /* yacc.c:1652 */
5812 {
5813 (yyval.expr).reset();
5814 }
5815#line 5767 "qquerytransformparser.cpp" /* yacc.c:1652 */
5816 break;
5817
5818 case 257:
5819#line 3216 "querytransformparser.ypp" /* yacc.c:1652 */
5820 {
5821 (yyval.expr) = (yyvsp[-1].expr);
5822 }
5823#line 5775 "qquerytransformparser.cpp" /* yacc.c:1652 */
5824 break;
5825
5826 case 260:
5827#line 3224 "querytransformparser.ypp" /* yacc.c:1652 */
5828 {
5829 allowedIn(allowedLanguages: QXmlQuery::XQuery10, parseInfo, sourceLocator: (yyloc));
5830 }
5831#line 5783 "qquerytransformparser.cpp" /* yacc.c:1652 */
5832 break;
5833
5834 case 263:
5835#line 3232 "querytransformparser.ypp" /* yacc.c:1652 */
5836 {
5837 /* This is "/step". That is, fn:root(self::node()) treat as document-node()/RelativePathExpr. */
5838 (yyval.expr) = create(expr: new Path(createRootExpression(parseInfo, sl: (yyloc)), (yyvsp[0].expr)), sourceLocator: (yyloc), parseInfo);
5839 }
5840#line 5792 "qquerytransformparser.cpp" /* yacc.c:1652 */
5841 break;
5842
5843 case 264:
5844#line 3238 "querytransformparser.ypp" /* yacc.c:1652 */
5845 {
5846 (yyval.expr) = createSlashSlashPath(begin: createRootExpression(parseInfo, sl: (yyloc)), end: (yyvsp[0].expr), sourceLocator: (yyloc), parseInfo);
5847 }
5848#line 5800 "qquerytransformparser.cpp" /* yacc.c:1652 */
5849 break;
5850
5851 case 265:
5852#line 3242 "querytransformparser.ypp" /* yacc.c:1652 */
5853 {
5854 /* This is "/". That is, fn:root(self::node()) treat as document-node(). */
5855 (yyval.expr) = createRootExpression(parseInfo, sl: (yyloc));
5856 }
5857#line 5809 "qquerytransformparser.cpp" /* yacc.c:1652 */
5858 break;
5859
5860 case 268:
5861#line 3252 "querytransformparser.ypp" /* yacc.c:1652 */
5862 {
5863 (yyval.expr) = create(expr: new Path((yyvsp[-2].expr), (yyvsp[0].expr), (yyvsp[-1].enums.pathKind)), sourceLocator: (yyloc), parseInfo);
5864 }
5865#line 5817 "qquerytransformparser.cpp" /* yacc.c:1652 */
5866 break;
5867
5868 case 269:
5869#line 3256 "querytransformparser.ypp" /* yacc.c:1652 */
5870 {
5871 const Expression::Ptr orderBy(createReturnOrderBy(orderSpecTransfer: (yyvsp[-3].orderSpecs), returnExpr: (yyvsp[-1].expr), stability: parseInfo->orderStability.pop(), sourceLocator: (yyloc), parseInfo));
5872
5873 ReturnOrderBy *const rob = orderBy->as<ReturnOrderBy>();
5874 const Expression::Ptr path(create(expr: new Path((yyvsp[-6].expr), orderBy, (yyvsp[-5].enums.pathKind)), sourceLocator: (yyloc), parseInfo));
5875
5876 (yyval.expr) = create(expr: new OrderBy(rob->stability(), rob->orderSpecs(), path, rob), sourceLocator: (yyloc), parseInfo);
5877 }
5878#line 5830 "qquerytransformparser.cpp" /* yacc.c:1652 */
5879 break;
5880
5881 case 270:
5882#line 3265 "querytransformparser.ypp" /* yacc.c:1652 */
5883 {
5884 (yyval.expr) = createSlashSlashPath(begin: (yyvsp[-2].expr), end: (yyvsp[0].expr), sourceLocator: (yyloc), parseInfo);
5885 }
5886#line 5838 "qquerytransformparser.cpp" /* yacc.c:1652 */
5887 break;
5888
5889 case 271:
5890#line 3270 "querytransformparser.ypp" /* yacc.c:1652 */
5891 {
5892 (yyval.expr) = NodeSortExpression::wrapAround(operand: (yyvsp[0].expr), context: parseInfo->staticContext);
5893 }
5894#line 5846 "qquerytransformparser.cpp" /* yacc.c:1652 */
5895 break;
5896
5897 case 273:
5898#line 3275 "querytransformparser.ypp" /* yacc.c:1652 */
5899 {
5900 (yyval.expr) = create(expr: new CurrentItemStore((yyvsp[0].expr)), sourceLocator: (yyloc), parseInfo);
5901 }
5902#line 5854 "qquerytransformparser.cpp" /* yacc.c:1652 */
5903 break;
5904
5905 case 274:
5906#line 3279 "querytransformparser.ypp" /* yacc.c:1652 */
5907 {
5908 const xsDouble version = (yyvsp[0].sval).toDouble();
5909
5910 parseInfo->isBackwardsCompat.push(t: version != 2);
5911
5912 (yyval.enums.Double) = version;
5913 }
5914#line 5866 "qquerytransformparser.cpp" /* yacc.c:1652 */
5915 break;
5916
5917 case 275:
5918#line 3287 "querytransformparser.ypp" /* yacc.c:1652 */
5919 {
5920 if((yyvsp[-1].enums.Double) < 2)
5921 (yyval.expr) = createCompatStore(expr: (yyvsp[0].expr), sourceLocator: (yyloc), parseInfo);
5922 else
5923 (yyval.expr) = (yyvsp[0].expr);
5924 }
5925#line 5877 "qquerytransformparser.cpp" /* yacc.c:1652 */
5926 break;
5927
5928 case 276:
5929#line 3294 "querytransformparser.ypp" /* yacc.c:1652 */
5930 {
5931 allowedIn(allowedLanguages: QXmlQuery::XSLT20, parseInfo, sourceLocator: (yyloc));
5932 Q_ASSERT(!(yyvsp[-3].sval).isEmpty());
5933 (yyval.expr) = create(expr: new StaticBaseURIStore((yyvsp[-3].sval), (yyvsp[-1].expr)), sourceLocator: (yyloc), parseInfo);
5934}
5935#line 5887 "qquerytransformparser.cpp" /* yacc.c:1652 */
5936 break;
5937
5938 case 277:
5939#line 3301 "querytransformparser.ypp" /* yacc.c:1652 */
5940 {
5941 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XSLT20), parseInfo, sourceLocator: (yyloc));
5942 parseInfo->resolvers.push(t: parseInfo->staticContext->namespaceBindings());
5943 const NamespaceResolver::Ptr resolver(new DelegatingNamespaceResolver(parseInfo->staticContext->namespaceBindings()));
5944 resolver->addBinding(nb: QXmlName(parseInfo->staticContext->namePool()->allocateNamespace(uri: (yyvsp[-1].sval)),
5945 StandardLocalNames::empty,
5946 parseInfo->staticContext->namePool()->allocatePrefix(prefix: (yyvsp[-3].sval))));
5947 parseInfo->staticContext->setNamespaceBindings(resolver);
5948 }
5949#line 5901 "qquerytransformparser.cpp" /* yacc.c:1652 */
5950 break;
5951
5952 case 278:
5953#line 3312 "querytransformparser.ypp" /* yacc.c:1652 */
5954 {
5955 parseInfo->staticContext->setNamespaceBindings(parseInfo->resolvers.pop());
5956 (yyval.expr) = (yyvsp[-1].expr);
5957 }
5958#line 5910 "qquerytransformparser.cpp" /* yacc.c:1652 */
5959 break;
5960
5961 case 279:
5962#line 3317 "querytransformparser.ypp" /* yacc.c:1652 */
5963 {
5964 (yyval.expr) = create(expr: new CallTemplate((yyvsp[-3].qName), parseInfo->templateWithParams), sourceLocator: (yyloc), parseInfo);
5965 parseInfo->templateWithParametersHandled();
5966 parseInfo->templateCalls.append(t: (yyval.expr));
5967 }
5968#line 5920 "qquerytransformparser.cpp" /* yacc.c:1652 */
5969 break;
5970
5971 case 280:
5972#line 3324 "querytransformparser.ypp" /* yacc.c:1652 */
5973 {
5974 parseInfo->startParsingWithParam();
5975 }
5976#line 5928 "qquerytransformparser.cpp" /* yacc.c:1652 */
5977 break;
5978
5979 case 281:
5980#line 3328 "querytransformparser.ypp" /* yacc.c:1652 */
5981 {
5982 parseInfo->endParsingWithParam();
5983 }
5984#line 5936 "qquerytransformparser.cpp" /* yacc.c:1652 */
5985 break;
5986
5987 case 282:
5988#line 3333 "querytransformparser.ypp" /* yacc.c:1652 */
5989 {
5990 }
5991#line 5943 "qquerytransformparser.cpp" /* yacc.c:1652 */
5992 break;
5993
5994 case 283:
5995#line 3336 "querytransformparser.ypp" /* yacc.c:1652 */
5996 {
5997 }
5998#line 5950 "qquerytransformparser.cpp" /* yacc.c:1652 */
5999 break;
6000
6001 case 284:
6002#line 3339 "querytransformparser.ypp" /* yacc.c:1652 */
6003 {
6004 }
6005#line 5957 "qquerytransformparser.cpp" /* yacc.c:1652 */
6006 break;
6007
6008 case 285:
6009#line 3343 "querytransformparser.ypp" /* yacc.c:1652 */
6010 {
6011 }
6012#line 5964 "qquerytransformparser.cpp" /* yacc.c:1652 */
6013 break;
6014
6015 case 286:
6016#line 3346 "querytransformparser.ypp" /* yacc.c:1652 */
6017 {
6018 }
6019#line 5971 "qquerytransformparser.cpp" /* yacc.c:1652 */
6020 break;
6021
6022 case 287:
6023#line 3350 "querytransformparser.ypp" /* yacc.c:1652 */
6024 {
6025 /* Note, this grammar rule is invoked for @c xsl:param @em and @c
6026 * xsl:with-param. */
6027 const bool isParsingWithParam = parseInfo->isParsingWithParam();
6028
6029 /**
6030 * @c xsl:param doesn't make life easy:
6031 *
6032 * If it only has @c name, it's default value is an empty
6033 * string(hence has type @c xs:string), but the value that
6034 * (maybe) is supplied can be anything, typically a node.
6035 *
6036 * Therefore, for that very common case we can't rely on
6037 * the Expression's type, but have to force it to item()*.
6038 *
6039 * So if we're supplied the type item()*, we pass a null
6040 * SequenceType. TemplateParameterReference recognizes this
6041 * and has item()* as its static type, regardless of if the
6042 * expression has a more specific type.
6043 */
6044 SequenceType::Ptr type;
6045
6046 if(!(yyvsp[-1].sequenceType)->is(other: CommonSequenceTypes::ZeroOrMoreItems))
6047 type = (yyvsp[-1].sequenceType);
6048
6049 Expression::Ptr expr;
6050
6051 /* The default value is an empty sequence. */
6052 if(!(yyvsp[0].expr) && ((type && (yyvsp[-1].sequenceType)->cardinality().allowsEmpty())
6053 || isParsingWithParam))
6054 expr = create(expr: new EmptySequence, sourceLocator: (yyloc), parseInfo);
6055 else
6056 expr = (yyvsp[0].expr);
6057
6058 /* We ensure we have some type, so CallTemplate, Template and friends
6059 * are happy. */
6060 if(!isParsingWithParam && !type)
6061 type = CommonSequenceTypes::ZeroOrMoreItems;
6062
6063 if((yyvsp[-4].enums.Bool))
6064 /* TODO, handle tunnel parameters. */;
6065 else
6066 {
6067 if((!isParsingWithParam && VariableDeclaration::contains(list: parseInfo->templateParameters, lookup: (yyvsp[-2].qName))) ||
6068 (isParsingWithParam && parseInfo->templateWithParams.contains(akey: (yyvsp[-2].qName))))
6069 {
6070 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "Each name of a template parameter must be unique; %1 is duplicated.")
6071 .arg(a: formatKeyword(np: parseInfo->staticContext->namePool(), name: (yyvsp[-2].qName))),
6072 errorCode: isParsingWithParam ? ReportContext::XTSE0670 : ReportContext::XTSE0580, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
6073 }
6074 else
6075 {
6076 if(isParsingWithParam)
6077 parseInfo->templateWithParams[(yyvsp[-2].qName)] = WithParam::Ptr(new WithParam((yyvsp[-2].qName), (yyvsp[-1].sequenceType), expr));
6078 else
6079 {
6080 Q_ASSERT(type);
6081 pushVariable(name: (yyvsp[-2].qName), seqType: type, expr, type: VariableDeclaration::TemplateParameter, sourceLocator: (yyloc), parseInfo);
6082 parseInfo->templateParameters.append(t: parseInfo->variables.top());
6083 }
6084 }
6085 }
6086 }
6087#line 6039 "qquerytransformparser.cpp" /* yacc.c:1652 */
6088 break;
6089
6090 case 288:
6091#line 3415 "querytransformparser.ypp" /* yacc.c:1652 */
6092 {
6093 (yyval.enums.Bool) = false;
6094 }
6095#line 6047 "qquerytransformparser.cpp" /* yacc.c:1652 */
6096 break;
6097
6098 case 289:
6099#line 3419 "querytransformparser.ypp" /* yacc.c:1652 */
6100 {
6101 (yyval.enums.Bool) = true;
6102 }
6103#line 6055 "qquerytransformparser.cpp" /* yacc.c:1652 */
6104 break;
6105
6106 case 290:
6107#line 3424 "querytransformparser.ypp" /* yacc.c:1652 */
6108 {
6109 (yyval.expr) = Expression::Ptr();
6110 }
6111#line 6063 "qquerytransformparser.cpp" /* yacc.c:1652 */
6112 break;
6113
6114 case 291:
6115#line 3428 "querytransformparser.ypp" /* yacc.c:1652 */
6116 {
6117 (yyval.expr) = (yyvsp[0].expr);
6118 }
6119#line 6071 "qquerytransformparser.cpp" /* yacc.c:1652 */
6120 break;
6121
6122 case 292:
6123#line 3437 "querytransformparser.ypp" /* yacc.c:1652 */
6124 {
6125 (yyval.enums.pathKind) = Path::RegularPath;
6126 }
6127#line 6079 "qquerytransformparser.cpp" /* yacc.c:1652 */
6128 break;
6129
6130 case 293:
6131#line 3441 "querytransformparser.ypp" /* yacc.c:1652 */
6132 {
6133 (yyval.enums.pathKind) = Path::XSLTForEach;
6134 }
6135#line 6087 "qquerytransformparser.cpp" /* yacc.c:1652 */
6136 break;
6137
6138 case 294:
6139#line 3445 "querytransformparser.ypp" /* yacc.c:1652 */
6140 {
6141 (yyval.enums.pathKind) = Path::ForApplyTemplate;
6142 }
6143#line 6095 "qquerytransformparser.cpp" /* yacc.c:1652 */
6144 break;
6145
6146 case 296:
6147#line 3451 "querytransformparser.ypp" /* yacc.c:1652 */
6148 {
6149 (yyval.expr) = create(expr: GenericPredicate::create(sourceExpression: (yyvsp[-3].expr), predicateExpression: (yyvsp[-1].expr), context: parseInfo->staticContext, location: fromYYLTYPE(sourceLocator: (yyloc), parseInfo)), sourceLocator: (yyloc), parseInfo);
6150 }
6151#line 6103 "qquerytransformparser.cpp" /* yacc.c:1652 */
6152 break;
6153
6154 case 299:
6155#line 3459 "querytransformparser.ypp" /* yacc.c:1652 */
6156 {
6157 if((yyvsp[0].enums.axis) == QXmlNodeModelIndex::AxisAttribute)
6158 parseInfo->nodeTestSource = BuiltinTypes::attribute;
6159 }
6160#line 6112 "qquerytransformparser.cpp" /* yacc.c:1652 */
6161 break;
6162
6163 case 300:
6164#line 3464 "querytransformparser.ypp" /* yacc.c:1652 */
6165 {
6166 if((yyvsp[0].itemType))
6167 {
6168 /* A node test was explicitly specified. The un-abbreviated syntax was used. */
6169 (yyval.expr) = create(expr: new AxisStep((yyvsp[-2].enums.axis), (yyvsp[0].itemType)), sourceLocator: (yyloc), parseInfo);
6170 }
6171 else
6172 {
6173 /* Quote from 3.2.1.1 Axes
6174 *
6175 * [Definition: Every axis has a principal node kind. If an axis
6176 * can contain elements, then the principal node kind is element;
6177 * otherwise, it is the kind of nodes that the axis can contain.] Thus:
6178 * - For the attribute axis, the principal node kind is attribute.
6179 * - For all other axes, the principal node kind is element. */
6180
6181 if((yyvsp[-2].enums.axis) == QXmlNodeModelIndex::AxisAttribute)
6182 (yyval.expr) = create(expr: new AxisStep(QXmlNodeModelIndex::AxisAttribute, BuiltinTypes::attribute), sourceLocator: (yyloc), parseInfo);
6183 else
6184 (yyval.expr) = create(expr: new AxisStep((yyvsp[-2].enums.axis), BuiltinTypes::element), sourceLocator: (yyloc), parseInfo);
6185 }
6186
6187 parseInfo->restoreNodeTestSource();
6188 }
6189#line 6141 "qquerytransformparser.cpp" /* yacc.c:1652 */
6190 break;
6191
6192 case 304:
6193#line 3494 "querytransformparser.ypp" /* yacc.c:1652 */
6194 {
6195 if((yyvsp[-1].enums.axis) == QXmlNodeModelIndex::AxisNamespace)
6196 {
6197 /* We don't raise XPST0010 here because the namespace axis isn't an optional
6198 * axis. It simply is not part of the XQuery grammar. */
6199 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "The %1-axis is unsupported in XQuery")
6200 .arg(a: formatKeyword(keyword: "namespace")),
6201 errorCode: ReportContext::XPST0003, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
6202 }
6203 else
6204 (yyval.enums.axis) = (yyvsp[-1].enums.axis);
6205
6206 switch((yyvsp[-1].enums.axis))
6207 {
6208 case QXmlNodeModelIndex::AxisAttribute:
6209 {
6210 allowedIn(allowedLanguages: QueryLanguages( QXmlQuery::XPath20
6211 | QXmlQuery::XQuery10
6212 | QXmlQuery::XmlSchema11IdentityConstraintField
6213 | QXmlQuery::XSLT20),
6214 parseInfo, sourceLocator: (yyloc));
6215 break;
6216 }
6217 case QXmlNodeModelIndex::AxisChild:
6218 {
6219 allowedIn(allowedLanguages: QueryLanguages( QXmlQuery::XPath20
6220 | QXmlQuery::XQuery10
6221 | QXmlQuery::XmlSchema11IdentityConstraintField
6222 | QXmlQuery::XmlSchema11IdentityConstraintSelector
6223 | QXmlQuery::XSLT20),
6224 parseInfo, sourceLocator: (yyloc));
6225 break;
6226 }
6227 default:
6228 {
6229 allowedIn(allowedLanguages: QueryLanguages( QXmlQuery::XPath20
6230 | QXmlQuery::XQuery10
6231 | QXmlQuery::XSLT20),
6232 parseInfo, sourceLocator: (yyloc));
6233 }
6234 }
6235 }
6236#line 6188 "qquerytransformparser.cpp" /* yacc.c:1652 */
6237 break;
6238
6239 case 305:
6240#line 3537 "querytransformparser.ypp" /* yacc.c:1652 */
6241 {(yyval.enums.axis) = QXmlNodeModelIndex::AxisAncestorOrSelf ;}
6242#line 6194 "qquerytransformparser.cpp" /* yacc.c:1652 */
6243 break;
6244
6245 case 306:
6246#line 3538 "querytransformparser.ypp" /* yacc.c:1652 */
6247 {(yyval.enums.axis) = QXmlNodeModelIndex::AxisAncestor ;}
6248#line 6200 "qquerytransformparser.cpp" /* yacc.c:1652 */
6249 break;
6250
6251 case 307:
6252#line 3539 "querytransformparser.ypp" /* yacc.c:1652 */
6253 {(yyval.enums.axis) = QXmlNodeModelIndex::AxisAttribute ;}
6254#line 6206 "qquerytransformparser.cpp" /* yacc.c:1652 */
6255 break;
6256
6257 case 308:
6258#line 3540 "querytransformparser.ypp" /* yacc.c:1652 */
6259 {(yyval.enums.axis) = QXmlNodeModelIndex::AxisChild ;}
6260#line 6212 "qquerytransformparser.cpp" /* yacc.c:1652 */
6261 break;
6262
6263 case 309:
6264#line 3541 "querytransformparser.ypp" /* yacc.c:1652 */
6265 {(yyval.enums.axis) = QXmlNodeModelIndex::AxisDescendantOrSelf;}
6266#line 6218 "qquerytransformparser.cpp" /* yacc.c:1652 */
6267 break;
6268
6269 case 310:
6270#line 3542 "querytransformparser.ypp" /* yacc.c:1652 */
6271 {(yyval.enums.axis) = QXmlNodeModelIndex::AxisDescendant ;}
6272#line 6224 "qquerytransformparser.cpp" /* yacc.c:1652 */
6273 break;
6274
6275 case 311:
6276#line 3543 "querytransformparser.ypp" /* yacc.c:1652 */
6277 {(yyval.enums.axis) = QXmlNodeModelIndex::AxisFollowing ;}
6278#line 6230 "qquerytransformparser.cpp" /* yacc.c:1652 */
6279 break;
6280
6281 case 312:
6282#line 3544 "querytransformparser.ypp" /* yacc.c:1652 */
6283 {(yyval.enums.axis) = QXmlNodeModelIndex::AxisPreceding ;}
6284#line 6236 "qquerytransformparser.cpp" /* yacc.c:1652 */
6285 break;
6286
6287 case 313:
6288#line 3545 "querytransformparser.ypp" /* yacc.c:1652 */
6289 {(yyval.enums.axis) = QXmlNodeModelIndex::AxisFollowingSibling;}
6290#line 6242 "qquerytransformparser.cpp" /* yacc.c:1652 */
6291 break;
6292
6293 case 314:
6294#line 3546 "querytransformparser.ypp" /* yacc.c:1652 */
6295 {(yyval.enums.axis) = QXmlNodeModelIndex::AxisPrecedingSibling;}
6296#line 6248 "qquerytransformparser.cpp" /* yacc.c:1652 */
6297 break;
6298
6299 case 315:
6300#line 3547 "querytransformparser.ypp" /* yacc.c:1652 */
6301 {(yyval.enums.axis) = QXmlNodeModelIndex::AxisParent ;}
6302#line 6254 "qquerytransformparser.cpp" /* yacc.c:1652 */
6303 break;
6304
6305 case 316:
6306#line 3548 "querytransformparser.ypp" /* yacc.c:1652 */
6307 {(yyval.enums.axis) = QXmlNodeModelIndex::AxisSelf ;}
6308#line 6260 "qquerytransformparser.cpp" /* yacc.c:1652 */
6309 break;
6310
6311 case 317:
6312#line 3551 "querytransformparser.ypp" /* yacc.c:1652 */
6313 {
6314 parseInfo->nodeTestSource = BuiltinTypes::attribute;
6315 }
6316#line 6268 "qquerytransformparser.cpp" /* yacc.c:1652 */
6317 break;
6318
6319 case 318:
6320#line 3555 "querytransformparser.ypp" /* yacc.c:1652 */
6321 {
6322 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XSLT20 | QXmlQuery::XmlSchema11IdentityConstraintField), parseInfo, sourceLocator: (yyloc));
6323 (yyval.expr) = create(expr: new AxisStep(QXmlNodeModelIndex::AxisAttribute, (yyvsp[0].itemType)), sourceLocator: (yyloc), parseInfo);
6324
6325 parseInfo->restoreNodeTestSource();
6326 }
6327#line 6279 "qquerytransformparser.cpp" /* yacc.c:1652 */
6328 break;
6329
6330 case 319:
6331#line 3562 "querytransformparser.ypp" /* yacc.c:1652 */
6332 {
6333 ItemType::Ptr nodeTest;
6334
6335 if(parseInfo->isParsingPattern && *(yyvsp[0].itemType) == *BuiltinTypes::node)
6336 nodeTest = BuiltinTypes::xsltNodeTest;
6337 else
6338 nodeTest = (yyvsp[0].itemType);
6339
6340 (yyval.expr) = create(expr: new AxisStep(QXmlNodeModelIndex::AxisChild, nodeTest), sourceLocator: (yyloc), parseInfo);
6341 }
6342#line 6294 "qquerytransformparser.cpp" /* yacc.c:1652 */
6343 break;
6344
6345 case 320:
6346#line 3573 "querytransformparser.ypp" /* yacc.c:1652 */
6347 {
6348 (yyval.expr) = create(expr: new AxisStep(QXmlNodeModelIndex::AxisAttribute, (yyvsp[0].itemType)), sourceLocator: (yyloc), parseInfo);
6349 }
6350#line 6302 "qquerytransformparser.cpp" /* yacc.c:1652 */
6351 break;
6352
6353 case 322:
6354#line 3580 "querytransformparser.ypp" /* yacc.c:1652 */
6355 {
6356 (yyval.expr) = create(expr: new AxisStep(QXmlNodeModelIndex::AxisParent, BuiltinTypes::node), sourceLocator: (yyloc), parseInfo);
6357 }
6358#line 6310 "qquerytransformparser.cpp" /* yacc.c:1652 */
6359 break;
6360
6361 case 324:
6362#line 3586 "querytransformparser.ypp" /* yacc.c:1652 */
6363 {
6364 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, sourceLocator: (yyloc));
6365 }
6366#line 6318 "qquerytransformparser.cpp" /* yacc.c:1652 */
6367 break;
6368
6369 case 325:
6370#line 3591 "querytransformparser.ypp" /* yacc.c:1652 */
6371 {
6372 (yyval.itemType) = QNameTest::create(primaryType: parseInfo->nodeTestSource, qName: (yyvsp[0].qName));
6373 }
6374#line 6326 "qquerytransformparser.cpp" /* yacc.c:1652 */
6375 break;
6376
6377 case 327:
6378#line 3597 "querytransformparser.ypp" /* yacc.c:1652 */
6379 {
6380 (yyval.itemType) = parseInfo->nodeTestSource;
6381 }
6382#line 6334 "qquerytransformparser.cpp" /* yacc.c:1652 */
6383 break;
6384
6385 case 328:
6386#line 3601 "querytransformparser.ypp" /* yacc.c:1652 */
6387 {
6388 const NamePool::Ptr np(parseInfo->staticContext->namePool());
6389 const ReflectYYLTYPE ryy((yyloc), parseInfo);
6390
6391 const QXmlName::NamespaceCode ns(QNameConstructor::namespaceForPrefix(prefix: np->allocatePrefix(prefix: (yyvsp[0].sval)), context: parseInfo->staticContext, r: &ryy));
6392
6393 (yyval.itemType) = NamespaceNameTest::create(primaryType: parseInfo->nodeTestSource, namespaceURI: ns);
6394 }
6395#line 6347 "qquerytransformparser.cpp" /* yacc.c:1652 */
6396 break;
6397
6398 case 329:
6399#line 3610 "querytransformparser.ypp" /* yacc.c:1652 */
6400 {
6401 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, sourceLocator: (yyloc));
6402 const QXmlName::LocalNameCode c = parseInfo->staticContext->namePool()->allocateLocalName(ln: (yyvsp[0].sval));
6403 (yyval.itemType) = LocalNameTest::create(primaryType: parseInfo->nodeTestSource, localName: c);
6404 }
6405#line 6357 "qquerytransformparser.cpp" /* yacc.c:1652 */
6406 break;
6407
6408 case 331:
6409#line 3618 "querytransformparser.ypp" /* yacc.c:1652 */
6410 {
6411 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, sourceLocator: (yyloc));
6412 (yyval.expr) = create(expr: GenericPredicate::create(sourceExpression: (yyvsp[-3].expr), predicateExpression: (yyvsp[-1].expr), context: parseInfo->staticContext, location: fromYYLTYPE(sourceLocator: (yylsp[0]), parseInfo)), sourceLocator: (yyloc), parseInfo);
6413 }
6414#line 6366 "qquerytransformparser.cpp" /* yacc.c:1652 */
6415 break;
6416
6417 case 339:
6418#line 3631 "querytransformparser.ypp" /* yacc.c:1652 */
6419 {
6420 (yyval.expr) = create(expr: new ApplyTemplate(parseInfo->modeFor(modeName: (yyvsp[-3].qName)),
6421 parseInfo->templateWithParams,
6422 parseInfo->modeFor(modeName: QXmlName(StandardNamespaces::InternalXSLT,
6423 StandardLocalNames::Default))),
6424 sourceLocator: (yylsp[-4]), parseInfo);
6425 parseInfo->templateWithParametersHandled();
6426 }
6427#line 6379 "qquerytransformparser.cpp" /* yacc.c:1652 */
6428 break;
6429
6430 case 341:
6431#line 3642 "querytransformparser.ypp" /* yacc.c:1652 */
6432 {
6433 (yyval.expr) = create(expr: new Literal(AtomicString::fromValue(value: (yyvsp[0].sval))), sourceLocator: (yyloc), parseInfo);
6434 }
6435#line 6387 "qquerytransformparser.cpp" /* yacc.c:1652 */
6436 break;
6437
6438 case 342:
6439#line 3647 "querytransformparser.ypp" /* yacc.c:1652 */
6440 {
6441 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, sourceLocator: (yyloc));
6442 (yyval.expr) = createNumericLiteral<Double>(in: (yyvsp[0].sval), sl: (yyloc), parseInfo);
6443 }
6444#line 6396 "qquerytransformparser.cpp" /* yacc.c:1652 */
6445 break;
6446
6447 case 343:
6448#line 3652 "querytransformparser.ypp" /* yacc.c:1652 */
6449 {
6450 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, sourceLocator: (yyloc));
6451 (yyval.expr) = createNumericLiteral<Numeric>(in: (yyvsp[0].sval), sl: (yyloc), parseInfo);
6452 }
6453#line 6405 "qquerytransformparser.cpp" /* yacc.c:1652 */
6454 break;
6455
6456 case 344:
6457#line 3658 "querytransformparser.ypp" /* yacc.c:1652 */
6458 {
6459 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, sourceLocator: (yyloc));
6460 (yyval.expr) = resolveVariable(name: (yyvsp[0].qName), sourceLocator: (yyloc), parseInfo, raiseErrorOnUnavailability: false);
6461 }
6462#line 6414 "qquerytransformparser.cpp" /* yacc.c:1652 */
6463 break;
6464
6465 case 345:
6466#line 3664 "querytransformparser.ypp" /* yacc.c:1652 */
6467 {
6468 /* See: http://www.w3.org/TR/xpath20/#id-variables */
6469 (yyval.qName) = parseInfo->staticContext->namePool()->allocateQName(uri: QString(), localName: (yyvsp[0].sval));
6470 }
6471#line 6423 "qquerytransformparser.cpp" /* yacc.c:1652 */
6472 break;
6473
6474 case 346:
6475#line 3669 "querytransformparser.ypp" /* yacc.c:1652 */
6476 {
6477 (yyval.qName) = (yyvsp[0].qName);
6478 }
6479#line 6431 "qquerytransformparser.cpp" /* yacc.c:1652 */
6480 break;
6481
6482 case 347:
6483#line 3674 "querytransformparser.ypp" /* yacc.c:1652 */
6484 {
6485 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, sourceLocator: (yyloc));
6486 (yyval.expr) = (yyvsp[-1].expr);
6487 }
6488#line 6440 "qquerytransformparser.cpp" /* yacc.c:1652 */
6489 break;
6490
6491 case 348:
6492#line 3679 "querytransformparser.ypp" /* yacc.c:1652 */
6493 {
6494 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, sourceLocator: (yyloc));
6495 (yyval.expr) = create(expr: new EmptySequence, sourceLocator: (yyloc), parseInfo);
6496 }
6497#line 6449 "qquerytransformparser.cpp" /* yacc.c:1652 */
6498 break;
6499
6500 case 349:
6501#line 3685 "querytransformparser.ypp" /* yacc.c:1652 */
6502 {
6503 (yyval.expr) = create(expr: new ContextItem(), sourceLocator: (yyloc), parseInfo);
6504 }
6505#line 6457 "qquerytransformparser.cpp" /* yacc.c:1652 */
6506 break;
6507
6508 case 350:
6509#line 3690 "querytransformparser.ypp" /* yacc.c:1652 */
6510 {
6511 (yyval.expr) = (yyvsp[0].expr);
6512 }
6513#line 6465 "qquerytransformparser.cpp" /* yacc.c:1652 */
6514 break;
6515
6516 case 351:
6517#line 3695 "querytransformparser.ypp" /* yacc.c:1652 */
6518 {
6519 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, sourceLocator: (yyloc));
6520 if(XPathHelper::isReservedNamespace(ns: (yyvsp[-3].qName).namespaceURI()) || (yyvsp[-3].qName).namespaceURI() == StandardNamespaces::InternalXSLT)
6521 { /* We got a call to a builtin function. */
6522 const ReflectYYLTYPE ryy((yyloc), parseInfo);
6523
6524 const Expression::Ptr
6525 func(parseInfo->staticContext->
6526 functionSignatures()->createFunctionCall(name: (yyvsp[-3].qName), arguments: (yyvsp[-1].expressionList), context: parseInfo->staticContext, r: &ryy));
6527
6528 if(func)
6529 (yyval.expr) = create(expr: func, sourceLocator: (yyloc), parseInfo);
6530 else
6531 {
6532 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "No function with name %1 is available.")
6533 .arg(a: formatKeyword(np: parseInfo->staticContext->namePool(), name: (yyvsp[-3].qName))),
6534 errorCode: ReportContext::XPST0017, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
6535 }
6536 }
6537 else /* It's a call to a function created with 'declare function'.*/
6538 {
6539 (yyval.expr) = create(expr: new UserFunctionCallsite((yyvsp[-3].qName), (yyvsp[-1].expressionList).count()), sourceLocator: (yyloc), parseInfo);
6540
6541 (yyval.expr)->setOperands((yyvsp[-1].expressionList));
6542 parseInfo->userFunctionCallsites.append(t: (yyval.expr));
6543 }
6544 }
6545#line 6497 "qquerytransformparser.cpp" /* yacc.c:1652 */
6546 break;
6547
6548 case 352:
6549#line 3724 "querytransformparser.ypp" /* yacc.c:1652 */
6550 {
6551 (yyval.expressionList) = Expression::List();
6552 }
6553#line 6505 "qquerytransformparser.cpp" /* yacc.c:1652 */
6554 break;
6555
6556 case 353:
6557#line 3729 "querytransformparser.ypp" /* yacc.c:1652 */
6558 {
6559 Expression::List list;
6560 list.append(t: (yyvsp[0].expr));
6561 (yyval.expressionList) = list;
6562 }
6563#line 6515 "qquerytransformparser.cpp" /* yacc.c:1652 */
6564 break;
6565
6566 case 355:
6567#line 3738 "querytransformparser.ypp" /* yacc.c:1652 */
6568 {
6569 allowedIn(allowedLanguages: QXmlQuery::XQuery10, parseInfo, sourceLocator: (yyloc));
6570 }
6571#line 6523 "qquerytransformparser.cpp" /* yacc.c:1652 */
6572 break;
6573
6574 case 360:
6575#line 3782 "querytransformparser.ypp" /* yacc.c:1652 */
6576 {
6577 (yyval.enums.tokenizerPosition) = parseInfo->tokenizer->commenceScanOnly();
6578 parseInfo->scanOnlyStack.push(t: true);
6579 }
6580#line 6532 "qquerytransformparser.cpp" /* yacc.c:1652 */
6581 break;
6582
6583 case 361:
6584#line 3791 "querytransformparser.ypp" /* yacc.c:1652 */
6585 {
6586 ++parseInfo->elementConstructorDepth;
6587 Expression::List constructors;
6588
6589 parseInfo->resolvers.push(t: parseInfo->staticContext->namespaceBindings());
6590
6591 /* Fix up attributes and namespace declarations. */
6592 const NamespaceResolver::Ptr resolver(new DelegatingNamespaceResolver(parseInfo->staticContext->namespaceBindings()));
6593 const NamePool::Ptr namePool(parseInfo->staticContext->namePool());
6594 const int len = (yyvsp[0].attributeHolders).size();
6595 QSet<QXmlName::PrefixCode> usedDeclarations;
6596
6597 /* Whether xmlns="" has been encountered. */
6598 bool hasDefaultDeclaration = false;
6599
6600 /* For each attribute & namespace declaration, do: */
6601 for(int i = 0; i < len; ++i)
6602 {
6603 QString strLocalName;
6604 QString strPrefix;
6605
6606 XPathHelper::splitQName(qName: (yyvsp[0].attributeHolders).at(i).first, prefix&: strPrefix, localName&: strLocalName);
6607 const QXmlName::PrefixCode prefix = namePool->allocatePrefix(prefix: strPrefix);
6608
6609 /* This can seem a bit weird. However, this name is ending up in a QXmlName
6610 * which consider its prefix a... prefix. So, a namespace binding name can in some cases
6611 * be a local name, but that's just as the initial syntactical construct. */
6612 const QXmlName::LocalNameCode localName = namePool->allocatePrefix(prefix: strLocalName);
6613
6614 /* Not that localName is "foo" in "xmlns:foo" and that prefix is "xmlns". */
6615
6616 if(prefix == StandardPrefixes::xmlns ||
6617 (prefix == StandardPrefixes::empty && localName == StandardPrefixes::xmlns))
6618 {
6619 if(localName == StandardPrefixes::xmlns)
6620 hasDefaultDeclaration = true;
6621
6622 /* We have a namespace declaration. */
6623
6624 const Expression::Ptr nsExpr((yyvsp[0].attributeHolders).at(i).second);
6625
6626 const QString strNamespace(nsExpr->is(i: Expression::IDEmptySequence) ? QString() : nsExpr->as<Literal>()->item().stringValue());
6627
6628 const QXmlName::NamespaceCode ns = namePool->allocateNamespace(uri: strNamespace);
6629
6630 if(ns == StandardNamespaces::empty)
6631 {
6632 if(localName != StandardPrefixes::xmlns)
6633 {
6634 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "The namespace URI cannot be the empty string when binding to a prefix, %1.")
6635 .arg(a: formatURI(uri: strPrefix)),
6636 errorCode: ReportContext::XQST0085, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
6637 }
6638 }
6639 else if(!AnyURI::isValid(candidate: strNamespace))
6640 {
6641 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "%1 is an invalid namespace URI.").arg(a: formatURI(uri: strNamespace)),
6642 errorCode: ReportContext::XQST0022, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
6643 }
6644
6645 if(prefix == StandardPrefixes::xmlns && localName == StandardPrefixes::xmlns)
6646 {
6647 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "It is not possible to bind to the prefix %1")
6648 .arg(a: formatKeyword(keyword: "xmlns")),
6649 errorCode: ReportContext::XQST0070, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
6650 }
6651
6652 if(ns == StandardNamespaces::xml && localName != StandardPrefixes::xml)
6653 {
6654 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "Namespace %1 can only be bound to %2 (and it is, in either case, pre-declared).")
6655 .arg(a: formatURI(uri: namePool->stringForNamespace(code: StandardNamespaces::xml)))
6656 .arg(a: formatKeyword(keyword: "xml")),
6657 errorCode: ReportContext::XQST0070, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
6658 }
6659
6660 if(localName == StandardPrefixes::xml && ns != StandardNamespaces::xml)
6661 {
6662 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "Prefix %1 can only be bound to %2 (and it is, in either case, pre-declared).")
6663 .arg(a: formatKeyword(keyword: "xml"))
6664 .arg(a: formatURI(uri: namePool->stringForNamespace(code: StandardNamespaces::xml))),
6665 errorCode: ReportContext::XQST0070, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
6666 }
6667
6668 QXmlName nb;
6669
6670 if(localName == StandardPrefixes::xmlns)
6671 nb = QXmlName(ns, StandardLocalNames::empty);
6672 else
6673 nb = QXmlName(ns, StandardLocalNames::empty, localName);
6674
6675 if(usedDeclarations.contains(value: nb.prefix()))
6676 {
6677 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "Two namespace declaration attributes have the same name: %1.")
6678 .arg(a: formatKeyword(keyword: namePool->stringForPrefix(code: nb.prefix()))),
6679 errorCode: ReportContext::XQST0071, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
6680
6681 }
6682 else
6683 usedDeclarations.insert(value: nb.prefix());
6684
6685 /* If the user has bound the XML namespace correctly, we in either
6686 * case don't want to output it.
6687 *
6688 * We only have to check the namespace parts since the above checks has ensured
6689 * consistency in the prefix parts. */
6690 if(ns != StandardNamespaces::xml)
6691 {
6692 /* We don't want default namespace declarations when the
6693 * default namespace already is empty. */
6694 if(!(ns == StandardNamespaces::empty &&
6695 localName == StandardNamespaces::xmlns &&
6696 resolver->lookupNamespaceURI(prefix: StandardPrefixes::empty) == StandardNamespaces::empty))
6697 {
6698 constructors.append(t: create(expr: new NamespaceConstructor(nb), sourceLocator: (yyloc), parseInfo));
6699 resolver->addBinding(nb);
6700 }
6701 }
6702 }
6703 }
6704
6705 if(parseInfo->elementConstructorDepth == 1 && !hasDefaultDeclaration)
6706 {
6707 /* TODO But mostly this isn't needed, since the default element
6708 * namespace is empty? How does this at all work? */
6709 const QXmlName def(resolver->lookupNamespaceURI(prefix: StandardPrefixes::empty), StandardLocalNames::empty);
6710 constructors.append(t: create(expr: new NamespaceConstructor(def), sourceLocator: (yyloc), parseInfo));
6711 }
6712
6713 parseInfo->staticContext->setNamespaceBindings(resolver);
6714 (yyval.expressionList) = constructors;
6715
6716 /* Resolve the name of the element, now that the namespace attributes are read. */
6717 {
6718 const ReflectYYLTYPE ryy((yyloc), parseInfo);
6719
6720 const QXmlName ele = QNameConstructor::expandQName<StaticContext::Ptr,
6721 ReportContext::XPST0081,
6722 ReportContext::XPST0081>(lexicalQName: (yyvsp[-2].sval), context: parseInfo->staticContext, nsResolver: resolver, r: &ryy);
6723 parseInfo->tagStack.push(t: ele);
6724 }
6725
6726 parseInfo->tokenizer->resumeTokenizationFrom(position: (yyvsp[-1].enums.tokenizerPosition));
6727 }
6728#line 6680 "qquerytransformparser.cpp" /* yacc.c:1652 */
6729 break;
6730
6731 case 362:
6732#line 3937 "querytransformparser.ypp" /* yacc.c:1652 */
6733 {
6734 /* We add the content constructor after the attribute constructors. This might result
6735 * in nested ExpressionSequences, but it will be optimized away later on. */
6736
6737 Expression::List attributes((yyvsp[-3].expressionList));
6738 const NamePool::Ptr namePool(parseInfo->staticContext->namePool());
6739 const int len = (yyvsp[-1].attributeHolders).size();
6740 QSet<QXmlName> declaredAttributes;
6741 declaredAttributes.reserve(asize: len);
6742
6743 /* For each namespace, resolve its name(now that we have resolved the namespace declarations) and
6744 * turn it into an attribute constructor. */
6745 for(int i = 0; i < len; ++i)
6746 {
6747 QString strLocalName;
6748 QString strPrefix;
6749
6750 XPathHelper::splitQName(qName: (yyvsp[-1].attributeHolders).at(i).first, prefix&: strPrefix, localName&: strLocalName);
6751 const QXmlName::PrefixCode prefix = namePool->allocatePrefix(prefix: strPrefix);
6752 const QXmlName::LocalNameCode localName = namePool->allocateLocalName(ln: strLocalName);
6753
6754 if(prefix == StandardPrefixes::xmlns ||
6755 (prefix == StandardPrefixes::empty && localName == StandardLocalNames::xmlns))
6756 {
6757 const Expression::ID id = (yyvsp[-1].attributeHolders).at(i).second->id();
6758
6759 if(id == Expression::IDStringValue || id == Expression::IDEmptySequence)
6760 {
6761 /* It's a namespace declaration, and we've already handled those above. */
6762 continue;
6763 }
6764 else
6765 {
6766 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "The namespace URI must be a constant and cannot "
6767 "use enclosed expressions."),
6768 errorCode: ReportContext::XQST0022, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
6769 }
6770
6771 }
6772 else
6773 {
6774 const ReflectYYLTYPE ryy((yyloc), parseInfo);
6775 const QXmlName att = QNameConstructor::expandQName<StaticContext::Ptr,
6776 ReportContext::XPST0081,
6777 ReportContext::XPST0081>(lexicalQName: (yyvsp[-1].attributeHolders).at(i).first, context: parseInfo->staticContext,
6778 nsResolver: parseInfo->staticContext->namespaceBindings(),
6779 r: &ryy, asForAttribute: true);
6780 if(declaredAttributes.contains(value: att))
6781 {
6782 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "An attribute with name %1 has already appeared on this element.")
6783 .arg(a: formatKeyword(np: parseInfo->staticContext->namePool(), name: att)),
6784 errorCode: ReportContext::XQST0040, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
6785
6786 }
6787 else
6788 declaredAttributes.insert(value: att);
6789
6790 /* wrapLiteral() needs the SourceLocationReflection of the AttributeConstructor, but
6791 * it's unknown inside the arguments to its constructor. Hence we have to do this workaround of setting
6792 * it twice.
6793 *
6794 * The AttributeConstructor's arguments are just dummies. */
6795 const Expression::Ptr ctor(create(expr: new AttributeConstructor((yyvsp[-1].attributeHolders).at(i).second, (yyvsp[-1].attributeHolders).at(i).second), sourceLocator: (yyloc), parseInfo));
6796
6797 Expression::List ops;
6798 ops.append(t: wrapLiteral(item: toItem(atomicValue: QNameValue::fromValue(np: namePool, name: att)), context: parseInfo->staticContext, r: ctor.data()));
6799 ops.append(t: (yyvsp[-1].attributeHolders).at(i).second);
6800 ctor->setOperands(ops);
6801
6802 attributes.append(t: ctor);
6803 }
6804 }
6805
6806 Expression::Ptr contentOp;
6807
6808 if(attributes.isEmpty())
6809 contentOp = (yyvsp[0].expr);
6810 else
6811 {
6812 attributes.append(t: (yyvsp[0].expr));
6813 contentOp = create(expr: new ExpressionSequence(attributes), sourceLocator: (yyloc), parseInfo);
6814 }
6815
6816 const Expression::Ptr name(create(expr: new Literal(toItem(atomicValue: QNameValue::fromValue(np: parseInfo->staticContext->namePool(), name: parseInfo->tagStack.top()))), sourceLocator: (yyloc), parseInfo));
6817 (yyval.expr) = create(expr: new ElementConstructor(name, contentOp, parseInfo->isXSLT()), sourceLocator: (yyloc), parseInfo);
6818
6819 /* Restore the old context. We don't want the namespaces
6820 * to be in-scope for expressions appearing after the
6821 * element they appeared on. */
6822 parseInfo->staticContext->setNamespaceBindings(parseInfo->resolvers.pop());
6823 parseInfo->tagStack.pop();
6824
6825 --parseInfo->elementConstructorDepth;
6826 }
6827#line 6779 "qquerytransformparser.cpp" /* yacc.c:1652 */
6828 break;
6829
6830 case 363:
6831#line 4033 "querytransformparser.ypp" /* yacc.c:1652 */
6832 {
6833 (yyval.expr) = create(expr: new EmptySequence(), sourceLocator: (yyloc), parseInfo);
6834 }
6835#line 6787 "qquerytransformparser.cpp" /* yacc.c:1652 */
6836 break;
6837
6838 case 364:
6839#line 4037 "querytransformparser.ypp" /* yacc.c:1652 */
6840 {
6841 if(!(yyvsp[-1].qName).isLexicallyEqual(other: parseInfo->tagStack.top()))
6842 {
6843 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "A direct element constructor is not "
6844 "well-formed. %1 is ended with %2.")
6845 .arg(args: formatKeyword(keyword: parseInfo->staticContext->namePool()->toLexical(qName: parseInfo->tagStack.top())),
6846 args: formatKeyword(keyword: parseInfo->staticContext->namePool()->toLexical(qName: (yyvsp[-1].qName)))),
6847 errorCode: ReportContext::XPST0003, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
6848 }
6849
6850 if((yyvsp[-3].expressionList).isEmpty())
6851 (yyval.expr) = create(expr: new EmptySequence(), sourceLocator: (yyloc), parseInfo);
6852 else if((yyvsp[-3].expressionList).size() == 1)
6853 (yyval.expr) = (yyvsp[-3].expressionList).first();
6854 else
6855 (yyval.expr) = create(expr: new ExpressionSequence((yyvsp[-3].expressionList)), sourceLocator: (yyloc), parseInfo);
6856 }
6857#line 6809 "qquerytransformparser.cpp" /* yacc.c:1652 */
6858 break;
6859
6860 case 365:
6861#line 4056 "querytransformparser.ypp" /* yacc.c:1652 */
6862 {
6863 (yyval.attributeHolders) = AttributeHolderVector();
6864 }
6865#line 6817 "qquerytransformparser.cpp" /* yacc.c:1652 */
6866 break;
6867
6868 case 366:
6869#line 4060 "querytransformparser.ypp" /* yacc.c:1652 */
6870 {
6871 (yyvsp[-1].attributeHolders).append(t: (yyvsp[0].attributeHolder));
6872 (yyval.attributeHolders) = (yyvsp[-1].attributeHolders);
6873 }
6874#line 6826 "qquerytransformparser.cpp" /* yacc.c:1652 */
6875 break;
6876
6877 case 367:
6878#line 4066 "querytransformparser.ypp" /* yacc.c:1652 */
6879 {
6880 (yyval.attributeHolder) = qMakePair(x: (yyvsp[-2].sval), y: (yyvsp[0].expr));
6881 }
6882#line 6834 "qquerytransformparser.cpp" /* yacc.c:1652 */
6883 break;
6884
6885 case 368:
6886#line 4071 "querytransformparser.ypp" /* yacc.c:1652 */
6887 {
6888 (yyval.expr) = createDirAttributeValue(content: (yyvsp[-1].expressionList), parseInfo, sourceLocator: (yyloc));
6889 }
6890#line 6842 "qquerytransformparser.cpp" /* yacc.c:1652 */
6891 break;
6892
6893 case 369:
6894#line 4076 "querytransformparser.ypp" /* yacc.c:1652 */
6895 {
6896 (yyval.expr) = createDirAttributeValue(content: (yyvsp[-1].expressionList), parseInfo, sourceLocator: (yyloc));
6897 }
6898#line 6850 "qquerytransformparser.cpp" /* yacc.c:1652 */
6899 break;
6900
6901 case 370:
6902#line 4081 "querytransformparser.ypp" /* yacc.c:1652 */
6903 {
6904 (yyval.expressionList) = Expression::List();
6905 }
6906#line 6858 "qquerytransformparser.cpp" /* yacc.c:1652 */
6907 break;
6908
6909 case 371:
6910#line 4085 "querytransformparser.ypp" /* yacc.c:1652 */
6911 {
6912 Expression::Ptr content((yyvsp[-1].expr));
6913
6914 if(parseInfo->isBackwardsCompat.top())
6915 content = create(expr: GenericPredicate::createFirstItem(sourceExpression: content), sourceLocator: (yyloc), parseInfo);
6916
6917 (yyvsp[0].expressionList).prepend(t: createSimpleContent(source: content, sourceLocator: (yyloc), parseInfo));
6918 (yyval.expressionList) = (yyvsp[0].expressionList);
6919 }
6920#line 6872 "qquerytransformparser.cpp" /* yacc.c:1652 */
6921 break;
6922
6923 case 372:
6924#line 4095 "querytransformparser.ypp" /* yacc.c:1652 */
6925 {
6926 (yyvsp[0].expressionList).prepend(t: create(expr: new Literal(AtomicString::fromValue(value: (yyvsp[-1].sval))), sourceLocator: (yyloc), parseInfo));
6927 (yyval.expressionList) = (yyvsp[0].expressionList);
6928 }
6929#line 6881 "qquerytransformparser.cpp" /* yacc.c:1652 */
6930 break;
6931
6932 case 373:
6933#line 4101 "querytransformparser.ypp" /* yacc.c:1652 */
6934 {
6935 (yyval.expressionList) = Expression::List();
6936 parseInfo->isPreviousEnclosedExpr = false;
6937 }
6938#line 6890 "qquerytransformparser.cpp" /* yacc.c:1652 */
6939 break;
6940
6941 case 374:
6942#line 4106 "querytransformparser.ypp" /* yacc.c:1652 */
6943 {
6944 (yyvsp[-1].expressionList).append(t: (yyvsp[0].expr));
6945 (yyval.expressionList) = (yyvsp[-1].expressionList);
6946 parseInfo->isPreviousEnclosedExpr = false;
6947 }
6948#line 6900 "qquerytransformparser.cpp" /* yacc.c:1652 */
6949 break;
6950
6951 case 375:
6952#line 4112 "querytransformparser.ypp" /* yacc.c:1652 */
6953 {
6954 if(parseInfo->staticContext->boundarySpacePolicy() == StaticContext::BSPStrip &&
6955 XPathHelper::isWhitespaceOnly(string: (yyvsp[0].sval)))
6956 {
6957 (yyval.expressionList) = (yyvsp[-1].expressionList);
6958 }
6959 else
6960 {
6961 (yyvsp[-1].expressionList).append(t: create(expr: new TextNodeConstructor(create(expr: new Literal(AtomicString::fromValue(value: (yyvsp[0].sval))), sourceLocator: (yyloc), parseInfo)), sourceLocator: (yyloc), parseInfo));
6962 (yyval.expressionList) = (yyvsp[-1].expressionList);
6963 parseInfo->isPreviousEnclosedExpr = false;
6964 }
6965 }
6966#line 6918 "qquerytransformparser.cpp" /* yacc.c:1652 */
6967 break;
6968
6969 case 376:
6970#line 4126 "querytransformparser.ypp" /* yacc.c:1652 */
6971 {
6972 (yyvsp[-1].expressionList).append(t: create(expr: new TextNodeConstructor(create(expr: new Literal(AtomicString::fromValue(value: (yyvsp[0].sval))), sourceLocator: (yyloc), parseInfo)), sourceLocator: (yyloc), parseInfo));
6973 (yyval.expressionList) = (yyvsp[-1].expressionList);
6974 parseInfo->isPreviousEnclosedExpr = false;
6975 }
6976#line 6928 "qquerytransformparser.cpp" /* yacc.c:1652 */
6977 break;
6978
6979 case 377:
6980#line 4132 "querytransformparser.ypp" /* yacc.c:1652 */
6981 {
6982 /* We insert a text node constructor that send an empty text node between
6983 * the two enclosed expressions, in order to ensure that no space is inserted.
6984 *
6985 * However, we only do it when we have no node constructors. */
6986 if(parseInfo->isPreviousEnclosedExpr &&
6987 BuiltinTypes::xsAnyAtomicType->xdtTypeMatches(other: (yyvsp[0].expr)->staticType()->itemType()) &&
6988 BuiltinTypes::xsAnyAtomicType->xdtTypeMatches(other: (yyvsp[-1].expressionList).last()->staticType()->itemType()))
6989 (yyvsp[-1].expressionList).append(t: create(expr: new TextNodeConstructor(create(expr: new Literal(AtomicString::fromValue(value: QString())), sourceLocator: (yyloc), parseInfo)), sourceLocator: (yyloc), parseInfo));
6990 else
6991 parseInfo->isPreviousEnclosedExpr = true;
6992
6993 (yyvsp[-1].expressionList).append(t: createCopyOf(operand: (yyvsp[0].expr), parseInfo, sl: (yyloc)));
6994 (yyval.expressionList) = (yyvsp[-1].expressionList);
6995 }
6996#line 6948 "qquerytransformparser.cpp" /* yacc.c:1652 */
6997 break;
6998
6999 case 378:
7000#line 4149 "querytransformparser.ypp" /* yacc.c:1652 */
7001 {
7002 (yyval.expr) = create(expr: new CommentConstructor(create(expr: new Literal(AtomicString::fromValue(value: (yyvsp[0].sval))), sourceLocator: (yyloc), parseInfo)), sourceLocator: (yyloc), parseInfo);
7003 }
7004#line 6956 "qquerytransformparser.cpp" /* yacc.c:1652 */
7005 break;
7006
7007 case 379:
7008#line 4154 "querytransformparser.ypp" /* yacc.c:1652 */
7009 {
7010 const ReflectYYLTYPE ryy((yyloc), parseInfo);
7011 NCNameConstructor::validateTargetName<StaticContext::Ptr,
7012 ReportContext::XPST0003,
7013 ReportContext::XPST0003>(lexicalTarget: (yyvsp[-1].sval),
7014 context: parseInfo->staticContext, r: &ryy);
7015
7016 (yyval.expr) = create(expr: new ProcessingInstructionConstructor(
7017 create(expr: new Literal(AtomicString::fromValue(value: (yyvsp[-1].sval))), sourceLocator: (yyloc), parseInfo),
7018 create(expr: new Literal(AtomicString::fromValue(value: (yyvsp[0].sval))), sourceLocator: (yyloc), parseInfo)), sourceLocator: (yyloc), parseInfo);
7019 }
7020#line 6972 "qquerytransformparser.cpp" /* yacc.c:1652 */
7021 break;
7022
7023 case 387:
7024#line 4175 "querytransformparser.ypp" /* yacc.c:1652 */
7025 {
7026 allowedIn(allowedLanguages: QXmlQuery::XQuery10, parseInfo, sourceLocator: (yyloc), isInternal: (yyvsp[-1].enums.Bool));
7027
7028 (yyval.expr) = create(expr: new DocumentConstructor((yyvsp[0].expr)), sourceLocator: (yyloc), parseInfo);
7029 }
7030#line 6982 "qquerytransformparser.cpp" /* yacc.c:1652 */
7031 break;
7032
7033 case 388:
7034#line 4182 "querytransformparser.ypp" /* yacc.c:1652 */
7035 {
7036 /* This value is incremented before the action below is executed. */
7037 ++parseInfo->elementConstructorDepth;
7038 }
7039#line 6991 "qquerytransformparser.cpp" /* yacc.c:1652 */
7040 break;
7041
7042 case 389:
7043#line 4187 "querytransformparser.ypp" /* yacc.c:1652 */
7044 {
7045 Q_ASSERT(5);
7046 allowedIn(allowedLanguages: QXmlQuery::XQuery10, parseInfo, sourceLocator: (yyloc), isInternal: (yyvsp[-3].enums.Bool));
7047
7048 Expression::Ptr effExpr;
7049
7050 if((yyvsp[0].expr))
7051 effExpr = createCopyOf(operand: (yyvsp[0].expr), parseInfo, sl: (yyloc));
7052 else
7053 effExpr = create(expr: new EmptySequence(), sourceLocator: (yyloc), parseInfo);
7054
7055 const QXmlName::NamespaceCode ns = parseInfo->resolvers.top()->lookupNamespaceURI(prefix: StandardPrefixes::empty);
7056
7057 /* Ensure the default namespace gets counted as an in-scope binding, if such a one exists. If we're
7058 * a child of another constructor, it has already been done. */
7059 if(parseInfo->elementConstructorDepth == 1 && ns != StandardNamespaces::empty)
7060 {
7061 Expression::List exprList;
7062
7063 /* We append the namespace constructor before the body, in order to
7064 * comply with QAbstractXmlPushHandler's contract. */
7065 const QXmlName def(parseInfo->resolvers.top()->lookupNamespaceURI(prefix: StandardPrefixes::empty), StandardLocalNames::empty);
7066 exprList.append(t: create(expr: new NamespaceConstructor(def), sourceLocator: (yyloc), parseInfo));
7067
7068 exprList.append(t: effExpr);
7069
7070 effExpr = create(expr: new ExpressionSequence(exprList), sourceLocator: (yyloc), parseInfo);
7071 }
7072
7073 --parseInfo->elementConstructorDepth;
7074 (yyval.expr) = create(expr: new ElementConstructor((yyvsp[-2].expr), effExpr, parseInfo->isXSLT()), sourceLocator: (yyloc), parseInfo);
7075 }
7076#line 7028 "qquerytransformparser.cpp" /* yacc.c:1652 */
7077 break;
7078
7079 case 390:
7080#line 4221 "querytransformparser.ypp" /* yacc.c:1652 */
7081 {
7082 (yyval.enums.Bool) = false;
7083 }
7084#line 7036 "qquerytransformparser.cpp" /* yacc.c:1652 */
7085 break;
7086
7087 case 391:
7088#line 4225 "querytransformparser.ypp" /* yacc.c:1652 */
7089 {
7090 (yyval.enums.Bool) = true;
7091 }
7092#line 7044 "qquerytransformparser.cpp" /* yacc.c:1652 */
7093 break;
7094
7095 case 392:
7096#line 4233 "querytransformparser.ypp" /* yacc.c:1652 */
7097 {
7098 allowedIn(allowedLanguages: QXmlQuery::XQuery10, parseInfo, sourceLocator: (yyloc), isInternal: (yyvsp[-2].enums.Bool));
7099
7100 const Expression::Ptr name(create(expr: new AttributeNameValidator((yyvsp[-1].expr)), sourceLocator: (yyloc), parseInfo));
7101
7102 if((yyvsp[0].expr))
7103 (yyval.expr) = create(expr: new AttributeConstructor(name, createSimpleContent(source: (yyvsp[0].expr), sourceLocator: (yyloc), parseInfo)), sourceLocator: (yyloc), parseInfo);
7104 else
7105 (yyval.expr) = create(expr: new AttributeConstructor(name, create(expr: new EmptySequence(), sourceLocator: (yyloc), parseInfo)), sourceLocator: (yyloc), parseInfo);
7106 }
7107#line 7059 "qquerytransformparser.cpp" /* yacc.c:1652 */
7108 break;
7109
7110 case 393:
7111#line 4245 "querytransformparser.ypp" /* yacc.c:1652 */
7112 {
7113 (yyval.expr) = create(expr: new TextNodeConstructor(createSimpleContent(source: (yyvsp[0].expr), sourceLocator: (yyloc), parseInfo)), sourceLocator: (yyloc), parseInfo);
7114 }
7115#line 7067 "qquerytransformparser.cpp" /* yacc.c:1652 */
7116 break;
7117
7118 case 394:
7119#line 4250 "querytransformparser.ypp" /* yacc.c:1652 */
7120 {
7121 allowedIn(allowedLanguages: QXmlQuery::XQuery10, parseInfo, sourceLocator: (yyloc), isInternal: (yyvsp[-1].enums.Bool));
7122
7123 (yyval.expr) = create(expr: new CommentConstructor(createSimpleContent(source: (yyvsp[0].expr), sourceLocator: (yyloc), parseInfo)), sourceLocator: (yyloc), parseInfo);
7124 }
7125#line 7077 "qquerytransformparser.cpp" /* yacc.c:1652 */
7126 break;
7127
7128 case 395:
7129#line 4257 "querytransformparser.ypp" /* yacc.c:1652 */
7130 {
7131 allowedIn(allowedLanguages: QXmlQuery::XQuery10, parseInfo, sourceLocator: (yyloc), isInternal: (yyvsp[-1].expr));
7132
7133 if((yyvsp[0].expr))
7134 {
7135 (yyval.expr) = create(expr: new ProcessingInstructionConstructor((yyvsp[-1].expr), createSimpleContent(source: (yyvsp[0].expr), sourceLocator: (yyloc), parseInfo)), sourceLocator: (yyloc), parseInfo);
7136 }
7137 else
7138 (yyval.expr) = create(expr: new ProcessingInstructionConstructor((yyvsp[-1].expr), create(expr: new EmptySequence(), sourceLocator: (yyloc), parseInfo)), sourceLocator: (yyloc), parseInfo);
7139 }
7140#line 7092 "qquerytransformparser.cpp" /* yacc.c:1652 */
7141 break;
7142
7143 case 396:
7144#line 4268 "querytransformparser.ypp" /* yacc.c:1652 */
7145 {
7146 parseInfo->nodeTestSource = BuiltinTypes::attribute;
7147 }
7148#line 7100 "qquerytransformparser.cpp" /* yacc.c:1652 */
7149 break;
7150
7151 case 397:
7152#line 4272 "querytransformparser.ypp" /* yacc.c:1652 */
7153 {
7154 parseInfo->restoreNodeTestSource();
7155 }
7156#line 7108 "qquerytransformparser.cpp" /* yacc.c:1652 */
7157 break;
7158
7159 case 398:
7160#line 4275 "querytransformparser.ypp" /* yacc.c:1652 */
7161 {
7162 (yyval.expr) = create(expr: new Literal(toItem(atomicValue: QNameValue::fromValue(np: parseInfo->staticContext->namePool(), name: (yyvsp[-1].qName)))), sourceLocator: (yyloc), parseInfo);
7163 }
7164#line 7116 "qquerytransformparser.cpp" /* yacc.c:1652 */
7165 break;
7166
7167 case 400:
7168#line 4281 "querytransformparser.ypp" /* yacc.c:1652 */
7169 {
7170 (yyval.expr) = create(expr: new Literal(toItem(atomicValue: QNameValue::fromValue(np: parseInfo->staticContext->namePool(), name: (yyvsp[0].qName)))), sourceLocator: (yyloc), parseInfo);
7171 }
7172#line 7124 "qquerytransformparser.cpp" /* yacc.c:1652 */
7173 break;
7174
7175 case 402:
7176#line 4287 "querytransformparser.ypp" /* yacc.c:1652 */
7177 {
7178 if(BuiltinTypes::xsQName->xdtTypeMatches(other: (yyvsp[0].expr)->staticType()->itemType()))
7179 (yyval.expr) = (yyvsp[0].expr);
7180 else
7181 {
7182 (yyval.expr) = create(expr: new QNameConstructor((yyvsp[0].expr),
7183 parseInfo->staticContext->namespaceBindings()),
7184 sourceLocator: (yyloc), parseInfo);
7185 }
7186 }
7187#line 7139 "qquerytransformparser.cpp" /* yacc.c:1652 */
7188 break;
7189
7190 case 403:
7191#line 4302 "querytransformparser.ypp" /* yacc.c:1652 */
7192 {
7193 (yyval.expr) = create(expr: new NCNameConstructor(create(expr: new Literal(AtomicString::fromValue(value: (yyvsp[0].sval))), sourceLocator: (yyloc), parseInfo)), sourceLocator: (yyloc), parseInfo);
7194 }
7195#line 7147 "qquerytransformparser.cpp" /* yacc.c:1652 */
7196 break;
7197
7198 case 404:
7199#line 4306 "querytransformparser.ypp" /* yacc.c:1652 */
7200 {
7201 (yyval.expr) = create(expr: new NCNameConstructor((yyvsp[0].expr)), sourceLocator: (yyloc), parseInfo);
7202 }
7203#line 7155 "qquerytransformparser.cpp" /* yacc.c:1652 */
7204 break;
7205
7206 case 405:
7207#line 4315 "querytransformparser.ypp" /* yacc.c:1652 */
7208 {
7209 (yyval.expr) = create(expr: new ComputedNamespaceConstructor((yyvsp[-1].expr), (yyvsp[0].expr)), sourceLocator: (yyloc), parseInfo);
7210}
7211#line 7163 "qquerytransformparser.cpp" /* yacc.c:1652 */
7212 break;
7213
7214 case 406:
7215#line 4320 "querytransformparser.ypp" /* yacc.c:1652 */
7216 {
7217 (yyval.sequenceType) = makeGenericSequenceType(itemType: (yyvsp[0].itemType), cardinality: Cardinality::exactlyOne());
7218 }
7219#line 7171 "qquerytransformparser.cpp" /* yacc.c:1652 */
7220 break;
7221
7222 case 407:
7223#line 4324 "querytransformparser.ypp" /* yacc.c:1652 */
7224 {
7225 (yyval.sequenceType) = makeGenericSequenceType(itemType: (yyvsp[-1].itemType), cardinality: Cardinality::zeroOrOne());
7226 }
7227#line 7179 "qquerytransformparser.cpp" /* yacc.c:1652 */
7228 break;
7229
7230 case 408:
7231#line 4329 "querytransformparser.ypp" /* yacc.c:1652 */
7232 {
7233 (yyval.sequenceType) = CommonSequenceTypes::ZeroOrMoreItems;
7234 }
7235#line 7187 "qquerytransformparser.cpp" /* yacc.c:1652 */
7236 break;
7237
7238 case 409:
7239#line 4333 "querytransformparser.ypp" /* yacc.c:1652 */
7240 {
7241 (yyval.sequenceType) = (yyvsp[0].sequenceType);
7242 }
7243#line 7195 "qquerytransformparser.cpp" /* yacc.c:1652 */
7244 break;
7245
7246 case 410:
7247#line 4338 "querytransformparser.ypp" /* yacc.c:1652 */
7248 {
7249 (yyval.sequenceType) = makeGenericSequenceType(itemType: (yyvsp[-1].itemType), cardinality: (yyvsp[0].cardinality));
7250 }
7251#line 7203 "qquerytransformparser.cpp" /* yacc.c:1652 */
7252 break;
7253
7254 case 411:
7255#line 4343 "querytransformparser.ypp" /* yacc.c:1652 */
7256 {
7257 (yyval.sequenceType) = CommonSequenceTypes::Empty;
7258 }
7259#line 7211 "qquerytransformparser.cpp" /* yacc.c:1652 */
7260 break;
7261
7262 case 412:
7263#line 4347 "querytransformparser.ypp" /* yacc.c:1652 */
7264 {(yyval.cardinality) = Cardinality::exactlyOne();}
7265#line 7217 "qquerytransformparser.cpp" /* yacc.c:1652 */
7266 break;
7267
7268 case 413:
7269#line 4348 "querytransformparser.ypp" /* yacc.c:1652 */
7270 {(yyval.cardinality) = Cardinality::oneOrMore();}
7271#line 7223 "qquerytransformparser.cpp" /* yacc.c:1652 */
7272 break;
7273
7274 case 414:
7275#line 4349 "querytransformparser.ypp" /* yacc.c:1652 */
7276 {(yyval.cardinality) = Cardinality::zeroOrMore();}
7277#line 7229 "qquerytransformparser.cpp" /* yacc.c:1652 */
7278 break;
7279
7280 case 415:
7281#line 4350 "querytransformparser.ypp" /* yacc.c:1652 */
7282 {(yyval.cardinality) = Cardinality::zeroOrOne();}
7283#line 7235 "qquerytransformparser.cpp" /* yacc.c:1652 */
7284 break;
7285
7286 case 419:
7287#line 4356 "querytransformparser.ypp" /* yacc.c:1652 */
7288 {
7289 (yyval.itemType) = BuiltinTypes::item;
7290 }
7291#line 7243 "qquerytransformparser.cpp" /* yacc.c:1652 */
7292 break;
7293
7294 case 420:
7295#line 4361 "querytransformparser.ypp" /* yacc.c:1652 */
7296 {
7297 const SchemaType::Ptr t(parseInfo->staticContext->schemaDefinitions()->createSchemaType(name: (yyvsp[0].qName)));
7298
7299 if(!t)
7300 {
7301 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "The name %1 does not refer to any schema type.")
7302 .arg(a: formatKeyword(np: parseInfo->staticContext->namePool(), name: (yyvsp[0].qName))), errorCode: ReportContext::XPST0051, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
7303 }
7304 else if(BuiltinTypes::xsAnyAtomicType->wxsTypeMatches(other: t))
7305 (yyval.itemType) = AtomicType::Ptr(t);
7306 else
7307 {
7308 /* Try to give an intelligent message. */
7309 if(t->isComplexType())
7310 {
7311 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "%1 is an complex type. Casting to complex "
7312 "types is not possible. However, casting "
7313 "to atomic types such as %2 works.")
7314 .arg(a: formatType(np: parseInfo->staticContext->namePool(), type: t))
7315 .arg(a: formatType(np: parseInfo->staticContext->namePool(), type: BuiltinTypes::xsInteger)),
7316 errorCode: ReportContext::XPST0051, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
7317 }
7318 else
7319 {
7320 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "%1 is not an atomic type. Casting "
7321 "is only possible to atomic types.")
7322 .arg(a: formatType(np: parseInfo->staticContext->namePool(), type: t)),
7323 errorCode: ReportContext::XPST0051, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
7324 }
7325 }
7326 }
7327#line 7279 "qquerytransformparser.cpp" /* yacc.c:1652 */
7328 break;
7329
7330 case 428:
7331#line 4405 "querytransformparser.ypp" /* yacc.c:1652 */
7332 {
7333 (yyval.itemType) = BuiltinTypes::node;
7334 }
7335#line 7287 "qquerytransformparser.cpp" /* yacc.c:1652 */
7336 break;
7337
7338 case 429:
7339#line 4410 "querytransformparser.ypp" /* yacc.c:1652 */
7340 {
7341 (yyval.itemType) = BuiltinTypes::document;
7342 }
7343#line 7295 "qquerytransformparser.cpp" /* yacc.c:1652 */
7344 break;
7345
7346 case 430:
7347#line 4415 "querytransformparser.ypp" /* yacc.c:1652 */
7348 {
7349 // TODO support for document element testing
7350 (yyval.itemType) = BuiltinTypes::document;
7351 }
7352#line 7304 "qquerytransformparser.cpp" /* yacc.c:1652 */
7353 break;
7354
7355 case 433:
7356#line 4424 "querytransformparser.ypp" /* yacc.c:1652 */
7357 {
7358 (yyval.itemType) = BuiltinTypes::text;
7359 }
7360#line 7312 "qquerytransformparser.cpp" /* yacc.c:1652 */
7361 break;
7362
7363 case 434:
7364#line 4429 "querytransformparser.ypp" /* yacc.c:1652 */
7365 {
7366 (yyval.itemType) = BuiltinTypes::comment;
7367 }
7368#line 7320 "qquerytransformparser.cpp" /* yacc.c:1652 */
7369 break;
7370
7371 case 435:
7372#line 4434 "querytransformparser.ypp" /* yacc.c:1652 */
7373 {
7374 (yyval.itemType) = BuiltinTypes::pi;
7375 }
7376#line 7328 "qquerytransformparser.cpp" /* yacc.c:1652 */
7377 break;
7378
7379 case 436:
7380#line 4439 "querytransformparser.ypp" /* yacc.c:1652 */
7381 {
7382 (yyval.itemType) = LocalNameTest::create(primaryType: BuiltinTypes::pi, localName: parseInfo->staticContext->namePool()->allocateLocalName(ln: (yyvsp[-1].sval)));
7383 }
7384#line 7336 "qquerytransformparser.cpp" /* yacc.c:1652 */
7385 break;
7386
7387 case 437:
7388#line 4444 "querytransformparser.ypp" /* yacc.c:1652 */
7389 {
7390 if(QXmlUtils::isNCName(ncName: (yyvsp[-1].sval)))
7391 {
7392 (yyval.itemType) = LocalNameTest::create(primaryType: BuiltinTypes::pi, localName: parseInfo->staticContext->namePool()->allocateLocalName(ln: (yyvsp[-1].sval)));
7393 }
7394 else
7395 {
7396 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "%1 is not a valid name for a "
7397 "processing-instruction.")
7398 .arg(a: formatKeyword(keyword: (yyvsp[-1].sval))),
7399 errorCode: ReportContext::XPTY0004,
7400 sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
7401 }
7402 }
7403#line 7355 "qquerytransformparser.cpp" /* yacc.c:1652 */
7404 break;
7405
7406 case 440:
7407#line 4463 "querytransformparser.ypp" /* yacc.c:1652 */
7408 {
7409 (yyval.itemType) = BuiltinTypes::attribute;
7410 }
7411#line 7363 "qquerytransformparser.cpp" /* yacc.c:1652 */
7412 break;
7413
7414 case 441:
7415#line 4468 "querytransformparser.ypp" /* yacc.c:1652 */
7416 {
7417 (yyval.itemType) = BuiltinTypes::attribute;
7418 }
7419#line 7371 "qquerytransformparser.cpp" /* yacc.c:1652 */
7420 break;
7421
7422 case 442:
7423#line 4473 "querytransformparser.ypp" /* yacc.c:1652 */
7424 {
7425 (yyval.itemType) = QNameTest::create(primaryType: BuiltinTypes::attribute, qName: (yyvsp[-1].qName));
7426 }
7427#line 7379 "qquerytransformparser.cpp" /* yacc.c:1652 */
7428 break;
7429
7430 case 443:
7431#line 4477 "querytransformparser.ypp" /* yacc.c:1652 */
7432 {
7433 const SchemaType::Ptr t(parseInfo->staticContext->schemaDefinitions()->createSchemaType(name: (yyvsp[-1].qName)));
7434
7435 if(t)
7436 (yyval.itemType) = BuiltinTypes::attribute;
7437 else
7438 {
7439 parseInfo->staticContext->error(message: unknownType().arg(a: formatKeyword(np: parseInfo->staticContext->namePool(), name: (yyvsp[-1].qName))),
7440 errorCode: ReportContext::XPST0008, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
7441 }
7442 }
7443#line 7395 "qquerytransformparser.cpp" /* yacc.c:1652 */
7444 break;
7445
7446 case 444:
7447#line 4489 "querytransformparser.ypp" /* yacc.c:1652 */
7448 {
7449 const SchemaType::Ptr t(parseInfo->staticContext->schemaDefinitions()->createSchemaType(name: (yyvsp[-1].qName)));
7450
7451 if(t)
7452 (yyval.itemType) = BuiltinTypes::attribute;
7453 else
7454 {
7455 parseInfo->staticContext->error(message: unknownType().arg(a: formatKeyword(np: parseInfo->staticContext->namePool(), name: (yyvsp[-1].qName))),
7456 errorCode: ReportContext::XPST0008, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
7457 }
7458 }
7459#line 7411 "qquerytransformparser.cpp" /* yacc.c:1652 */
7460 break;
7461
7462 case 445:
7463#line 4502 "querytransformparser.ypp" /* yacc.c:1652 */
7464 {
7465 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "%1 is not in the in-scope attribute "
7466 "declarations. Note that the schema import "
7467 "feature is not supported.")
7468 .arg(a: formatKeyword(np: parseInfo->staticContext->namePool(), name: (yyvsp[-1].qName))),
7469 errorCode: ReportContext::XPST0008, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
7470 (yyval.itemType).reset();
7471 }
7472#line 7424 "qquerytransformparser.cpp" /* yacc.c:1652 */
7473 break;
7474
7475 case 446:
7476#line 4512 "querytransformparser.ypp" /* yacc.c:1652 */
7477 {
7478 (yyval.itemType) = BuiltinTypes::element;
7479 }
7480#line 7432 "qquerytransformparser.cpp" /* yacc.c:1652 */
7481 break;
7482
7483 case 447:
7484#line 4517 "querytransformparser.ypp" /* yacc.c:1652 */
7485 {
7486 (yyval.itemType) = BuiltinTypes::element;
7487 }
7488#line 7440 "qquerytransformparser.cpp" /* yacc.c:1652 */
7489 break;
7490
7491 case 448:
7492#line 4522 "querytransformparser.ypp" /* yacc.c:1652 */
7493 {
7494 (yyval.itemType) = QNameTest::create(primaryType: BuiltinTypes::element, qName: (yyvsp[-1].qName));
7495 }
7496#line 7448 "qquerytransformparser.cpp" /* yacc.c:1652 */
7497 break;
7498
7499 case 449:
7500#line 4527 "querytransformparser.ypp" /* yacc.c:1652 */
7501 {
7502 const SchemaType::Ptr t(parseInfo->staticContext->schemaDefinitions()->createSchemaType(name: (yyvsp[-2].qName)));
7503
7504 if(t)
7505 (yyval.itemType) = BuiltinTypes::element;
7506 else
7507 {
7508 parseInfo->staticContext->error(message: unknownType()
7509 .arg(a: formatKeyword(np: parseInfo->staticContext->namePool(), name: (yyvsp[-2].qName))),
7510 errorCode: ReportContext::XPST0008, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
7511 }
7512 }
7513#line 7465 "qquerytransformparser.cpp" /* yacc.c:1652 */
7514 break;
7515
7516 case 450:
7517#line 4541 "querytransformparser.ypp" /* yacc.c:1652 */
7518 {
7519 const SchemaType::Ptr t(parseInfo->staticContext->schemaDefinitions()->createSchemaType(name: (yyvsp[-2].qName)));
7520
7521 if(t)
7522 (yyval.itemType) = BuiltinTypes::element;
7523 else
7524 {
7525 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "%1 is an unknown schema type.")
7526 .arg(a: formatKeyword(np: parseInfo->staticContext->namePool(), name: (yyvsp[-2].qName))),
7527 errorCode: ReportContext::XPST0008, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
7528 }
7529 }
7530#line 7482 "qquerytransformparser.cpp" /* yacc.c:1652 */
7531 break;
7532
7533 case 453:
7534#line 4558 "querytransformparser.ypp" /* yacc.c:1652 */
7535 {
7536 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "%1 is not in the in-scope attribute "
7537 "declarations. Note that the schema import "
7538 "feature is not supported.")
7539 .arg(a: formatKeyword(np: parseInfo->staticContext->namePool(), name: (yyvsp[-1].qName))),
7540 errorCode: ReportContext::XPST0008, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
7541 (yyval.itemType).reset();
7542 }
7543#line 7495 "qquerytransformparser.cpp" /* yacc.c:1652 */
7544 break;
7545
7546 case 455:
7547#line 4570 "querytransformparser.ypp" /* yacc.c:1652 */
7548 {
7549 (yyval.qName) = parseInfo->staticContext->namePool()->allocateQName(uri: StandardNamespaces::empty, ln: (yyvsp[0].sval));
7550 }
7551#line 7503 "qquerytransformparser.cpp" /* yacc.c:1652 */
7552 break;
7553
7554 case 457:
7555#line 4582 "querytransformparser.ypp" /* yacc.c:1652 */
7556 {
7557 if(parseInfo->nodeTestSource == BuiltinTypes::element)
7558 (yyval.qName) = parseInfo->staticContext->namePool()->allocateQName(uri: parseInfo->staticContext->namespaceBindings()->lookupNamespaceURI(prefix: StandardPrefixes::empty), ln: (yyvsp[0].sval));
7559 else
7560 (yyval.qName) = parseInfo->staticContext->namePool()->allocateQName(uri: StandardNamespaces::empty, ln: (yyvsp[0].sval));
7561 }
7562#line 7514 "qquerytransformparser.cpp" /* yacc.c:1652 */
7563 break;
7564
7565 case 462:
7566#line 4596 "querytransformparser.ypp" /* yacc.c:1652 */
7567 {
7568 (yyval.qName) = parseInfo->staticContext->namePool()->allocateQName(uri: parseInfo->staticContext->defaultFunctionNamespace(), localName: (yyvsp[0].sval));
7569 }
7570#line 7522 "qquerytransformparser.cpp" /* yacc.c:1652 */
7571 break;
7572
7573 case 463:
7574#line 4600 "querytransformparser.ypp" /* yacc.c:1652 */
7575 {
7576 (yyval.qName) = parseInfo->staticContext->namePool()->allocateQName(uri: StandardNamespaces::InternalXSLT, ln: (yyvsp[0].sval));
7577 }
7578#line 7530 "qquerytransformparser.cpp" /* yacc.c:1652 */
7579 break;
7580
7581 case 466:
7582#line 4608 "querytransformparser.ypp" /* yacc.c:1652 */
7583 {
7584 parseInfo->staticContext->error(message: QtXmlPatterns::tr(sourceText: "The name of an extension expression must be in "
7585 "a namespace."),
7586 errorCode: ReportContext::XPST0081, sourceLocation: fromYYLTYPE(sourceLocator: (yyloc), parseInfo));
7587 }
7588#line 7540 "qquerytransformparser.cpp" /* yacc.c:1652 */
7589 break;
7590
7591 case 469:
7592#line 4618 "querytransformparser.ypp" /* yacc.c:1652 */
7593 {
7594 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, sourceLocator: (yyloc));
7595 }
7596#line 7548 "qquerytransformparser.cpp" /* yacc.c:1652 */
7597 break;
7598
7599 case 470:
7600#line 4622 "querytransformparser.ypp" /* yacc.c:1652 */
7601 {
7602 allowedIn(allowedLanguages: QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XPath20), parseInfo, sourceLocator: (yyloc));
7603 }
7604#line 7556 "qquerytransformparser.cpp" /* yacc.c:1652 */
7605 break;
7606
7607 case 471:
7608#line 4627 "querytransformparser.ypp" /* yacc.c:1652 */
7609 {
7610
7611 const ReflectYYLTYPE ryy((yyloc), parseInfo);
7612
7613 (yyval.qName) = QNameConstructor::
7614 expandQName<StaticContext::Ptr,
7615 ReportContext::XPST0081,
7616 ReportContext::XPST0081>(lexicalQName: (yyvsp[0].sval), context: parseInfo->staticContext,
7617 nsResolver: parseInfo->staticContext->namespaceBindings(), r: &ryy);
7618
7619 }
7620#line 7572 "qquerytransformparser.cpp" /* yacc.c:1652 */
7621 break;
7622
7623 case 472:
7624#line 4639 "querytransformparser.ypp" /* yacc.c:1652 */
7625 {
7626 (yyval.qName) = parseInfo->staticContext->namePool()->fromClarkName(clarkName: (yyvsp[0].sval));
7627 }
7628#line 7580 "qquerytransformparser.cpp" /* yacc.c:1652 */
7629 break;
7630
7631
7632#line 7584 "qquerytransformparser.cpp" /* yacc.c:1652 */
7633 default: break;
7634 }
7635 /* User semantic actions sometimes alter yychar, and that requires
7636 that yytoken be updated with the new translation. We take the
7637 approach of translating immediately before every use of yytoken.
7638 One alternative is translating here after every semantic action,
7639 but that translation would be missed if the semantic action invokes
7640 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
7641 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
7642 incorrect destructor might then be invoked immediately. In the
7643 case of YYERROR or YYBACKUP, subsequent parser actions might lead
7644 to an incorrect destructor call or verbose syntax error message
7645 before the lookahead is translated. */
7646 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
7647
7648 YYPOPSTACK (yylen);
7649 yylen = 0;
7650 YY_STACK_PRINT (yyss, yyssp);
7651
7652 *++yyvsp = yyval;
7653 *++yylsp = yyloc;
7654
7655 /* Now 'shift' the result of the reduction. Determine what state
7656 that goes to, based on the state we popped back to and the rule
7657 number reduced by. */
7658 {
7659 const int yylhs = yyr1[yyn] - YYNTOKENS;
7660 const int yyi = yypgoto[yylhs] + *yyssp;
7661 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
7662 ? yytable[yyi]
7663 : yydefgoto[yylhs]);
7664 }
7665
7666 goto yynewstate;
7667
7668
7669/*--------------------------------------.
7670| yyerrlab -- here on detecting error. |
7671`--------------------------------------*/
7672yyerrlab:
7673 /* Make sure we have latest lookahead translation. See comments at
7674 user semantic actions for why this is necessary. */
7675 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
7676
7677 /* If not already recovering from an error, report this error. */
7678 if (!yyerrstatus)
7679 {
7680 ++yynerrs;
7681#if ! YYERROR_VERBOSE
7682 yyerror (&yylloc, parseInfo, YY_("syntax error"));
7683#else
7684# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
7685 yyssp, yytoken)
7686 {
7687 char const *yymsgp = YY_("syntax error");
7688 int yysyntax_error_status;
7689 yysyntax_error_status = YYSYNTAX_ERROR;
7690 if (yysyntax_error_status == 0)
7691 yymsgp = yymsg;
7692 else if (yysyntax_error_status == 1)
7693 {
7694 if (yymsg != yymsgbuf)
7695 YYSTACK_FREE (ptr: yymsg);
7696 yymsg = (char *) YYSTACK_ALLOC (size: yymsg_alloc);
7697 if (!yymsg)
7698 {
7699 yymsg = yymsgbuf;
7700 yymsg_alloc = sizeof yymsgbuf;
7701 yysyntax_error_status = 2;
7702 }
7703 else
7704 {
7705 yysyntax_error_status = YYSYNTAX_ERROR;
7706 yymsgp = yymsg;
7707 }
7708 }
7709 yyerror (sourceLocator: &yylloc, parseInfo, msg: yymsgp);
7710 if (yysyntax_error_status == 2)
7711 goto yyexhaustedlab;
7712 }
7713# undef YYSYNTAX_ERROR
7714#endif
7715 }
7716
7717 yyerror_range[1] = yylloc;
7718
7719 if (yyerrstatus == 3)
7720 {
7721 /* If just tried and failed to reuse lookahead token after an
7722 error, discard it. */
7723
7724 if (yychar <= YYEOF)
7725 {
7726 /* Return failure if at end of input. */
7727 if (yychar == YYEOF)
7728 YYABORT;
7729 }
7730 else
7731 {
7732 yydestruct (yymsg: "Error: discarding",
7733 yytype: yytoken, yyvaluep: &yylval, yylocationp: &yylloc, parseInfo);
7734 yychar = YYEMPTY;
7735 }
7736 }
7737
7738 /* Else will try to reuse lookahead token after shifting the error
7739 token. */
7740 goto yyerrlab1;
7741
7742
7743/*---------------------------------------------------.
7744| yyerrorlab -- error raised explicitly by YYERROR. |
7745`---------------------------------------------------*/
7746yyerrorlab:
7747 /* Pacify compilers when the user code never invokes YYERROR and the
7748 label yyerrorlab therefore never appears in user code. */
7749 if (0)
7750 YYERROR;
7751
7752 /* Do not reclaim the symbols of the rule whose action triggered
7753 this YYERROR. */
7754 YYPOPSTACK (yylen);
7755 yylen = 0;
7756 YY_STACK_PRINT (yyss, yyssp);
7757 yystate = *yyssp;
7758 goto yyerrlab1;
7759
7760
7761/*-------------------------------------------------------------.
7762| yyerrlab1 -- common code for both syntax error and YYERROR. |
7763`-------------------------------------------------------------*/
7764yyerrlab1:
7765 yyerrstatus = 3; /* Each real token shifted decrements this. */
7766
7767 for (;;)
7768 {
7769 yyn = yypact[yystate];
7770 if (!yypact_value_is_default (yyn))
7771 {
7772 yyn += YYTERROR;
7773 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
7774 {
7775 yyn = yytable[yyn];
7776 if (0 < yyn)
7777 break;
7778 }
7779 }
7780
7781 /* Pop the current state because it cannot handle the error token. */
7782 if (yyssp == yyss)
7783 YYABORT;
7784
7785 yyerror_range[1] = *yylsp;
7786 yydestruct (yymsg: "Error: popping",
7787 yytype: yystos[yystate], yyvaluep: yyvsp, yylocationp: yylsp, parseInfo);
7788 YYPOPSTACK (1);
7789 yystate = *yyssp;
7790 YY_STACK_PRINT (yyss, yyssp);
7791 }
7792
7793 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
7794 *++yyvsp = yylval;
7795 YY_IGNORE_MAYBE_UNINITIALIZED_END
7796
7797 yyerror_range[2] = yylloc;
7798 /* Using YYLLOC is tempting, but would change the location of
7799 the lookahead. YYLOC is available though. */
7800 YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
7801 *++yylsp = yyloc;
7802
7803 /* Shift the error token. */
7804 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
7805
7806 yystate = yyn;
7807 goto yynewstate;
7808
7809
7810/*-------------------------------------.
7811| yyacceptlab -- YYACCEPT comes here. |
7812`-------------------------------------*/
7813yyacceptlab:
7814 yyresult = 0;
7815 goto yyreturn;
7816
7817
7818/*-----------------------------------.
7819| yyabortlab -- YYABORT comes here. |
7820`-----------------------------------*/
7821yyabortlab:
7822 yyresult = 1;
7823 goto yyreturn;
7824
7825
7826#if !defined yyoverflow || YYERROR_VERBOSE
7827/*-------------------------------------------------.
7828| yyexhaustedlab -- memory exhaustion comes here. |
7829`-------------------------------------------------*/
7830yyexhaustedlab:
7831 yyerror (sourceLocator: &yylloc, parseInfo, YY_("memory exhausted"));
7832 yyresult = 2;
7833 /* Fall through. */
7834#endif
7835
7836
7837/*-----------------------------------------------------.
7838| yyreturn -- parsing is finished, return the result. |
7839`-----------------------------------------------------*/
7840yyreturn:
7841 if (yychar != YYEMPTY)
7842 {
7843 /* Make sure we have latest lookahead translation. See comments at
7844 user semantic actions for why this is necessary. */
7845 yytoken = YYTRANSLATE (yychar);
7846 yydestruct (yymsg: "Cleanup: discarding lookahead",
7847 yytype: yytoken, yyvaluep: &yylval, yylocationp: &yylloc, parseInfo);
7848 }
7849 /* Do not reclaim the symbols of the rule whose action triggered
7850 this YYABORT or YYACCEPT. */
7851 YYPOPSTACK (yylen);
7852 YY_STACK_PRINT (yyss, yyssp);
7853 while (yyssp != yyss)
7854 {
7855 yydestruct (yymsg: "Cleanup: popping",
7856 yytype: yystos[*yyssp], yyvaluep: yyvsp, yylocationp: yylsp, parseInfo);
7857 YYPOPSTACK (1);
7858 }
7859#ifndef yyoverflow
7860 if (yyss != yyssa)
7861 YYSTACK_FREE (yyss);
7862#endif
7863#if YYERROR_VERBOSE
7864 if (yymsg != yymsgbuf)
7865 YYSTACK_FREE (ptr: yymsg);
7866#endif
7867 return yyresult;
7868}
7869#line 4643 "querytransformparser.ypp" /* yacc.c:1918 */
7870
7871
7872QString Tokenizer::tokenToString(const Token &token)
7873{
7874 switch(token.type)
7875 {
7876 case T_NCNAME:
7877 case T_QNAME:
7878 case T_NUMBER:
7879 case T_XPATH2_NUMBER:
7880 return token.value;
7881 case T_STRING_LITERAL:
7882 return QLatin1Char('"') + token.value + QLatin1Char('"');
7883 default:
7884 {
7885 const QString raw(QString::fromLatin1(str: yytname[YYTRANSLATE(token.type)]));
7886
7887 /* Remove the quotes. */
7888 if(raw.at(i: 0) == QLatin1Char('"') && raw.length() > 1)
7889 return raw.mid(position: 1, n: raw.length() - 2);
7890 else
7891 return raw;
7892 }
7893 }
7894}
7895
7896} /* namespace Patternist */
7897
7898QT_END_NAMESPACE
7899
7900// vim: et:ts=4:sw=4:sts=4:syntax=yacc
7901

source code of qtxmlpatterns/src/xmlpatterns/parser/qquerytransformparser.cpp