Qt 4.8
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
QPatternist Namespace Reference

The namespace for the internal API of QtXmlPatterns. More...

Namespaces

 CommonNamespaces
 Contains common, standardized XML namespaces.
 
 OptimizationPasses
 Contains a set of common OptimizerPass instances.
 

Classes

class  AbsFN
 Implements the function fn:abs(). More...
 
class  AbstractDateTime
 Base class for classes implementing values related to time, date or both. More...
 
class  AbstractDateTimeComparator
 Compares sub-classes of AbstractDateTime. More...
 
class  AbstractDateTimeMathematician
 Performs arithmetics between two AbstractDateTime values. More...
 
class  AbstractDateTimeToDateCaster
 Casts an AbstractDateTime instance to SchemaTime. More...
 
class  AbstractDateTimeToDateTimeCaster
 Casts an AbstractDateTime instance to DateTime. More...
 
class  AbstractDateTimeToGDayCaster
 Casts a xs:date or xs:dateTime atomic value to xs:gDay. More...
 
class  AbstractDateTimeToGMonthCaster
 Casts a xs:date or xs:dateTime atomic value to xs:gMonth. More...
 
class  AbstractDateTimeToGMonthDayCaster
 Casts a xs:date or xs:dateTime atomic value to xs:gMonthDay. More...
 
class  AbstractDateTimeToGYearCaster
 Casts a xs:date or xs:dateTime atomic value to xs:gYear. More...
 
class  AbstractDateTimeToGYearMonthCaster
 Casts a xs:date or xs:dateTime atomic value to xs:gYearMonth. More...
 
class  AbstractDateTimeToTimeCaster
 Casts an AbstractDateTime instance to SchemaTime. More...
 
class  AbstractDuration
 Base class for classes implementing durations. More...
 
class  AbstractDurationComparator
 Compares sub-classes of AbstractDuration. More...
 
class  AbstractDurationToDayTimeDurationCaster
 Casts an AbstractDuration instance to DayTimeDuration. More...
 
class  AbstractDurationToDurationCaster
 Casts an AbstractDuration instance to Duration. More...
 
class  AbstractDurationToYearMonthDurationCaster
 Casts an AbstractDuration instance to YearMonthDuration. More...
 
class  AbstractFloat
 Base template class for Float and Double classes. More...
 
class  AbstractFloatComparator
 Compares xs:double values. More...
 
class  AbstractFloatMathematician
 Performs arithmetics between AbstractFloat values (Float and Double classes). More...
 
class  AbstractFloatSortComparator
 Compares xs:double values for the purpose of sorting. More...
 
class  AbstractFunctionFactory
 Supplies convenience code for the function factories. More...
 
class  AbstractNodeTest
 A name test that is of the type prefix:ncName. More...
 
class  AbstractXmlPullProvider
 
class  AccelIterator
 Abstract base class for Iterators for the AccelTree, that contains common functions and members. More...
 
class  AccelTree
 Stores an XML document using the XPath Accelerator scheme, also known as pre/post numbering. More...
 
class  AccelTreeBuilder
 Builds an AccelTree from a stream of XML/Item events received through the NodeBuilder interface. More...
 
class  AccelTreePrivate
 
class  AccelTreeResourceLoader
 Handles requests for documents, and instantiates them as AccelTree instances. More...
 
class  AddingAggregate
 Base class for the implementations of the fn:avg() and fn:sum() function. More...
 
class  AdjustDateTimeToTimezoneFN
 Implements the function fn:adjust-dateTime-to-timezone(). More...
 
class  AdjustDateToTimezoneFN
 Implements the function fn:adjust-dateTime-to-timezone(). More...
 
class  AdjustTimeToTimezoneFN
 Implements the function fn:adjust-time-to-timezone(). More...
 
class  AdjustTimezone
 Base class for classes implementing functions changing the timezone on values. More...
 
class  Aggregator
 Carries a staticType() implementation appropriate for functions which returns a singleton value derived from its first argument. More...
 
class  AncestorIterator
 Iterates along the ancestor or ancestor-or-self axis in an AccelTree. More...
 
class  AndExpression
 Implements XPath 2.0's logical expression and. More...
 
class  AnyAtomicType
 Implements the type xs:anyAtomicType. More...
 
class  AnyItemType
 Represents the item() item type. More...
 
class  AnyNodeType
 Represents the node() item type. More...
 
class  AnySimpleType
 Represents the xs:anySimpleType item type. More...
 
class  AnyToDerivedStringCaster
 Casts an xs:boolean instance to a derived type of xs:integer. More...
 
class  AnyType
 Represents the xs:anyType item type. More...
 
class  AnyURI
 A value of type xs:anyURI. More...
 
class  AnyURIType
 Implements the type xs:anyURI. More...
 
class  ApplyTemplate
 When combined with other components, implements xsl:apply-templates. More...
 
class  ArgumentConverter
 UntypedAtomicConverter for ArgumentReference, if needed. More...
 
class  ArgumentReference
 A reference to an argument declared in a UserFunction. More...
 
class  ArithmeticExpression
 Implements arithmetics, such as multiplication and subtraction. More...
 
class  AtomicCaster
 AtomicCaster is an abstract base class for classes that performs casting between two atomic values of specific types. More...
 
class  AtomicCasterLocator
 
class  AtomicComparator
 Base class for classes responsible of comparing two atomic values. More...
 
class  AtomicComparatorLocator
 
class  AtomicMathematician
 Base class for classes that performs arithmetic operations between atomic values. More...
 
class  AtomicMathematicianLocator
 
class  AtomicString
 Implements the value instance of the xs:string type. More...
 
class  AtomicType
 Base class for all classes that implements atomic types. More...
 
class  AtomicTypeVisitor
 
class  AtomicTypeVisitorResult
 
class  AtomicValue
 Base class for all classes representing atomic values. More...
 
class  Atomizer
 Performs atomization. Effectively, it is an implementation of the fn:data() function. More...
 
class  AttributeConstructor
 Constructs an element node. This covers both computed and directly constructed element nodes. More...
 
class  AttributeIterator
 Implements axis attribute for the AccelTree. More...
 
class  AttributeNameValidator
 Ensures the lexical space of the string value of the Item returned from its child Expression is an NCName. Also possibly changes the name by generating a prefix if one is needed. More...
 
class  AutoPtr
 A smart pointer very similar to std::auto_ptr. More...
 
class  AutoPtrRef
 
class  AvgFN
 Implements the function fn:avg(). More...
 
class  AxisStep
 A step in a path expression that with an axis and a node test evaluates to a sequence of nodes from the context item. More...
 
class  Base64Binary
 Implements the value instance of the xs:base64Binary type. More...
 
class  Base64BinaryComparatorLocator
 
class  Base64BinaryToHexBinaryCaster
 Casts a xs:base64Binary atomic value to xs:hexBinary. More...
 
class  Base64BinaryType
 Implements the type xs:base64Binary. More...
 
class  BaseURIFN
 Implements the function fn:base-uri(). More...
 
class  BasicTypesFactory
 Factory for creating schema types for the types defined in XSL-T 2.0. More...
 
class  BinaryDataComparator
 Compares xs:base64Binary and xs:hexBinary values. More...
 
class  Boolean
 Implements the value instance of the xs:boolean type. More...
 
class  BooleanComparator
 Compares xs:boolean values. More...
 
class  BooleanComparatorLocator
 
class  BooleanFN
 Implements the function fn:boolean(). More...
 
class  BooleanIdentifier
 Matches boolean literals. More...
 
class  BooleanToAbstractFloatCaster
 Casts a value of type xs:boolean to xs:double or xs:float. More...
 
class  BooleanToDecimalCaster
 Casts a value of type xs:boolean to xs:decimal. More...
 
class  BooleanToDerivedIntegerCaster
 Casts an xs:boolean instance to a derived type of xs:integer. More...
 
class  BooleanToIntegerCaster
 Casts a value of type xs:boolean to xs:integer. More...
 
class  BooleanType
 Implements the type xs:boolean. More...
 
class  BuiltinAtomicType
 Instances of this class represents types that are sub-classes of xs:anyAtomicType. More...
 
class  BuiltinNodeType
 Instances of this class represents types that are sub-classes of node(), such as processing-instruction(). More...
 
class  BuiltinTypes
 Provides access to singleton instances of ItemType and SchemaType sub-classes. More...
 
class  ByIDCreator
 Creates a particular Expression instance identified by an Expression::ID. More...
 
class  ByIDIdentifier
 Identifies Expression instances by their Expression::id(). More...
 
class  BySequenceTypeIdentifier
 Identifies Expression instances based on their static type. More...
 
class  CachingIterator
 An QAbstractXmlForwardIterator that gets its item from a cache unless its empty, in which case it continues to populate the cache as well as deliver on its own from a source QAbstractXmlForwardIterator. More...
 
class  CallSite
 Abstract base-class for Expression instances that are callsites to other components, such as templates or user functions. More...
 
class  CallTargetDescription
 Contains metadata for a callable component, such as a function or template. More...
 
class  CallTemplate
 Implements xsl:call-template. More...
 
class  Cardinality
 Represents a cardinality, a possible , often represented by occurrence indicators. More...
 
class  CardinalityVerifier
 Verifies that the sequence an Expression evaluates to conforms to a Cardinality. More...
 
class  CaseInsensitiveStringComparator
 Performs case insensitive string comparison between xs:anyUri, xs:string, and xs:untypedAtomic. More...
 
class  CastableAs
 Implements XPath 2.0's castable as expression. More...
 
class  CastAs
 Implements XPath 2.0's cast as expression. More...
 
class  CastingPlatform
 Provides casting functionality for classes, such as CastAs or NumberFN, which needs to perform casting. More...
 
class  CeilingFN
 Implements the function fn:ceiling(). More...
 
class  ChildIterator
 Iterates along the child axis in an AccelTree. More...
 
class  CodepointEqualFN
 Implements the function fn:codepoint-equal(). More...
 
class  CodepointsToStringFN
 Implements the function fn:codepoints-to-string(). More...
 
class  CollationChecker
 Checks that its operand evaluates to a supported string collation. More...
 
class  CollectionFN
 Implements the function fn:collection(). More...
 
class  ColoringMessageHandler
 
class  ColorOutput
 
class  ColorOutputPrivate
 
class  CombineNodes
 Implements XPath 2.0's operators for combining node sequences: union, intersect and except. More...
 
class  CommentConstructor
 Constructs a comment node. This covers both computed and directly constructed text nodes. More...
 
class  CommonSequenceTypes
 Provides access to singleton instances of SequenceType sub-classes. More...
 
class  CommonValues
 A collection of common values. More...
 
class  CompareFN
 Implements the function fn:compare(). More...
 
class  ComparesCaseAware
 Base-class for functions that compares strings and provides an opportunity to optimize compares intended to be case insensitive. More...
 
class  ComparingAggregator
 Base class for the implementations of the fn:min() and fn:max() function. More...
 
class  ComparisonFactory
 Provides compare(), which is a high-level helper function for comparing atomic values. More...
 
class  ComparisonIdentifier
 Determines whether an Expression is a value or general comparison or both, with a certain operator. More...
 
class  ComparisonPlatform
 Provides comparison functionality for classes that compare Items, such as ValueComparison or MaxFN. More...
 
class  CompressedWhitespace
 A compression facility for whitespace nodes. More...
 
class  ComputedNamespaceConstructor
 Constructs a namespace on an element, and naturally only appears as a child of ElementConstructor. More...
 
class  ConcatFN
 Implements the function fn:concat(). More...
 
class  ConstructorFunctionsFactory
 A function factory that handles the builtin constructor functions, such as xs:time(). More...
 
class  ContainsFN
 Implements the function fn:contains(). More...
 
class  ContextItem
 Implements the context item, the dot: .. More...
 
class  ContextNodeChecker
 Helper class that checks that the context node is a document node. More...
 
class  CopyOf
 Does node copying in a parameterized way, in order to deal with namespace preservation/inheritance. More...
 
class  CountFN
 Implements the function fn:count(). More...
 
class  CppCastingHelper
 Provides convenience methods for performing static casts between C++ classes. More...
 
class  CurrentDateFN
 Implements the function fn:current-date(). More...
 
class  CurrentDateTimeFN
 Implements the function fn:current-dateTime(). More...
 
class  CurrentFN
 Implements XSL-T's function fn:current(). More...
 
class  CurrentItemContext
 A DynamicContext that maintains the focus, a sequence of items. More...
 
class  CurrentItemStore
 Creates a DynamicContext which provides the focus item for the function fn:current(). More...
 
class  CurrentTimeFN
 Implements the function fn:current-time(). More...
 
class  Date
 Implements the value instance of the xs:date type. More...
 
class  DateComparatorLocator
 
class  DateMathematicianLocator
 
class  DateTime
 Implements the value instance of the xs:dateTime type. More...
 
class  DateTimeComparatorLocator
 
class  DateTimeDurationMathematician
 Performs arithmetics between an AbstractDateTime value and an AbstractDuration value. More...
 
class  DateTimeFN
 Implements the function fn:dateTime(). More...
 
class  DateTimeMathematicianLocator
 
class  DateTimeType
 Implements the type xs:dateTime. More...
 
class  DateType
 Implements the type xs:date. More...
 
class  DayFromAbstractDateTimeFN
 Extracts the day property from a sub-class of AbstractDateTime such as DateTime or Date. This function implements fn:day-from-dateTime() and fn:day-from-date(). More...
 
class  DaysFromDurationFN
 Implements the function fn:days-from-duration(). More...
 
class  DayTimeDuration
 Implements the value instance of the xs:dayTimeDuration type. More...
 
class  DayTimeDurationComparatorLocator
 
class  DayTimeDurationMathematicianLocator
 
class  DayTimeDurationType
 Implements the type xs:dayTimeDuration. More...
 
class  Decimal
 Implements the value instance of the xs:decimal type. More...
 
class  DecimalComparator
 Compares xs:decimal values. More...
 
class  DecimalComparatorLocator
 
class  DecimalMathematician
 
class  DecimalMathematicianLocator
 
class  DecimalType
 Implements the type xs:decimal. More...
 
class  DeduplicateIterator
 Performs deduplication of the nodes on its source list. More...
 
class  DeepEqualFN
 Implements the function fn:deep-equal(). More...
 
class  DefaultCollationFN
 Implements the function fn:default-collation(). More...
 
class  DelegatingDynamicContext
 Base class for dynamic contexts that are created from an existing one. More...
 
class  DelegatingNamespaceResolver
 Contains a set of bindings, plus a pointer to another resolver which is delegates requests to, in case it can't handle a lookup on its own. More...
 
class  DelegatingSourceLocationReflection
 
class  DelegatingStaticContext
 Delegates all members to a second instance. Used for sub-classing. More...
 
class  DerivedInteger
 Represents instances of derived xs:integer types, such as xs:byte. More...
 
class  DerivedIntegerDetails
 
class  DerivedIntegerDetails< TypeByte >
 
class  DerivedIntegerDetails< TypeInt >
 
class  DerivedIntegerDetails< TypeLong >
 
class  DerivedIntegerDetails< TypeNegativeInteger >
 
class  DerivedIntegerDetails< TypeNonNegativeInteger >
 
class  DerivedIntegerDetails< TypeNonPositiveInteger >
 
class  DerivedIntegerDetails< TypePositiveInteger >
 
class  DerivedIntegerDetails< TypeShort >
 
class  DerivedIntegerDetails< TypeUnsignedByte >
 
class  DerivedIntegerDetails< TypeUnsignedInt >
 
class  DerivedIntegerDetails< TypeUnsignedLong >
 
class  DerivedIntegerDetails< TypeUnsignedShort >
 
class  DerivedIntegerType
 
class  DerivedString
 Represents instances of derived xs:string types, such as xs:normalizedString. More...
 
class  DerivedStringType
 
class  DescendantIterator
 Implements axis descendant and descendant-or-self for the AccelTree. More...
 
class  DeviceResourceLoader
 Base class for resource loaders that manage device variables. More...
 
class  DistinctIterator
 Filters another sequence by removing duplicates such that the items are unique. More...
 
class  DistinctValuesFN
 Implements the function fn:distinct-values(). More...
 
class  DocAvailableFN
 Implements the function fn:doc-available(). More...
 
class  DocFN
 Implements the function fn:doc(). More...
 
class  DocumentConstructor
 Constructs a text node. This covers both computed and directly constructed text nodes. More...
 
class  DocumentContentValidator
 Receives QAbstractXmlReceiver events and validates that they are correct, before sending them on to a second QAbstractXmlReceiver. More...
 
class  DocumentFN
 Implements XSL-T's function fn:document(). More...
 
class  DocumentProjector
 
class  DocumentURIFN
 Implements the function fn:document-uri(). More...
 
class  DoubleComparatorLocator
 
class  DoubleMathematicianLocator
 
class  DoubleType
 Implements the type xs:double. More...
 
class  Duration
 Implements the value instance of the xs:duration type. More...
 
class  DurationComparatorLocator
 
class  DurationDurationDivisor
 Performs division between DayTimeDuration and DayTimeDuration, or YearMonthDuration and YearMonthDuration. More...
 
class  DurationDurationMathematician
 Performs arithmetics between DayTimeDuration and DayTimeDuration, or YearMonthDuration and YearMonthDuration. More...
 
class  DurationNumericMathematician
 Performs division or multiplication between either DayTimeDuration or YearMonthDuration and Double values. More...
 
class  DurationType
 Implements the type xs:duration. More...
 
class  DynamicContext
 Carries information and facilities used at runtime, and hence provides a state for that stage in a thread-safe manner. More...
 
class  DynamicContextStore
 Evaluates its operand with an assigned DynamicContext, not the one passed to one of the evaluation functions. More...
 
class  EBVExtractor
 Calculates the Effective Boolean Value of its operand. More...
 
class  EBVType
 Represents the type for which a value of can an Effective Boolean Value be extracted from. More...
 
class  ElementAvailableFN
 Implements the function fn:unparsed-text(). More...
 
class  ElementConstructor
 Constructs an element node. This covers both computed and directly constructed element nodes. More...
 
class  ElementDescription
 A structure that lists the optional and required attributes of an element. Used with MaintainingReader. More...
 
class  ElementNamespaceHandler
 A helper class for automatically handling namespace scopes of elements. More...
 
class  EmptyContainer
 Base class for expressions that has no operands. More...
 
class  EmptyIterator
 An QAbstractXmlForwardIterator which always is empty. More...
 
class  EmptySequence
 Implements the value instance of empty sequence: (). More...
 
class  EmptySequenceType
 Represents the empty-sequence() type. More...
 
class  EncodeForURIFN
 Implements the function fn:encode-for-uri(). More...
 
class  EncodeString
 Provides functionality for encoding strings. Sub-classed by various function implementations. More...
 
class  EndsWithFN
 Implements the function fn:ends-with(). More...
 
union  EnumUnion
 A union of all the enums the parser uses. More...
 
class  ErrorFN
 Implements the function fn:error(). More...
 
class  EscapeHtmlURIFN
 Implements the function fn:escape-html-uri(). More...
 
class  EvaluationCache
 Evaluates to the same result as its operand, but ensures the operand is evaluated once even if this Expression is evaluated several times. More...
 
class  ExceptIterator
 Implements the except operator. That is, the computation of the sequence of nodes from one sequence, that doesn't appear in the other. More...
 
class  Existence
 Implements the functions fn:exists() and fn:empty(). More...
 
class  Expression
 Base class for all AST nodes in an XPath/XQuery/XSL-T expression. More...
 
class  ExpressionCreator
 A factory for creating Expression instances. More...
 
class  ExpressionFactory
 The central entry point for compiling expressions. More...
 
class  ExpressionIdentifier
 Abstract base class for all classes that identify Expressions based on some criteria. More...
 
class  ExpressionSequence
 Implements the comma(",") operator, the sequence constructor. More...
 
class  ExpressionVariableReference
 A reference to a variable declared with declare variable or let. More...
 
class  ExpressionVisitor
 
class  ExpressionVisitorResult
 
class  ExternalVariableLoader
 Responsible for loading and declaring available external variables. More...
 
class  ExternalVariableReference
 A reference to an external variable. More...
 
class  ExtractFromDateTimeFN
 Helper class for implementing functions extracting components from date/time values. More...
 
class  ExtractFromDurationFN
 Helper class for implementing functions extracting components from durations. More...
 
class  FalseFN
 Implements the function fn:false(). More...
 
class  FieldNode
 A helper class for validating identity constraints. More...
 
class  FirstItemPredicate
 A predicate that always selects the first item from its sequence. More...
 
class  FloatComparatorLocator
 
class  FloatMathematicianLocator
 
class  FloatType
 Implements the type xs:float. More...
 
class  FloorFN
 Implements the function fn:floor(). More...
 
class  Focus
 A DynamicContext that maintains the focus, a sequence of items. More...
 
class  FollowingIterator
 Implements axis following for the AccelTree. More...
 
class  ForClause
 Implements XPath 2.0's for expression. More...
 
class  FunctionArgument
 Carries meta data for a function argument as found in XPath's builtin functions and user declared functions in XQuery and XSL-T. More...
 
class  FunctionAvailableFN
 Implements XSL-T 2.0's XPath function fn:function-available(). More...
 
class  FunctionCall
 Base class for implementations of builtin functions. More...
 
class  FunctionFactory
 An entry point for looking up and creating FunctionCall instances. More...
 
class  FunctionFactoryCollection
 A FunctionFactoryCollection instance is a FunctionFactory in its own right, but looks in its contained collection of factories for requested functions. More...
 
class  FunctionSignature
 Represents the signature of an XPath function. More...
 
class  GDay
 Implements the value instance of the xs:gDay type. More...
 
class  GDayComparatorLocator
 
class  GDayType
 Implements the type xs:gDay. More...
 
class  GeneralComparison
 Implements XPath 2.0's general comparions, such as the = operator. More...
 
class  GenerateIDFN
 Implements the function fn:generate-id(). More...
 
class  GenericDynamicContext
 A DynamicContext supplying basic information that always is used. More...
 
class  GenericNamespaceResolver
 Generic namespace resolver which resolves lookups against entries in a QHash. More...
 
class  GenericPredicate
 A predicate that can handle all kinds of predicates and is therefore not very efficient, but can cope with all the tricky scenarios. More...
 
class  GenericSequenceType
 
class  GenericStaticContext
 Provides setters and getters for the properties defined in StaticContext. More...
 
class  GMonth
 Implements the value instance of the xs:gMonth type. More...
 
class  GMonthComparatorLocator
 
class  GMonthDay
 Implements the value instance of the xs:gYearMonth type. More...
 
class  GMonthDayComparatorLocator
 
class  GMonthDayType
 Implements the type xs:gMonthDay. More...
 
class  GMonthType
 Implements the type xs:gMonth. More...
 
class  GYear
 Implements the value instance of the xs:gYear type. More...
 
class  GYearComparatorLocator
 
class  GYearMonth
 Implements the value instance of the xs:gYearMonth type. More...
 
class  GYearMonthComparatorLocator
 
class  GYearMonthType
 Implements the type xs:gYearMonth. More...
 
class  GYearType
 Implements the type xs:gYear. More...
 
class  HexBinary
 Implements the value instance of the xs:hexBinary type. More...
 
class  HexBinaryComparatorLocator
 
class  HexBinaryToBase64BinaryCaster
 Casts a xs:hexBinary atomic value to xs:base64Binary. More...
 
class  HexBinaryType
 Implements the type xs:hexBinary. More...
 
class  HoursFromAbstractDateTimeFN
 Extracts the minute property from a sub-class of AbstractDateTime such as DateTime or SchemaTime. Implements the functions fn:hours-from-dateTime() and fn:hours-from-time(). More...
 
class  HoursFromDurationFN
 Implements the function fn:hours-from-duration(). More...
 
class  IdFN
 Implements the function fn:id(). More...
 
class  IdrefFN
 Implements the function fn:idref(). More...
 
class  IfThenClause
 Implements XPath 2.0's conditional expression if([expr]) then [expr] else [expr]. More...
 
class  ImplicitTimezoneFN
 Implements the function fn:implicit-timezone(). More...
 
class  IndexOfFN
 Implements the function fn:index-of(). More...
 
class  IndexOfIterator
 Forms an QAbstractXmlForwardIterator over a sequence of integers, which each is the position of where a search parameter appeared in another QAbstractXmlForwardIterator. More...
 
class  InScopePrefixesFN
 Implements the function fn:in-scope-prefixes(). More...
 
class  InsertBeforeFN
 Implements the function fn:insert-before(). More...
 
class  InsertionIterator
 Conceptually inserts one QAbstractXmlForwardIterator into another, make two QAbstractXmlForwardIterator instances appear as one. More...
 
class  InstanceOf
 Implements XPath 2.0's instance of expression. More...
 
class  Integer
 Implements the value instance of the xs:integer type. More...
 
class  IntegerComparator
 Compares xs:integer values. More...
 
class  IntegerComparatorLocator
 
class  IntegerIdentifier
 Matches numeric literals that are of type xs:integer and has a specific value. More...
 
class  IntegerMathematician
 Performs arithmetics between Integer values. More...
 
class  IntegerMathematicianLocator
 
class  IntegerType
 Implements the type xs:integer. More...
 
class  IntersectIterator
 Implements the intersect operator. That is, the computation of the intersection between two sequences of nodes. More...
 
class  IriToURIFN
 Implements the function fn:iri-to-uri(). More...
 
class  Item
 Represents an item in the XPath 2.0 Data Model. More...
 
class  ItemCacheCell
 Represents a cache entry for a single Item, as opposed to for a sequence of items. More...
 
class  ItemMappingIterator
 Proxies another QAbstractXmlForwardIterator, and for each item, returns the Item returned from a mapping function. More...
 
class  ItemSequenceCacheCell
 Represents a cache entry for a sequence of items. More...
 
class  ItemType
 Base class for the XPath Data Model's type hierarchy. More...
 
class  ItemVerifier
 Verifies that the items in a sequence an Expression evaluates is of a certain ItemType. More...
 
class  IteratorVector
 
class  LangFN
 Implements the function fn:lang(). More...
 
class  LastFN
 Implements the function fn:last(). More...
 
class  LetClause
 Represents a let-clause, but is only used at compile time. More...
 
class  ListIterator
 Bridges values in Qt's QList container class into an QAbstractXmlForwardIterator. More...
 
class  ListIteratorPlatform
 Helper class for ListIterator, and should only be instantiated through sub-classing. More...
 
class  Literal
 Houses an AtomicValue, making it available as an Expression. More...
 
class  LiteralSequence
 Houses a sequence of atomic values, making it available as an Expression. More...
 
class  LocalNameFN
 Implements the function fn:local-name(). More...
 
class  LocalNameFromQNameFN
 Implements the function fn:local-name-from-QXmlName(). More...
 
class  LocalNameTest
 A name test that is of the type *:local-name. More...
 
class  LowerCaseFN
 Implements the function fn:lower-case(). More...
 
class  MaintainingReader
 Base class for tokenizers that reads XML formats. This is XSLTTokenizer, and the W3C XML Schema parser. More...
 
class  MatchesFN
 Implements the function fn:matches(). More...
 
class  MergeIterator
 
class  MinutesFromAbstractDateTimeFN
 Extracts the minutes property from a sub-class of AbstractDateTime such as DateTime or Date. Implements the functions fn:minutes-from-dateTime() and fn:minutes-from-time(). More...
 
class  MinutesFromDurationFN
 Implements the function fn:minutes-from-duration(). More...
 
class  MonthFromAbstractDateTimeFN
 implements the functions fn:month-from-dateTime() and fn:month-from-date(). More...
 
class  MonthsFromDurationFN
 Implements the function fn:months-from-duration(). More...
 
class  MultiItemType
 Represents multiple types such as document() or xs:integer. More...
 
class  NamedSchemaComponent
 Base class for all named components that can appear in a W3C XML Schema. More...
 
class  NameFN
 Implements the function fn:name(). More...
 
class  NamePool
 Store names such as namespace bindings and QNames and allows them to be referenced in efficient ways. More...
 
class  NamespaceBinding
 Represents a namespace binding: a prefix, and a namespace URI. More...
 
class  NamespaceConstructor
 Constructs a namespace on an element, and naturally only appears as a child of ElementConstructor. More...
 
class  NamespaceNameTest
 A name test that is of the type prefix:*. More...
 
class  NamespaceResolver
 Base class for namespace resolvers. More...
 
class  NamespaceSupport
 A helper class for handling nested namespace declarations. More...
 
class  NamespaceURIFN
 Implements the function fn:namespace-uri(). More...
 
class  NamespaceURIForPrefixFN
 Implements the function fn:namespace-uri-from-QXmlName(). More...
 
class  NamespaceURIFromQNameFN
 Implements the function fn:local-name-from-QXmlName(). More...
 
class  NCNameConstructor
 Ensures the lexical space of the string value of the Item returned from its child Expression is an NCName. More...
 
class  NetworkAccessDelegator
 A value based class that hands out QNetworkAccessManager appropriately for variable bindings. More...
 
class  NetworkLoop
 An helper class which enables QNetworkAccessManager to be used in a blocking manner. More...
 
class  NilledFN
 Implements the function fn:nilled(). More...
 
class  NodeBuilder
 Receives QAbstractXmlReceiver events and builds a node tree in memory that afterwards can be retrieved via builtNode() More...
 
class  NodeComparison
 Implements the node comparison operators >>, <<, and is. More...
 
class  NodeIndexStorage
 
class  NodeNameFN
 Implements the function fn:node-name(). More...
 
class  NodeNamespaceResolver
 A NamespaceResolver that use a QXmlNodeModelIndex's in-scope namespace bindings for resolving namespaces. More...
 
class  NodeSortExpression
 De-duplicates and sorts in document order the content that its operand returns. More...
 
class  NoneType
 Represents the special none type. More...
 
class  NormalizeSpaceFN
 Implements the function fn:normalize-space(). More...
 
class  NormalizeUnicodeFN
 Implements the function fn:normalize-unicode(). More...
 
class  NOTATIONType
 Implements the type xs:NOTATION. More...
 
class  NotFN
 Implements the function fn:not(). More...
 
class  NumberFN
 Implements the function fn:number(). More...
 
class  Numeric
 Base class for all numeric values. More...
 
class  NumericToAbstractFloatCaster
 Casts a numeric value, such as xs:integer or xs:float, to xs:double or xs:float. More...
 
class  NumericToBooleanCaster
 Casts any numeric value to xs:boolean. More...
 
class  NumericToDecimalCaster
 Casts a numeric value, such as xs:double or xs:decimal, to xs:integer or xs:decimal, depending on IsInteger. More...
 
class  NumericToDerivedIntegerCaster
 Casts any numeric instance to a derived type of xs:integer. More...
 
class  NumericType
 Represents the internal and abstract type fs:numeric. More...
 
class  OperandsIterator
 A helper class that iterates a tree of Expression instances. It is not a sub-class of QAbstractXmlForwardIterator. More...
 
class  OperandSwitcherMathematician
 Delegates an AtomicMathematician and switches its operands. More...
 
class  OptimizationPass
 Describes how a particular optimization pass should be carried out. More...
 
class  OrderBy
 Performs the sorting by being a parent to ForClause. More...
 
class  OrderSpecTransfer
 
class  OrExpression
 Implements XPath 2.0's logical expression or. More...
 
class  OutputValidator
 Receives QAbstractXmlReceiver events and validates that they are correct, before sending them on to a second QAbstractXmlReceiver. More...
 
class  PairContainer
 Base class for expressions that has exactly two operands. More...
 
class  ParameterizedAtomicTypeVisitor
 
class  ParentNodeAxis
 Corresponds to the expression parent::node(). More...
 
class  ParserContext
 Contains data used when parsing and tokenizing. More...
 
class  Path
 Implements the path expression, containing two steps, such as in html/body. More...
 
class  PatternFlag
 Used internally by PatternPlatform and describes a flag that affects how a pattern is treated. More...
 
class  PatternPlatform
 Contains functionality for functions and expressions that uses regular expressions. More...
 
class  PositionalVariableReference
 A reference to an at variable, declared with the for-part in XQuery's FLWOR expression. More...
 
class  PositionFN
 Implements the function fn:position(). More...
 
class  PrecedingIterator
 Implements axis preceding for the AccelTree. More...
 
class  PrefixFromQNameFN
 Implements the function fn:prefix-from-QXmlName(). More...
 
class  ProcessingInstructionConstructor
 Constructs an element node. This covers both computed and directly constructed element nodes. More...
 
class  ProjectedExpression
 
class  ProjectedNodeTest
 
class  ProjectedPath
 
class  ProjectedStep
 
class  PullBridge
 Bridges a QPatternist::SequenceIterator to QAbstractXmlPullProvider. More...
 
class  QAbstractXmlReceiver
 A push interface for the XPath Data Model. Similar to SAX's ContentHandler. More...
 
class  QIODeviceDelegate
 
class  QNameComparator
 Compares xs:QName values. More...
 
class  QNameComparatorLocator
 
class  QNameConstructor
 Creates an xs:QName value from a lexical QName using statically known namespace bindings. More...
 
class  QNameFN
 Implements the function fn:QXmlName(). More...
 
class  QNameTest
 A name test that is of the type prefix:ncName. More...
 
class  QNameType
 Implements the type xs:QName. More...
 
class  QNameValue
 Implements the value instance of the xs:QName type. More...
 
class  QtXmlPatterns
 Provides a translation context & functions for the QtXmlPatterns module. More...
 
class  QuantifiedExpression
 Implements XPath 2.0's quantification expressions some and every. More...
 
class  RangeExpression
 Implements XPath 2.0's to expression. More...
 
class  RangeIterator
 RangeIterator represents a sequence of integers between a start and end value. More...
 
class  RangeVariableReference
 A reference to a variable declared with for or a quantification expression, but not for instance a let binding. More...
 
class  ReceiverDynamicContext
 A DynamicContext that has a specialized QAbstractXmlReceiver. More...
 
class  ReferenceCountedValue
 A template class that reference counts a value. More...
 
class  ReflectYYLTYPE
 
class  RemovalIterator
 Removes one items at a specified position from an input QAbstractXmlForwardIterator. More...
 
class  RemoveFN
 Implements the function fn:remove(). More...
 
class  ReplaceFN
 Implements the function fn:replace(). More...
 
class  ReportContext
 A callback for reporting errors. More...
 
class  ResolveQNameFN
 Implements the function fn:resolve-QXmlName(). More...
 
class  ResolveURIFN
 Implements the function fn:resolve-uri(). More...
 
class  ResourceDelegator
 Delegates to another ResourceLoader, but in case a URI is in an exception list, it delegates to a different loader. More...
 
class  ResourceLoader
 Responsible for handling requests for opening files and node collections. More...
 
class  ReturnOrderBy
 Together with OrderBy, it implements XQuery 1.0's order by expression. More...
 
class  ReverseFN
 Implements the function fn:reverse(). More...
 
class  RootFN
 Implements the function fn:root(). More...
 
class  RoundFN
 Implements the function fn:round(). More...
 
class  RoundHalfToEvenFN
 Implements the function fn:round-half-to-even(). More...
 
class  SchemaComponent
 Base class for all constructs that can appear in a W3C XML Schema. More...
 
class  SchemaTime
 Implements the value instance of the xs:time type. More...
 
class  SchemaTimeComparatorLocator
 
class  SchemaTimeMathematicianLocator
 
class  SchemaTimeType
 Implements the type xs:time. More...
 
class  SchemaType
 Base class for W3C XML Schema types. More...
 
class  SchemaTypeFactory
 A factory creating schema types. More...
 
class  SecondsFromAbstractDateTimeFN
 Extracts the seconds property from a sub-class of AbstractDateTime such as DateTime or Date. Implements the functions fn:seconds-from-dateTime() and fn:seconds-from-time(). More...
 
class  SecondsFromDurationFN
 Implements the function fn:seconds-from-duration(). More...
 
class  SelfToSelfCaster
 Casts a value to itself. Essentially, this AtomicCaster does nothing. More...
 
class  SequenceMappingIterator
 Proxies another QAbstractXmlForwardIterator, and for each item, returns the Sequence returned from a mapping function. More...
 
class  SequenceType
 A SequenceType instance represents the type of a sequence of Item instances. More...
 
class  SiblingIterator
 Iterates along the sibling axes in an AccelTree. More...
 
class  SimpleContentConstructor
 Constructs simple content as specified for attributes in direct element constructors in XQuery. More...
 
class  SingleContainer
 Base class for expressions that has exactly one operand. More...
 
class  SingleTokenContainer
 A TokenSource which contains one Tokenizer::Token. More...
 
class  SingletonIterator
 An QAbstractXmlForwardIterator over exactly one item. More...
 
class  SortTuple
 Represents a value and its sort keys in FLOWR's order by clause. More...
 
class  SourceLocationReflection
 Base class for all instances that represents something at a certain location. More...
 
class  StackContextBase
 Base class for all DynamicContext classes that needs to supply variables. It has a new frame for local caches, position iterators, expressions, range variables, template parameters but notably continues to delegate global caches. More...
 
class  StandardLocalNames
 
class  StandardNamespaces
 
class  StandardPrefixes
 
class  StartsWithFN
 Implements the function fn:starts-with(). More...
 
class  StaticBaseUriContainer
 Base class for functions that needs to store the static base URI for use at runtime. More...
 
class  StaticBaseURIContext
 A StaticContext that changes the static base URI. of items. More...
 
class  StaticBaseURIFN
 Implements the function fn:static-base-uri(). More...
 
class  StaticBaseURIStore
 A compile time only AST node that changes the static base URI, used when xml:base attributes appears. More...
 
class  StaticCompatibilityContext
 Has the XPath Compatibility Mode activated. Used for XSL-T 2.0's compatibility mode. More...
 
class  StaticCompatibilityStore
 A compile time only AST node that changes the backwareds compatibility mode. Used for XSL-T 2.0's backwards compatibility mode. More...
 
class  StaticContext
 Carries information and facilities used at compilation time. More...
 
class  StaticCurrentContext
 A StaticContext that carries a specified static type for the current item, as returned by fn:current(), but otherwise delegates to another StaticContext. More...
 
class  StaticFocusContext
 A StaticContext that carries a specified static type for the context item, but otherwise delegates to another StaticContext. More...
 
class  StaticNamespaceContext
 A StaticContext that carries a specified namespace resolver for the context item, but otherwise delegates to another StaticContext. More...
 
class  StaticNamespacesContainer
 A helper subclass that stores a NamespaceResolver for the static namespaces. More...
 
class  StringComparator
 Performs case sensitive string comparison between xs:anyUri, xs:string, and xs:untypedAtomic. More...
 
class  StringComparatorLocator
 
class  StringFN
 Implements the function fn:string(). More...
 
class  StringJoinFN
 Implements the function fn:string-join(). More...
 
class  StringLengthFN
 Implements the function fn:string-length(). More...
 
class  StringListIterator
 
class  StringToAbstractFloatCaster
 Casts a string value, xs:string or xs:untypedAtomic, to xs:double or xs:float. More...
 
class  StringToBase64BinaryCaster
 Casts a xs:string or xs:untypedAtomic atomic value to xs:base64Binary. More...
 
class  StringToBooleanCaster
 Casts any string value, xs:string or xs:untypedAtomic, to xs:boolean. More...
 
class  StringToCodepointsFN
 Implements the function fn:string-to-codepoints(). More...
 
class  StringToDateCaster
 Casts a xs:string or xs:untypedAtomic atomic value to xs:date. More...
 
class  StringToDateTimeCaster
 Casts a xs:string or xs:untypedAtomic atomic value to xs:dateTime. More...
 
class  StringToDayTimeDurationCaster
 Casts a xs:string or xs:untypedAtomic atomic value to xs:dayTimeDuration. More...
 
class  StringToDecimalCaster
 Casts a string value, xs:string or xs:untypedAtomic, to xs:decimal. More...
 
class  StringToDerivedIntegerCaster
 Casts an xs:string instance to a derived type of xs:integer. More...
 
class  StringToDurationCaster
 Casts a xs:string or xs:untypedAtomic atomic value to xs:duration. More...
 
class  StringToGDayCaster
 Casts a xs:string or xs:untypedAtomic atomic value to xs:gDay. More...
 
class  StringToGMonthCaster
 Casts a xs:string or xs:untypedAtomic atomic value to xs:gMonth. More...
 
class  StringToGMonthDayCaster
 Casts a xs:string or xs:untypedAtomic atomic value to xs:gYearMonth. More...
 
class  StringToGYearCaster
 Casts a xs:string or xs:untypedAtomic atomic value to xs:gYear. More...
 
class  StringToGYearMonthCaster
 Casts a xs:string or xs:untypedAtomic atomic value to xs:gYearMonth. More...
 
class  StringToHexBinaryCaster
 Casts a xs:string or xs:untypedAtomic atomic value to xs:hexBinary. More...
 
class  StringToIntegerCaster
 Casts a string value, xs:string or xs:untypedAtomic, to xs:integer. More...
 
class  StringToTimeCaster
 Casts a xs:string or xs:untypedAtomic atomic value to xs:time. More...
 
class  StringToYearMonthDurationCaster
 Casts a xs:string or xs:untypedAtomic atomic value to xs:yearMonthDuration. More...
 
class  StringType
 
class  SubsequenceFN
 Implements the function fn:subsequence(). More...
 
class  SubsequenceIterator
 Picks out a slice from another QAbstractXmlForwardIterator, specified by a start and end position. More...
 
class  SubstringAfterFN
 Implements the function fn:substring-after(). More...
 
class  SubstringBeforeFN
 Implements the function fn:substring-before(). More...
 
class  SubstringFN
 Implements the function fn:substring(). More...
 
class  SumFN
 Implements the function fn:sum(). More...
 
class  SystemPropertyFN
 Implements XSL-T 2.0's XPath function fn:system-property(). More...
 
class  TagValidationHandler
 
class  TargetNode
 A helper class for validating identity constraints. More...
 
class  Template
 Contains data related to a template. More...
 
class  TemplateInvoker
 Base class for classes that invokes templates, such as CallTemplate and ApplyTemplate. More...
 
class  TemplateMode
 Houses the data specific to the templates for a certain mode. More...
 
class  TemplateParameterReference
 A reference to a template parameter declared with xsl:param. More...
 
class  TemplatePattern
 Houses the data necessary for a template pattern. More...
 
class  TemporaryTreesRedirectingContext
 
class  TextNodeConstructor
 Constructs a text node. This covers both computed and directly constructed text nodes. More...
 
class  TimezoneFromAbstractDateTimeFN
 Extracts the timezone property from a sub-class of AbstractDateTime such as DateTime or Date. Implements the functions fn:timezone-from-dateTime(), fn:timezone-from-time() and fn:timezone-from-date(). More...
 
class  ToAnyURICaster
 Casts a string value to xs:anyURI. More...
 
class  ToAnyURICasterLocator
 
class  ToBase64BinaryCasterLocator
 
class  ToBooleanCasterLocator
 
class  ToCodepointsIterator
 Represents a stream of Unicode codepoints, which are computed from a string. More...
 
class  ToDateCasterLocator
 
class  ToDateTimeCasterLocator
 
class  ToDayTimeDurationCasterLocator
 
class  ToDecimalCasterLocator
 
class  ToDerivedIntegerCasterLocator
 
class  ToDerivedStringCasterLocator
 
class  ToDoubleCasterLocator
 
class  ToDurationCasterLocator
 
class  ToFloatCasterLocator
 
class  ToGDayCasterLocator
 
class  ToGMonthCasterLocator
 
class  ToGMonthDayCasterLocator
 
class  ToGYearCasterLocator
 
class  ToGYearMonthCasterLocator
 
class  ToHexBinaryCasterLocator
 
class  ToIntegerCasterLocator
 
class  TokenizeFN
 Implements the function fn:tokenize(). More...
 
class  Tokenizer
 Base class for all tokenizers. More...
 
class  TokenLookup
 
struct  TokenMap
 
class  TokenRevealer
 Delegates another Tokenizer, and while doing so prints the tokens it delivers to stderr. More...
 
class  TokenSource
 Base class for components that needs to return tokens. More...
 
class  TokenValue
 The value the parser, but not the tokenizers, uses for tokens and non-terminals. More...
 
class  ToQNameCasterLocator
 
class  ToSchemaTimeCasterLocator
 
class  ToStringCaster
 Casts any atomic value to xs:string. More...
 
class  ToStringCasterLocator
 
class  ToUntypedAtomicCaster
 Casts any atomic value to xs:untypedAtomic. More...
 
class  ToUntypedAtomicCasterLocator
 
class  ToYearMonthDurationCasterLocator
 
class  TraceCallback
 TraceCallback is a MappingCallback and takes care of the tracing of each individual item. More...
 
class  TraceFN
 Implements the function fn:trace(). More...
 
class  TranslateFN
 Implements the function fn:translate(). More...
 
class  TreatAs
 Implements XPath 2.0's treat as expression. More...
 
class  TripleContainer
 Base class for expressions that has exactly three operands. More...
 
class  TrueFN
 Implements the function fn:true(). More...
 
class  TruthPredicate
 A predicate which is optimized for filter expressions that are of type xs:boolean. More...
 
class  TypeAvailableFN
 Implements XSL-T 2.0's XPath function fn:type-available(). More...
 
class  TypeChecker
 Contains functions that applies Function Conversion Rules and other kinds of compile-time type checking tasks. More...
 
class  UnaryExpression
 Implements XPath 2.0 unary expression, (-|+)ValueExpr. More...
 
class  UnionIterator
 Implements the except operator. That is, the computation of the sequence of nodes from one sequence, that doesn't appear in the other. More...
 
class  UnlimitedContainer
 Base class for expressions that has any amount of operands. More...
 
class  UnparsedEntityPublicIDFN
 Implements XSL-T 2.0's XPath function fn:unparsed-entity-public-id(). More...
 
class  UnparsedEntityURIFN
 Implements XSL-T 2.0's XPath function fn:unparsed-entity-uri(). More...
 
class  UnparsedTextAvailableFN
 Implements the function fn:unparsed-text-available(). More...
 
class  UnparsedTextFN
 Implements the function fn:unparsed-text(). More...
 
class  UnresolvedVariableReference
 Compile time only AST-node which is a marker for variable references whose declaration has not yet appeared in the source code. More...
 
class  Untyped
 Represents the complex W3C XML Schema type xs:untyped. More...
 
class  UntypedAtomic
 Implements the value instance of the xs:untypedAtomic type. More...
 
class  UntypedAtomicConverter
 Casts every item in a sequence obtained from evaluating an Expression, to a requested atomic type. More...
 
class  UntypedAtomicType
 Implements the type xs:untypedAtomic. More...
 
class  UpperCaseFN
 Implements the function fn:upper-case(). More...
 
class  URILoader
 
class  UserFunction
 A function created with XQuery's declare function declaration. More...
 
class  UserFunctionCallsite
 Performs a call to a UserFunction. More...
 
class  Validate
 Handles XQuery 1.0's validate expression. More...
 
class  ValidationError
 Used for signalling casting errors. More...
 
class  ValueComparison
 Implements XPath 2.0 value comparions, such as the eq operator. More...
 
class  ValueFactory
 Provides fromLexical(), which allows instantiation of atomic values from arbitrary types. More...
 
class  VariableDeclaration
 Represents a declared variable. Only used at the compilation stage. More...
 
class  VariableLoader
 
class  VariableReference
 Baseclass for classes being references to variables. More...
 
class  VariantListIterator
 
class  WithParam
 Carries meta data for xsl:with-param as encountered in template callsites such as xsl:call-template and xsl:apply-templates. More...
 
class  XPath10CoreFunctions
 Supplies the functions available in XPath 1.0. More...
 
class  XPath20CoreFunctions
 Handles the functions defines in XQuery 1.0 and XPath 2.0 Function and Operators, except those also available in XPath 1.0. More...
 
class  XPathHelper
 Contains helper and utility functions. More...
 
class  XQueryTokenizer
 A hand-written tokenizer which tokenizes XQuery 1.0 & XPath 2.0, and delivers tokens to the Bison generated parser. More...
 
class  XsdAlternative
 Represents a XSD alternative object. More...
 
class  XsdAnnotated
 Base class for all XSD components with annotation content. More...
 
class  XsdAnnotation
 Represents a XSD annotation object. More...
 
class  XsdApplicationInformation
 Represents a XSD appinfo object. More...
 
class  XsdAssertion
 Represents a XSD assertion object. More...
 
class  XsdAttribute
 Represents a XSD attribute object. More...
 
class  XsdAttributeGroup
 Represents the XSD attributeGroup object. More...
 
class  XsdAttributeReference
 A helper class for attribute reference resolving. More...
 
class  XsdAttributeTerm
 A base class for all attribute types. More...
 
class  XsdAttributeUse
 Represents a XSD attribute use object. More...
 
class  XsdComplexType
 Represents a XSD complexType object. More...
 
class  XsdDocumentation
 Represents a XSD documentation object. More...
 
class  XsdElement
 Represents a XSD element object. More...
 
class  XsdFacet
 Represents a XSD facet object. More...
 
class  XsdIdCache
 Helper class for keeping track of all existing IDs in a schema. More...
 
class  XsdIdentityConstraint
 Represents a XSD identity constraint object. More...
 
class  XsdInstanceReader
 The schema instance reader. More...
 
class  XsdModelGroup
 Represents a XSD model group object. More...
 
class  XsdNotation
 Represents a XSD notation object, which should not be confused with the atomic type xs:NOTATION. More...
 
class  XsdParticle
 Represents a XSD particle object. More...
 
class  XsdParticleChecker
 A helper class to check validity of particles. More...
 
class  XsdReference
 A helper class for element and group reference resolving. More...
 
class  XsdSchema
 Represents a XSD schema object. More...
 
class  XsdSchemaChecker
 Encapsulates the checking of schema valitity after reference resolving has finished. More...
 
class  XsdSchemaContext
 A context for schema parsing and validation. More...
 
class  XsdSchemaDebugger
 
class  XsdSchemaHelper
 Contains helper methods that are used by XsdSchemaParser, XsdSchemaResolver and XsdSchemaChecker. More...
 
class  XsdSchemaMerger
 A helper class that merges two schemas into one. More...
 
class  XsdSchemaParser
 Implements the parsing of XML schema file. More...
 
class  XsdSchemaParserContext
 A context for schema parsing. More...
 
class  XsdSchemaResolver
 Encapsulates the resolving of type/element references in a schema after parsing has finished. More...
 
class  XsdSchemaSourceLocationReflection
 An implementation of SourceLocationReflection that takes a QSourceLocation. More...
 
class  XsdSchemaTypesFactory
 Factory for creating schema types for the types defined in XSD. More...
 
class  XsdSimpleType
 Represents a XSD simpleType object. More...
 
class  XsdStateMachine
 A state machine used for evaluation. More...
 
class  XsdStateMachineBuilder
 A helper class to build up validation state machines. More...
 
class  XsdTagScope
 A namespace class that contains identifiers for the different scopes a tag from the xml schema spec can appear in. More...
 
class  XsdTerm
 A base class for all particles of a model group. More...
 
class  XsdTypeChecker
 The class that provides methods for checking a string against a type. More...
 
class  XsdUserSchemaType
 A base class for all user defined simple and complex types. More...
 
class  XsdValidatedXmlNodeModel
 A delegate class that wraps around a QAbstractXmlNodeModel and provides additional validation specific information. More...
 
class  XsdValidatingInstanceReader
 The validating schema instance reader. More...
 
class  XsdWildcard
 Represents a XSD wildcard object. More...
 
class  XsdXPathExpression
 Represents a XSD assertion object. More...
 
class  XSLT20CoreFunctions
 Handles the functions defines in XSL-T 2.0, except those also available in XPath 2.0. More...
 
class  XSLTNodeTest
 Represents node() in patterns in XSL-T, which are just like how node() usually is, except that it doesn't match document nodes. More...
 
class  XSLTSimpleContentConstructor
 Implements XSL-T's construction of simple content, which is different from XQuery's approach. More...
 
class  XSLTTokenizer
 Tokenizes XSL-T 2.0 documents. More...
 
class  XSLTTokenLookup
 
class  YearFromAbstractDateTimeFN
 Extracts the year property from a sub-class of AbstractDateTime such as DateTime or Date. This function implements fn:year-from-dateTime() and fn:year-from-date(). More...
 
class  YearMonthDuration
 Implements the value instance of the xs:yearMonthDuration type. More...
 
class  YearMonthDurationComparatorLocator
 
class  YearMonthDurationMathematicianLocator
 
class  YearMonthDurationType
 Implements the type xs:yearMonthDuration. More...
 
class  YearsFromDurationFN
 Implements the function fn:years-from-duration(). More...
 

Typedefs

typedef QPair< QString, Expression::PtrAttributeHolder
 
typedef QVector< AttributeHolderAttributeHolderVector
 
typedef BooleanToAbstractFloatCaster< true > BooleanToDoubleCaster
 Casts a value of type xs:boolean to xs:double. More...
 
typedef BooleanToAbstractFloatCaster< false > BooleanToFloatCaster
 Casts a value of type xs:boolean to xs:float. More...
 
typedef QHash< NamedSchemaComponent::Ptr, QSourceLocationComponentLocationHash
 
typedef qint32 DayCountProperty
 
typedef qint8 DayProperty
 
typedef AbstractFloat< true > Double
 An instantiation of AbsbstractFloat suitable for xs:double. More...
 
typedef AbstractFloatMathematician< true > DoubleMathematician
 
typedef AbstractFloat< false > Float
 An instantiation of AbstractFloat suitable for xs:float. More...
 
typedef AbstractFloatMathematician< false > FloatMathematician
 
typedef qint32 HourCountProperty
 
typedef qint8 HourProperty
 
typedef int ImportPrecedence
 
typedef QExplicitlySharedDataPointer< QAbstractXmlForwardIterator< Item > > ItemIteratorPtr
 
typedef QExplicitlySharedDataPointer< ItemTypeItemTypePtr
 
typedef ComparingAggregator< AtomicComparator::OperatorGreaterThan, AtomicComparator::GreaterThanMaxFN
 An instantiation of ComparingAggregator suitable for fn:max(). More...
 
typedef ComparingAggregator< AtomicComparator::OperatorLessThan, AtomicComparator::LessThanMinFN
 An instantiation of ComparingAggregator suitable for fn:max(). More...
 
typedef qint32 MinuteCountProperty
 
typedef qint8 MinuteProperty
 
typedef qint32 MonthCountProperty
 
typedef qint8 MonthProperty
 
typedef qint64 MSecondCountProperty
 
typedef qint16 MSecondProperty
 
typedef NumericToAbstractFloatCaster< true > NumericToDoubleCaster
 Casts a numeric value, such as xs:integer or xs:float, to xs:double. More...
 
typedef NumericToAbstractFloatCaster< false > NumericToFloatCaster
 Casts a numeric value, such as xs:double or xs:decimal, to xs:float. More...
 
typedef xsDouble PatternPriority
 
typedef QVector< QXmlNameQXmlNameVector
 
typedef qint32 SecondCountProperty
 
typedef qint32 SecondProperty
 
typedef StackContextBase< DelegatingDynamicContextStackContext
 A DynamicContext that creates a new scope for variables. More...
 
typedef StringToAbstractFloatCaster< true > StringToDoubleCaster
 Casts a string value, xs:string or xs:untypedAtomic, to xs:double. More...
 
typedef StringToAbstractFloatCaster< false > StringToFloatCaster
 Casts a string value, xs:string or xs:untypedAtomic, to xs:float. More...
 
typedef qint32 VariableSlotID
 
typedef xsDouble xsDecimal
 
typedef qreal xsDouble
 
typedef xsDouble xsFloat
 
typedef qint64 xsInteger
 
typedef qint32 YearProperty
 
typedef short int yytype_int16
 
typedef signed char yytype_int8
 
typedef unsigned short int yytype_uint16
 
typedef unsigned char yytype_uint8
 
typedef qint8 ZOHourProperty
 
typedef qint8 ZOMinuteProperty
 
typedef qint32 ZOTotal
 

Enumerations

enum  { IgnorableSignedValue = 0, IgnorableUnsignedValue = 0 }
 
enum  DerivedIntegerLimitsUsage
 
enum  TypeOfDerivedInteger {
  TypeByte, TypeInt, TypeLong, TypeNegativeInteger,
  TypeNonNegativeInteger, TypeNonPositiveInteger, TypePositiveInteger, TypeShort,
  TypeUnsignedByte, TypeUnsignedInt, TypeUnsignedLong, TypeUnsignedShort
}
 
enum  TypeOfDerivedString {
  TypeString, TypeNormalizedString, TypeToken, TypeLanguage,
  TypeNMTOKEN, TypeName, TypeNCName, TypeID,
  TypeIDREF, TypeENTITY
}
 

Functions

static void allowedIn (const QueryLanguages allowedLanguages, const ParserContext *const parseInfo, const YYLTYPE &sourceLocator, const bool isInternal=false)
 Flags invalid expressions and declarations in the currently parsed language. More...
 
static void changeToTopAxis (const Expression::Ptr &op)
 
static void checkVariableCircularity (const VariableDeclaration::Ptr &var, const Expression::Ptr &checkee, const VariableDeclaration::Type type, FunctionSignature::List &signList, const ParserContext *const parseInfo)
 Checks for variable initialization circularity. More...
 
static Expression::Ptr create (Expression *const expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
 
static Template::Ptr create (Template *const expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
 
static Expression::Ptr create (const Expression::Ptr &expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
 
static Expression::Ptr createCompatStore (const Expression::Ptr &expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
 
static Expression::Ptr createConcatFN (const ParserContext *const parseInfo, const Expression::List &args, const YYLTYPE &sourceLocator)
 Creates a call to fn:concat() with args as the arguments. More...
 
static Expression::Ptr createCopyOf (const Expression::Ptr &operand, const ParserContext *const parseInfo, const YYLTYPE &sl)
 
static Expression::Ptr createDirAttributeValue (const Expression::List &content, const ParserContext *const parseInfo, const YYLTYPE &sourceLocator)
 
template<const bool isDouble>
Numeric::Ptr createFloat (const xsDouble num)
 
static Expression::Ptr createIdPatternPath (const Expression::Ptr &operand1, const Expression::Ptr &operand2, const QXmlNodeModelIndex::Axis axis, const YYLTYPE &sl, const ParserContext *const parseInfo)
 Performs the same role as createPatternPath(), but is tailored for fn:key() and fn:id(). More...
 
template<typename TNumberClass >
Expression::Ptr createNumericLiteral (const QString &in, const YYLTYPE &sl, const ParserContext *const parseInfo)
 Centralizes code for creating numeric literals. More...
 
static Expression::Ptr createPatternPath (const Expression::Ptr &operand1, const Expression::Ptr &operand2, const QXmlNodeModelIndex::Axis axis, const YYLTYPE &sl, const ParserContext *const parseInfo)
 Writes operand1 and operand2, two operands in an XSL-T pattern, into an equivalent XPath expression. More...
 
static Expression::Ptr createReturnOrderBy (const OrderSpecTransfer::List &orderSpecTransfer, const Expression::Ptr &returnExpr, const OrderBy::Stability stability, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
 
static Expression::Ptr createRootExpression (const ParserContext *const parseInfo, const YYLTYPE &sl)
 Creates an Expression that corresponds to /. This is literally fn:root(self::node()) treat as document-node(). More...
 
static Expression::Ptr createSimpleContent (const Expression::Ptr &source, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
 
static Expression::Ptr createSlashSlashPath (const Expression::Ptr &begin, const Expression::Ptr &end, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
 Creates a path expression which contains the step // between begin and and end. More...
 
QString Q_AUTOTEST_EXPORT escape (const QString &input)
 Similar to Qt::escape(), but also escapes apostrophes and quotes, such that the result is suitable as attribute content too. More...
 
static Expression::Ptr findAxisStep (const Expression::Ptr &expr, const bool throughStructures=true)
 
static QString formatAttribute (const QString &attribute)
 Formats attribute name. More...
 
static QString formatAttribute (const char *const attribute)
 
static QString formatData (const QString &data)
 
static QString formatData (const xsInteger data)
 
static QString formatData (const char *const data)
 
static QString formatData (const QLatin1Char &data)
 
static QString formatElement (const QString &element)
 Formats element name. More...
 
static QString formatElement (const char *const element)
 
static QString formatExpression (const QString &expr)
 
static QString formatFunction (const NamePool::Ptr &np, const FunctionSignature::Ptr &func)
 Formats FunctionSignature. More...
 
QString formatKeyword (const QString &keyword)
 
static QString formatKeyword (const QStringRef &keyword)
 
static QString formatKeyword (const char *const keyword)
 
static QString formatKeyword (const QChar keyword)
 
static QString formatResourcePath (const QUrl &uri)
 Formats uri as a path to a resource, typically it's a filename or a URI. More...
 
template<typename T >
QString formatType (const NamePool::Ptr &np, const T &type)
 Formats ItemType and SequenceType. More...
 
static QString formatType (const NamePool::Ptr &np, const QXmlName &name)
 Formats name of any type. More...
 
static QString formatType (const Cardinality &type)
 Formats Cardinality. More...
 
static QString formatURI (const NamePool::Ptr &np, const QXmlName::NamespaceCode &uri)
 Formats uri, that's considered to be a URI, for display. More...
 
static QString formatURI (const QUrl &uri)
 Formats uri for display. More...
 
static QString formatURI (const QString &uri)
 Formats uri, that's considered to be a URI, for display. More...
 
static QSourceLocation fromYYLTYPE (const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
 
static bool isPredicate (const Expression::ID id)
 
static bool isVariableReference (const Expression::ID id)
 
static void loadPattern (const Expression::Ptr &matchPattern, TemplatePattern::Vector &ourPatterns, const TemplatePattern::ID id, const PatternPriority priority, const Template::Ptr &temp)
 
static ReturnOrderBylocateReturnClause (const Expression::Ptr &expr)
 
template<typename T >
static QAbstractXmlForwardIterator< T >::Ptr makeEmptyIterator ()
 
template<typename T >
QAbstractXmlForwardIterator< T >::Ptr makeListIterator (const QList< T > &list)
 
template<typename T >
QAbstractXmlForwardIterator< T >::Ptr makeVectorIterator (const QVector< T > &vector)
 
static QXmlNodeModelIndex::NodeKind operator| (const QXmlNodeModelIndex::NodeKind &op1, const QXmlNodeModelIndex::NodeKind &op2)
 
QNoDebug pDebug ()
 
static QString prologMessage (const char *const msg)
 Centralizes a translation message, for the purpose of consistency and modularization. More...
 
static Expression::Ptr pushVariable (const QXmlName name, const SequenceType::Ptr &seqType, const Expression::Ptr &expr, const VariableDeclaration::Type type, const YYLTYPE &sourceLocator, ParserContext *const parseInfo, const bool checkSource=true)
 
uint qHash (const QPatternist::TargetNode &node)
 
static SequenceType::Ptr quantificationType (const SequenceType::Ptr &type)
 
static void registerNamedTemplate (const QXmlName &name, const Expression::Ptr &body, ParserContext *const parseInfo, const YYLTYPE &sourceLocator, const Template::Ptr &temp)
 
template<const ReportContext::ErrorCode errorCode>
static QUrl resolveAndCheckCollation (const QString &collation, const ParserContext *const parseInfo, const YYLTYPE &sl)
 Resolves against the static base URI and checks that collation is a supported Unicode Collation. More...
 
static Expression::Ptr resolveVariable (const QXmlName &name, const YYLTYPE &sourceLocator, ParserContext *const parseInfo, const bool raiseErrorOnUnavailability)
 
template<typename T >
Item toItem (const QExplicitlySharedDataPointer< T > atomicValue)
 
static Expression::Ptr typeCheckTemplateBody (const Expression::Ptr &body, const SequenceType::Ptr &reqType, const ParserContext *const parseInfo)
 
static QString unknownType ()
 Centralizes a translation string for the purpose of increasing consistency. More...
 
static VariableDeclaration::Ptr variableByName (const QXmlName name, const ParserContext *const parseInfo)
 
static void variableUnavailable (const QXmlName &variableName, const ParserContext *const parseInfo, const YYLTYPE &location)
 
static int XPatherror (YYLTYPE *sourceLocator, const ParserContext *const parseInfo, const char *const msg)
 The generated Bison parser calls this function when there is a parse error. More...
 
static int XPathlex (YYSTYPE *lexVal, YYLTYPE *sourceLocator, const ParserContext *const parseInfo)
 
int XPathparse (QPatternist::ParserContext *const info)
 The entry point to the parser. More...
 
static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, ParserContext *const parseInfo)
 
int yyparse (ParserContext *const parseInfo)
 
static char * yystpcpy (char *yydest, const char *yysrc)
 
static YYSIZE_T yystrlen (const char *yystr)
 
static YYSIZE_T yysyntax_error (char *yyresult, int yystate, int yychar)
 
static YYSIZE_T yytnamerr (char *yyres, const char *yystr)
 

Variables

static const MergeIterator mergeIterator
 
static const yytype_int16 yycheck []
 
static const yytype_uint16 yydefact []
 
static const yytype_int16 yydefgoto []
 
static const yytype_int16 yypact []
 
static const yytype_int16 yypgoto []
 
static const yytype_uint16 yyr1 []
 
static const yytype_uint8 yyr2 []
 
static const yytype_uint16 yystos []
 
static const yytype_int16 yytable []
 
static const char *const yytname []
 
static const yytype_uint8 yytranslate []
 

Detailed Description

The namespace for the internal API of QtXmlPatterns.

Warning
This function is not part of the public interface.

Typedef Documentation

◆ AttributeHolder

Definition at line 74 of file qtokenizer_p.h.

◆ AttributeHolderVector

Definition at line 75 of file qtokenizer_p.h.

◆ BooleanToDoubleCaster

Casts a value of type xs:boolean to xs:double.

Author
Frans Englich frans.nosp@m..eng.nosp@m.lich@.nosp@m.noki.nosp@m.a.com

Definition at line 160 of file qabstractfloatcasters_p.h.

◆ BooleanToFloatCaster

Casts a value of type xs:boolean to xs:float.

Author
Frans Englich frans.nosp@m..eng.nosp@m.lich@.nosp@m.noki.nosp@m.a.com

Definition at line 168 of file qabstractfloatcasters_p.h.

◆ ComponentLocationHash

A hash that keeps the mapping between the single components that can appear in a schema document (e.g. elements, attributes, type definitions) and their source locations inside the document.

Definition at line 147 of file qxsdschemaparsercontext_p.h.

◆ DayCountProperty

Definition at line 141 of file qprimitives_p.h.

◆ DayProperty

Definition at line 149 of file qprimitives_p.h.

◆ Double

An instantiation of AbsbstractFloat suitable for xs:double.

Definition at line 160 of file qabstractfloat_p.h.

◆ DoubleMathematician

An instantiation of AbstractFloatMathematician that handles xs:double.

Definition at line 93 of file qabstractfloatmathematician_p.h.

◆ Float

An instantiation of AbstractFloat suitable for xs:float.

Definition at line 167 of file qabstractfloat_p.h.

◆ FloatMathematician

An instantiation of AbstractFloatMathematician that handles xs:float.

Definition at line 98 of file qabstractfloatmathematician_p.h.

◆ HourCountProperty

Definition at line 142 of file qprimitives_p.h.

◆ HourProperty

Definition at line 150 of file qprimitives_p.h.

◆ ImportPrecedence

Signifies the import precedence of a template. For instance, the first stylesheet module has 1, the first import 2, and so forth. Smaller means higher import precedence. 0 is reserved for builtin templates.

Definition at line 183 of file qprimitives_p.h.

◆ ItemIteratorPtr

Definition at line 78 of file qabstractxmlnodemodel.h.

◆ ItemTypePtr

Definition at line 76 of file qabstractxmlnodemodel.h.

◆ MaxFN

An instantiation of ComparingAggregator suitable for fn:max().

Definition at line 132 of file qcomparingaggregator_p.h.

◆ MinFN

An instantiation of ComparingAggregator suitable for fn:max().

Definition at line 139 of file qcomparingaggregator_p.h.

◆ MinuteCountProperty

Definition at line 143 of file qprimitives_p.h.

◆ MinuteProperty

Definition at line 151 of file qprimitives_p.h.

◆ MonthCountProperty

Definition at line 144 of file qprimitives_p.h.

◆ MonthProperty

Definition at line 152 of file qprimitives_p.h.

◆ MSecondCountProperty

Definition at line 146 of file qprimitives_p.h.

◆ MSecondProperty

Milliseconds. 1 equals 0.001 SecondProperty.

Definition at line 157 of file qprimitives_p.h.

◆ NumericToDoubleCaster

Casts a numeric value, such as xs:integer or xs:float, to xs:double.

castFrom() uses Numeric::toDouble() for doing the actual casting.

Author
Frans Englich frans.nosp@m..eng.nosp@m.lich@.nosp@m.noki.nosp@m.a.com

Definition at line 126 of file qabstractfloatcasters_p.h.

◆ NumericToFloatCaster

Casts a numeric value, such as xs:double or xs:decimal, to xs:float.

castFrom() uses Numeric::toFloat() for doing the actual casting.

Author
Frans Englich frans.nosp@m..eng.nosp@m.lich@.nosp@m.noki.nosp@m.a.com

Definition at line 136 of file qabstractfloatcasters_p.h.

◆ PatternPriority

Definition at line 176 of file qprimitives_p.h.

◆ QXmlNameVector

Definition at line 79 of file qabstractxmlnodemodel.h.

◆ SecondCountProperty

Definition at line 145 of file qprimitives_p.h.

◆ SecondProperty

Definition at line 147 of file qprimitives_p.h.

◆ StackContext

A DynamicContext that creates a new scope for variables.

This DynamicContext is used for recursive user function calls, for example.

Definition at line 129 of file qstackcontextbase_p.h.

◆ StringToDoubleCaster

Casts a string value, xs:string or xs:untypedAtomic, to xs:double.

Author
Frans Englich frans.nosp@m..eng.nosp@m.lich@.nosp@m.noki.nosp@m.a.com

Definition at line 144 of file qabstractfloatcasters_p.h.

◆ StringToFloatCaster

Casts a string value, xs:string or xs:untypedAtomic, to xs:float.

Author
Frans Englich frans.nosp@m..eng.nosp@m.lich@.nosp@m.noki.nosp@m.a.com

Definition at line 152 of file qabstractfloatcasters_p.h.

◆ YearProperty

Definition at line 148 of file qprimitives_p.h.

◆ yytype_int16

typedef short int QPatternist::yytype_int16

Definition at line 1372 of file qquerytransformparser.cpp.

◆ yytype_int8

typedef signed char QPatternist::yytype_int8

Definition at line 1358 of file qquerytransformparser.cpp.

◆ yytype_uint16

typedef unsigned short int QPatternist::yytype_uint16

Definition at line 1366 of file qquerytransformparser.cpp.

◆ yytype_uint8

typedef unsigned char QPatternist::yytype_uint8

Definition at line 1351 of file qquerytransformparser.cpp.

◆ ZOHourProperty

The hour property of a zone offset. For example, -13 in the zone offset "-13:08".

Definition at line 163 of file qprimitives_p.h.

◆ ZOMinuteProperty

The minute property of a zone offset. For example, -08 in the zone offset "-13:08".

Definition at line 169 of file qprimitives_p.h.

◆ ZOTotal

The full zone offset in minutes.

Definition at line 174 of file qprimitives_p.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
IgnorableSignedValue 
IgnorableUnsignedValue 

Definition at line 77 of file qderivedinteger_p.h.

◆ DerivedIntegerLimitsUsage

template<TypeOfDerivedInteger DerivedType>
enum DerivedIntegerLimitsUsage
related

◆ TypeOfDerivedInteger

◆ TypeOfDerivedString

Function Documentation

◆ allowedIn()

static void QPatternist::allowedIn ( const QueryLanguages  allowedLanguages,
const ParserContext *const  parseInfo,
const YYLTYPE sourceLocator,
const bool  isInternal = false 
)
static

Flags invalid expressions and declarations in the currently parsed language.

Since this grammar is used for several languages: XQuery 1.0, XSL-T 2.0, and XPath 2.0 inside XSL-T, and field and selector patterns in W3C XML Schema's identity constraints, it is the union of all the constructs in these languages. However, when dealing with each language individually, we regularly need to disallow some expressions, such as direct element constructors when parsing XSL-T, or the typeswitch when parsing XPath.

This is further complicated by that XSLTTokenizer sometimes generates code which is allowed in XQuery but not in XPath. For that reason the token INTERNAL is sometimes generated, which signals that an expression, for instance the let clause, should not be flagged as an error, because it's used for internal purposes.

Hence, this function is called from each expression and declaration with allowedLanguages stating what languages it is allowed in.

If isInternal is true, no error is raised. Otherwise, if the current language is not in allowedLanguages, an error is raised.

Definition at line 270 of file qquerytransformparser.cpp.

Referenced by yyparse().

274 {
275  /* We treat XPath 2.0 as a subset of XSL-T 2.0, so if XPath 2.0 is allowed
276  * and XSL-T is the language, it's ok. */
277  if(!isInternal &&
278  (!allowedLanguages.testFlag(parseInfo->languageAccent) && !(allowedLanguages.testFlag(QXmlQuery::XPath20) && parseInfo->languageAccent == QXmlQuery::XSLT20)))
279  {
280 
281  QString langName;
282 
283  switch(parseInfo->languageAccent)
284  {
285  case QXmlQuery::XPath20:
286  langName = QLatin1String("XPath 2.0");
287  break;
288  case QXmlQuery::XSLT20:
289  langName = QLatin1String("XSL-T 2.0");
290  break;
291  case QXmlQuery::XQuery10:
292  langName = QLatin1String("XQuery 1.0");
293  break;
295  langName = QtXmlPatterns::tr("W3C XML Schema identity constraint selector");
296  break;
298  langName = QtXmlPatterns::tr("W3C XML Schema identity constraint field");
299  break;
300  }
301 
302  parseInfo->staticContext->error(QtXmlPatterns::tr("A construct was encountered "
303  "which is disallowed in the current language(%1).").arg(langName),
304  ReportContext::XPST0003,
305  fromYYLTYPE(sourceLocator, parseInfo));
306 
307  }
308 }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
static QSourceLocation fromYYLTYPE(const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)

◆ changeToTopAxis()

static void QPatternist::changeToTopAxis ( const Expression::Ptr op)
static

Definition at line 530 of file qquerytransformparser.cpp.

Referenced by createIdPatternPath().

531 {
532  /* This axis must have been written away by now. */
533  Q_ASSERT(op->as<AxisStep>()->axis() != QXmlNodeModelIndex::AxisChild);
534 
535  if(op->as<AxisStep>()->axis() != QXmlNodeModelIndex::AxisSelf)
536  op->as<AxisStep>()->setAxis(QXmlNodeModelIndex::AxisAttributeOrTop);
537 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

◆ checkVariableCircularity()

static void QPatternist::checkVariableCircularity ( const VariableDeclaration::Ptr var,
const Expression::Ptr checkee,
const VariableDeclaration::Type  type,
FunctionSignature::List signList,
const ParserContext *const  parseInfo 
)
static

Checks for variable initialization circularity.

"A recursive function that checks for recursion is full of ironies."

 -- The Salsa Master

Issues an error via parseInfo's StaticContext if the initialization expression checkee for the global variable var, contains a variable reference to var. That is, if there's a circularity.

See also
XQuery 1.0: An XML Query Language, err:XQST0054

Definition at line 803 of file qquerytransformparser.cpp.

Referenced by yyparse().

808 {
809  Q_ASSERT(var);
810  Q_ASSERT(checkee);
811  Q_ASSERT(parseInfo);
812 
813  const Expression::ID id = checkee->id();
814 
815  if(id == Expression::IDExpressionVariableReference)
816  {
817  const ExpressionVariableReference *const ref =
818  static_cast<const ExpressionVariableReference *>(checkee.data());
819 
820  if(var->slot == ref->slot() && type == ref->variableDeclaration()->type)
821  {
822  parseInfo->staticContext->error(QtXmlPatterns::tr("The initialization of variable %1 "
823  "depends on itself").arg(formatKeyword(var, parseInfo->staticContext->namePool())),
824  parseInfo->isXSLT() ? ReportContext::XTDE0640 : ReportContext::XQST0054, ref);
825  return;
826  }
827  else
828  {
829  /* If the variable we're checking is below another variable, it can be a recursive
830  * dependency through functions, so we need to check variable references too. */
831  checkVariableCircularity(var, ref->sourceExpression(), type, signList, parseInfo);
832  return;
833  }
834  }
835  else if(id == Expression::IDUserFunctionCallsite)
836  {
837  const UserFunctionCallsite::Ptr callsite(checkee);
838  const FunctionSignature::Ptr sign(callsite->callTargetDescription());
839  const FunctionSignature::List::const_iterator end(signList.constEnd());
840  FunctionSignature::List::const_iterator it(signList.constBegin());
841  bool noMatch = true;
842 
843  for(; it != end; ++it)
844  {
845  if(*it == sign)
846  {
847  /* The variable we're checking is depending on a function that's recursive. The
848  * user has written a weird query, in other words. Since it's the second time
849  * we've encountered a callsite, we now skip it. */
850  noMatch = false;
851  break;
852  }
853  }
854 
855  if(noMatch)
856  {
857  signList.append(sign);
858  /* Check the body of the function being called. */
859  checkVariableCircularity(var, callsite->body(), type, signList, parseInfo);
860  }
861  /* Continue with the operands, such that we also check the arguments of the callsite. */
862  }
863  else if(id == Expression::IDUnresolvedVariableReference)
864  {
865  /* We're called before it has rewritten itself. */
866  checkVariableCircularity(var, checkee->as<UnresolvedVariableReference>()->replacement(), type, signList, parseInfo);
867  }
868 
869  /* Check the operands. */
870  const Expression::List ops(checkee->operands());
871  if(ops.isEmpty())
872  return;
873 
874  const Expression::List::const_iterator end(ops.constEnd());
875  Expression::List::const_iterator it(ops.constBegin());
876 
877  for(; it != end; ++it)
878  checkVariableCircularity(var, *it, type, signList, parseInfo);
879 }
static QString formatKeyword(const VariableDeclaration::Ptr &var, const NamePool::Ptr &np)
Formats var appropriately for display.
int type
Definition: qmetatype.cpp:239
#define it(className, varName)
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
static void checkVariableCircularity(const VariableDeclaration::Ptr &var, const Expression::Ptr &checkee, const VariableDeclaration::Type type, FunctionSignature::List &signList, const ParserContext *const parseInfo)
Checks for variable initialization circularity.
static int sign(int x)
static const KeyPair *const end

◆ create() [1/3]

static Expression::Ptr QPatternist::create ( Expression *const  expr,
const YYLTYPE sourceLocator,
const ParserContext *const  parseInfo 
)
inlinestatic

Definition at line 355 of file qquerytransformparser.cpp.

Referenced by QPixmapData::cacheKey(), createCompatStore(), createConcatFN(), createCopyOf(), createDirAttributeValue(), createIdPatternPath(), createNumericLiteral(), createPatternPath(), createReturnOrderBy(), createRootExpression(), createSimpleContent(), createSlashSlashPath(), QScriptStaticScopeObject::createStructure(), QScriptObject::createStructure(), QScript::QMetaObjectWrapperObject::createStructure(), effectiveState(), QScriptEngine::evaluate(), QScriptProgramPrivate::executable(), QImage::format(), QImage::fromData(), QScriptEngine::fromScriptValue(), QDeclarativeCompiler::genComponent(), QDeclarativeCompiler::genObject(), QScriptEnginePrivate::get(), QWSDisplay::Data::init(), QWSDisplay::instance(), QScriptEnginePrivate::jscValueFromVariant(), QScriptEnginePrivate::pushContext(), pushVariable(), QLock::QLock(), qmlAttachedPropertiesObject(), qmlRegisterCustomType(), QScriptEnginePrivate::QScriptEnginePrivate(), QMacPinchGestureRecognizer::reset(), resolveVariable(), QWidget::setShown(), QVariant::swap(), QWSDisplay::Data::takeId(), QPatternist::ComparingAggregator< oper, result >::typeCheck(), and yyparse().

358 {
359  parseInfo->staticContext->addLocation(expr, fromYYLTYPE(sourceLocator, parseInfo));
360  return Expression::Ptr(expr);
361 }
static QSourceLocation fromYYLTYPE(const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)

◆ create() [2/3]

static Template::Ptr QPatternist::create ( Template *const  expr,
const YYLTYPE sourceLocator,
const ParserContext *const  parseInfo 
)
inlinestatic

Definition at line 363 of file qquerytransformparser.cpp.

366 {
367  parseInfo->staticContext->addLocation(expr, fromYYLTYPE(sourceLocator, parseInfo));
368  return Template::Ptr(expr);
369 }
static QSourceLocation fromYYLTYPE(const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)

◆ create() [3/3]

static Expression::Ptr QPatternist::create ( const Expression::Ptr expr,
const YYLTYPE sourceLocator,
const ParserContext *const  parseInfo 
)
inlinestatic

Definition at line 371 of file qquerytransformparser.cpp.

374 {
375  parseInfo->staticContext->addLocation(expr.data(), fromYYLTYPE(sourceLocator, parseInfo));
376  return expr;
377 }
static QSourceLocation fromYYLTYPE(const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)

◆ createCompatStore()

static Expression::Ptr QPatternist::createCompatStore ( const Expression::Ptr expr,
const YYLTYPE sourceLocator,
const ParserContext *const  parseInfo 
)
static

Definition at line 691 of file qquerytransformparser.cpp.

Referenced by yyparse().

694 {
695  return create(new StaticCompatibilityStore(expr), sourceLocator, parseInfo);
696 }
static Expression::Ptr create(const Expression::Ptr &expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)

◆ createConcatFN()

static Expression::Ptr QPatternist::createConcatFN ( const ParserContext *const  parseInfo,
const Expression::List args,
const YYLTYPE sourceLocator 
)
inlinestatic

Creates a call to fn:concat() with args as the arguments.

Definition at line 765 of file qquerytransformparser.cpp.

Referenced by createDirAttributeValue().

768 {
769  Q_ASSERT(parseInfo);
770  const QXmlName name(StandardNamespaces::fn, StandardLocalNames::concat);
771  const ReflectYYLTYPE ryy(sourceLocator, parseInfo);
772 
773  return create(parseInfo->staticContext->functionSignatures()->createFunctionCall(name, args, parseInfo->staticContext, &ryy),
774  sourceLocator, parseInfo);
775 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
const char * name
static Expression::Ptr create(const Expression::Ptr &expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
The QXmlName class represents the name of an XML node, in an efficient, namespace-aware way...
Definition: qxmlname.h:58

◆ createCopyOf()

static Expression::Ptr QPatternist::createCopyOf ( const Expression::Ptr operand,
const ParserContext *const  parseInfo,
const YYLTYPE sl 
)
static

Wraps operand with a CopyOf in case it makes any difference.

There is no need to wrap the return value in a call to create(), it's already done.

Definition at line 683 of file qquerytransformparser.cpp.

Referenced by yyparse().

686 {
687  return create(new CopyOf(operand, parseInfo->inheritNamespacesMode,
688  parseInfo->preserveNamespacesMode), sl, parseInfo);
689 }
static Expression::Ptr create(const Expression::Ptr &expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)

◆ createDirAttributeValue()

static Expression::Ptr QPatternist::createDirAttributeValue ( const Expression::List content,
const ParserContext *const  parseInfo,
const YYLTYPE sourceLocator 
)
inlinestatic

Definition at line 777 of file qquerytransformparser.cpp.

Referenced by yyparse().

780 {
781  if(content.isEmpty())
782  return create(new EmptySequence(), sourceLocator, parseInfo);
783  else if(content.size() == 1)
784  return content.first();
785  else
786  return createConcatFN(parseInfo, content, sourceLocator);
787 }
static Expression::Ptr createConcatFN(const ParserContext *const parseInfo, const Expression::List &args, const YYLTYPE &sourceLocator)
Creates a call to fn:concat() with args as the arguments.
static Expression::Ptr create(const Expression::Ptr &expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)

◆ createFloat()

template<const bool isDouble>
Numeric::Ptr QPatternist::createFloat ( const xsDouble  num)

◆ createIdPatternPath()

static Expression::Ptr QPatternist::createIdPatternPath ( const Expression::Ptr operand1,
const Expression::Ptr operand2,
const QXmlNodeModelIndex::Axis  axis,
const YYLTYPE sl,
const ParserContext *const  parseInfo 
)
inlinestatic

Performs the same role as createPatternPath(), but is tailored for fn:key() and fn:id().

fn:key() and fn:id() can be part of path patterns(only as the first step, to be precise) and that poses a challenge to rewriting because what createPatternPath() is not possible to express, since the functions cannot be node tests. E.g, this rewrite is not possible:

id-or-key/abc => child-or-top::abc[parent::id-or-key]

Our approach is to rewrite like this:

id-or-key/abc => child-or-top::abc[parent::node is id-or-key]

operand1 is the call to fn:key() or fn:id(), operand2 the right operand, and axis the target axis to rewrite to.

See also
createPatternPath()

Definition at line 604 of file qquerytransformparser.cpp.

Referenced by yyparse().

609 {
610  const Expression::Ptr operandR(findAxisStep(operand2));
611  Q_ASSERT(operandR);
612  changeToTopAxis(operandR);
613 
614  const Expression::Ptr parentStep(create(new AxisStep(axis, BuiltinTypes::node),
615  sl,
616  parseInfo));
617  const Expression::Ptr isComp(create(new NodeComparison(parentStep,
619  operand1),
620  sl,
621  parseInfo));
622 
623  return create(GenericPredicate::create(operandR, isComp,
624  parseInfo->staticContext, fromYYLTYPE(sl, parseInfo)), sl, parseInfo);
625 }
static Expression::Ptr findAxisStep(const Expression::Ptr &expr, const bool throughStructures=true)
static void changeToTopAxis(const Expression::Ptr &op)
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
static Expression::Ptr create(const Expression::Ptr &expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
static QSourceLocation fromYYLTYPE(const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)

◆ createNumericLiteral()

template<typename TNumberClass >
Expression::Ptr QPatternist::createNumericLiteral ( const QString in,
const YYLTYPE sl,
const ParserContext *const  parseInfo 
)

Centralizes code for creating numeric literals.

Definition at line 439 of file qquerytransformparser.cpp.

442 {
443  const Item num(TNumberClass::fromLexical(in));
444 
445  if(num.template as<AtomicValue>()->hasError())
446  {
447  parseInfo->staticContext->error(QtXmlPatterns::tr("%1 is not a valid numeric literal.")
448  .arg(formatData(in)),
449  ReportContext::XPST0003, fromYYLTYPE(sl, parseInfo));
450  return Expression::Ptr(); /* Avoid compiler warning. */
451  }
452  else
453  return create(new Literal(num), sl, parseInfo);
454 }
The Item is the most basic of all visual items in QML.
static Expression::Ptr create(const Expression::Ptr &expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
static QSourceLocation fromYYLTYPE(const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
static QString formatData(const QXmlNodeModelIndex node)
Definition: qitem_p.h:440

◆ createPatternPath()

static Expression::Ptr QPatternist::createPatternPath ( const Expression::Ptr operand1,
const Expression::Ptr operand2,
const QXmlNodeModelIndex::Axis  axis,
const YYLTYPE sl,
const ParserContext *const  parseInfo 
)
inlinestatic

Writes operand1 and operand2, two operands in an XSL-T pattern, into an equivalent XPath expression.

Essentially, the following rewrite is done:

axis1::test1(a)/axis2::test2(b) => child-or-top::test2(b)[parent::test1(a)]

Section 5.5.3 The Meaning of a Pattern talks about rewrites that are applied to only the first step in a pattern, but since we're doing rewrites more radically, its line of reasoning cannot be followed.

Keep in mind the rewrites that non-terminal PatternStep do.

See also
createIdPatternPath()

Definition at line 559 of file qquerytransformparser.cpp.

Referenced by yyparse().

564 {
565  const Expression::Ptr operandL(findAxisStep(operand1, false));
566 
567  if(operandL->is(Expression::IDAxisStep))
568  operandL->as<AxisStep>()->setAxis(axis);
569  else
570  findAxisStep(operand1)->as<AxisStep>()->setAxis(axis);
571 
572  return create(GenericPredicate::create(operand2, operandL,
573  parseInfo->staticContext, fromYYLTYPE(sl, parseInfo)), sl, parseInfo);
574 }
static Expression::Ptr findAxisStep(const Expression::Ptr &expr, const bool throughStructures=true)
static Expression::Ptr create(const Expression::Ptr &expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
static QSourceLocation fromYYLTYPE(const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)

◆ createReturnOrderBy()

static Expression::Ptr QPatternist::createReturnOrderBy ( const OrderSpecTransfer::List orderSpecTransfer,
const Expression::Ptr returnExpr,
const OrderBy::Stability  stability,
const YYLTYPE sourceLocator,
const ParserContext *const  parseInfo 
)
static

Definition at line 1097 of file qquerytransformparser.cpp.

Referenced by yyparse().

1102 {
1103  // TODO do resize(orderSpec.size() + 1)
1104  Expression::List exprs;
1105  OrderBy::OrderSpec::Vector orderSpecs;
1106 
1107  exprs.append(returnExpr);
1108 
1109  const int len = orderSpecTransfer.size();
1110 
1111  for(int i = 0; i < len; ++i)
1112  {
1113  exprs.append(orderSpecTransfer.at(i).expression);
1114  orderSpecs.append(orderSpecTransfer.at(i).orderSpec);
1115  }
1116 
1117  return create(new ReturnOrderBy(stability, orderSpecs, exprs), sourceLocator, parseInfo);
1118 }
static Expression::Ptr create(const Expression::Ptr &expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)

◆ createRootExpression()

static Expression::Ptr QPatternist::createRootExpression ( const ParserContext *const  parseInfo,
const YYLTYPE sl 
)
static

Creates an Expression that corresponds to /. This is literally fn:root(self::node()) treat as document-node().

Definition at line 702 of file qquerytransformparser.cpp.

Referenced by yyparse().

704 {
705  Q_ASSERT(parseInfo);
706  const QXmlName name(StandardNamespaces::fn, StandardLocalNames::root);
707 
708  Expression::List args;
709  args.append(create(new ContextItem(), sl, parseInfo));
710 
711  const ReflectYYLTYPE ryy(sl, parseInfo);
712 
713  const Expression::Ptr fnRoot(parseInfo->staticContext->functionSignatures()
714  ->createFunctionCall(name, args, parseInfo->staticContext, &ryy));
715  Q_ASSERT(fnRoot);
716 
717  return create(new TreatAs(create(fnRoot, sl, parseInfo), CommonSequenceTypes::ExactlyOneDocumentNode), sl, parseInfo);
718 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
const char * name
static Expression::Ptr create(const Expression::Ptr &expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
The QXmlName class represents the name of an XML node, in an efficient, namespace-aware way...
Definition: qxmlname.h:58

◆ createSimpleContent()

static Expression::Ptr QPatternist::createSimpleContent ( const Expression::Ptr source,
const YYLTYPE sourceLocator,
const ParserContext *const  parseInfo 
)
static

Definition at line 379 of file qquerytransformparser.cpp.

Referenced by yyparse().

382 {
383  return create(parseInfo->isXSLT() ? new XSLTSimpleContentConstructor(source) : new SimpleContentConstructor(source),
384  sourceLocator,
385  parseInfo);
386 }
static Expression::Ptr create(const Expression::Ptr &expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)

◆ createSlashSlashPath()

static Expression::Ptr QPatternist::createSlashSlashPath ( const Expression::Ptr begin,
const Expression::Ptr end,
const YYLTYPE sourceLocator,
const ParserContext *const  parseInfo 
)
static

Creates a path expression which contains the step // between begin and and end.

begin//end is a short form for: begin/descendant-or-self::node()/end

This will be compiled as two-path expression: (/)/(//.)/step/

Definition at line 751 of file qquerytransformparser.cpp.

Referenced by yyparse().

755 {
756  const Expression::Ptr twoSlash(create(new AxisStep(QXmlNodeModelIndex::AxisDescendantOrSelf, BuiltinTypes::node), sourceLocator, parseInfo));
757  const Expression::Ptr p1(create(new Path(begin, twoSlash), sourceLocator, parseInfo));
758 
759  return create(new Path(p1, end), sourceLocator, parseInfo);
760 }
A Path object defines a path for use by PathView .
static Expression::Ptr create(const Expression::Ptr &expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
static const KeyPair *const end

◆ escape()

QString QPatternist::escape ( const QString input)

Similar to Qt::escape(), but also escapes apostrophes and quotes, such that the result is suitable as attribute content too.

Converts the plain text string plain to a HTML string with HTML metacharacters <, >, &, and " replaced by HTML entities.

Since Qt::escape() is in QtGui, using it creates a dependency on that library. This function does not.

The implementation resides in qpatternistlocale.cpp.

See also
Qt::escape()

Definition at line 48 of file qpatternistlocale.cpp.

Referenced by QPatternist::XSLTTokenizer::checkForParseError(), QSvgPaintEngine::drawTextItem(), QTextHtmlExporter::emitAttribute(), QTextHtmlExporter::emitFontFamily(), QTextHtmlExporter::emitFragment(), findArgEscapes(), formatData(), formatExpression(), formatFunction(), formatKeyword(), QXmlName::formatKeyword(), formatResourcePath(), formatType(), formatURI(), getEscape(), QPatternist::AccelTreeResourceLoader::load(), QScriptErrorLogWidget::message(), QRegExp::operator!=(), QLineControl::parseInputMask(), replaceArgEscapes(), QPatternist::AccelTreeResourceLoader::streamToReceiver(), QPatternist::XSLTTokenizer::unexpectedContent(), and XPatherror().

49  {
50  QString rich;
51  rich.reserve(int(input.length() * 1.1));
52 
53  for(int i = 0; i < input.length(); ++i)
54  {
55  switch(input.at(i).unicode())
56  {
57  case '<':
58  {
59  rich += QLatin1String("&lt;");
60  break;
61  }
62  case '>':
63  {
64  rich += QLatin1String("&gt;");
65  break;
66  }
67  case '&':
68  {
69  rich += QLatin1String("&amp;");
70  break;
71  }
72  case '"':
73  {
74  rich += QLatin1String("&quot;");
75  break;
76  }
77  case '\'':
78  {
79  rich += QLatin1String("&apos;");
80  break;
81  }
82  default:
83  rich += input.at(i);
84  }
85  }
86 
87  return rich;
88  }
const QChar at(int i) const
Returns the character at the given index position in the string.
Definition: qstring.h:698
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qchar.h:251
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
void reserve(int size)
Attempts to allocate memory for at least size characters.
Definition: qstring.h:881

◆ findAxisStep()

static Expression::Ptr QPatternist::findAxisStep ( const Expression::Ptr expr,
const bool  throughStructures = true 
)
static

Assumes expr is an AxisStep wrapped in some kind of predicates or paths. Filters through the predicates and returns the AxisStep.

Definition at line 498 of file qquerytransformparser.cpp.

Referenced by createIdPatternPath(), createPatternPath(), and yyparse().

500 {
501  Q_ASSERT(expr);
502 
503  if(!throughStructures)
504  return expr;
505 
506  Expression *candidate = expr.data();
507  Expression::ID id = candidate->id();
508 
509  while(isPredicate(id) || id == Expression::IDPath)
510  {
511  const Expression::List &children = candidate->operands();
512  if(children.isEmpty())
513  return Expression::Ptr();
514  else
515  {
516  candidate = children.first().data();
517  id = candidate->id();
518  }
519  }
520 
521  if(id == Expression::IDEmptySequence)
522  return Expression::Ptr();
523  else
524  {
525  Q_ASSERT(candidate->is(Expression::IDAxisStep));
526  return Expression::Ptr(candidate);
527  }
528 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
static bool isPredicate(const Expression::ID id)

◆ formatAttribute() [1/2]

static QString QPatternist::formatAttribute ( const QString attribute)
inlinestatic

Formats attribute name.

Definition at line 139 of file qpatternistlocale_p.h.

Referenced by QPatternist::XsdSchemaParser::addAttribute(), QPatternist::XsdSchemaParser::attributeContentError(), QPatternist::XsdSchemaChecker::checkAttributeUseConstraints(), QPatternist::XsdSchemaChecker::checkSimpleTypeConstraints(), formatAttribute(), QPatternist::XsdSchemaHelper::isValidAttributeUsesRestriction(), QPatternist::XsdSchemaParser::parseAll(), QPatternist::XsdSchemaParser::parseAlternative(), QPatternist::XsdSchemaParser::parseAny(), QPatternist::XsdSchemaParser::parseAnyAttribute(), QPatternist::XsdSchemaParser::parseGlobalAttribute(), QPatternist::XsdSchemaParser::parseGlobalComplexType(), QPatternist::XsdSchemaParser::parseGlobalElement(), QPatternist::XsdSchemaParser::parseImport(), QPatternist::XsdSchemaParser::parseList(), QPatternist::XsdSchemaParser::parseLocalAll(), QPatternist::XsdSchemaParser::parseLocalAttribute(), QPatternist::XsdSchemaParser::parseLocalElement(), QPatternist::XsdSchemaParser::parseMinMaxConstraint(), QPatternist::XsdSchemaParser::parseNotation(), QPatternist::XsdSchemaParser::parseSimpleRestriction(), QPatternist::XsdSchemaParser::parseUnion(), QPatternist::XsdSchemaParser::readBlockingConstraintAttribute(), QPatternist::XsdSchemaParser::readDerivationConstraintAttribute(), QPatternist::XsdSchemaResolver::resolveAttributeInheritance(), QPatternist::XsdSchemaResolver::resolveAttributeTermReferences(), and QPatternist::XsdSchemaResolver::resolveTermReference().

140  {
141  // for the moment we forward to formatKeyword, that will change later
142  return formatKeyword(attribute);
143  }
static QString formatKeyword(const VariableDeclaration::Ptr &var, const NamePool::Ptr &np)
Formats var appropriately for display.

◆ formatAttribute() [2/2]

static QString QPatternist::formatAttribute ( const char *const  attribute)
inlinestatic

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 148 of file qpatternistlocale_p.h.

149  {
150  return formatAttribute(QLatin1String(attribute));
151  }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static QString formatAttribute(const char *const attribute)

◆ formatData() [1/4]

static QString QPatternist::formatData ( const QString data)
inlinestatic

Definition at line 228 of file qpatternistlocale_p.h.

Referenced by QPatternist::AccelTreeBuilder< true >::attribute(), QPatternist::XsdSchemaParser::attributeContentError(), QPatternist::DurationNumericMathematician::calculate(), QPatternist::NumericToDecimalCaster< IsInteger >::castFrom(), QPatternist::NumericToDerivedIntegerCaster< type >::castFrom(), QPatternist::XsdSchemaChecker::checkAttributeUseConstraints(), QPatternist::XsdSchemaChecker::checkConstrainingFacets(), QPatternist::XsdTypeChecker::checkConstrainingFacetsQName(), QPatternist::XsdSchemaResolver::checkRedefinedAttributeGroups(), QPatternist::XsdSchemaResolver::checkRedefinedGroups(), QPatternist::ContextNodeChecker::checkTargetNode(), QPatternist::AbstractDateTime::create(), createNumericLiteral(), QPatternist::ProcessingInstructionConstructor::data(), divZeroInvalid(), QPatternist::DerivedString< TypeToken >::error(), QPatternist::CommentConstructor::evaluateContent(), QPatternist::DateTimeFN::evaluateSingleton(), QPatternist::QNameFN::evaluateSingleton(), QPatternist::CodepointsToStringFN::evaluateSingleton(), QPatternist::AdjustTimezone::evaluateSingleton(), QPatternist::QNameConstructor::expandQName(), formatData(), QPatternist::HexBinary::fromLexical(), QPatternist::DerivedInteger< DerivedType >::fromValue(), QPatternist::XSLTTokenizer::handleXSLTVersion(), idivZeroInvalid(), QPatternist::XsdTypeChecker::isValidString(), modZeroInvalid(), QPatternist::XsdSchemaParser::parseAll(), QPatternist::XsdSchemaParser::parseAny(), QPatternist::XsdSchemaParser::parseAnyAttribute(), QPatternist::XsdSchemaParser::parseGlobalAttribute(), QPatternist::XsdSchemaParser::parseLocalAll(), QPatternist::XsdSchemaParser::parseLocalAttribute(), QPatternist::XsdValidatingInstanceReader::qNameAttribute(), QPatternist::XSLTTokenizer::readAlternativeAttribute(), QPatternist::XsdSchemaParser::readBlockingConstraintAttribute(), QPatternist::XsdSchemaParser::readDerivationConstraintAttribute(), QPatternist::XSLTTokenizer::readToggleAttribute(), QPatternist::XsdSchemaResolver::resolveAttributeInheritance(), QPatternist::XsdSchemaResolver::resolveEnumerationFacetValues(), QPatternist::XsdSchemaResolver::resolveTermReference(), QPatternist::AccelTreeResourceLoader::retrieveUnparsedText(), QPatternist::XsdValidatingInstanceReader::selectNodeSets(), QPatternist::XsdValidatingInstanceReader::validateElement(), QPatternist::XsdSchemaParser::validateIdAttribute(), QPatternist::ItemVerifier::verifyItem(), and yyparse().

229  {
230  return QLatin1String("<span class='XQuery-data'>") +
231  escape(data) +
232  QLatin1String("</span>");
233  }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
Q_GUI_EXPORT QString escape(const QString &plain)
Converts the plain text string plain to a HTML string with HTML metacharacters <, >...

◆ formatData() [2/4]

static QString QPatternist::formatData ( const xsInteger  data)
inlinestatic

This is an overload, provided for convenience.

Definition at line 238 of file qpatternistlocale_p.h.

239  {
241  }
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qstring.cpp:6448
static const char * data(const QByteArray &arr)
static QString formatData(const QXmlNodeModelIndex node)
Definition: qitem_p.h:440

◆ formatData() [3/4]

static QString QPatternist::formatData ( const char *const  data)
inlinestatic

This is an overload, provided for convenience.

Definition at line 246 of file qpatternistlocale_p.h.

247  {
248  return formatData(QLatin1String(data));
249  }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static const char * data(const QByteArray &arr)
static QString formatData(const QXmlNodeModelIndex node)
Definition: qitem_p.h:440

◆ formatData() [4/4]

static QString QPatternist::formatData ( const QLatin1Char data)
inlinestatic

This is an overload, provided for convenience.

Definition at line 254 of file qpatternistlocale_p.h.

255  {
256  return formatData(QString(data));
257  }
The QString class provides a Unicode character string.
Definition: qstring.h:83
static QString formatData(const QXmlNodeModelIndex node)
Definition: qitem_p.h:440

◆ formatElement() [1/2]

static QString QPatternist::formatElement ( const QString element)
inlinestatic

Formats element name.

Definition at line 122 of file qpatternistlocale_p.h.

Referenced by QPatternist::XsdSchemaParser::addElement(), QPatternist::XsdSchemaParser::attributeContentError(), QPatternist::XsdSchemaResolver::checkRedefinedAttributeGroups(), QPatternist::XsdSchemaResolver::checkRedefinedGroups(), QPatternist::TagValidationHandler::finalize(), formatElement(), QPatternist::XsdSchemaHelper::isValidAttributeUsesExtension(), QPatternist::XsdSchemaHelper::isValidAttributeUsesRestriction(), QPatternist::XsdSchemaParser::parseAll(), QPatternist::XsdSchemaParser::parseAlternative(), QPatternist::XsdSchemaParser::parseAny(), QPatternist::XsdSchemaParser::parseAnyAttribute(), QPatternist::XsdSchemaParser::parseGlobalAttribute(), QPatternist::XsdSchemaParser::parseGlobalComplexType(), QPatternist::XsdSchemaParser::parseGlobalElement(), QPatternist::XsdSchemaParser::parseImport(), QPatternist::XsdSchemaParser::parseList(), QPatternist::XsdSchemaParser::parseLocalAll(), QPatternist::XsdSchemaParser::parseLocalAttribute(), QPatternist::XsdSchemaParser::parseLocalElement(), QPatternist::XsdSchemaParser::parseMinMaxConstraint(), QPatternist::XsdSchemaParser::parseNotation(), QPatternist::XsdSchemaParser::parseSimpleRestriction(), QPatternist::XsdSchemaParser::parseUnion(), QPatternist::XsdSchemaParser::parseUnknown(), QPatternist::XsdSchemaParser::readBlockingConstraintAttribute(), QPatternist::XsdSchemaParser::readDerivationConstraintAttribute(), QPatternist::XsdSchemaResolver::resolveAlternativeTypes(), QPatternist::XsdSchemaResolver::resolveAttributeTermReferences(), QPatternist::XsdSchemaResolver::resolveAttributeTypes(), QPatternist::XsdSchemaResolver::resolveComplexBaseTypes(), QPatternist::XsdSchemaResolver::resolveElementTypes(), QPatternist::XsdSchemaResolver::resolveKeyReferences(), QPatternist::XsdSchemaResolver::resolveSimpleListType(), QPatternist::XsdSchemaResolver::resolveSimpleRestrictionBaseTypes(), QPatternist::XsdSchemaResolver::resolveSimpleUnionTypes(), QPatternist::XsdSchemaResolver::resolveSubstitutionGroupAffiliations(), QPatternist::XsdSchemaResolver::resolveTermReference(), and QPatternist::TagValidationHandler::validate().

123  {
124  // for the moment we forward to formatKeyword, that will change later
125  return formatKeyword(element);
126  }
static QString formatKeyword(const VariableDeclaration::Ptr &var, const NamePool::Ptr &np)
Formats var appropriately for display.

◆ formatElement() [2/2]

static QString QPatternist::formatElement ( const char *const  element)
inlinestatic

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 131 of file qpatternistlocale_p.h.

132  {
133  return formatElement(QLatin1String(element));
134  }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static QString formatElement(const char *const element)

◆ formatExpression()

static QString QPatternist::formatExpression ( const QString expr)
inlinestatic

Formats an arbitrary expression, such as a regular expression or XQuery query.

Definition at line 263 of file qpatternistlocale_p.h.

Referenced by QPatternist::PatternPlatform::parsePattern(), and yyparse().

264  {
265  return QLatin1String("<span class='XQuery-expression'>") +
266  escape(expr) +
267  QLatin1String("</span>");
268  }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
Q_GUI_EXPORT QString escape(const QString &plain)
Converts the plain text string plain to a HTML string with HTML metacharacters <, >...

◆ formatFunction()

static QString QPatternist::formatFunction ( const NamePool::Ptr np,
const FunctionSignature::Ptr func 
)
inlinestatic

Formats FunctionSignature.

Definition at line 201 of file qfunctionsignature_p.h.

Referenced by QPatternist::ContextNodeChecker::checkTargetNode(), QPatternist::ErrorFN::evaluateSingleton(), QPatternist::ComparingAggregator< oper, result >::typeCheck(), QPatternist::AddingAggregate::typeCheck(), QPatternist::SumFN::typeCheck(), QPatternist::AbstractFunctionFactory::verifyArity(), and yyparse().

202  {
203  return QLatin1String("<span class='XQuery-function'>") +
204  escape(func->displayName(np)) +
205  QLatin1String("</span>");
206  }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
Q_GUI_EXPORT QString escape(const QString &plain)
Converts the plain text string plain to a HTML string with HTML metacharacters <, >...

◆ formatKeyword() [1/4]

QString QPatternist::formatKeyword ( const QString keyword)
inline

Definition at line 94 of file qpatternistlocale_p.h.

Referenced by QPatternist::XsdSchemaParser::addAttributeGroup(), QPatternist::XsdSchemaParser::addElementGroup(), QPatternist::XsdSchemaParser::addIdentityConstraint(), QPatternist::XsdValidatingInstanceReader::addIdIdRefBinding(), QPatternist::XsdSchemaParser::addNotation(), QXmlSerializer::attribute(), QPatternist::DocumentContentValidator::attribute(), QPatternist::OutputValidator::attribute(), QPatternist::AccelTreeBuilder< true >::attribute(), QPatternist::XsdSchemaChecker::checkAttributeConstraints(), QPatternist::XsdSchemaChecker::checkAttributeUseConstraints(), QPatternist::XsdSchemaChecker::checkComplexTypeConstraints(), QPatternist::XsdSchemaChecker::checkConstrainingFacets(), QPatternist::XsdSchemaChecker::checkDuplicatedAttributeUses(), QPatternist::XsdSchemaChecker::checkElementConstraints(), QPatternist::XsdSchemaChecker::checkElementDuplicates(), QPatternist::XsdSchemaChecker::checkSimpleTypeConstraints(), checkVariableCircularity(), QPatternist::XsdSchemaParser::convertName(), QPatternist::AbstractDuration::create(), QPatternist::Template::createContext(), QPatternist::ExpressionFactory::createExpression(), derivedTermValid(), QPatternist::NormalizeUnicodeFN::determineNormalizationForm(), divZeroInvalid(), QPatternist::ReplaceFN::errorAtEnd(), QPatternist::AttributeNameValidator::evaluateSingleton(), QPatternist::QNameFN::evaluateSingleton(), QPatternist::ComputedNamespaceConstructor::evaluateToSequenceReceiver(), QPatternist::QNameConstructor::expandQName(), QPatternist::ArithmeticExpression::fetchMathematician(), QPatternist::ParserContext::finalizePushedVariable(), flagDescriptions(), formatAttribute(), formatElement(), formatKeyword(), QPatternist::XSLTTokenizer::handleStandardAttributes(), QPatternist::XSLTTokenizer::handleValidationAttributes(), idivZeroInvalid(), QPatternist::XSLTTokenizer::insideChoose(), QPatternist::XSLTTokenizer::insideSequenceConstructor(), QPatternist::XSLTTokenizer::insideStylesheetModule(), QPatternist::XSLTTokenizer::insideTemplate(), QPatternist::XsdSchemaHelper::isValidAttributeUsesExtension(), QPatternist::XsdSchemaHelper::isValidAttributeUsesRestriction(), modZeroInvalid(), QPatternist::NCNameConstructor::nameIsXML(), QPatternist::QNameConstructor::namespaceForPrefix(), QPatternist::XSLTTokenizer::outsideDocumentElement(), QPatternist::PatternPlatform::parseFlags(), QPatternist::XsdSchemaParser::parseRedefine(), QPatternist::ReplaceFN::parseReplacement(), prologMessage(), QPatternist::XSLTTokenizer::queueParams(), QPatternist::XSLTTokenizer::queueSelectOrSequenceConstructor(), QPatternist::XSLTTokenizer::queueSorting(), QPatternist::XSLTTokenizer::queueVariableDeclaration(), QPatternist::Template::raiseXTSE0680(), QPatternist::XsdValidatingInstanceReader::read(), QPatternist::XSLTTokenizer::readAlternativeAttribute(), QPatternist::XSLTTokenizer::readToggleAttribute(), registerNamedTemplate(), QPatternist::XsdSchemaResolver::resolveAttributeTermReferences(), QPatternist::XsdSchemaResolver::resolveComplexContentComplexTypes(), QPatternist::XsdSchemaResolver::resolveKeyReferences(), QPatternist::XsdSchemaResolver::resolveSubstitutionGroupAffiliations(), QPatternist::XsdSchemaResolver::resolveTermReference(), QPatternist::XSLTTokenizer::skipBodyOfParam(), QXmlSerializer::startElement(), QPatternist::XSLTTokenizer::unexpectedContent(), QPatternist::XsdValidatingInstanceReader::validate(), QPatternist::XsdValidatingInstanceReader::validateAttribute(), QPatternist::XsdValidatingInstanceReader::validateElement(), QPatternist::MaintainingReader< XSLTTokenLookup >::validateElement(), QPatternist::XsdValidatingInstanceReader::validateElementComplexType(), QPatternist::XsdValidatingInstanceReader::validateElementSimpleType(), QPatternist::XsdValidatingInstanceReader::validateKeyIdentityConstraint(), QPatternist::XsdValidatingInstanceReader::validateKeyRefIdentityConstraint(), QPatternist::NCNameConstructor::validateTargetName(), QPatternist::XsdValidatingInstanceReader::validateUniqueIdentityConstraint(), variableUnavailable(), and yyparse().

95  {
96  return QLatin1String("<span class='XQuery-keyword'>") +
97  escape(keyword) +
98  QLatin1String("</span>");
99  }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
Q_GUI_EXPORT QString escape(const QString &plain)
Converts the plain text string plain to a HTML string with HTML metacharacters <, >...

◆ formatKeyword() [2/4]

static QString QPatternist::formatKeyword ( const QStringRef keyword)
inlinestatic

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 104 of file qpatternistlocale_p.h.

105  {
106  return formatKeyword(keyword.toString());
107  }
QString toString() const
Returns a copy of the string reference as a QString object.
Definition: qstring.cpp:8653
static QString formatKeyword(const VariableDeclaration::Ptr &var, const NamePool::Ptr &np)
Formats var appropriately for display.

◆ formatKeyword() [3/4]

static QString QPatternist::formatKeyword ( const char *const  keyword)
inlinestatic

Definition at line 109 of file qpatternistlocale_p.h.

110  {
111  return formatKeyword(QLatin1String(keyword));
112  }
static QString formatKeyword(const VariableDeclaration::Ptr &var, const NamePool::Ptr &np)
Formats var appropriately for display.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString

◆ formatKeyword() [4/4]

static QString QPatternist::formatKeyword ( const QChar  keyword)
inlinestatic

Definition at line 114 of file qpatternistlocale_p.h.

115  {
116  return formatKeyword(QString(keyword));
117  }
static QString formatKeyword(const VariableDeclaration::Ptr &var, const NamePool::Ptr &np)
Formats var appropriately for display.
The QString class provides a Unicode character string.
Definition: qstring.h:83

◆ formatResourcePath()

static QString QPatternist::formatResourcePath ( const QUrl uri)
inlinestatic

Formats uri as a path to a resource, typically it's a filename or a URI.

Definition at line 192 of file qpatternistlocale_p.h.

Referenced by QPatternist::CollectionFN::evaluateSequence().

193  {
194  const QString normalizedURI(escape(uri.toString(QUrl::RemovePassword)));
195 
196  return QLatin1String("<span class='XQuery-filepath'><a href='") +
197  normalizedURI +
198  QLatin1String("'>") +
199  normalizedURI +
200  QLatin1String("</a></span>");
201  }
QString toString(FormattingOptions options=None) const
Returns the human-displayable string representation of the URL.
Definition: qurl.cpp:5896
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
Q_GUI_EXPORT QString escape(const QString &plain)
Converts the plain text string plain to a HTML string with HTML metacharacters <, >...

◆ formatType() [1/3]

template<typename T >
QString QPatternist::formatType ( const NamePool::Ptr np,
const T &  type 
)
inline

Formats ItemType and SequenceType.

This function is not declared static, because the compiler on target aix-xlc-64 won't accept it.

Definition at line 160 of file qpatternistlocale_p.h.

Referenced by QPatternist::XsdSchemaParser::addFacet(), QPatternist::XsdSchemaParser::addType(), QPatternist::AccelTreeBuilder< true >::attribute(), QPatternist::XsdSchemaParser::attributeContentError(), QPatternist::DurationNumericMathematician::calculate(), QPatternist::NumericToDecimalCaster< IsInteger >::castFrom(), QPatternist::NumericToDerivedIntegerCaster< type >::castFrom(), QPatternist::XsdSchemaChecker::checkAttributeConstraints(), QPatternist::XsdSchemaChecker::checkBasicCircularInheritances(), QPatternist::XsdSchemaChecker::checkBasicComplexTypeConstraints(), QPatternist::XsdSchemaChecker::checkBasicSimpleTypeConstraints(), QPatternist::XsdSchemaChecker::checkCircularInheritances(), QPatternist::XsdSchemaChecker::checkComplexTypeConstraints(), QPatternist::XsdSchemaChecker::checkConstrainingFacets(), QPatternist::XsdSchemaChecker::checkDuplicatedAttributeUses(), QPatternist::XsdSchemaChecker::checkElementConstraints(), QPatternist::XsdSchemaChecker::checkInheritanceRestrictions(), QPatternist::XsdSchemaChecker::checkSimpleDerivationRestrictions(), QPatternist::XsdSchemaChecker::checkSimpleTypeConstraints(), QPatternist::CastingPlatform< UntypedAtomicConverter, true >::checkTargetType(), QPatternist::GenericPredicate::create(), QPatternist::DerivedString< TypeToken >::error(), QPatternist::AtomicValue::evaluateEBV(), QPatternist::QNameFN::evaluateSingleton(), QPatternist::CastAs::evaluateSingleton(), QPatternist::ComputedNamespaceConstructor::evaluateToSequenceReceiver(), QPatternist::QNameConstructor::expandQName(), QPatternist::ComparisonPlatform< IndexOfIterator, false >::fetchComparator(), QPatternist::ArithmeticExpression::fetchMathematician(), QPatternist::HexBinary::fromLexical(), QPatternist::XsdTypeChecker::fromLexical(), QPatternist::DerivedInteger< DerivedType >::fromValue(), QPatternist::XSLTTokenizer::handleXSLTVersion(), QPatternist::CastingPlatform< UntypedAtomicConverter, true >::issueCastError(), QPatternist::XsdTypeChecker::isValidString(), QPatternist::CastingPlatform< UntypedAtomicConverter, true >::locateCaster(), QPatternist::TraceCallback::mapToItem(), QPatternist::XsdSchemaParser::parseRedefine(), QPatternist::TypeChecker::promotionPossible(), QPatternist::XsdSchemaResolver::resolveAlternativeTypes(), QPatternist::XsdSchemaResolver::resolveAttributeInheritance(), QPatternist::XsdSchemaResolver::resolveAttributeTypes(), QPatternist::XsdSchemaResolver::resolveComplexBaseTypes(), QPatternist::XsdSchemaResolver::resolveComplexContentComplexTypes(), QPatternist::XsdSchemaResolver::resolveElementTypes(), QPatternist::XsdSchemaResolver::resolveEnumerationFacetValues(), QPatternist::XsdSchemaResolver::resolveSimpleListType(), QPatternist::XsdSchemaResolver::resolveSimpleRestrictionBaseTypes(), QPatternist::XsdSchemaResolver::resolveSimpleUnionTypes(), QPatternist::AnyURI::toQUrl(), QPatternist::ComparingAggregator< oper, result >::typeCheck(), QPatternist::AddingAggregate::typeCheck(), QPatternist::CastAs::typeCheck(), QPatternist::AvgFN::typeCheck(), QPatternist::SumFN::typeCheck(), QPatternist::XsdValidatingInstanceReader::validate(), QPatternist::XsdValidatingInstanceReader::validateElement(), QPatternist::XsdValidatingInstanceReader::validateElementType(), QPatternist::NCNameConstructor::validateTargetName(), QPatternist::ItemVerifier::verifyItem(), QPatternist::CardinalityVerifier::wrongCardinality(), QPatternist::TypeChecker::wrongType(), and yyparse().

161  {
162  Q_ASSERT(type);
163  return QLatin1String("<span class='XQuery-type'>") +
164  escape(type->displayName(np)) +
165  QLatin1String("</span>");
166  }
int type
Definition: qmetatype.cpp:239
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
Q_GUI_EXPORT QString escape(const QString &plain)
Converts the plain text string plain to a HTML string with HTML metacharacters <, >...

◆ formatType() [2/3]

static QString QPatternist::formatType ( const NamePool::Ptr np,
const QXmlName name 
)
inlinestatic

Formats name of any type.

Definition at line 171 of file qpatternistlocale_p.h.

172  {
173  return QLatin1String("<span class='XQuery-type'>") +
174  escape(np->displayName(name)) +
175  QLatin1String("</span>");
176  }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
Q_GUI_EXPORT QString escape(const QString &plain)
Converts the plain text string plain to a HTML string with HTML metacharacters <, >...

◆ formatType() [3/3]

static QString QPatternist::formatType ( const Cardinality type)
inlinestatic

Formats Cardinality.

Definition at line 181 of file qpatternistlocale_p.h.

182  {
183  return QLatin1String("<span class='XQuery-type'>") +
184  escape(type.displayName(Cardinality::IncludeExplanation)) +
185  QLatin1String("</span>");
186  }
int type
Definition: qmetatype.cpp:239
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
Q_GUI_EXPORT QString escape(const QString &plain)
Converts the plain text string plain to a HTML string with HTML metacharacters <, >...

◆ formatURI() [1/3]

static QString QPatternist::formatURI ( const NamePool::Ptr np,
const QXmlName::NamespaceCode uri 
)
inlinestatic

Formats uri, that's considered to be a URI, for display.

Definition at line 202 of file qanyuri_p.h.

Referenced by QPatternist::XPathHelper::checkCollationSupport(), QPatternist::AttributeNameValidator::evaluateSingleton(), formatURI(), QPatternist::XsdSchemaParser::parseGlobalAttribute(), QPatternist::XsdSchemaParser::parseImport(), QPatternist::XsdSchemaParser::parseLocalAttribute(), QPatternist::XsdSchemaParser::parseSchema(), QPatternist::AccelTreeResourceLoader::retrieveUnparsedText(), QPatternist::AnyURI::toQUrl(), QPatternist::DocFN::typeCheck(), and yyparse().

203  {
204  return formatURI(np->stringForNamespace(uri));
205  }
static QString formatURI(const NamePool::Ptr &np, const QXmlName::NamespaceCode &uri)
Formats uri, that&#39;s considered to be a URI, for display.
Definition: qanyuri_p.h:202

◆ formatURI() [2/3]

static QString QPatternist::formatURI ( const QUrl uri)
inlinestatic

Formats uri for display.

Note
It's not guaranteed that URIs being formatted are valid. That can be an arbitrary string.

Definition at line 209 of file qpatternistlocale_p.h.

210  {
211  return QLatin1String("<span class='XQuery-uri'>") +
213  QLatin1String("</span>");
214  }
QString toString(FormattingOptions options=None) const
Returns the human-displayable string representation of the URL.
Definition: qurl.cpp:5896
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
Q_GUI_EXPORT QString escape(const QString &plain)
Converts the plain text string plain to a HTML string with HTML metacharacters <, >...

◆ formatURI() [3/3]

static QString QPatternist::formatURI ( const QString uri)
inlinestatic

Formats uri, that's considered to be a URI, for display.

uri does not have to be a valid QUrl or valid instance of xs:anyURI.

Definition at line 222 of file qpatternistlocale_p.h.

223  {
224  const QUrl realURI(uri);
225  return formatURI(realURI);
226  }
The QUrl class provides a convenient interface for working with URLs.
Definition: qurl.h:61
static QString formatURI(const QString &uri)
Formats uri, that&#39;s considered to be a URI, for display.

◆ fromYYLTYPE()

static QSourceLocation QPatternist::fromYYLTYPE ( const YYLTYPE sourceLocator,
const ParserContext *const  parseInfo 
)
inlinestatic

Definition at line 233 of file qquerytransformparser.cpp.

Referenced by allowedIn(), create(), createIdPatternPath(), createNumericLiteral(), createPatternPath(), registerNamedTemplate(), QPatternist::ReflectYYLTYPE::sourceLocation(), variableUnavailable(), XPatherror(), and yyparse().

235 {
236  return QSourceLocation(parseInfo->tokenizer->queryURI(),
237  sourceLocator.first_line,
238  sourceLocator.first_column);
239 }
The QSourceLocation class identifies a location in a resource by URI, line, and column.

◆ isPredicate()

static bool QPatternist::isPredicate ( const Expression::ID  id)
inlinestatic

Definition at line 488 of file qquerytransformparser.cpp.

Referenced by findAxisStep(), and yyparse().

489 {
490  return id == Expression::IDGenericPredicate ||
491  id == Expression::IDFirstItemPredicate;
492 }

◆ isVariableReference()

static bool QPatternist::isVariableReference ( const Expression::ID  id)
inlinestatic

Definition at line 310 of file qquerytransformparser.cpp.

Referenced by yyparse().

311 {
312  return id == Expression::IDExpressionVariableReference
313  || id == Expression::IDRangeVariableReference
314  || id == Expression::IDArgumentReference;
315 }

◆ loadPattern()

static void QPatternist::loadPattern ( const Expression::Ptr matchPattern,
TemplatePattern::Vector ourPatterns,
const TemplatePattern::ID  id,
const PatternPriority  priority,
const Template::Ptr temp 
)
static

Definition at line 388 of file qquerytransformparser.cpp.

Referenced by yyparse().

393 {
394  Q_ASSERT(temp);
395 
396  const PatternPriority effectivePriority = qIsNaN(priority) ? matchPattern->patternPriority() : priority;
397 
398  ourPatterns.append(TemplatePattern::Ptr(new TemplatePattern(matchPattern, effectivePriority, id, temp)));
399 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
Q_CORE_EXPORT bool qIsNaN(double d)
Returns true if the double {d} is not a number (NaN).
Definition: qnumeric.cpp:55
xsDouble PatternPriority

◆ locateReturnClause()

static ReturnOrderBy* QPatternist::locateReturnClause ( const Expression::Ptr expr)
static

When we want to connect the OrderBy and ReturnOrderBy, it might be that we have other expressions, such as where and let inbetween. We need to continue through them. This function does that.

Definition at line 475 of file qquerytransformparser.cpp.

Referenced by yyparse().

476 {
477  Q_ASSERT(expr);
478 
479  const Expression::ID id = expr->id();
480  if(id == Expression::IDLetClause || id == Expression::IDIfThenClause || id == Expression::IDForClause)
481  return locateReturnClause(expr->operands()[1]);
482  else if(id == Expression::IDReturnOrderBy)
483  return expr->as<ReturnOrderBy>();
484  else
485  return 0;
486 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
static ReturnOrderBy * locateReturnClause(const Expression::Ptr &expr)
const TCastTarget * as() const

◆ makeEmptyIterator()

template<typename T >
static QAbstractXmlForwardIterator<T>::Ptr QPatternist::makeEmptyIterator ( )
inlinestatic

Definition at line 135 of file qemptyiterator_p.h.

136  {
137  return typename QAbstractXmlForwardIterator<T>::Ptr(new EmptyIterator<T>());
138  }
QExplicitlySharedDataPointer< QAbstractXmlForwardIterator< T > > Ptr
A smart pointer wrapping an instance of a QAbstractXmlForwardIterator subclass.

◆ makeListIterator()

template<typename T >
QAbstractXmlForwardIterator<T>::Ptr QPatternist::makeListIterator ( const QList< T > &  list)
related

◆ makeVectorIterator()

template<typename T >
QAbstractXmlForwardIterator<T>::Ptr QPatternist::makeVectorIterator ( const QVector< T > &  vector)
inline

Definition at line 258 of file qabstractxmlforwarditerator_p.h.

Referenced by QAbstractXmlNodeModel::iterate().

259  {
260  return typename ListIterator<T, QVector<T> >::Ptr(new ListIterator<T, QVector<T> >(vector));
261  }
The QVector class is a template class that provides a dynamic array.
Definition: qdatastream.h:64

◆ operator|()

static QXmlNodeModelIndex::NodeKind QPatternist::operator| ( const QXmlNodeModelIndex::NodeKind op1,
const QXmlNodeModelIndex::NodeKind op2 
)
inlinestatic

This operator is needed for the s_whenAxisNodeKindEmpty array. The int constructors ensure we invoke another operator| such that we don't get an infinite loop.

Definition at line 60 of file qaxisstep.cpp.

61  {
62  return QXmlNodeModelIndex::NodeKind(int(op1) | int(op2));
63  }
NodeKind
Identifies a kind of node.

◆ pDebug()

QNoDebug QPatternist::pDebug ( )
inline

◆ prologMessage()

static QString QPatternist::prologMessage ( const char *const  msg)
inlinestatic

Centralizes a translation message, for the purpose of consistency and modularization.

Definition at line 631 of file qquerytransformparser.cpp.

Referenced by yyparse().

632 {
633  Q_ASSERT(msg);
634  return QtXmlPatterns::tr("Only one %1 declaration can occur in the query prolog.").arg(formatKeyword(msg));
635 }
static QString formatKeyword(const VariableDeclaration::Ptr &var, const NamePool::Ptr &np)
Formats var appropriately for display.
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

◆ pushVariable()

static Expression::Ptr QPatternist::pushVariable ( const QXmlName  name,
const SequenceType::Ptr seqType,
const Expression::Ptr expr,
const VariableDeclaration::Type  type,
const YYLTYPE sourceLocator,
ParserContext *const  parseInfo,
const bool  checkSource = true 
)
static

seqType and expr may be null.

Definition at line 907 of file qquerytransformparser.cpp.

Referenced by yyparse().

914 {
915  Q_ASSERT(!name.isNull());
916  Q_ASSERT(parseInfo);
917 
918  /* -2 will cause Q_ASSERTs to trigger if it isn't changed. */
919  VariableSlotID slot = -2;
920 
921  switch(type)
922  {
923  case VariableDeclaration::FunctionArgument:
924  /* Fallthrough. */
925  case VariableDeclaration::ExpressionVariable:
926  {
927  slot = parseInfo->allocateExpressionSlot();
928  break;
929  }
930  case VariableDeclaration::GlobalVariable:
931  {
932  slot = parseInfo->allocateGlobalVariableSlot();
933  break;
934  }
935  case VariableDeclaration::RangeVariable:
936  {
937  slot = parseInfo->staticContext->allocateRangeSlot();
938  break;
939  }
940  case VariableDeclaration::PositionalVariable:
941  {
942  slot = parseInfo->allocatePositionalSlot();
943  break;
944  }
945  case VariableDeclaration::TemplateParameter:
946  /* Fallthrough. We do nothing, template parameters
947  * doesn't use context slots at all, they're hashed
948  * on the name. */
949  case VariableDeclaration::ExternalVariable:
950  /* We do nothing, external variables doesn't use
951  *context slots/stack frames at all. */
952  ;
953  }
954 
955  const VariableDeclaration::Ptr var(new VariableDeclaration(name, slot, type, seqType));
956 
957  Expression::Ptr checked;
958 
959  if(checkSource && seqType)
960  {
961  if(expr)
962  {
963  /* We only want to add conversion for function arguments, and variables
964  * if we're XSL-T.
965  *
966  * We unconditionally skip TypeChecker::CheckFocus because the StaticContext we
967  * pass hasn't set up the focus yet, since that's the parent's responsibility. */
968  const TypeChecker::Options options(( type == VariableDeclaration::FunctionArgument
969  || type == VariableDeclaration::TemplateParameter
970  || parseInfo->isXSLT())
971  ? TypeChecker::AutomaticallyConvert : TypeChecker::Options());
972 
973  checked = TypeChecker::applyFunctionConversion(expr, seqType, parseInfo->staticContext,
974  parseInfo->isXSLT() ? ReportContext::XTTE0570 : ReportContext::XPTY0004,
975  options);
976  }
977  }
978  else
979  checked = expr;
980 
981  /* Add an evaluation cache for all expression variables. No EvaluationCache is needed for
982  * positional variables because in the end they are calls to Iterator::position(). Similarly,
983  * no need to cache range variables either because they are calls to DynamicContext::rangeVariable().
984  *
985  * We don't do it for function arguments because the Expression being cached depends -- it depends
986  * on the callsite. UserFunctionCallsite is responsible for the evaluation caches in that case.
987  *
988  * In some cases the EvaluationCache instance isn't necessary, but in those cases EvaluationCache
989  * optimizes itself away. */
990  if(type == VariableDeclaration::ExpressionVariable)
991  checked = create(new EvaluationCache<false>(checked, var.data(), parseInfo->allocateCacheSlot()), sourceLocator, parseInfo);
992  else if(type == VariableDeclaration::GlobalVariable)
993  checked = create(new EvaluationCache<true>(checked, var.data(), parseInfo->allocateCacheSlot()), sourceLocator, parseInfo);
994 
995  var->setExpression(checked);
996 
997  parseInfo->variables.push(var);
998  return checked;
999 }
qint32 VariableSlotID
int type
Definition: qmetatype.cpp:239
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
static Expression::Ptr create(const Expression::Ptr &expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
bool isNull() const
Returns true if this QXmlName is not initialized with a valid combination of {namespace URI}...
Definition: qxmlname.cpp:224

◆ qHash()

uint QPatternist::qHash ( const QPatternist::TargetNode node)
inline

Creates a hash value for the given target node.

Definition at line 176 of file qxsdidchelper_p.h.

Referenced by qHash().

177  {
178  return qHash(node.item().toNodeModelIndex());
179  }
uint qHash(const QUrl &url)
Definition: qurl.h:285
QXmlItem item() const
QXmlNodeModelIndex toNodeModelIndex() const
If this QXmlItem represents a node, it returns the item as a QXmlNodeModelIndex.

◆ quantificationType()

static SequenceType::Ptr QPatternist::quantificationType ( const SequenceType::Ptr type)
inlinestatic

The Cardinality in a TypeDeclaration for a variable in a quantification has no effect, and this function ensures this by changing type to Cardinality Cardinality::zeroOrMore().

See also
Bugzilla Bug 3305 Cardinality + on range variables
ParserContext::finalizePushedVariable()

Definition at line 898 of file qquerytransformparser.cpp.

Referenced by yyparse().

899 {
900  Q_ASSERT(type);
901  return makeGenericSequenceType(type->itemType(), Cardinality::zeroOrMore());
902 }
static SequenceType::Ptr makeGenericSequenceType(const ItemType::Ptr &itemType, const Cardinality &cardinality)
An object generator for GenericSequenceType.
int type
Definition: qmetatype.cpp:239
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

◆ registerNamedTemplate()

static void QPatternist::registerNamedTemplate ( const QXmlName name,
const Expression::Ptr body,
ParserContext *const  parseInfo,
const YYLTYPE sourceLocator,
const Template::Ptr temp 
)
static

Definition at line 411 of file qquerytransformparser.cpp.

Referenced by yyparse().

416 {
417  Template::Ptr &e = parseInfo->namedTemplates[name];
418 
419  if(e)
420  {
421  parseInfo->staticContext->error(QtXmlPatterns::tr("A template with name %1 "
422  "has already been declared.")
423  .arg(formatKeyword(parseInfo->staticContext->namePool(),
424  name)),
425  ReportContext::XTSE0660,
426  fromYYLTYPE(sourceLocator, parseInfo));
427  }
428  else
429  {
430  e = temp;
431  e->body = body;
432  }
433 }
static QString formatKeyword(const VariableDeclaration::Ptr &var, const NamePool::Ptr &np)
Formats var appropriately for display.
const char * name
static QSourceLocation fromYYLTYPE(const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)

◆ resolveAndCheckCollation()

template<const ReportContext::ErrorCode errorCode>
static QUrl QPatternist::resolveAndCheckCollation ( const QString collation,
const ParserContext *const  parseInfo,
const YYLTYPE sl 
)
static

Resolves against the static base URI and checks that collation is a supported Unicode Collation.

"If a default collation declaration specifies a collation by a relative URI, that relative URI is resolved to an absolute URI using the base URI in the static context."

Returns
the Unicode Collation properly resolved, if collation is a valid collation

Definition at line 648 of file qquerytransformparser.cpp.

651 {
652  Q_ASSERT(parseInfo);
653  const ReflectYYLTYPE ryy(sl, parseInfo);
654 
655  QUrl uri(AnyURI::toQUrl<ReportContext::XQST0046>(collation, parseInfo->staticContext, &ryy));
656 
657  if(uri.isRelative())
658  uri = parseInfo->staticContext->baseURI().resolved(uri);
659 
660  XPathHelper::checkCollationSupport<errorCode>(uri.toString(), parseInfo->staticContext, &ryy);
661 
662  return uri;
663 }
The QUrl class provides a convenient interface for working with URLs.
Definition: qurl.h:61
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

◆ resolveVariable()

static Expression::Ptr QPatternist::resolveVariable ( const QXmlName name,
const YYLTYPE sourceLocator,
ParserContext *const  parseInfo,
const bool  raiseErrorOnUnavailability 
)
static

Definition at line 1022 of file qquerytransformparser.cpp.

Referenced by yyparse().

1026 {
1027  const VariableDeclaration::Ptr var(variableByName(name, parseInfo));
1028  Expression::Ptr retval;
1029 
1030  if(var && var->type != VariableDeclaration::ExternalVariable)
1031  {
1032  switch(var->type)
1033  {
1034  case VariableDeclaration::RangeVariable:
1035  {
1036  retval = create(new RangeVariableReference(var->expression(), var->slot), sourceLocator, parseInfo);
1037  break;
1038  }
1039  case VariableDeclaration::GlobalVariable:
1040  /* Fallthrough. From the perspective of an ExpressionVariableReference, it can't tell
1041  * a difference between a global and a local expression variable. However, the cache
1042  * mechanism must. */
1043  case VariableDeclaration::ExpressionVariable:
1044  {
1045  retval = create(new ExpressionVariableReference(var->slot, var.data()), sourceLocator, parseInfo);
1046  break;
1047  }
1048  case VariableDeclaration::FunctionArgument:
1049  {
1050  retval = create(new ArgumentReference(var->sequenceType, var->slot), sourceLocator, parseInfo);
1051  break;
1052  }
1053  case VariableDeclaration::PositionalVariable:
1054  {
1055  retval = create(new PositionalVariableReference(var->slot), sourceLocator, parseInfo);
1056  break;
1057  }
1058  case VariableDeclaration::TemplateParameter:
1059  {
1060  retval = create(new TemplateParameterReference(var.data()), sourceLocator, parseInfo);
1061  break;
1062  }
1063  case VariableDeclaration::ExternalVariable:
1064  /* This code path will never be hit, but the case
1065  * label silences a warning. See above. */
1066  ;
1067  }
1068  Q_ASSERT(retval);
1069  var->references.append(retval);
1070  }
1071  else
1072  {
1073  /* Let's see if your external variable loader can provide us with one. */
1074  const SequenceType::Ptr varType(parseInfo->staticContext->
1075  externalVariableLoader()->announceExternalVariable(name, CommonSequenceTypes::ZeroOrMoreItems));
1076 
1077  if(varType)
1078  {
1079  const Expression::Ptr extRef(create(new ExternalVariableReference(name, varType), sourceLocator, parseInfo));
1080  const Expression::Ptr checked(TypeChecker::applyFunctionConversion(extRef, varType, parseInfo->staticContext));
1081  retval = checked;
1082  }
1083  else if(!raiseErrorOnUnavailability && parseInfo->isXSLT())
1084  {
1085  /* In XSL-T, global variables are in scope for the whole
1086  * stylesheet, so we must resolve this first at the end. */
1087  retval = create(new UnresolvedVariableReference(name), sourceLocator, parseInfo);
1088  parseInfo->unresolvedVariableReferences.insert(name, retval);
1089  }
1090  else
1091  variableUnavailable(name, parseInfo, sourceLocator);
1092  }
1093 
1094  return retval;
1095 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
static Expression::Ptr create(const Expression::Ptr &expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
static void variableUnavailable(const QXmlName &variableName, const ParserContext *const parseInfo, const YYLTYPE &location)
static VariableDeclaration::Ptr variableByName(const QXmlName name, const ParserContext *const parseInfo)

◆ toItem()

template<typename T >
Item QPatternist::toItem ( const QExplicitlySharedDataPointer< T >  atomicValue)
inline

Definition at line 431 of file qitem_p.h.

Referenced by QPatternist::ComparingAggregator< oper, result >::applyNumericPromotion(), QPatternist::AbstractFloatMathematician< isDouble >::calculate(), QPatternist::DecimalMathematician::calculate(), QPatternist::IntegerMathematician::calculate(), QPatternist::DurationDurationMathematician::calculate(), QPatternist::AbstractDateTimeMathematician::calculate(), QPatternist::NumericToAbstractFloatCaster< isDouble >::castFrom(), QPatternist::StringToAbstractFloatCaster< isDouble >::castFrom(), QPatternist::BooleanToAbstractFloatCaster< isDouble >::castFrom(), QPatternist::ToAnyURICaster::castFrom(), QPatternist::NumericToDecimalCaster< IsInteger >::castFrom(), QPatternist::StringToDayTimeDurationCaster::castFrom(), QPatternist::AbstractDurationToDayTimeDurationCaster::castFrom(), QPatternist::AbstractDurationToYearMonthDurationCaster::castFrom(), QPatternist::NumericToDerivedIntegerCaster< type >::castFrom(), QPatternist::CastAs::castToQName(), QPatternist::ResolveURIFN::evaluateSingleton(), QPatternist::UnparsedEntityURIFN::evaluateSingleton(), QPatternist::NodeNameFN::evaluateSingleton(), QPatternist::FloorFN::evaluateSingleton(), QPatternist::QNameConstructor::evaluateSingleton(), QPatternist::QNameFN::evaluateSingleton(), QPatternist::AbsFN::evaluateSingleton(), QPatternist::ResolveQNameFN::evaluateSingleton(), QPatternist::StringJoinFN::evaluateSingleton(), QPatternist::NamespaceURIFN::evaluateSingleton(), QPatternist::RoundFN::evaluateSingleton(), QPatternist::ImplicitTimezoneFN::evaluateSingleton(), QPatternist::CeilingFN::evaluateSingleton(), QPatternist::BaseURIFN::evaluateSingleton(), QPatternist::LocalNameFromQNameFN::evaluateSingleton(), QPatternist::CurrentDateTimeFN::evaluateSingleton(), QPatternist::DocumentURIFN::evaluateSingleton(), QPatternist::NamespaceURIFromQNameFN::evaluateSingleton(), QPatternist::RoundHalfToEvenFN::evaluateSingleton(), QPatternist::NormalizeSpaceFN::evaluateSingleton(), QPatternist::CurrentDateFN::evaluateSingleton(), QPatternist::NamespaceURIForPrefixFN::evaluateSingleton(), QPatternist::CurrentTimeFN::evaluateSingleton(), QPatternist::NormalizeUnicodeFN::evaluateSingleton(), QPatternist::SecondsFromDurationFN::extract(), QPatternist::SecondsFromAbstractDateTimeFN::extract(), QPatternist::TimezoneFromAbstractDateTimeFN::extract(), QPatternist::Integer::fromValue(), QPatternist::YearMonthDuration::fromValue(), QPatternist::DayTimeDuration::fromValue(), QPatternist::ResolveURIFN::typeCheck(), QPatternist::StaticBaseURIFN::typeCheck(), and yyparse().

432  {
433  return Item(atomicValue.data());
434  }
T * data() const
Returns a pointer to the shared data object.
Definition: qshareddata.h:145
The Item is the most basic of all visual items in QML.

◆ typeCheckTemplateBody()

static Expression::Ptr QPatternist::typeCheckTemplateBody ( const Expression::Ptr body,
const SequenceType::Ptr reqType,
const ParserContext *const  parseInfo 
)
static

Definition at line 401 of file qquerytransformparser.cpp.

Referenced by yyparse().

404 {
405  return TypeChecker::applyFunctionConversion(body, reqType,
406  parseInfo->staticContext,
407  ReportContext::XTTE0505,
408  TypeChecker::Options(TypeChecker::AutomaticallyConvert | TypeChecker::GeneratePromotion));
409 }

◆ unknownType()

static QString QPatternist::unknownType ( )
inlinestatic

Centralizes a translation string for the purpose of increasing consistency.

Definition at line 350 of file qquerytransformparser.cpp.

Referenced by QDeclarativeBindingCompilerPrivate::Result::operator==(), and yyparse().

351 {
352  return QtXmlPatterns::tr("%1 is an unknown schema type.");
353 }

◆ variableByName()

static VariableDeclaration::Ptr QPatternist::variableByName ( const QXmlName  name,
const ParserContext *const  parseInfo 
)
inlinestatic

Definition at line 1001 of file qquerytransformparser.cpp.

Referenced by resolveVariable(), and yyparse().

1003 {
1004  Q_ASSERT(!name.isNull());
1005  Q_ASSERT(parseInfo);
1006 
1007  /* We walk the list backwards. */
1008  const VariableDeclaration::Stack::const_iterator start(parseInfo->variables.constBegin());
1009  VariableDeclaration::Stack::const_iterator it(parseInfo->variables.constEnd());
1010 
1011  while(it != start)
1012  {
1013  --it;
1014  Q_ASSERT(*it);
1015  if((*it)->name == name)
1016  return *it;
1017  }
1018 
1019  return VariableDeclaration::Ptr();
1020 }
#define it(className, varName)
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
bool isNull() const
Returns true if this QXmlName is not initialized with a valid combination of {namespace URI}...
Definition: qxmlname.cpp:224

◆ variableUnavailable()

static void QPatternist::variableUnavailable ( const QXmlName variableName,
const ParserContext *const  parseInfo,
const YYLTYPE location 
)
static

Definition at line 881 of file qquerytransformparser.cpp.

Referenced by resolveVariable().

884 {
885  parseInfo->staticContext->error(QtXmlPatterns::tr("No variable with name %1 exists")
886  .arg(formatKeyword(parseInfo->staticContext->namePool(), variableName)),
887  ReportContext::XPST0008, fromYYLTYPE(location, parseInfo));
888 }
static QString formatKeyword(const VariableDeclaration::Ptr &var, const NamePool::Ptr &np)
Formats var appropriately for display.
static QSourceLocation fromYYLTYPE(const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)

◆ XPatherror()

static int QPatternist::XPatherror ( YYLTYPE sourceLocator,
const ParserContext *const  parseInfo,
const char *const  msg 
)
static

The generated Bison parser calls this function when there is a parse error.

It is not called, nor should be, for logical errors(which the Bison not know about). For those, ReportContext::error() is called.

Definition at line 462 of file qquerytransformparser.cpp.

463 {
464  Q_UNUSED(sourceLocator);
465  Q_ASSERT(parseInfo);
466 
467  parseInfo->staticContext->error(escape(QLatin1String(msg)), ReportContext::XPST0003, fromYYLTYPE(*sourceLocator, parseInfo));
468  return 1;
469 }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
Q_GUI_EXPORT QString escape(const QString &plain)
Converts the plain text string plain to a HTML string with HTML metacharacters <, >...
static QSourceLocation fromYYLTYPE(const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ XPathlex()

static int QPatternist::XPathlex ( YYSTYPE lexVal,
YYLTYPE sourceLocator,
const ParserContext *const  parseInfo 
)
static

Definition at line 720 of file qquerytransformparser.cpp.

721 {
722 #ifdef Patternist_DEBUG_PARSER
723 
728 # define YYDEBUG 1
729 
730  extern int XPathdebug;
731  XPathdebug = 1;
732 #endif
733 
734  Q_ASSERT(parseInfo);
735 
736  const Tokenizer::Token tok(parseInfo->tokenizer->nextToken(sourceLocator));
737 
738  (*lexVal).sval = tok.value;
739 
740  return static_cast<int>(tok.type);
741 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

◆ XPathparse()

int QPatternist::XPathparse ( QPatternist::ParserContext *const  info)

The entry point to the parser.

Parameters
infosupplies the information the parser & scanner needs to create expressions. The created expression, if everything succeeds, can be retrieved via the object info points to.
Returns
non-negative if the parser fails.
See also
ExpressionFactory::createExpression()

Referenced by QPatternist::ExpressionFactory::createExpression().

◆ yydestruct()

static void QPatternist::yydestruct ( const char *  yymsg,
int  yytype,
YYSTYPE yyvaluep,
YYLTYPE yylocationp,
ParserContext *const  parseInfo 
)
static

Definition at line 3360 of file qquerytransformparser.cpp.

3370 {
3371  YYUSE (yyvaluep);
3372  YYUSE (yylocationp);
3373  YYUSE (parseInfo);
3374 
3375  if (!yymsg)
3376  yymsg = "Deleting";
3377  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
3378 
3379  switch (yytype)
3380  {
3381 
3382  default:
3383  break;
3384  }
3385 }
#define YYUSE(e)
#define YY_SYMBOL_PRINT(Title, Type, Value, Location)

◆ yyparse()

int QPatternist::yyparse ( ParserContext *const  parseInfo)

xsl:param doesn't make life easy:

If it only has name, it's default value is an empty string(hence has type xs:string), but the value that (maybe) is supplied can be anything, typically a node.

Therefore, for that very common case we can't rely on the Expression's type, but have to force it to item()*.

So if we're supplied the type item()*, we pass a null SequenceType. TemplateParameterReference recognizes this and has item()* as its static type, regardless of if the expression has a more specific type.

xsl:param doesn't make life easy:

If it only has name, it's default value is an empty string(hence has type xs:string), but the value that (maybe) is supplied can be anything, typically a node.

Therefore, for that very common case we can't rely on the Expression's type, but have to force it to item()*.

So if we're supplied the type item()*, we pass a null SequenceType. TemplateParameterReference recognizes this and has item()* as its static type, regardless of if the expression has a more specific type.

Definition at line 3427 of file qquerytransformparser.cpp.

Referenced by yydestruct().

3434 {
3435  /* The lookahead symbol. */
3436 int yychar;
3437 
3438 /* The semantic value of the lookahead symbol. */
3439 YYSTYPE yylval;
3440 
3441 /* Number of syntax errors so far. */
3442 int yynerrs;
3443 /* Location data for the lookahead symbol. */
3444 YYLTYPE yylloc;
3445 
3446  int yystate;
3447  int yyn;
3448  int yyresult;
3449  /* Number of tokens to shift before error messages enabled. */
3450  int yyerrstatus;
3451  /* Lookahead token as an internal (translated) token number. */
3452  int yytoken = 0;
3453 #if YYERROR_VERBOSE
3454  /* Buffer for error messages, and its allocated size. */
3455  char yymsgbuf[128];
3456  char *yymsg = yymsgbuf;
3457  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
3458 #endif
3459 
3460  /* Three stacks and their tools:
3461  `yyss': related to states,
3462  `yyvs': related to semantic values,
3463  `yyls': related to locations.
3464 
3465  Refer to the stacks thru separate pointers, to allow yyoverflow
3466  to reallocate them elsewhere. */
3467 
3468  /* The state stack. */
3469  yytype_int16 yyssa[YYINITDEPTH];
3470  yytype_int16 *yyss = yyssa;
3471  yytype_int16 *yyssp;
3472 
3473  /* The semantic value stack. */
3474  YYSTYPE yyvsa[YYINITDEPTH];
3475  YYSTYPE *yyvs = yyvsa;
3476  YYSTYPE *yyvsp;
3477 
3478  /* The location stack. */
3479  YYLTYPE yylsa[YYINITDEPTH];
3480  YYLTYPE *yyls = yylsa;
3481  YYLTYPE *yylsp;
3482  /* The locations where the error started and ended. */
3483  YYLTYPE yyerror_range[2];
3484 
3485 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
3486 
3487  YYSIZE_T yystacksize = YYINITDEPTH;
3488 
3489  /* The variables used to return semantic value and location from the
3490  action routines. */
3491  YYSTYPE yyval;
3492  YYLTYPE yyloc;
3493 
3494  /* The number of symbols on the RHS of the reduced rule.
3495  Keep to zero when no symbol should be popped. */
3496  int yylen = 0;
3497 
3498  YYDPRINTF ((stderr, "Starting parse\n"));
3499 
3500  yystate = 0;
3501  yyerrstatus = 0;
3502  yynerrs = 0;
3503  yychar = YYEMPTY; /* Cause a token to be read. */
3504 
3505  /* Initialize stack pointers.
3506  Waste one element of value and location stack
3507  so that they stay on the same level as the state stack.
3508  The wasted elements are never initialized. */
3509 
3510  yyssp = yyss;
3511  yyvsp = yyvs;
3512  yylsp = yyls;
3513 #if YYLTYPE_IS_TRIVIAL
3514  /* Initialize the default location before parsing starts. */
3515  yylloc.first_line = yylloc.last_line = 1;
3516  yylloc.first_column = yylloc.last_column = 1;
3517 #endif
3518 
3519  goto yysetstate;
3520 
3521 /*------------------------------------------------------------.
3522 | yynewstate -- Push a new state, which is found in yystate. |
3523 `------------------------------------------------------------*/
3524  yynewstate:
3525  /* In all cases, when you get here, the value and location stacks
3526  have just been pushed. So pushing a state here evens the stacks. */
3527  yyssp++;
3528 
3529  yysetstate:
3530  *yyssp = yystate;
3531 
3532  if (yyss + yystacksize - 1 <= yyssp)
3533  {
3534  /* Get the current used size of the three stacks, in elements. */
3535  YYSIZE_T yysize = yyssp - yyss + 1;
3536 
3537 #ifdef yyoverflow
3538  {
3539  /* Give user a chance to reallocate the stack. Use copies of
3540  these so that the &'s don't force the real ones into
3541  memory. */
3542  YYSTYPE *yyvs1 = yyvs;
3543  yytype_int16 *yyss1 = yyss;
3544  YYLTYPE *yyls1 = yyls;
3545 
3546  /* Each stack pointer address is followed by the size of the
3547  data in use in that stack, in bytes. This used to be a
3548  conditional around just the two extra args, but that might
3549  be undefined if yyoverflow is a macro. */
3550  yyoverflow (YY_("memory exhausted"),
3551  &yyss1, yysize * sizeof (*yyssp),
3552  &yyvs1, yysize * sizeof (*yyvsp),
3553  &yyls1, yysize * sizeof (*yylsp),
3554  &yystacksize);
3555  yyls = yyls1;
3556  yyss = yyss1;
3557  yyvs = yyvs1;
3558  }
3559 #else /* no yyoverflow */
3560 # ifndef YYSTACK_RELOCATE
3561  goto yyexhaustedlab;
3562 # else
3563  /* Extend the stack our own way. */
3564  if (YYMAXDEPTH <= yystacksize)
3565  goto yyexhaustedlab;
3566  yystacksize *= 2;
3567  if (YYMAXDEPTH < yystacksize)
3568  yystacksize = YYMAXDEPTH;
3569 
3570  {
3571  yytype_int16 *yyss1 = yyss;
3572  union yyalloc *yyptr =
3573  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
3574  if (! yyptr)
3575  goto yyexhaustedlab;
3576  YYSTACK_RELOCATE (yyss);
3577  YYSTACK_RELOCATE (yyvs);
3578  YYSTACK_RELOCATE (yyls);
3579 # undef YYSTACK_RELOCATE
3580  if (yyss1 != yyssa)
3581  YYSTACK_FREE (yyss1);
3582  }
3583 # endif
3584 #endif /* no yyoverflow */
3585 
3586  yyssp = yyss + yysize - 1;
3587  yyvsp = yyvs + yysize - 1;
3588  yylsp = yyls + yysize - 1;
3589 
3590  YYDPRINTF ((stderr, "Stack size increased to %lu\n",
3591  (unsigned long int) yystacksize));
3592 
3593  if (yyss + yystacksize - 1 <= yyssp)
3594  YYABORT;
3595  }
3596 
3597  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
3598 
3599  if (yystate == YYFINAL)
3600  YYACCEPT;
3601 
3602  goto yybackup;
3603 
3604 /*-----------.
3605 | yybackup. |
3606 `-----------*/
3607 yybackup:
3608 
3609  /* Do appropriate processing given the current state. Read a
3610  lookahead token if we need one and don't already have one. */
3611 
3612  /* First try to decide what to do without reference to lookahead token. */
3613  yyn = yypact[yystate];
3614  if (yyn == YYPACT_NINF)
3615  goto yydefault;
3616 
3617  /* Not known => get a lookahead token if don't already have one. */
3618 
3619  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
3620  if (yychar == YYEMPTY)
3621  {
3622  YYDPRINTF ((stderr, "Reading a token: "));
3623  yychar = YYLEX;
3624  }
3625 
3626  if (yychar <= YYEOF)
3627  {
3628  yychar = yytoken = YYEOF;
3629  YYDPRINTF ((stderr, "Now at end of input.\n"));
3630  }
3631  else
3632  {
3633  yytoken = YYTRANSLATE (yychar);
3634  YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3635  }
3636 
3637  /* If the proper action on seeing token YYTOKEN is to reduce or to
3638  detect an error, take that action. */
3639  yyn += yytoken;
3640  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3641  goto yydefault;
3642  yyn = yytable[yyn];
3643  if (yyn <= 0)
3644  {
3645  if (yyn == 0 || yyn == YYTABLE_NINF)
3646  goto yyerrlab;
3647  yyn = -yyn;
3648  goto yyreduce;
3649  }
3650 
3651  /* Count tokens shifted since error; after three, turn off error
3652  status. */
3653  if (yyerrstatus)
3654  yyerrstatus--;
3655 
3656  /* Shift the lookahead token. */
3657  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3658 
3659  /* Discard the shifted token. */
3660  yychar = YYEMPTY;
3661 
3662  yystate = yyn;
3663  *++yyvsp = yylval;
3664  *++yylsp = yylloc;
3665  goto yynewstate;
3666 
3667 
3668 /*-----------------------------------------------------------.
3669 | yydefault -- do the default action for the current state. |
3670 `-----------------------------------------------------------*/
3671 yydefault:
3672  yyn = yydefact[yystate];
3673  if (yyn == 0)
3674  goto yyerrlab;
3675  goto yyreduce;
3676 
3677 
3678 /*-----------------------------.
3679 | yyreduce -- Do a reduction. |
3680 `-----------------------------*/
3681 yyreduce:
3682  /* yyn is the number of a rule to reduce with. */
3683  yylen = yyr2[yyn];
3684 
3685  /* If YYLEN is nonzero, implement the default value of the action:
3686  `$$ = $1'.
3687 
3688  Otherwise, the following line sets YYVAL to garbage.
3689  This behavior is undocumented and Bison
3690  users should not rely upon it. Assigning to YYVAL
3691  unconditionally makes the parser a bit smaller, and it avoids a
3692  GCC warning that YYVAL may be used uninitialized. */
3693  yyval = yyvsp[1-yylen];
3694 
3695  /* Default location. */
3696  YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
3697  YY_REDUCE_PRINT (yyn);
3698  switch (yyn)
3699  {
3700  case 5:
3701 /* Line 1269 of yacc.c. */
3702 #line 1380 "querytransformparser.ypp"
3703  {
3704 
3705 /* Suppress more compiler warnings about unused defines. */
3706 #if defined(YYNNTS) \
3707  || defined(yyerrok) \
3708  || defined(YYNSTATES) \
3709  || defined(YYRHSLOC) \
3710  || defined(YYRECOVERING) \
3711  || defined(YYFAIL) \
3712  || defined(YYERROR) \
3713  || defined(YYNRULES) \
3714  || defined(YYBACKUP) \
3715  || defined(YYMAXDEPTH) \
3716  || defined(yyclearin) \
3717  || defined(YYERRCODE) \
3718  || defined(YY_LOCATION_PRINT) \
3719  || defined(YYLLOC_DEFAULT)
3720 #endif
3721 
3722  if((yyvsp[(3) - (5)].sval) != QLatin1String("1.0"))
3723  {
3724  const ReflectYYLTYPE ryy((yyloc), parseInfo);
3725 
3726  parseInfo->staticContext->error(QtXmlPatterns::tr("Version %1 is not supported. The supported "
3727  "XQuery version is 1.0.")
3728  .arg(formatData((yyvsp[(3) - (5)].sval))),
3729  ReportContext::XQST0031, &ryy);
3730  }
3731  }
3732  break;
3733 
3734  case 7:
3735 /* Line 1269 of yacc.c. */
3736 #line 1412 "querytransformparser.ypp"
3737  {
3738  const QRegExp encNameRegExp(QLatin1String("[A-Za-z][A-Za-z0-9._\\-]*"));
3739 
3740  if(!encNameRegExp.exactMatch((yyvsp[(2) - (2)].sval)))
3741  {
3742  parseInfo->staticContext->error(QtXmlPatterns::tr("The encoding %1 is invalid. "
3743  "It must contain Latin characters only, "
3744  "must not contain whitespace, and must match "
3745  "the regular expression %2.")
3746  .arg(formatKeyword((yyvsp[(2) - (2)].sval)),
3747  formatExpression(encNameRegExp.pattern())),
3748  ReportContext::XQST0087, fromYYLTYPE((yyloc), parseInfo));
3749  }
3750  }
3751  break;
3752 
3753  case 8:
3754 /* Line 1269 of yacc.c. */
3755 #line 1428 "querytransformparser.ypp"
3756  {
3757  /* In XSL-T, we can have dangling variable references, so resolve them
3758  * before we proceed with other steps, such as checking circularity. */
3759  if(parseInfo->isXSLT())
3760  {
3761  typedef QHash<QXmlName, Expression::Ptr> Hash;
3762  const Hash::const_iterator end(parseInfo->unresolvedVariableReferences.constEnd());
3763 
3764  for(Hash::const_iterator it(parseInfo->unresolvedVariableReferences.constBegin()); it != end; ++it)
3765  {
3766  const Expression::Ptr body(resolveVariable(it.key(), (yyloc), parseInfo, true)); // TODO source locations vaise
3767  Q_ASSERT(body);
3768  it.value()->as<UnresolvedVariableReference>()->bindTo(body);
3769  }
3770  }
3771 
3772  /* The UserFunction callsites aren't bound yet, so bind them(if possible!). */
3773  {
3774  const UserFunctionCallsite::List::const_iterator cend(parseInfo->userFunctionCallsites.constEnd());
3775  UserFunctionCallsite::List::const_iterator cit(parseInfo->userFunctionCallsites.constBegin());
3776  for(; cit != cend; ++cit) /* For each callsite. */
3777  {
3778  const UserFunctionCallsite::Ptr callsite(*cit);
3779  Q_ASSERT(callsite);
3780  const UserFunction::List::const_iterator end(parseInfo->userFunctions.constEnd());
3781  UserFunction::List::const_iterator it(parseInfo->userFunctions.constBegin());
3782 
3783  for(; it != end; ++it) /* For each UserFunction. */
3784  {
3785  const FunctionSignature::Ptr sign((*it)->signature());
3786  Q_ASSERT(sign);
3787 
3788  if(callsite->isSignatureValid(sign))
3789  {
3790  callsite->setSource((*it),
3791  parseInfo->allocateCacheSlots((*it)->argumentDeclarations().count()));
3792  break;
3793  }
3794  }
3795  if(it == end)
3796  {
3797  parseInfo->staticContext->error(QtXmlPatterns::tr("No function with signature %1 is available")
3798  .arg(formatFunction(callsite)),
3799  ReportContext::XPST0017, fromYYLTYPE((yyloc), parseInfo));
3800  }
3801  }
3802  }
3803 
3804  /* Mark callsites in UserFunction bodies as recursive, if they are. */
3805  {
3806  const UserFunction::List::const_iterator fend(parseInfo->userFunctions.constEnd());
3807  UserFunction::List::const_iterator fit(parseInfo->userFunctions.constBegin());
3808  for(; fit != fend; ++fit)
3809  {
3810  CallTargetDescription::List signList;
3811  signList.append((*fit)->signature());
3812  CallTargetDescription::checkCallsiteCircularity(signList, (*fit)->body());
3813  }
3814  }
3815 
3816  /* Now, check all global variables for circularity. This is done
3817  * backwards because global variables are only in scope below them,
3818  * in XQuery. */
3819  {
3820  const VariableDeclaration::List::const_iterator start(parseInfo->declaredVariables.constBegin());
3821  VariableDeclaration::List::const_iterator it(parseInfo->declaredVariables.constEnd());
3822 
3823  while(it != start)
3824  {
3825  --it;
3826  if((*it)->type != VariableDeclaration::ExpressionVariable && (*it)->type != VariableDeclaration::GlobalVariable)
3827  continue; /* We want to ignore 'external' variables. */
3828 
3829  FunctionSignature::List signList;
3830  checkVariableCircularity(*it, (*it)->expression(), (*it)->type, signList, parseInfo);
3831  ExpressionFactory::registerLastPath((*it)->expression());
3832  parseInfo->finalizePushedVariable(1, false); /* Warn if it's unused. */
3833  }
3834  }
3835 
3836  /* Generate code for doing initial template name calling. One problem
3837  * is that we compilation in the initial template name, since we throw away the
3838  * code if we don't have the requested template. */
3839  if(parseInfo->languageAccent == QXmlQuery::XSLT20
3840  && !parseInfo->initialTemplateName.isNull()
3841  && parseInfo->namedTemplates.contains(parseInfo->initialTemplateName))
3842  {
3843  parseInfo->queryBody = create(new CallTemplate(parseInfo->initialTemplateName,
3844  WithParam::Hash()),
3845  (yyloc), parseInfo);
3846  parseInfo->templateCalls.append(parseInfo->queryBody);
3847  /* We just discard the template body that XSLTTokenizer generated. */
3848  }
3849  else
3850  parseInfo->queryBody = (yyvsp[(2) - (2)].expr);
3851  }
3852  break;
3853 
3854  case 10:
3855 /* Line 1269 of yacc.c. */
3856 #line 1528 "querytransformparser.ypp"
3857  {
3858  // TODO add to namespace context
3859  parseInfo->moduleNamespace = parseInfo->staticContext->namePool()->allocateNamespace((yyvsp[(3) - (6)].sval));
3860  }
3861  break;
3862 
3863  case 12:
3864 /* Line 1269 of yacc.c. */
3865 #line 1536 "querytransformparser.ypp"
3866  {
3867  allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
3868  if(parseInfo->hasSecondPrologPart)
3869  parseInfo->staticContext->error(QtXmlPatterns::tr("A default namespace declaration must occur before function, "
3870  "variable, and option declarations."), ReportContext::XPST0003, fromYYLTYPE((yyloc), parseInfo));
3871  }
3872  break;
3873 
3874  case 13:
3875 /* Line 1269 of yacc.c. */
3876 #line 1543 "querytransformparser.ypp"
3877  {
3878  if(parseInfo->hasSecondPrologPart)
3879  parseInfo->staticContext->error(QtXmlPatterns::tr("A default namespace declaration must occur before function, "
3880  "variable, and option declarations."), ReportContext::XPST0003, fromYYLTYPE((yyloc), parseInfo));
3881  }
3882  break;
3883 
3884  case 14:
3885 /* Line 1269 of yacc.c. */
3886 #line 1549 "querytransformparser.ypp"
3887  {
3888  if(parseInfo->hasSecondPrologPart)
3889  parseInfo->staticContext->error(QtXmlPatterns::tr("Namespace declarations must occur before function, "
3890  "variable, and option declarations."), ReportContext::XPST0003, fromYYLTYPE((yyloc), parseInfo));
3891  }
3892  break;
3893 
3894  case 15:
3895 /* Line 1269 of yacc.c. */
3896 #line 1555 "querytransformparser.ypp"
3897  {
3898  allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
3899  if(parseInfo->hasSecondPrologPart)
3900  parseInfo->staticContext->error(QtXmlPatterns::tr("Module imports must occur before function, "
3901  "variable, and option declarations."), ReportContext::XPST0003, fromYYLTYPE((yyloc), parseInfo));
3902  }
3903  break;
3904 
3905  case 17:
3906 /* Line 1269 of yacc.c. */
3907 #line 1565 "querytransformparser.ypp"
3908  {
3909  parseInfo->hasSecondPrologPart = true;
3910  }
3911  break;
3912 
3913  case 18:
3914 /* Line 1269 of yacc.c. */
3915 #line 1569 "querytransformparser.ypp"
3916  {
3917  parseInfo->hasSecondPrologPart = true;
3918  }
3919  break;
3920 
3921  case 19:
3922 /* Line 1269 of yacc.c. */
3923 #line 1573 "querytransformparser.ypp"
3924  {
3925  allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
3926  parseInfo->hasSecondPrologPart = true;
3927  }
3928  break;
3929 
3930  case 20:
3931 /* Line 1269 of yacc.c. */
3932 #line 1596 "querytransformparser.ypp"
3933  {
3934  Template::Ptr temp(create(new Template(parseInfo->currentImportPrecedence, (yyvsp[(5) - (7)].sequenceType)), (yyloc), parseInfo));
3935 
3936  registerNamedTemplate((yyvsp[(3) - (7)].qName), typeCheckTemplateBody((yyvsp[(6) - (7)].expr), (yyvsp[(5) - (7)].sequenceType), parseInfo),
3937  parseInfo, (yylsp[(1) - (7)]), temp);
3938  temp->templateParameters = parseInfo->templateParameters;
3939  parseInfo->templateParametersHandled();
3940  }
3941  break;
3942 
3943  case 21:
3944 /* Line 1269 of yacc.c. */
3945 #line 1606 "querytransformparser.ypp"
3946  {
3947  parseInfo->isParsingPattern = true;
3948  }
3949  break;
3950 
3951  case 22:
3952 /* Line 1269 of yacc.c. */
3953 #line 1610 "querytransformparser.ypp"
3954  {
3955  parseInfo->isParsingPattern = false;
3956  }
3957  break;
3958 
3959  case 23:
3960 /* Line 1269 of yacc.c. */
3961 #line 1619 "querytransformparser.ypp"
3962  {
3963  /* In this grammar branch, we're guaranteed to be a template rule, but
3964  * may also be a named template. */
3965 
3966  const ImportPrecedence ip = parseInfo->isFirstTemplate() ? 0 : parseInfo->currentImportPrecedence;
3967  Expression::Ptr pattern((yyvsp[(7) - (15)].expr));
3968  const TemplatePattern::ID templateID = parseInfo->allocateTemplateID();
3969 
3970  Template::Ptr templ(create(new Template(ip, (yyvsp[(13) - (15)].sequenceType)), (yyloc), parseInfo));
3971  templ->body = typeCheckTemplateBody((yyvsp[(14) - (15)].expr), (yyvsp[(13) - (15)].sequenceType), parseInfo);
3972  templ->templateParameters = parseInfo->templateParameters;
3973  parseInfo->templateParametersHandled();
3974 
3975  TemplatePattern::Vector ourPatterns;
3976  /* We do it as per 6.4 Conflict Resolution for Template Rules:
3977  *
3978  * "If the pattern contains multiple alternatives separated by |, then
3979  * the template rule is treated equivalently to a set of template
3980  * rules, one for each alternative. However, it is not an error if a
3981  * node matches more than one of the alternatives." */
3982  while(pattern->is(Expression::IDCombineNodes))
3983  {
3984  const Expression::List operands(pattern->operands());
3985  pattern = operands.first();
3986 
3987  loadPattern(operands.at(1), ourPatterns, templateID, (yyvsp[(11) - (15)].enums.Double), templ);
3988  }
3989 
3990  loadPattern(pattern, ourPatterns, templateID, (yyvsp[(11) - (15)].enums.Double), templ);
3991 
3992  if(!(yyvsp[(3) - (15)].qName).isNull())
3993  registerNamedTemplate((yyvsp[(3) - (15)].qName), (yyvsp[(14) - (15)].expr), parseInfo, (yylsp[(1) - (15)]), templ);
3994 
3995  /* Now, let's add it to all the relevant templates. */
3996  for(int i = 0; i < (yyvsp[(10) - (15)].qNameVector).count(); ++i) /* For each mode. */
3997  {
3998  const QXmlName &modeName = (yyvsp[(10) - (15)].qNameVector).at(i);
3999 
4000  if(modeName == QXmlName(StandardNamespaces::InternalXSLT, StandardLocalNames::all) && (yyvsp[(10) - (15)].qNameVector).count() > 1)
4001  {
4002  parseInfo->staticContext->error(QtXmlPatterns::tr("The keyword %1 cannot occur with any other mode name.")
4003  .arg(formatKeyword(QLatin1String("#all"))),
4004  ReportContext::XTSE0530,
4005  fromYYLTYPE((yyloc), parseInfo));
4006  }
4007 
4008  /* For each pattern the template use. */
4009  const TemplateMode::Ptr mode(parseInfo->modeFor(modeName));
4010  for(int t = 0; t < ourPatterns.count(); ++t)
4011  mode->templatePatterns.append(ourPatterns.at(t));
4012  }
4013  }
4014  break;
4015 
4016  case 24:
4017 /* Line 1269 of yacc.c. */
4018 #line 1673 "querytransformparser.ypp"
4019  {
4020  (yyval.enums.Double) = std::numeric_limits<xsDouble>::quiet_NaN();
4021  }
4022  break;
4023 
4024  case 25:
4025 /* Line 1269 of yacc.c. */
4026 #line 1678 "querytransformparser.ypp"
4027  {
4028  const AtomicValue::Ptr val(Decimal::fromLexical((yyvsp[(2) - (2)].sval)));
4029  if(val->hasError())
4030  {
4031  parseInfo->staticContext->error(QtXmlPatterns::tr("The value of attribute %1 must be of type %2, which %3 isn't.")
4032  .arg(formatKeyword(QLatin1String("priority")),
4033  formatType(parseInfo->staticContext->namePool(), BuiltinTypes::xsDecimal),
4034  formatData((yyvsp[(2) - (2)].sval))),
4035  ReportContext::XTSE0530,
4036  fromYYLTYPE((yyloc), parseInfo));
4037  }
4038  else
4039  (yyval.enums.Double) = val->as<Numeric>()->toDouble();
4040  }
4041  break;
4042 
4043  case 26:
4044 /* Line 1269 of yacc.c. */
4045 #line 1694 "querytransformparser.ypp"
4046  {
4047  (yyval.qName) = QXmlName();
4048  }
4049  break;
4050 
4051  case 28:
4052 /* Line 1269 of yacc.c. */
4053 #line 1700 "querytransformparser.ypp"
4054  {
4055  (yyval.qName) = (yyvsp[(2) - (2)].qName);
4056  }
4057  break;
4058 
4059  case 30:
4060 /* Line 1269 of yacc.c. */
4061 #line 1706 "querytransformparser.ypp"
4062  {
4063  allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
4064  }
4065  break;
4066 
4067  case 32:
4068 /* Line 1269 of yacc.c. */
4069 #line 1711 "querytransformparser.ypp"
4070  {
4071  allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
4072  }
4073  break;
4074 
4075  case 33:
4076 /* Line 1269 of yacc.c. */
4077 #line 1715 "querytransformparser.ypp"
4078  {
4079  allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
4080  }
4081  break;
4082 
4083  case 34:
4084 /* Line 1269 of yacc.c. */
4085 #line 1719 "querytransformparser.ypp"
4086  {
4087  allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
4088  }
4089  break;
4090 
4091  case 39:
4092 /* Line 1269 of yacc.c. */
4093 #line 1730 "querytransformparser.ypp"
4094  {
4095  if(!(yyvsp[(6) - (7)].enums.Bool))
4096  allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
4097 
4098  if((yyvsp[(3) - (7)].sval) == QLatin1String("xmlns"))
4099  {
4100  parseInfo->staticContext->error(QtXmlPatterns::tr("It is not possible to redeclare prefix %1.")
4101  .arg(formatKeyword(QLatin1String("xmlns"))),
4102  ReportContext::XQST0070, fromYYLTYPE((yyloc), parseInfo));
4103  }
4104  else if ((yyvsp[(5) - (7)].sval) == CommonNamespaces::XML || (yyvsp[(3) - (7)].sval) == QLatin1String("xml"))
4105  {
4106  parseInfo->staticContext->error(QtXmlPatterns::tr(
4107  "The prefix %1 cannot be bound. By default, it is already bound "
4108  "to the namespace %2.")
4109  .arg(formatKeyword("xml"))
4111  ReportContext::XQST0070,
4112  fromYYLTYPE((yyloc), parseInfo));
4113  }
4114  else if(parseInfo->declaredPrefixes.contains((yyvsp[(3) - (7)].sval)))
4115  {
4116  /* This includes the case where the user has bound a default prefix(such
4117  * as 'local') and now tries to do it again. */
4118  parseInfo->staticContext->error(QtXmlPatterns::tr("Prefix %1 is already declared in the prolog.")
4119  .arg(formatKeyword((yyvsp[(3) - (7)].sval))),
4120  ReportContext::XQST0033, fromYYLTYPE((yyloc), parseInfo));
4121  }
4122  else
4123  {
4124  parseInfo->declaredPrefixes.append((yyvsp[(3) - (7)].sval));
4125 
4126  if((yyvsp[(5) - (7)].sval).isEmpty())
4127  {
4128  parseInfo->staticContext->namespaceBindings()->addBinding(QXmlName(StandardNamespaces::UndeclarePrefix,
4129  StandardLocalNames::empty,
4130  parseInfo->staticContext->namePool()->allocatePrefix((yyvsp[(3) - (7)].sval))));
4131  }
4132  else
4133  {
4134  parseInfo->staticContext->namespaceBindings()->addBinding(parseInfo->staticContext->namePool()->allocateBinding((yyvsp[(3) - (7)].sval), (yyvsp[(5) - (7)].sval)));
4135  }
4136  }
4137  }
4138  break;
4139 
4140  case 40:
4141 /* Line 1269 of yacc.c. */
4142 #line 1776 "querytransformparser.ypp"
4143  {
4144  if(parseInfo->hasDeclaration(ParserContext::BoundarySpaceDecl))
4145  {
4146  parseInfo->staticContext->error(prologMessage("declare boundary-space"),
4147  ReportContext::XQST0068, fromYYLTYPE((yyloc), parseInfo));
4148  }
4149  else
4150  {
4151  parseInfo->staticContext->setBoundarySpacePolicy((yyvsp[(3) - (4)].enums.boundarySpacePolicy));
4152  parseInfo->registerDeclaration(ParserContext::BoundarySpaceDecl);
4153  }
4154  }
4155  break;
4156 
4157  case 41:
4158 /* Line 1269 of yacc.c. */
4159 #line 1790 "querytransformparser.ypp"
4160  {
4161  (yyval.enums.boundarySpacePolicy) = StaticContext::BSPStrip;
4162  }
4163  break;
4164 
4165  case 42:
4166 /* Line 1269 of yacc.c. */
4167 #line 1795 "querytransformparser.ypp"
4168  {
4169  (yyval.enums.boundarySpacePolicy) = StaticContext::BSPPreserve;
4170  }
4171  break;
4172 
4173  case 45:
4174 /* Line 1269 of yacc.c. */
4175 #line 1804 "querytransformparser.ypp"
4176  {
4177  if(parseInfo->hasDeclaration(ParserContext::DeclareDefaultElementNamespace))
4178  {
4179  parseInfo->staticContext->error(prologMessage("declare default element namespace"),
4180  ReportContext::XQST0066, fromYYLTYPE((yyloc), parseInfo));
4181  }
4182  else
4183  {
4184  parseInfo->staticContext->namespaceBindings()->addBinding(QXmlName(parseInfo->staticContext->namePool()->allocateNamespace((yyvsp[(5) - (6)].sval)), StandardLocalNames::empty));
4185  parseInfo->registerDeclaration(ParserContext::DeclareDefaultElementNamespace);
4186  }
4187  }
4188  break;
4189 
4190  case 46:
4191 /* Line 1269 of yacc.c. */
4192 #line 1819 "querytransformparser.ypp"
4193  {
4194  if(parseInfo->hasDeclaration(ParserContext::DeclareDefaultFunctionNamespace))
4195  {
4196  parseInfo->staticContext->error(prologMessage("declare default function namespace"),
4197  ReportContext::XQST0066, fromYYLTYPE((yyloc), parseInfo));
4198  }
4199  else
4200  {
4201  parseInfo->staticContext->setDefaultFunctionNamespace((yyvsp[(5) - (6)].sval));
4202  parseInfo->registerDeclaration(ParserContext::DeclareDefaultFunctionNamespace);
4203  }
4204  }
4205  break;
4206 
4207  case 47:
4208 /* Line 1269 of yacc.c. */
4209 #line 1833 "querytransformparser.ypp"
4210  {
4211  if((yyvsp[(3) - (5)].qName).prefix() == StandardPrefixes::empty)
4212  {
4213  parseInfo->staticContext->error(QtXmlPatterns::tr("The name of an option must have a prefix. "
4214  "There is no default namespace for options."),
4215  ReportContext::XPST0081, fromYYLTYPE((yyloc), parseInfo));
4216  }
4217  }
4218  break;
4219 
4220  case 48:
4221 /* Line 1269 of yacc.c. */
4222 #line 1843 "querytransformparser.ypp"
4223  {
4224  allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
4225  if(parseInfo->hasDeclaration(ParserContext::OrderingModeDecl))
4226  {
4227  parseInfo->staticContext->error(prologMessage("declare ordering"),
4228  ReportContext::XQST0065, fromYYLTYPE((yyloc), parseInfo));
4229  }
4230  else
4231  {
4232  parseInfo->registerDeclaration(ParserContext::OrderingModeDecl);
4233  parseInfo->staticContext->setOrderingMode((yyvsp[(3) - (4)].enums.orderingMode));
4234  }
4235  }
4236  break;
4237 
4238  case 49:
4239 /* Line 1269 of yacc.c. */
4240 #line 1858 "querytransformparser.ypp"
4241  {
4242  (yyval.enums.orderingMode) = StaticContext::Ordered;
4243  }
4244  break;
4245 
4246  case 50:
4247 /* Line 1269 of yacc.c. */
4248 #line 1862 "querytransformparser.ypp"
4249  {
4250  (yyval.enums.orderingMode) = StaticContext::Unordered;
4251  }
4252  break;
4253 
4254  case 51:
4255 /* Line 1269 of yacc.c. */
4256 #line 1867 "querytransformparser.ypp"
4257  {
4258  if(parseInfo->hasDeclaration(ParserContext::EmptyOrderDecl))
4259  {
4260  parseInfo->staticContext->error(prologMessage("declare default order"),
4261  ReportContext::XQST0069, fromYYLTYPE((yyloc), parseInfo));
4262  }
4263  else
4264  {
4265  parseInfo->registerDeclaration(ParserContext::EmptyOrderDecl);
4266  parseInfo->staticContext->setOrderingEmptySequence((yyvsp[(4) - (5)].enums.orderingEmptySequence));
4267  }
4268  }
4269  break;
4270 
4271  case 52:
4272 /* Line 1269 of yacc.c. */
4273 #line 1881 "querytransformparser.ypp"
4274  {
4275  (yyval.enums.orderingEmptySequence) = StaticContext::Least;
4276  }
4277  break;
4278 
4279  case 53:
4280 /* Line 1269 of yacc.c. */
4281 #line 1885 "querytransformparser.ypp"
4282  {
4283  (yyval.enums.orderingEmptySequence) = StaticContext::Greatest;
4284  }
4285  break;
4286 
4287  case 54:
4288 /* Line 1269 of yacc.c. */
4289 #line 1891 "querytransformparser.ypp"
4290  {
4291  if(parseInfo->hasDeclaration(ParserContext::CopyNamespacesDecl))
4292  {
4293  parseInfo->staticContext->error(prologMessage("declare copy-namespaces"),
4294  ReportContext::XQST0055, fromYYLTYPE((yyloc), parseInfo));
4295  }
4296  else
4297  {
4298  parseInfo->registerDeclaration(ParserContext::CopyNamespacesDecl);
4299  }
4300  }
4301  break;
4302 
4303  case 55:
4304 /* Line 1269 of yacc.c. */
4305 #line 1904 "querytransformparser.ypp"
4306  {
4307  parseInfo->preserveNamespacesMode = true;
4308  }
4309  break;
4310 
4311  case 56:
4312 /* Line 1269 of yacc.c. */
4313 #line 1909 "querytransformparser.ypp"
4314  {
4315  parseInfo->preserveNamespacesMode = false;
4316  }
4317  break;
4318 
4319  case 57:
4320 /* Line 1269 of yacc.c. */
4321 #line 1914 "querytransformparser.ypp"
4322  {
4323  parseInfo->inheritNamespacesMode = true;
4324  }
4325  break;
4326 
4327  case 58:
4328 /* Line 1269 of yacc.c. */
4329 #line 1919 "querytransformparser.ypp"
4330  {
4331  parseInfo->inheritNamespacesMode = false;
4332  }
4333  break;
4334 
4335  case 59:
4336 /* Line 1269 of yacc.c. */
4337 #line 1924 "querytransformparser.ypp"
4338  {
4339  if(parseInfo->hasDeclaration(ParserContext::DefaultCollationDecl))
4340  {
4341  parseInfo->staticContext->error(prologMessage("declare default collation"),
4342  ReportContext::XQST0038, fromYYLTYPE((yyloc), parseInfo));
4343  }
4344  else
4345  {
4346  const QUrl coll(resolveAndCheckCollation<ReportContext::XQST0038>((yyvsp[(4) - (5)].sval), parseInfo, (yyloc)));
4347 
4348  parseInfo->registerDeclaration(ParserContext::DefaultCollationDecl);
4349  parseInfo->staticContext->setDefaultCollation(coll);
4350  }
4351  }
4352  break;
4353 
4354  case 60:
4355 /* Line 1269 of yacc.c. */
4356 #line 1940 "querytransformparser.ypp"
4357  {
4358  allowedIn(QueryLanguages(QXmlQuery::XQuery10 | QXmlQuery::XSLT20), parseInfo, (yyloc), (yyvsp[(3) - (5)].enums.Bool));
4359  if(parseInfo->hasDeclaration(ParserContext::BaseURIDecl))
4360  {
4361  parseInfo->staticContext->error(prologMessage("declare base-uri"),
4362  ReportContext::XQST0032, fromYYLTYPE((yyloc), parseInfo));
4363  }
4364  else
4365  {
4366  parseInfo->registerDeclaration(ParserContext::BaseURIDecl);
4367  const ReflectYYLTYPE ryy((yyloc), parseInfo);
4368 
4369  QUrl toBeBase(AnyURI::toQUrl<ReportContext::XQST0046>((yyvsp[(4) - (5)].sval), parseInfo->staticContext, &ryy));
4370  /* Now we're guaranteed that base is a valid lexical representation, but it can still be relative. */
4371 
4372  if(toBeBase.isRelative())
4373  toBeBase = parseInfo->staticContext->baseURI().resolved(toBeBase);
4374 
4375  parseInfo->staticContext->setBaseURI(toBeBase);
4376  }
4377  }
4378  break;
4379 
4380  case 61:
4381 /* Line 1269 of yacc.c. */
4382 #line 1963 "querytransformparser.ypp"
4383  {
4384  parseInfo->staticContext->error(QtXmlPatterns::tr("The Schema Import feature is not supported, "
4385  "and therefore %1 declarations cannot occur.")
4386  .arg(formatKeyword("import schema")),
4387  ReportContext::XQST0009, fromYYLTYPE((yyloc), parseInfo));
4388  }
4389  break;
4390 
4391  case 65:
4392 /* Line 1269 of yacc.c. */
4393 #line 1975 "querytransformparser.ypp"
4394  {
4395  if((yyvsp[(4) - (6)].sval).isEmpty())
4396  {
4397  parseInfo->staticContext->error(QtXmlPatterns::tr("The target namespace of a %1 cannot be empty.")
4398  .arg(formatKeyword("module import")),
4399  ReportContext::XQST0088, fromYYLTYPE((yyloc), parseInfo));
4400 
4401  }
4402  else
4403  {
4404  /* This is temporary until we have implemented it. */
4405  parseInfo->staticContext->error(QtXmlPatterns::tr("The module import feature is not supported"),
4406  ReportContext::XQST0016, fromYYLTYPE((yyloc), parseInfo));
4407  }
4408  }
4409  break;
4410 
4411  case 72:
4412 /* Line 1269 of yacc.c. */
4413 #line 2002 "querytransformparser.ypp"
4414  {
4415  allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc), (yyvsp[(3) - (9)].enums.Bool));
4416  if(variableByName((yyvsp[(5) - (9)].qName), parseInfo))
4417  {
4418  parseInfo->staticContext->error(QtXmlPatterns::tr("A variable with name %1 has already "
4419  "been declared.")
4420  .arg(formatKeyword(parseInfo->staticContext->namePool()->toLexical((yyvsp[(5) - (9)].qName)))),
4421  parseInfo->isXSLT() ? ReportContext::XTSE0630 : ReportContext::XQST0049,
4422  fromYYLTYPE((yyloc), parseInfo));
4423  }
4424  else
4425  {
4426  if((yyvsp[(7) - (9)].expr)) /* We got a value assigned. */
4427  {
4428  const Expression::Ptr checked
4429  (TypeChecker::applyFunctionConversion((yyvsp[(7) - (9)].expr), (yyvsp[(6) - (9)].sequenceType), parseInfo->staticContext,
4430  (yyvsp[(3) - (9)].enums.Bool) ? ReportContext::XTTE0570 : ReportContext::XPTY0004,
4431  (yyvsp[(3) - (9)].enums.Bool) ? TypeChecker::Options(TypeChecker::CheckFocus | TypeChecker::AutomaticallyConvert) : TypeChecker::CheckFocus));
4432 
4433  pushVariable((yyvsp[(5) - (9)].qName), (yyvsp[(6) - (9)].sequenceType), checked, VariableDeclaration::GlobalVariable, (yyloc), parseInfo);
4434  parseInfo->declaredVariables.append(parseInfo->variables.last());
4435  }
4436  else /* We got an 'external' declaration. */
4437  {
4438  const SequenceType::Ptr varType(parseInfo->staticContext->
4439  externalVariableLoader()->announceExternalVariable((yyvsp[(5) - (9)].qName), (yyvsp[(6) - (9)].sequenceType)));
4440 
4441  if(varType)
4442  {
4443  /* We push the declaration such that we can see name clashes and so on, but we don't use it for tying
4444  * any references to it. */
4445  pushVariable((yyvsp[(5) - (9)].qName), varType, Expression::Ptr(), VariableDeclaration::ExternalVariable, (yyloc), parseInfo);
4446  }
4447  else if((yyvsp[(8) - (9)].expr))
4448  {
4449  /* Ok, the xsl:param got a default value, we make it
4450  * available as a regular variable declaration. */
4451  // TODO turn into checked
4452  pushVariable((yyvsp[(5) - (9)].qName), (yyvsp[(6) - (9)].sequenceType), (yyvsp[(8) - (9)].expr), VariableDeclaration::GlobalVariable, (yyloc), parseInfo);
4453  // TODO ensure that duplicates are trapped.
4454  }
4455  else
4456  {
4457  parseInfo->staticContext->error(QtXmlPatterns::tr("No value is available for the external "
4458  "variable with name %1.")
4459  .arg(formatKeyword(parseInfo->staticContext->namePool(), (yyvsp[(5) - (9)].qName))),
4460  parseInfo->isXSLT() ? ReportContext::XTDE0050 : ReportContext::XPDY0002,
4461  fromYYLTYPE((yyloc), parseInfo));
4462  }
4463  }
4464  }
4465  }
4466  break;
4467 
4468  case 73:
4469 /* Line 1269 of yacc.c. */
4470 #line 2056 "querytransformparser.ypp"
4471  {
4472  (yyval.expr).reset();
4473  }
4474  break;
4475 
4476  case 74:
4477 /* Line 1269 of yacc.c. */
4478 #line 2060 "querytransformparser.ypp"
4479  {
4480  (yyval.expr) = (yyvsp[(2) - (2)].expr);
4481  }
4482  break;
4483 
4484  case 75:
4485 /* Line 1269 of yacc.c. */
4486 #line 2065 "querytransformparser.ypp"
4487  {
4488  (yyval.expr).reset();
4489  }
4490  break;
4491 
4492  case 76:
4493 /* Line 1269 of yacc.c. */
4494 #line 2069 "querytransformparser.ypp"
4495  {
4496  (yyval.expr) = (yyvsp[(2) - (2)].expr);
4497  }
4498  break;
4499 
4500  case 77:
4501 /* Line 1269 of yacc.c. */
4502 #line 2074 "querytransformparser.ypp"
4503  {
4504  if(parseInfo->hasDeclaration(ParserContext::ConstructionDecl))
4505  {
4506  parseInfo->staticContext->error(prologMessage("declare ordering"),
4507  ReportContext::XQST0067, fromYYLTYPE((yyloc), parseInfo));
4508  }
4509  else
4510  {
4511  parseInfo->registerDeclaration(ParserContext::ConstructionDecl);
4512  parseInfo->staticContext->setConstructionMode((yyvsp[(3) - (4)].enums.constructionMode));
4513  }
4514  }
4515  break;
4516 
4517  case 78:
4518 /* Line 1269 of yacc.c. */
4519 #line 2088 "querytransformparser.ypp"
4520  {
4521  (yyval.enums.constructionMode) = StaticContext::CMStrip;
4522  }
4523  break;
4524 
4525  case 79:
4526 /* Line 1269 of yacc.c. */
4527 #line 2092 "querytransformparser.ypp"
4528  {
4529  (yyval.enums.constructionMode) = StaticContext::CMPreserve;
4530  }
4531  break;
4532 
4533  case 80:
4534 /* Line 1269 of yacc.c. */
4535 #line 2097 "querytransformparser.ypp"
4536  {
4537  (yyval.enums.slot) = parseInfo->currentExpressionSlot() - (yyvsp[(6) - (7)].functionArguments).count();
4538  }
4539  break;
4540 
4541  case 81:
4542 /* Line 1269 of yacc.c. */
4543 #line 2101 "querytransformparser.ypp"
4544  {
4545  if(!(yyvsp[(3) - (11)].enums.Bool))
4546  allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc), (yyvsp[(3) - (11)].enums.Bool));
4547 
4548  /* If FunctionBody is null, it is 'external', otherwise the value is the body. */
4549  const QXmlName::NamespaceCode ns((yyvsp[(4) - (11)].qName).namespaceURI());
4550 
4551  if(parseInfo->isXSLT() && !(yyvsp[(4) - (11)].qName).hasPrefix())
4552  {
4553  parseInfo->staticContext->error(QtXmlPatterns::tr("A stylesheet function must have a prefixed name."),
4554  ReportContext::XTSE0740,
4555  fromYYLTYPE((yyloc), parseInfo));
4556  }
4557 
4558  if((yyvsp[(10) - (11)].expr)) /* We got a function body. */
4559  {
4560  if(ns == StandardNamespaces::empty)
4561  {
4562  parseInfo->staticContext->error(QtXmlPatterns::tr("The namespace for a user defined function "
4563  "cannot be empty (try the predefined "
4564  "prefix %1, which exists for cases "
4565  "like this)")
4566  .arg(formatKeyword("local")),
4567  ReportContext::XQST0060, fromYYLTYPE((yyloc), parseInfo));
4568  }
4569  else if(XPathHelper::isReservedNamespace(ns))
4570  {
4571  parseInfo->staticContext->error(QtXmlPatterns::tr(
4572  "The namespace %1 is reserved; therefore "
4573  "user defined functions may not use it. "
4574  "Try the predefined prefix %2, which "
4575  "exists for these cases.")
4576  .arg(formatURI(parseInfo->staticContext->namePool(), ns), formatKeyword("local")),
4577  parseInfo->isXSLT() ? ReportContext::XTSE0080 : ReportContext::XQST0045,
4578  fromYYLTYPE((yyloc), parseInfo));
4579  }
4580  else if(parseInfo->moduleNamespace != StandardNamespaces::empty &&
4581  ns != parseInfo->moduleNamespace)
4582  {
4583  parseInfo->staticContext->error(QtXmlPatterns::tr(
4584  "The namespace of a user defined "
4585  "function in a library module must be "
4586  "equivalent to the module namespace. "
4587  "In other words, it should be %1 instead "
4588  "of %2")
4589  .arg(formatURI(parseInfo->staticContext->namePool(), parseInfo->moduleNamespace),
4590  formatURI(parseInfo->staticContext->namePool(), ns)),
4591  ReportContext::XQST0048, fromYYLTYPE((yyloc), parseInfo));
4592  }
4593  else
4594  {
4595  /* Apply function conversion such that the body matches the declared
4596  * return type. */
4597  const Expression::Ptr checked(TypeChecker::applyFunctionConversion((yyvsp[(10) - (11)].expr), (yyvsp[(9) - (11)].sequenceType),
4598  parseInfo->staticContext,
4599  ReportContext::XPTY0004,
4600  TypeChecker::Options(TypeChecker::AutomaticallyConvert |
4601  TypeChecker::CheckFocus |
4602  TypeChecker::GeneratePromotion)));
4603 
4604  const int argCount = (yyvsp[(6) - (11)].functionArguments).count();
4605  const FunctionSignature::Ptr sign(new FunctionSignature((yyvsp[(4) - (11)].qName) /* name */,
4606  argCount /* minArgs */,
4607  argCount /* maxArgs */,
4608  (yyvsp[(9) - (11)].sequenceType) /* returnType */));
4609  sign->setArguments((yyvsp[(6) - (11)].functionArguments));
4610  const UserFunction::List::const_iterator end(parseInfo->userFunctions.constEnd());
4611  UserFunction::List::const_iterator it(parseInfo->userFunctions.constBegin());
4612 
4613  for(; it != end; ++it)
4614  {
4615  if(*(*it)->signature() == *sign)
4616  {
4617  parseInfo->staticContext->error(QtXmlPatterns::tr("A function already exists with "
4618  "the signature %1.")
4619  .arg(formatFunction(parseInfo->staticContext->namePool(), sign)),
4620  parseInfo->isXSLT() ? ReportContext::XTSE0770 : ReportContext::XQST0034, fromYYLTYPE((yyloc), parseInfo));
4621  }
4622  }
4623 
4624  VariableDeclaration::List argDecls;
4625 
4626  for(int i = 0; i < argCount; ++i)
4627  argDecls.append(parseInfo->variables.at(i));
4628 
4629  if((yyvsp[(8) - (11)].enums.slot) > -1)
4630  {
4631  /* We have allocated slots, so now push them out of scope. */
4632  parseInfo->finalizePushedVariable(argCount);
4633  }
4634 
4635  parseInfo->userFunctions.append(UserFunction::Ptr(new UserFunction(sign, checked, (yyvsp[(8) - (11)].enums.slot), argDecls)));
4636  }
4637  }
4638  else /* We got an 'external' declaration. */
4639  {
4640  parseInfo->staticContext->error(QtXmlPatterns::tr("No external functions are supported. "
4641  "All supported functions can be used directly, "
4642  "without first declaring them as external"),
4643  ReportContext::XPST0017, fromYYLTYPE((yyloc), parseInfo));
4644  }
4645  }
4646  break;
4647 
4648  case 82:
4649 /* Line 1269 of yacc.c. */
4650 #line 2205 "querytransformparser.ypp"
4651  {
4652  (yyval.functionArguments) = FunctionArgument::List();
4653  }
4654  break;
4655 
4656  case 83:
4657 /* Line 1269 of yacc.c. */
4658 #line 2209 "querytransformparser.ypp"
4659  {
4660  FunctionArgument::List l;
4661  l.append((yyvsp[(1) - (1)].functionArgument));
4662  (yyval.functionArguments) = l;
4663  }
4664  break;
4665 
4666  case 84:
4667 /* Line 1269 of yacc.c. */
4668 #line 2215 "querytransformparser.ypp"
4669  {
4670  FunctionArgument::List::const_iterator it((yyvsp[(1) - (3)].functionArguments).constBegin());
4671  const FunctionArgument::List::const_iterator end((yyvsp[(1) - (3)].functionArguments).constEnd());
4672 
4673  for(; it != end; ++it)
4674  {
4675  if((*it)->name() == (yyvsp[(3) - (3)].functionArgument)->name())
4676  {
4677  parseInfo->staticContext->error(QtXmlPatterns::tr("An argument with name %1 has already "
4678  "been declared. Every argument name "
4679  "must be unique.")
4680  .arg(formatKeyword(parseInfo->staticContext->namePool(), (yyvsp[(3) - (3)].functionArgument)->name())),
4681  ReportContext::XQST0039, fromYYLTYPE((yyloc), parseInfo));
4682  }
4683  }
4684 
4685  (yyvsp[(1) - (3)].functionArguments).append((yyvsp[(3) - (3)].functionArgument));
4686  (yyval.functionArguments) = (yyvsp[(1) - (3)].functionArguments);
4687  }
4688  break;
4689 
4690  case 85:
4691 /* Line 1269 of yacc.c. */
4692 #line 2236 "querytransformparser.ypp"
4693  {
4694  pushVariable((yyvsp[(2) - (3)].qName), (yyvsp[(3) - (3)].sequenceType), Expression::Ptr(), VariableDeclaration::FunctionArgument, (yyloc), parseInfo);
4695  (yyval.functionArgument) = FunctionArgument::Ptr(new FunctionArgument((yyvsp[(2) - (3)].qName), (yyvsp[(3) - (3)].sequenceType)));
4696  }
4697  break;
4698 
4699  case 86:
4700 /* Line 1269 of yacc.c. */
4701 #line 2242 "querytransformparser.ypp"
4702  {
4703  (yyval.expr).reset();
4704  }
4705  break;
4706 
4707  case 88:
4708 /* Line 1269 of yacc.c. */
4709 #line 2248 "querytransformparser.ypp"
4710  {
4711  (yyval.expr) = (yyvsp[(2) - (3)].expr);
4712  }
4713  break;
4714 
4715  case 91:
4716 /* Line 1269 of yacc.c. */
4717 #line 2264 "querytransformparser.ypp"
4718  {
4719  (yyval.expr) = create(new CombineNodes((yyvsp[(1) - (3)].expr), CombineNodes::Union, (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo);
4720  }
4721  break;
4722 
4723  case 93:
4724 /* Line 1269 of yacc.c. */
4725 #line 2270 "querytransformparser.ypp"
4726  {
4727  /* We write this into a node test. The spec says, 5.5.3 The Meaning of a Pattern:
4728  * "Similarly, / matches a document node, and only a document node,
4729  * because the result of the expression root(.)//(/) returns the root
4730  * node of the tree containing the context node if and only if it is a
4731  * document node." */
4732  (yyval.expr) = create(new AxisStep(QXmlNodeModelIndex::AxisSelf, BuiltinTypes::document), (yyloc), parseInfo);
4733  }
4734  break;
4735 
4736  case 94:
4737 /* Line 1269 of yacc.c. */
4738 #line 2279 "querytransformparser.ypp"
4739  {
4740  /* /axis::node-test
4741  * =>
4742  * axis::node-test[parent::document-node()]
4743  *
4744  * In practice it looks like this. $2 is:
4745  *
4746  * TruthPredicate
4747  * AxisStep self::element(c)
4748  * TruthPredicate
4749  * AxisStep parent::element(b)
4750  * AxisStep parent::element(a)
4751  *
4752  * and we want this:
4753  *
4754  * TruthPredicate
4755  * AxisStep self::element(c)
4756  * TruthPredicate
4757  * AxisStep self::element(b)
4758  * TruthPredicate
4759  * AxisStep parent::element(a)
4760  * AxisStep parent::document()
4761  *
4762  * So we want to rewrite the predicate deepest down into a
4763  * another TruthPredicate containing the AxisStep.
4764  *
4765  * The simplest case where $2 is only an axis step is special. When $2 is:
4766  *
4767  * AxisStep self::element(a)
4768  *
4769  * we want:
4770  *
4771  * TruthPredicate
4772  * AxisStep self::element(a)
4773  * AxisStep parent::document()
4774  */
4775 
4776  /* First, find the target. */
4777  Expression::Ptr target((yyvsp[(2) - (2)].expr));
4778 
4779  while(isPredicate(target->id()))
4780  {
4781  const Expression::Ptr candidate(target->operands().at(1));
4782 
4783  if(isPredicate(candidate->id()))
4784  target = candidate;
4785  else
4786  break; /* target is now the last predicate. */
4787  }
4788 
4789  if(target->is(Expression::IDAxisStep))
4790  {
4791  (yyval.expr) = create(GenericPredicate::create((yyvsp[(2) - (2)].expr), create(new AxisStep(QXmlNodeModelIndex::AxisParent, BuiltinTypes::document), (yyloc), parseInfo),
4792  parseInfo->staticContext, fromYYLTYPE((yylsp[(1) - (2)]), parseInfo)), (yylsp[(1) - (2)]), parseInfo);
4793  }
4794  else
4795  {
4796  const Expression::List targetOperands(target->operands());
4797  Expression::List newOps;
4798  newOps.append(targetOperands.at(0));
4799 
4800  newOps.append(create(GenericPredicate::create(targetOperands.at(1),
4801  create(new AxisStep(QXmlNodeModelIndex::AxisParent, BuiltinTypes::document), (yyloc), parseInfo),
4802  parseInfo->staticContext, fromYYLTYPE((yylsp[(1) - (2)]), parseInfo)), (yylsp[(1) - (2)]), parseInfo));
4803 
4804  target->setOperands(newOps);
4805  (yyval.expr) = (yyvsp[(2) - (2)].expr);
4806  }
4807  }
4808  break;
4809 
4810  case 95:
4811 /* Line 1269 of yacc.c. */
4812 #line 2349 "querytransformparser.ypp"
4813  {
4814  /* //axis::node-test
4815  * =>
4816  * axis::node-test[parent::node()]
4817  *
4818  * Spec says: "//para matches any para element that has a parent node."
4819  */
4820  (yyval.expr) = create(GenericPredicate::create((yyvsp[(2) - (2)].expr), create(new AxisStep(QXmlNodeModelIndex::AxisParent, BuiltinTypes::node), (yyloc), parseInfo),
4821  parseInfo->staticContext, fromYYLTYPE((yylsp[(1) - (2)]), parseInfo)), (yylsp[(1) - (2)]), parseInfo);
4822  }
4823  break;
4824 
4825  case 97:
4826 /* Line 1269 of yacc.c. */
4827 #line 2361 "querytransformparser.ypp"
4828  {
4829  createIdPatternPath((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), QXmlNodeModelIndex::AxisParent, (yylsp[(2) - (3)]), parseInfo);
4830  }
4831  break;
4832 
4833  case 98:
4834 /* Line 1269 of yacc.c. */
4835 #line 2365 "querytransformparser.ypp"
4836  {
4837  createIdPatternPath((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), QXmlNodeModelIndex::AxisAncestor, (yylsp[(2) - (3)]), parseInfo);
4838  }
4839  break;
4840 
4841  case 99:
4842 /* Line 1269 of yacc.c. */
4843 #line 2370 "querytransformparser.ypp"
4844  {
4845  const Expression::List ands((yyvsp[(1) - (1)].expr)->operands());
4846  const FunctionSignature::Ptr signature((yyvsp[(1) - (1)].expr)->as<FunctionCall>()->signature());
4847  const QXmlName name(signature->name());
4848  const QXmlName key(StandardNamespaces::fn, StandardLocalNames::key);
4849  const QXmlName id(StandardNamespaces::fn, StandardLocalNames::id);
4850 
4851  if(name == id)
4852  {
4853  const Expression::ID id = ands.first()->id();
4854  if(!isVariableReference(id) && id != Expression::IDStringValue)
4855  {
4856  parseInfo->staticContext->error(QtXmlPatterns::tr("When function %1 is used for matching inside a pattern, "
4857  "the argument must be a variable reference or a string literal.")
4858  .arg(formatFunction(parseInfo->staticContext->namePool(), signature)),
4859  ReportContext::XPST0003,
4860  fromYYLTYPE((yyloc), parseInfo));
4861  }
4862  }
4863  else if(name == key)
4864  {
4865  if(ands.first()->id() != Expression::IDStringValue)
4866  {
4867  parseInfo->staticContext->error(QtXmlPatterns::tr("In an XSL-T pattern, the first argument to function %1 "
4868  "must be a string literal, when used for matching.")
4869  .arg(formatFunction(parseInfo->staticContext->namePool(), signature)),
4870  ReportContext::XPST0003,
4871  fromYYLTYPE((yyloc), parseInfo));
4872  }
4873 
4874  const Expression::ID id2 = ands.at(1)->id();
4875  if(!isVariableReference(id2) &&
4876  id2 != Expression::IDStringValue &&
4877  id2 != Expression::IDIntegerValue &&
4878  id2 != Expression::IDBooleanValue &&
4879  id2 != Expression::IDFloat)
4880  {
4881  parseInfo->staticContext->error(QtXmlPatterns::tr("In an XSL-T pattern, the first argument to function %1 "
4882  "must be a literal or a variable reference, when used for matching.")
4883  .arg(formatFunction(parseInfo->staticContext->namePool(), signature)),
4884  ReportContext::XPST0003,
4885  fromYYLTYPE((yyloc), parseInfo));
4886  }
4887 
4888  if(ands.count() == 3)
4889  {
4890  parseInfo->staticContext->error(QtXmlPatterns::tr("In an XSL-T pattern, function %1 cannot have a third argument.")
4891  .arg(formatFunction(parseInfo->staticContext->namePool(), signature)),
4892  ReportContext::XPST0003,
4893  fromYYLTYPE((yyloc), parseInfo));
4894  }
4895 
4896  }
4897  else
4898  {
4899  const FunctionSignature::Hash signs(parseInfo->staticContext->functionSignatures()->functionSignatures());
4900  parseInfo->staticContext->error(QtXmlPatterns::tr("In an XSL-T pattern, only function %1 "
4901  "and %2, not %3, can be used for matching.")
4902  .arg(formatFunction(parseInfo->staticContext->namePool(), signs.value(id)),
4903  formatFunction(parseInfo->staticContext->namePool(), signs.value(key)),
4904  formatFunction(parseInfo->staticContext->namePool(), signature)),
4905  ReportContext::XPST0003,
4906  fromYYLTYPE((yyloc), parseInfo));
4907  }
4908 
4909  (yyval.expr) = (yyvsp[(1) - (1)].expr);
4910  }
4911  break;
4912 
4913  case 101:
4914 /* Line 1269 of yacc.c. */
4915 #line 2440 "querytransformparser.ypp"
4916  {
4917  (yyval.expr) = createPatternPath((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), QXmlNodeModelIndex::AxisParent, (yylsp[(2) - (3)]), parseInfo);
4918  }
4919  break;
4920 
4921  case 102:
4922 /* Line 1269 of yacc.c. */
4923 #line 2444 "querytransformparser.ypp"
4924  {
4925  (yyval.expr) = createPatternPath((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), QXmlNodeModelIndex::AxisAncestor, (yylsp[(2) - (3)]), parseInfo);
4926  }
4927  break;
4928 
4929  case 103:
4930 /* Line 1269 of yacc.c. */
4931 #line 2449 "querytransformparser.ypp"
4932  {
4933  const Expression::Ptr expr(findAxisStep((yyvsp[(1) - (1)].expr)));
4934 
4935  const QXmlNodeModelIndex::Axis axis = expr->as<AxisStep>()->axis();
4936  AxisStep *const axisStep = expr->as<AxisStep>();
4937 
4938  /* Here we constrain the possible axes, and we rewrite the axes as according
4939  * to 5.5.3 The Meaning of a Pattern.
4940  *
4941  * However, we also rewrite axis child and attribute to axis self. The
4942  * reason for this is that if we don't, we will match the children of
4943  * the context node, instead of the context node itself. The formal
4944  * definition of a pattern, root(.)//EE is insensitive to context,
4945  * while the way we implement pattern, "the other way of seeing it",
4946  * e.g from right to left, are very much. */
4947 
4948  if(axisStep->nodeTest() == BuiltinTypes::document
4949  || axis == QXmlNodeModelIndex::AxisChild)
4950  axisStep->setAxis(QXmlNodeModelIndex::AxisSelf);
4951  else if(axis == QXmlNodeModelIndex::AxisAttribute)
4952  {
4953  axisStep->setAxis(QXmlNodeModelIndex::AxisSelf);
4954  /* Consider that the user write attribute::node(). This is
4955  * semantically equivalent to attribute::attribute(), but since we have changed
4956  * the axis to axis self, we also need to change the node test, such that we
4957  * have self::attribute(). */
4958  if(*axisStep->nodeTest() == *BuiltinTypes::node)
4959  axisStep->setNodeTest(BuiltinTypes::attribute);
4960  }
4961  else
4962  {
4963  parseInfo->staticContext->error(QtXmlPatterns::tr("In an XSL-T pattern, axis %1 cannot be used, "
4964  "only axis %2 or %3 can.")
4965  .arg(formatKeyword(AxisStep::axisName(axis)),
4966  formatKeyword(AxisStep::axisName(QXmlNodeModelIndex::AxisChild)),
4967  formatKeyword(AxisStep::axisName(QXmlNodeModelIndex::AxisAttribute))),
4968  ReportContext::XPST0003,
4969  fromYYLTYPE((yyloc), parseInfo));
4970  }
4971 
4972  (yyval.expr) = (yyvsp[(1) - (1)].expr);
4973  }
4974  break;
4975 
4976  case 105:
4977 /* Line 1269 of yacc.c. */
4978 #line 2494 "querytransformparser.ypp"
4979  {
4980  (yyval.expr) = create(new ExpressionSequence((yyvsp[(1) - (1)].expressionList)), (yyloc), parseInfo);
4981  }
4982  break;
4983 
4984  case 106:
4985 /* Line 1269 of yacc.c. */
4986 #line 2499 "querytransformparser.ypp"
4987  {
4988  Expression::List l;
4989  l.append((yyvsp[(1) - (3)].expr));
4990  l.append((yyvsp[(3) - (3)].expr));
4991  (yyval.expressionList) = l;
4992  }
4993  break;
4994 
4995  case 107:
4996 /* Line 1269 of yacc.c. */
4997 #line 2506 "querytransformparser.ypp"
4998  {
4999  (yyvsp[(1) - (3)].expressionList).append((yyvsp[(3) - (3)].expr));
5000  (yyval.expressionList) = (yyvsp[(1) - (3)].expressionList);
5001  }
5002  break;
5003 
5004  case 113:
5005 /* Line 1269 of yacc.c. */
5006 #line 2517 "querytransformparser.ypp"
5007  {
5008  (yyval.expr) = createDirAttributeValue((yyvsp[(3) - (4)].expressionList), parseInfo, (yyloc));
5009  }
5010  break;
5011 
5012  case 114:
5013 /* Line 1269 of yacc.c. */
5014 #line 2522 "querytransformparser.ypp"
5015  {
5016  QVector<QXmlName> result;
5017  result.append(QXmlName(StandardNamespaces::InternalXSLT, StandardLocalNames::Default));
5018  (yyval.qNameVector) = result;
5019  }
5020  break;
5021 
5022  case 115:
5023 /* Line 1269 of yacc.c. */
5024 #line 2528 "querytransformparser.ypp"
5025  {
5026  (yyval.qNameVector) = (yyvsp[(2) - (2)].qNameVector);
5027  }
5028  break;
5029 
5030  case 116:
5031 /* Line 1269 of yacc.c. */
5032 #line 2533 "querytransformparser.ypp"
5033  {
5034  (yyval.qName) = QXmlName(StandardNamespaces::InternalXSLT, StandardLocalNames::Default);
5035  }
5036  break;
5037 
5038  case 117:
5039 /* Line 1269 of yacc.c. */
5040 #line 2537 "querytransformparser.ypp"
5041  {
5042  (yyval.qName) = (yyvsp[(2) - (2)].qName);
5043  }
5044  break;
5045 
5046  case 118:
5047 /* Line 1269 of yacc.c. */
5048 #line 2542 "querytransformparser.ypp"
5049  {
5050  QVector<QXmlName> result;
5051  result.append((yyvsp[(1) - (1)].qName));
5052  (yyval.qNameVector) = result;
5053  }
5054  break;
5055 
5056  case 119:
5057 /* Line 1269 of yacc.c. */
5058 #line 2548 "querytransformparser.ypp"
5059  {
5060  (yyvsp[(1) - (3)].qNameVector).append((yyvsp[(3) - (3)].qName));
5061  (yyval.qNameVector) = (yyvsp[(1) - (3)].qNameVector);
5062  }
5063  break;
5064 
5065  case 120:
5066 /* Line 1269 of yacc.c. */
5067 #line 2554 "querytransformparser.ypp"
5068  {
5069  (yyval.qName) = (yyvsp[(1) - (1)].qName);
5070  }
5071  break;
5072 
5073  case 121:
5074 /* Line 1269 of yacc.c. */
5075 #line 2558 "querytransformparser.ypp"
5076  {
5077  if((yyvsp[(1) - (1)].sval) == QLatin1String("#current"))
5078  (yyval.qName) = QXmlName(StandardNamespaces::InternalXSLT, StandardLocalNames::current);
5079  else if((yyvsp[(1) - (1)].sval) == QLatin1String("#default"))
5080  (yyval.qName) = QXmlName(StandardNamespaces::InternalXSLT, StandardLocalNames::Default);
5081  else if((yyvsp[(1) - (1)].sval) == QLatin1String("#all"))
5082  (yyval.qName) = QXmlName(StandardNamespaces::InternalXSLT, StandardLocalNames::all);
5083  else
5084  {
5085  const ReflectYYLTYPE ryy((yyloc), parseInfo);
5086 
5087  if(!QXmlUtils::isNCName((yyvsp[(1) - (1)].sval)))
5088  {
5089  parseInfo->staticContext->error(QtXmlPatterns::tr("%1 is an invalid template mode name.")
5090  .arg(formatKeyword((yyvsp[(1) - (1)].sval))),
5091  ReportContext::XTSE0550,
5092  fromYYLTYPE((yyloc), parseInfo));
5093  }
5094 
5095  (yyval.qName) = parseInfo->staticContext->namePool()->allocateQName(StandardNamespaces::empty, (yyvsp[(1) - (1)].sval));
5096  }
5097  }
5098  break;
5099 
5100  case 124:
5101 /* Line 1269 of yacc.c. */
5102 #line 2587 "querytransformparser.ypp"
5103  {
5104  /* We're pushing the range variable here, not the positional. */
5105  (yyval.expr) = pushVariable((yyvsp[(3) - (7)].qName), quantificationType((yyvsp[(4) - (7)].sequenceType)), (yyvsp[(7) - (7)].expr), VariableDeclaration::RangeVariable, (yyloc), parseInfo);
5106  }
5107  break;
5108 
5109  case 125:
5110 /* Line 1269 of yacc.c. */
5111 #line 2591 "querytransformparser.ypp"
5112  {
5113  /* It is ok this appears after PositionalVar, because currentRangeSlot()
5114  * uses a different "channel" than currentPositionSlot(), so they can't trash
5115  * each other. */
5116  (yyval.enums.slot) = parseInfo->staticContext->currentRangeSlot();
5117  }
5118  break;
5119 
5120  case 126:
5121 /* Line 1269 of yacc.c. */
5122 #line 2598 "querytransformparser.ypp"
5123  {
5124  Q_ASSERT((yyvsp[(7) - (10)].expr));
5125  Q_ASSERT((yyvsp[(10) - (10)].expr));
5126 
5127  /* We want the next last pushed variable, since we push the range variable after the
5128  * positional variable. */
5129  if((yyvsp[(5) - (10)].enums.slot) != -1 && parseInfo->variables.at(parseInfo->variables.count() -2)->name == (yyvsp[(3) - (10)].qName))
5130  {
5131  /* Ok, a positional variable is used since its slot is not -1, and its name is equal
5132  * to our range variable. This is an error. */
5133  parseInfo->staticContext->error(QtXmlPatterns::tr("The name of a variable bound in a for-expression must be different "
5134  "from the positional variable. Hence, the two variables named %1 collide.")
5135  .arg(formatKeyword(parseInfo->staticContext->namePool(), (yyvsp[(3) - (10)].qName))),
5136  ReportContext::XQST0089,
5137  fromYYLTYPE((yyloc), parseInfo));
5138 
5139  }
5140 
5141  const Expression::Ptr retBody(create(new ForClause((yyvsp[(9) - (10)].enums.slot), (yyvsp[(8) - (10)].expr), (yyvsp[(10) - (10)].expr), (yyvsp[(5) - (10)].enums.slot)), (yyloc), parseInfo));
5142  ReturnOrderBy *const rob = locateReturnClause((yyvsp[(10) - (10)].expr));
5143 
5144  if(rob)
5145  (yyval.expr) = create(new OrderBy(rob->stability(), rob->orderSpecs(), retBody, rob), (yyloc), parseInfo);
5146  else
5147  (yyval.expr) = retBody;
5148 
5149  parseInfo->finalizePushedVariable();
5150 
5151  if((yyvsp[(5) - (10)].enums.slot) != -1) /* We also have a positional variable to remove from the scope. */
5152  parseInfo->finalizePushedVariable();
5153  }
5154  break;
5155 
5156  case 127:
5157 /* Line 1269 of yacc.c. */
5158 #line 2632 "querytransformparser.ypp"
5159  {
5160  pushVariable((yyvsp[(3) - (7)].qName), quantificationType((yyvsp[(4) - (7)].sequenceType)), (yyvsp[(7) - (7)].expr), VariableDeclaration::RangeVariable, (yyloc), parseInfo);
5161  }
5162  break;
5163 
5164  case 128:
5165 /* Line 1269 of yacc.c. */
5166 #line 2635 "querytransformparser.ypp"
5167  {
5168  /* It is ok this appears after PositionalVar, because currentRangeSlot()
5169  * uses a different "channel" than currentPositionSlot(), so they can't trash
5170  * each other. */
5171  (yyval.enums.slot) = parseInfo->staticContext->currentRangeSlot();
5172  }
5173  break;
5174 
5175  case 129:
5176 /* Line 1269 of yacc.c. */
5177 #line 2642 "querytransformparser.ypp"
5178  {
5179  (yyval.expr) = create(new ForClause((yyvsp[(9) - (10)].enums.slot), (yyvsp[(7) - (10)].expr), (yyvsp[(10) - (10)].expr), (yyvsp[(5) - (10)].enums.slot)), (yyloc), parseInfo);
5180 
5181  parseInfo->finalizePushedVariable();
5182 
5183  if((yyvsp[(5) - (10)].enums.slot) != -1) /* We also have a positional variable to remove from the scope. */
5184  parseInfo->finalizePushedVariable();
5185  }
5186  break;
5187 
5188  case 133:
5189 /* Line 1269 of yacc.c. */
5190 #line 2656 "querytransformparser.ypp"
5191  {
5192  (yyval.enums.slot) = -1;
5193  }
5194  break;
5195 
5196  case 134:
5197 /* Line 1269 of yacc.c. */
5198 #line 2661 "querytransformparser.ypp"
5199  {
5200  pushVariable((yyvsp[(3) - (3)].qName), CommonSequenceTypes::ExactlyOneInteger, Expression::Ptr(),
5201  VariableDeclaration::PositionalVariable, (yyloc), parseInfo);
5202  (yyval.enums.slot) = parseInfo->currentPositionSlot();
5203  }
5204  break;
5205 
5206  case 135:
5207 /* Line 1269 of yacc.c. */
5208 #line 2668 "querytransformparser.ypp"
5209  {
5210  (yyval.expr) = pushVariable((yyvsp[(4) - (7)].qName), quantificationType((yyvsp[(5) - (7)].sequenceType)), (yyvsp[(7) - (7)].expr), VariableDeclaration::ExpressionVariable, (yyloc), parseInfo);
5211  }
5212  break;
5213 
5214  case 136:
5215 /* Line 1269 of yacc.c. */
5216 #line 2672 "querytransformparser.ypp"
5217  {
5218  allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc), (yyvsp[(2) - (9)].enums.Bool));
5219 
5220  Q_ASSERT(parseInfo->variables.top()->name == (yyvsp[(4) - (9)].qName));
5221  (yyval.expr) = create(new LetClause((yyvsp[(8) - (9)].expr), (yyvsp[(9) - (9)].expr), parseInfo->variables.top()), (yyloc), parseInfo);
5222  parseInfo->finalizePushedVariable();
5223  }
5224  break;
5225 
5226  case 137:
5227 /* Line 1269 of yacc.c. */
5228 #line 2681 "querytransformparser.ypp"
5229  { (yyval.expr) = pushVariable((yyvsp[(3) - (6)].qName), quantificationType((yyvsp[(4) - (6)].sequenceType)), (yyvsp[(6) - (6)].expr), VariableDeclaration::ExpressionVariable, (yyloc), parseInfo);}
5230  break;
5231 
5232  case 138:
5233 /* Line 1269 of yacc.c. */
5234 #line 2683 "querytransformparser.ypp"
5235  {
5236  Q_ASSERT(parseInfo->variables.top()->name == (yyvsp[(3) - (8)].qName));
5237  (yyval.expr) = create(new LetClause((yyvsp[(7) - (8)].expr), (yyvsp[(8) - (8)].expr), parseInfo->variables.top()), (yyloc), parseInfo);
5238  parseInfo->finalizePushedVariable();
5239  }
5240  break;
5241 
5242  case 142:
5243 /* Line 1269 of yacc.c. */
5244 #line 2694 "querytransformparser.ypp"
5245  {
5246  if((yyvsp[(1) - (3)].orderSpecs).isEmpty())
5247  (yyval.expr) = (yyvsp[(3) - (3)].expr);
5248  else
5249  (yyval.expr) = createReturnOrderBy((yyvsp[(1) - (3)].orderSpecs), (yyvsp[(3) - (3)].expr), parseInfo->orderStability.pop(), (yyloc), parseInfo);
5250  }
5251  break;
5252 
5253  case 143:
5254 /* Line 1269 of yacc.c. */
5255 #line 2702 "querytransformparser.ypp"
5256  {
5257  if((yyvsp[(3) - (5)].orderSpecs).isEmpty())
5258  (yyval.expr) = create(new IfThenClause((yyvsp[(2) - (5)].expr), (yyvsp[(5) - (5)].expr), create(new EmptySequence, (yyloc), parseInfo)), (yyloc), parseInfo);
5259  else
5260  (yyval.expr) = create(new IfThenClause((yyvsp[(2) - (5)].expr), createReturnOrderBy((yyvsp[(3) - (5)].orderSpecs), (yyvsp[(5) - (5)].expr), parseInfo->orderStability.pop(), (yyloc), parseInfo),
5261  create(new EmptySequence, (yyloc), parseInfo)),
5262  (yyloc), parseInfo);
5263  }
5264  break;
5265 
5266  case 144:
5267 /* Line 1269 of yacc.c. */
5268 #line 2712 "querytransformparser.ypp"
5269  {
5270  (yyval.orderSpecs) = OrderSpecTransfer::List();
5271  }
5272  break;
5273 
5274  case 146:
5275 /* Line 1269 of yacc.c. */
5276 #line 2718 "querytransformparser.ypp"
5277  {
5278  (yyval.orderSpecs) = (yyvsp[(2) - (2)].orderSpecs);
5279  }
5280  break;
5281 
5282  case 147:
5283 /* Line 1269 of yacc.c. */
5284 #line 2723 "querytransformparser.ypp"
5285  {
5286  OrderSpecTransfer::List list;
5287  list += (yyvsp[(1) - (3)].orderSpecs);
5288  list.append((yyvsp[(3) - (3)].orderSpec));
5289  (yyval.orderSpecs) = list;
5290  }
5291  break;
5292 
5293  case 148:
5294 /* Line 1269 of yacc.c. */
5295 #line 2730 "querytransformparser.ypp"
5296  {
5297  OrderSpecTransfer::List list;
5298  list.append((yyvsp[(1) - (1)].orderSpec));
5299  (yyval.orderSpecs) = list;
5300  }
5301  break;
5302 
5303  case 149:
5304 /* Line 1269 of yacc.c. */
5305 #line 2737 "querytransformparser.ypp"
5306  {
5307  (yyval.orderSpec) = OrderSpecTransfer((yyvsp[(1) - (4)].expr), OrderBy::OrderSpec((yyvsp[(2) - (4)].enums.sortDirection), (yyvsp[(3) - (4)].enums.orderingEmptySequence)));
5308  }
5309  break;
5310 
5311  case 150:
5312 /* Line 1269 of yacc.c. */
5313 #line 2742 "querytransformparser.ypp"
5314  {
5315  /* Where does the specification state the default value is ascending?
5316  *
5317  * It is implicit, in the first enumerated list in 3.8.3 Order By and Return Clauses:
5318  *
5319  * "If T1 and T2 are two tuples in the tuple stream, and V1 and V2 are the first pair
5320  * of values encountered when evaluating their orderspecs from left to right for
5321  * which one value is greater-than the other (as defined above), then:
5322  *
5323  * 1. If V1 is greater-than V2: If the orderspec specifies descending,
5324  * then T1 precedes T2 in the tuple stream; otherwise, T2 precedes T1 in the tuple stream.
5325  * 2. If V2 is greater-than V1: If the orderspec specifies descending,
5326  * then T2 precedes T1 in the tuple stream; otherwise, T1 precedes T2 in the tuple stream."
5327  *
5328  * which means that if you don't specify anything, or you
5329  * specify ascending, you get the same result.
5330  */
5331  (yyval.enums.sortDirection) = OrderBy::OrderSpec::Ascending;
5332  }
5333  break;
5334 
5335  case 151:
5336 /* Line 1269 of yacc.c. */
5337 #line 2763 "querytransformparser.ypp"
5338  {
5339  (yyval.enums.sortDirection) = OrderBy::OrderSpec::Ascending;
5340  }
5341  break;
5342 
5343  case 152:
5344 /* Line 1269 of yacc.c. */
5345 #line 2768 "querytransformparser.ypp"
5346  {
5347  (yyval.enums.sortDirection) = OrderBy::OrderSpec::Descending;
5348  }
5349  break;
5350 
5351  case 153:
5352 /* Line 1269 of yacc.c. */
5353 #line 2773 "querytransformparser.ypp"
5354  {
5355  (yyval.enums.orderingEmptySequence) = parseInfo->staticContext->orderingEmptySequence();
5356  }
5357  break;
5358 
5359  case 156:
5360 /* Line 1269 of yacc.c. */
5361 #line 2780 "querytransformparser.ypp"
5362  {
5363  if(parseInfo->isXSLT())
5364  resolveAndCheckCollation<ReportContext::XTDE1035>((yyvsp[(2) - (2)].sval), parseInfo, (yyloc));
5365  else
5366  resolveAndCheckCollation<ReportContext::XQST0076>((yyvsp[(2) - (2)].sval), parseInfo, (yyloc));
5367  }
5368  break;
5369 
5370  case 157:
5371 /* Line 1269 of yacc.c. */
5372 #line 2787 "querytransformparser.ypp"
5373  {
5374  /* We do nothing. We don't use collations, and we have this non-terminal
5375  * in order to accept expressions. */
5376  }
5377  break;
5378 
5379  case 158:
5380 /* Line 1269 of yacc.c. */
5381 #line 2793 "querytransformparser.ypp"
5382  {
5383  parseInfo->orderStability.push(OrderBy::StableOrder);
5384  }
5385  break;
5386 
5387  case 159:
5388 /* Line 1269 of yacc.c. */
5389 #line 2797 "querytransformparser.ypp"
5390  {
5391  parseInfo->orderStability.push(OrderBy::UnstableOrder);
5392  }
5393  break;
5394 
5395  case 162:
5396 /* Line 1269 of yacc.c. */
5397 #line 2805 "querytransformparser.ypp"
5398  {
5399  pushVariable((yyvsp[(3) - (6)].qName), quantificationType((yyvsp[(4) - (6)].sequenceType)), (yyvsp[(6) - (6)].expr),
5400  VariableDeclaration::RangeVariable, (yyloc), parseInfo);
5401  }
5402  break;
5403 
5404  case 163:
5405 /* Line 1269 of yacc.c. */
5406 #line 2809 "querytransformparser.ypp"
5407  {(yyval.enums.slot) = parseInfo->staticContext->currentRangeSlot();}
5408  break;
5409 
5410  case 164:
5411 /* Line 1269 of yacc.c. */
5412 #line 2811 "querytransformparser.ypp"
5413  {
5415  (yyval.expr) = create(new QuantifiedExpression((yyvsp[(8) - (9)].enums.slot),
5416  QuantifiedExpression::Some, (yyvsp[(6) - (9)].expr), (yyvsp[(9) - (9)].expr)), (yyloc), parseInfo);
5417  parseInfo->finalizePushedVariable();
5418  }
5419  break;
5420 
5421  case 165:
5422 /* Line 1269 of yacc.c. */
5423 #line 2819 "querytransformparser.ypp"
5424  {
5425  (yyval.expr) = pushVariable((yyvsp[(3) - (6)].qName), quantificationType((yyvsp[(4) - (6)].sequenceType)), (yyvsp[(6) - (6)].expr),
5426  VariableDeclaration::RangeVariable, (yyloc), parseInfo);
5427  }
5428  break;
5429 
5430  case 166:
5431 /* Line 1269 of yacc.c. */
5432 #line 2823 "querytransformparser.ypp"
5433  {(yyval.enums.slot) = parseInfo->staticContext->currentRangeSlot();}
5434  break;
5435 
5436  case 167:
5437 /* Line 1269 of yacc.c. */
5438 #line 2825 "querytransformparser.ypp"
5439  {
5440  (yyval.expr) = create(new QuantifiedExpression((yyvsp[(8) - (9)].enums.slot),
5441  QuantifiedExpression::Some, (yyvsp[(7) - (9)].expr), (yyvsp[(9) - (9)].expr)), (yyloc), parseInfo);
5442  parseInfo->finalizePushedVariable();
5443  }
5444  break;
5445 
5446  case 169:
5447 /* Line 1269 of yacc.c. */
5448 #line 2834 "querytransformparser.ypp"
5449  {
5450  pushVariable((yyvsp[(3) - (6)].qName), quantificationType((yyvsp[(4) - (6)].sequenceType)), (yyvsp[(6) - (6)].expr),
5451  VariableDeclaration::RangeVariable, (yyloc), parseInfo);
5452  }
5453  break;
5454 
5455  case 170:
5456 /* Line 1269 of yacc.c. */
5457 #line 2838 "querytransformparser.ypp"
5458  {(yyval.enums.slot) = parseInfo->staticContext->currentRangeSlot();}
5459  break;
5460 
5461  case 171:
5462 /* Line 1269 of yacc.c. */
5463 #line 2840 "querytransformparser.ypp"
5464  {
5466  (yyval.expr) = create(new QuantifiedExpression((yyvsp[(8) - (9)].enums.slot),
5467  QuantifiedExpression::Every, (yyvsp[(6) - (9)].expr), (yyvsp[(9) - (9)].expr)), (yyloc), parseInfo);
5468  parseInfo->finalizePushedVariable();
5469  }
5470  break;
5471 
5472  case 172:
5473 /* Line 1269 of yacc.c. */
5474 #line 2848 "querytransformparser.ypp"
5475  {
5476  (yyval.expr) = pushVariable((yyvsp[(3) - (6)].qName), quantificationType((yyvsp[(4) - (6)].sequenceType)), (yyvsp[(6) - (6)].expr),
5477  VariableDeclaration::RangeVariable, (yyloc), parseInfo);
5478  }
5479  break;
5480 
5481  case 173:
5482 /* Line 1269 of yacc.c. */
5483 #line 2852 "querytransformparser.ypp"
5484  {(yyval.enums.slot) = parseInfo->staticContext->currentRangeSlot();}
5485  break;
5486 
5487  case 174:
5488 /* Line 1269 of yacc.c. */
5489 #line 2854 "querytransformparser.ypp"
5490  {
5491  (yyval.expr) = create(new QuantifiedExpression((yyvsp[(8) - (9)].enums.slot),
5492  QuantifiedExpression::Every, (yyvsp[(7) - (9)].expr), (yyvsp[(9) - (9)].expr)), (yyloc), parseInfo);
5493  parseInfo->finalizePushedVariable();
5494  }
5495  break;
5496 
5497  case 176:
5498 /* Line 1269 of yacc.c. */
5499 #line 2863 "querytransformparser.ypp"
5500  {
5501  (yyval.expr) = (yyvsp[(2) - (2)].expr);
5502  }
5503  break;
5504 
5505  case 177:
5506 /* Line 1269 of yacc.c. */
5507 #line 2890 "querytransformparser.ypp"
5508  {
5509  parseInfo->typeswitchSource.push((yyvsp[(3) - (4)].expr));
5510  }
5511  break;
5512 
5513  case 178:
5514 /* Line 1269 of yacc.c. */
5515 #line 2894 "querytransformparser.ypp"
5516  {
5517  allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
5518  parseInfo->typeswitchSource.pop();
5519  (yyval.expr) = (yyvsp[(6) - (6)].expr);
5520  }
5521  break;
5522 
5523  case 179:
5524 /* Line 1269 of yacc.c. */
5525 #line 2901 "querytransformparser.ypp"
5526  {
5527  if(!(yyvsp[(2) - (3)].qName).isNull())
5528  {
5529  pushVariable((yyvsp[(2) - (3)].qName), (yyvsp[(3) - (3)].sequenceType), parseInfo->typeswitchSource.top(),
5530  VariableDeclaration::ExpressionVariable, (yyloc), parseInfo, false);
5531  }
5532  }
5533  break;
5534 
5535  case 180:
5536 /* Line 1269 of yacc.c. */
5537 #line 2909 "querytransformparser.ypp"
5538  {
5539  /* The variable shouldn't be in-scope for other case branches. */
5540  if(!(yyvsp[(2) - (6)].qName).isNull())
5541  parseInfo->finalizePushedVariable();
5542  }
5543  break;
5544 
5545  case 181:
5546 /* Line 1269 of yacc.c. */
5547 #line 2915 "querytransformparser.ypp"
5548  {
5549  const Expression::Ptr instanceOf(create(new InstanceOf(parseInfo->typeswitchSource.top(), (yyvsp[(3) - (8)].sequenceType)), (yyloc), parseInfo));
5550  (yyval.expr) = create(new IfThenClause(instanceOf, (yyvsp[(6) - (8)].expr), (yyvsp[(8) - (8)].expr)), (yyloc), parseInfo);
5551  }
5552  break;
5553 
5554  case 184:
5555 /* Line 1269 of yacc.c. */
5556 #line 2924 "querytransformparser.ypp"
5557  {
5558  (yyval.qName) = QXmlName();
5559  }
5560  break;
5561 
5562  case 185:
5563 /* Line 1269 of yacc.c. */
5564 #line 2929 "querytransformparser.ypp"
5565  {
5566  (yyval.qName) = (yyvsp[(2) - (3)].qName);
5567  }
5568  break;
5569 
5570  case 186:
5571 /* Line 1269 of yacc.c. */
5572 #line 2934 "querytransformparser.ypp"
5573  {
5574  (yyval.expr) = (yyvsp[(3) - (3)].expr);
5575  }
5576  break;
5577 
5578  case 187:
5579 /* Line 1269 of yacc.c. */
5580 #line 2938 "querytransformparser.ypp"
5581  {
5582  if(!(yyvsp[(3) - (3)].qName).isNull())
5583  {
5584  pushVariable((yyvsp[(3) - (3)].qName), parseInfo->typeswitchSource.top()->staticType(),
5585  parseInfo->typeswitchSource.top(),
5586  VariableDeclaration::ExpressionVariable, (yyloc), parseInfo, false);
5587  }
5588  }
5589  break;
5590 
5591  case 188:
5592 /* Line 1269 of yacc.c. */
5593 #line 2947 "querytransformparser.ypp"
5594  {
5595  if(!(yyvsp[(3) - (6)].qName).isNull())
5596  parseInfo->finalizePushedVariable();
5597  (yyval.expr) = (yyvsp[(6) - (6)].expr);
5598  }
5599  break;
5600 
5601  case 189:
5602 /* Line 1269 of yacc.c. */
5603 #line 2954 "querytransformparser.ypp"
5604  {
5606  (yyval.expr) = create(new IfThenClause((yyvsp[(3) - (8)].expr), (yyvsp[(6) - (8)].expr), (yyvsp[(8) - (8)].expr)), (yyloc), parseInfo);
5607  }
5608  break;
5609 
5610  case 191:
5611 /* Line 1269 of yacc.c. */
5612 #line 2961 "querytransformparser.ypp"
5613  {
5615  (yyval.expr) = create(new OrExpression((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo);
5616  }
5617  break;
5618 
5619  case 193:
5620 /* Line 1269 of yacc.c. */
5621 #line 2968 "querytransformparser.ypp"
5622  {
5624  (yyval.expr) = create(new AndExpression((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo);
5625  }
5626  break;
5627 
5628  case 199:
5629 /* Line 1269 of yacc.c. */
5630 #line 2980 "querytransformparser.ypp"
5631  {
5633  (yyval.expr) = create(new RangeExpression((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo);
5634  }
5635  break;
5636 
5637  case 201:
5638 /* Line 1269 of yacc.c. */
5639 #line 2987 "querytransformparser.ypp"
5640  {
5642  (yyval.expr) = create(new ArithmeticExpression((yyvsp[(1) - (3)].expr), (yyvsp[(2) - (3)].enums.mathOperator), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo);
5643  }
5644  break;
5645 
5646  case 202:
5647 /* Line 1269 of yacc.c. */
5648 #line 2992 "querytransformparser.ypp"
5649  {(yyval.enums.mathOperator) = AtomicMathematician::Add;}
5650  break;
5651 
5652  case 203:
5653 /* Line 1269 of yacc.c. */
5654 #line 2993 "querytransformparser.ypp"
5655  {(yyval.enums.mathOperator) = AtomicMathematician::Substract;}
5656  break;
5657 
5658  case 205:
5659 /* Line 1269 of yacc.c. */
5660 #line 2997 "querytransformparser.ypp"
5661  {
5663  (yyval.expr) = create(new ArithmeticExpression((yyvsp[(1) - (3)].expr), (yyvsp[(2) - (3)].enums.mathOperator), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo);
5664  }
5665  break;
5666 
5667  case 206:
5668 /* Line 1269 of yacc.c. */
5669 #line 3002 "querytransformparser.ypp"
5670  {(yyval.enums.mathOperator) = AtomicMathematician::Multiply;}
5671  break;
5672 
5673  case 207:
5674 /* Line 1269 of yacc.c. */
5675 #line 3003 "querytransformparser.ypp"
5676  {(yyval.enums.mathOperator) = AtomicMathematician::Div;}
5677  break;
5678 
5679  case 208:
5680 /* Line 1269 of yacc.c. */
5681 #line 3004 "querytransformparser.ypp"
5682  {(yyval.enums.mathOperator) = AtomicMathematician::IDiv;}
5683  break;
5684 
5685  case 209:
5686 /* Line 1269 of yacc.c. */
5687 #line 3005 "querytransformparser.ypp"
5688  {(yyval.enums.mathOperator) = AtomicMathematician::Mod;}
5689  break;
5690 
5691  case 211:
5692 /* Line 1269 of yacc.c. */
5693 #line 3009 "querytransformparser.ypp"
5694  {
5699  parseInfo, (yyloc));
5700  (yyval.expr) = create(new CombineNodes((yyvsp[(1) - (3)].expr), CombineNodes::Union, (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo);
5701  }
5702  break;
5703 
5704  case 213:
5705 /* Line 1269 of yacc.c. */
5706 #line 3020 "querytransformparser.ypp"
5707  {
5709  (yyval.expr) = create(new CombineNodes((yyvsp[(1) - (3)].expr), (yyvsp[(2) - (3)].enums.combinedNodeOp), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo);
5710  }
5711  break;
5712 
5713  case 216:
5714 /* Line 1269 of yacc.c. */
5715 #line 3029 "querytransformparser.ypp"
5716  {
5717  (yyval.enums.combinedNodeOp) = CombineNodes::Intersect;
5718  }
5719  break;
5720 
5721  case 217:
5722 /* Line 1269 of yacc.c. */
5723 #line 3033 "querytransformparser.ypp"
5724  {
5725  (yyval.enums.combinedNodeOp) = CombineNodes::Except;
5726  }
5727  break;
5728 
5729  case 219:
5730 /* Line 1269 of yacc.c. */
5731 #line 3039 "querytransformparser.ypp"
5732  {
5734  (yyval.expr) = create(new InstanceOf((yyvsp[(1) - (4)].expr),
5735  SequenceType::Ptr((yyvsp[(4) - (4)].sequenceType))), (yyloc), parseInfo);
5736  }
5737  break;
5738 
5739  case 221:
5740 /* Line 1269 of yacc.c. */
5741 #line 3047 "querytransformparser.ypp"
5742  {
5744  (yyval.expr) = create(new TreatAs((yyvsp[(1) - (4)].expr), (yyvsp[(4) - (4)].sequenceType)), (yyloc), parseInfo);
5745  }
5746  break;
5747 
5748  case 223:
5749 /* Line 1269 of yacc.c. */
5750 #line 3054 "querytransformparser.ypp"
5751  {
5753  (yyval.expr) = create(new CastableAs((yyvsp[(1) - (4)].expr), (yyvsp[(4) - (4)].sequenceType)), (yyloc), parseInfo);
5754  }
5755  break;
5756 
5757  case 225:
5758 /* Line 1269 of yacc.c. */
5759 #line 3061 "querytransformparser.ypp"
5760  {
5762  (yyval.expr) = create(new CastAs((yyvsp[(1) - (4)].expr), (yyvsp[(4) - (4)].sequenceType)), (yyloc), parseInfo);
5763  }
5764  break;
5765 
5766  case 227:
5767 /* Line 1269 of yacc.c. */
5768 #line 3068 "querytransformparser.ypp"
5769  {
5771  (yyval.expr) = create(new UnaryExpression((yyvsp[(1) - (2)].enums.mathOperator), (yyvsp[(2) - (2)].expr), parseInfo->staticContext), (yyloc), parseInfo);
5772  }
5773  break;
5774 
5775  case 228:
5776 /* Line 1269 of yacc.c. */
5777 #line 3074 "querytransformparser.ypp"
5778  {
5779  (yyval.enums.mathOperator) = AtomicMathematician::Add;
5780  }
5781  break;
5782 
5783  case 229:
5784 /* Line 1269 of yacc.c. */
5785 #line 3078 "querytransformparser.ypp"
5786  {
5787  (yyval.enums.mathOperator) = AtomicMathematician::Substract;
5788  }
5789  break;
5790 
5791  case 233:
5792 /* Line 1269 of yacc.c. */
5793 #line 3087 "querytransformparser.ypp"
5794  {
5796  (yyval.expr) = create(new GeneralComparison((yyvsp[(1) - (3)].expr), (yyvsp[(2) - (3)].enums.valueOperator), (yyvsp[(3) - (3)].expr), parseInfo->isBackwardsCompat.top()), (yyloc), parseInfo);
5797  }
5798  break;
5799 
5800  case 234:
5801 /* Line 1269 of yacc.c. */
5802 #line 3092 "querytransformparser.ypp"
5803  {(yyval.enums.valueOperator) = AtomicComparator::OperatorEqual;}
5804  break;
5805 
5806  case 235:
5807 /* Line 1269 of yacc.c. */
5808 #line 3093 "querytransformparser.ypp"
5809  {(yyval.enums.valueOperator) = AtomicComparator::OperatorNotEqual;}
5810  break;
5811 
5812  case 236:
5813 /* Line 1269 of yacc.c. */
5814 #line 3094 "querytransformparser.ypp"
5815  {(yyval.enums.valueOperator) = AtomicComparator::OperatorGreaterOrEqual;}
5816  break;
5817 
5818  case 237:
5819 /* Line 1269 of yacc.c. */
5820 #line 3095 "querytransformparser.ypp"
5821  {(yyval.enums.valueOperator) = AtomicComparator::OperatorGreaterThan;}
5822  break;
5823 
5824  case 238:
5825 /* Line 1269 of yacc.c. */
5826 #line 3096 "querytransformparser.ypp"
5827  {(yyval.enums.valueOperator) = AtomicComparator::OperatorLessOrEqual;}
5828  break;
5829 
5830  case 239:
5831 /* Line 1269 of yacc.c. */
5832 #line 3097 "querytransformparser.ypp"
5833  {(yyval.enums.valueOperator) = AtomicComparator::OperatorLessThan;}
5834  break;
5835 
5836  case 240:
5837 /* Line 1269 of yacc.c. */
5838 #line 3100 "querytransformparser.ypp"
5839  {
5840  (yyval.expr) = create(new ValueComparison((yyvsp[(1) - (3)].expr), (yyvsp[(2) - (3)].enums.valueOperator), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo);
5841  }
5842  break;
5843 
5844  case 241:
5845 /* Line 1269 of yacc.c. */
5846 #line 3104 "querytransformparser.ypp"
5847  {(yyval.enums.valueOperator) = AtomicComparator::OperatorEqual;}
5848  break;
5849 
5850  case 242:
5851 /* Line 1269 of yacc.c. */
5852 #line 3105 "querytransformparser.ypp"
5853  {(yyval.enums.valueOperator) = AtomicComparator::OperatorNotEqual;}
5854  break;
5855 
5856  case 243:
5857 /* Line 1269 of yacc.c. */
5858 #line 3106 "querytransformparser.ypp"
5859  {(yyval.enums.valueOperator) = AtomicComparator::OperatorGreaterOrEqual;}
5860  break;
5861 
5862  case 244:
5863 /* Line 1269 of yacc.c. */
5864 #line 3107 "querytransformparser.ypp"
5865  {(yyval.enums.valueOperator) = AtomicComparator::OperatorGreaterThan;}
5866  break;
5867 
5868  case 245:
5869 /* Line 1269 of yacc.c. */
5870 #line 3108 "querytransformparser.ypp"
5871  {(yyval.enums.valueOperator) = AtomicComparator::OperatorLessOrEqual;}
5872  break;
5873 
5874  case 246:
5875 /* Line 1269 of yacc.c. */
5876 #line 3109 "querytransformparser.ypp"
5877  {(yyval.enums.valueOperator) = AtomicComparator::OperatorLessThan;}
5878  break;
5879 
5880  case 247:
5881 /* Line 1269 of yacc.c. */
5882 #line 3112 "querytransformparser.ypp"
5883  {
5884  (yyval.expr) = create(new NodeComparison((yyvsp[(1) - (3)].expr), (yyvsp[(2) - (3)].enums.nodeOperator), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo);
5885  }
5886  break;
5887 
5888  case 248:
5889 /* Line 1269 of yacc.c. */
5890 #line 3116 "querytransformparser.ypp"
5891  {(yyval.enums.nodeOperator) = QXmlNodeModelIndex::Is;}
5892  break;
5893 
5894  case 249:
5895 /* Line 1269 of yacc.c. */
5896 #line 3117 "querytransformparser.ypp"
5897  {(yyval.enums.nodeOperator) = QXmlNodeModelIndex::Precedes;}
5898  break;
5899 
5900  case 250:
5901 /* Line 1269 of yacc.c. */
5902 #line 3118 "querytransformparser.ypp"
5903  {(yyval.enums.nodeOperator) = QXmlNodeModelIndex::Follows;}
5904  break;
5905 
5906  case 251:
5907 /* Line 1269 of yacc.c. */
5908 #line 3121 "querytransformparser.ypp"
5909  {
5910  allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
5911  parseInfo->staticContext->error(QtXmlPatterns::tr("The Schema Validation Feature is not supported. "
5912  "Hence, %1-expressions may not be used.")
5913  .arg(formatKeyword("validate")),
5914  ReportContext::XQST0075, fromYYLTYPE((yyloc), parseInfo));
5915  /*
5916  $$ = Validate::create($2, $1, parseInfo->staticContext);
5917  */
5918  }
5919  break;
5920 
5921  case 252:
5922 /* Line 1269 of yacc.c. */
5923 #line 3134 "querytransformparser.ypp"
5924  {(yyval.enums.validationMode) = Validate::Strict;}
5925  break;
5926 
5927  case 253:
5928 /* Line 1269 of yacc.c. */
5929 #line 3135 "querytransformparser.ypp"
5930  {(yyval.enums.validationMode) = Validate::Strict;}
5931  break;
5932 
5933  case 254:
5934 /* Line 1269 of yacc.c. */
5935 #line 3136 "querytransformparser.ypp"
5936  {(yyval.enums.validationMode) = Validate::Lax;}
5937  break;
5938 
5939  case 255:
5940 /* Line 1269 of yacc.c. */
5941 #line 3139 "querytransformparser.ypp"
5942  {
5943  allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
5944  /* We don't support any pragmas, so we only do the
5945  * necessary validation and use the fallback expression. */
5946 
5947  if((yyvsp[(2) - (2)].expr))
5948  (yyval.expr) = (yyvsp[(2) - (2)].expr);
5949  else
5950  {
5951  parseInfo->staticContext->error(QtXmlPatterns::tr("None of the pragma expressions are supported. "
5952  "Therefore, a fallback expression "
5953  "must be present"),
5954  ReportContext::XQST0079, fromYYLTYPE((yyloc), parseInfo));
5955  }
5956  }
5957  break;
5958 
5959  case 256:
5960 /* Line 1269 of yacc.c. */
5961 #line 3156 "querytransformparser.ypp"
5962  {
5963  (yyval.expr).reset();
5964  }
5965  break;
5966 
5967  case 257:
5968 /* Line 1269 of yacc.c. */
5969 #line 3160 "querytransformparser.ypp"
5970  {
5971  (yyval.expr) = (yyvsp[(2) - (3)].expr);
5972  }
5973  break;
5974 
5975  case 260:
5976 /* Line 1269 of yacc.c. */
5977 #line 3168 "querytransformparser.ypp"
5978  {
5979  allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
5980  }
5981  break;
5982 
5983  case 263:
5984 /* Line 1269 of yacc.c. */
5985 #line 3176 "querytransformparser.ypp"
5986  {
5987  /* This is "/step". That is, fn:root(self::node()) treat as document-node()/RelativePathExpr. */
5988  (yyval.expr) = create(new Path(createRootExpression(parseInfo, (yyloc)), (yyvsp[(2) - (2)].expr)), (yyloc), parseInfo);
5989  }
5990  break;
5991 
5992  case 264:
5993 /* Line 1269 of yacc.c. */
5994 #line 3182 "querytransformparser.ypp"
5995  {
5996  (yyval.expr) = createSlashSlashPath(createRootExpression(parseInfo, (yyloc)), (yyvsp[(2) - (2)].expr), (yyloc), parseInfo);
5997  }
5998  break;
5999 
6000  case 265:
6001 /* Line 1269 of yacc.c. */
6002 #line 3186 "querytransformparser.ypp"
6003  {
6004  /* This is "/". That is, fn:root(self::node()) treat as document-node(). */
6005  (yyval.expr) = createRootExpression(parseInfo, (yyloc));
6006  }
6007  break;
6008 
6009  case 268:
6010 /* Line 1269 of yacc.c. */
6011 #line 3196 "querytransformparser.ypp"
6012  {
6013  (yyval.expr) = create(new Path((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].enums.pathKind)), (yyloc), parseInfo);
6014  }
6015  break;
6016 
6017  case 269:
6018 /* Line 1269 of yacc.c. */
6019 #line 3200 "querytransformparser.ypp"
6020  {
6021  const Expression::Ptr orderBy(createReturnOrderBy((yyvsp[(4) - (7)].orderSpecs), (yyvsp[(6) - (7)].expr), parseInfo->orderStability.pop(), (yyloc), parseInfo));
6022 
6023  ReturnOrderBy *const rob = orderBy->as<ReturnOrderBy>();
6024  const Expression::Ptr path(create(new Path((yyvsp[(1) - (7)].expr), orderBy, (yyvsp[(2) - (7)].enums.pathKind)), (yyloc), parseInfo));
6025 
6026  (yyval.expr) = create(new OrderBy(rob->stability(), rob->orderSpecs(), path, rob), (yyloc), parseInfo);
6027  }
6028  break;
6029 
6030  case 270:
6031 /* Line 1269 of yacc.c. */
6032 #line 3209 "querytransformparser.ypp"
6033  {
6034  (yyval.expr) = createSlashSlashPath((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyloc), parseInfo);
6035  }
6036  break;
6037 
6038  case 271:
6039 /* Line 1269 of yacc.c. */
6040 #line 3214 "querytransformparser.ypp"
6041  {
6042  (yyval.expr) = NodeSortExpression::wrapAround((yyvsp[(1) - (1)].expr), parseInfo->staticContext);
6043  }
6044  break;
6045 
6046  case 273:
6047 /* Line 1269 of yacc.c. */
6048 #line 3219 "querytransformparser.ypp"
6049  {
6050  (yyval.expr) = create(new CurrentItemStore((yyvsp[(2) - (2)].expr)), (yyloc), parseInfo);
6051  }
6052  break;
6053 
6054  case 274:
6055 /* Line 1269 of yacc.c. */
6056 #line 3223 "querytransformparser.ypp"
6057  {
6058  const xsDouble version = (yyvsp[(1) - (1)].sval).toDouble();
6059 
6060  parseInfo->isBackwardsCompat.push(version != 2);
6061 
6062  (yyval.enums.Double) = version;
6063  }
6064  break;
6065 
6066  case 275:
6067 /* Line 1269 of yacc.c. */
6068 #line 3231 "querytransformparser.ypp"
6069  {
6070  if((yyvsp[(2) - (3)].enums.Double) < 2)
6071  (yyval.expr) = createCompatStore((yyvsp[(3) - (3)].expr), (yyloc), parseInfo);
6072  else
6073  (yyval.expr) = (yyvsp[(3) - (3)].expr);
6074  }
6075  break;
6076 
6077  case 276:
6078 /* Line 1269 of yacc.c. */
6079 #line 3238 "querytransformparser.ypp"
6080  {
6081  allowedIn(QXmlQuery::XSLT20, parseInfo, (yyloc));
6082  Q_ASSERT(!(yyvsp[(2) - (5)].sval).isEmpty());
6083  (yyval.expr) = create(new StaticBaseURIStore((yyvsp[(2) - (5)].sval), (yyvsp[(4) - (5)].expr)), (yyloc), parseInfo);
6084 }
6085  break;
6086 
6087  case 277:
6088 /* Line 1269 of yacc.c. */
6089 #line 3245 "querytransformparser.ypp"
6090  {
6092  parseInfo->resolvers.push(parseInfo->staticContext->namespaceBindings());
6093  const NamespaceResolver::Ptr resolver(new DelegatingNamespaceResolver(parseInfo->staticContext->namespaceBindings()));
6094  resolver->addBinding(QXmlName(parseInfo->staticContext->namePool()->allocateNamespace((yyvsp[(5) - (6)].sval)),
6095  StandardLocalNames::empty,
6096  parseInfo->staticContext->namePool()->allocatePrefix((yyvsp[(3) - (6)].sval))));
6097  parseInfo->staticContext->setNamespaceBindings(resolver);
6098  }
6099  break;
6100 
6101  case 278:
6102 /* Line 1269 of yacc.c. */
6103 #line 3256 "querytransformparser.ypp"
6104  {
6105  parseInfo->staticContext->setNamespaceBindings(parseInfo->resolvers.pop());
6106  (yyval.expr) = (yyvsp[(8) - (9)].expr);
6107  }
6108  break;
6109 
6110  case 279:
6111 /* Line 1269 of yacc.c. */
6112 #line 3261 "querytransformparser.ypp"
6113  {
6114  (yyval.expr) = create(new CallTemplate((yyvsp[(2) - (5)].qName), parseInfo->templateWithParams), (yyloc), parseInfo);
6115  parseInfo->templateWithParametersHandled();
6116  parseInfo->templateCalls.append((yyval.expr));
6117  }
6118  break;
6119 
6120  case 280:
6121 /* Line 1269 of yacc.c. */
6122 #line 3268 "querytransformparser.ypp"
6123  {
6124  parseInfo->startParsingWithParam();
6125  }
6126  break;
6127 
6128  case 281:
6129 /* Line 1269 of yacc.c. */
6130 #line 3272 "querytransformparser.ypp"
6131  {
6132  parseInfo->endParsingWithParam();
6133  }
6134  break;
6135 
6136  case 282:
6137 /* Line 1269 of yacc.c. */
6138 #line 3277 "querytransformparser.ypp"
6139  {
6140  }
6141  break;
6142 
6143  case 283:
6144 /* Line 1269 of yacc.c. */
6145 #line 3280 "querytransformparser.ypp"
6146  {
6147  }
6148  break;
6149 
6150  case 284:
6151 /* Line 1269 of yacc.c. */
6152 #line 3283 "querytransformparser.ypp"
6153  {
6154  }
6155  break;
6156 
6157  case 285:
6158 /* Line 1269 of yacc.c. */
6159 #line 3287 "querytransformparser.ypp"
6160  {
6161  }
6162  break;
6163 
6164  case 286:
6165 /* Line 1269 of yacc.c. */
6166 #line 3290 "querytransformparser.ypp"
6167  {
6168  }
6169  break;
6170 
6171  case 287:
6172 /* Line 1269 of yacc.c. */
6173 #line 3294 "querytransformparser.ypp"
6174  {
6175  /* Note, this grammar rule is invoked for @c xsl:param @em and @c
6176  * xsl:with-param. */
6177  const bool isParsingWithParam = parseInfo->isParsingWithParam();
6178 
6194  SequenceType::Ptr type;
6195 
6196  if(!(yyvsp[(4) - (5)].sequenceType)->is(CommonSequenceTypes::ZeroOrMoreItems))
6197  type = (yyvsp[(4) - (5)].sequenceType);
6198 
6199  Expression::Ptr expr;
6200 
6201  /* The default value is an empty sequence. */
6202  if(!(yyvsp[(5) - (5)].expr) && ((type && (yyvsp[(4) - (5)].sequenceType)->cardinality().allowsEmpty())
6203  || isParsingWithParam))
6204  expr = create(new EmptySequence, (yyloc), parseInfo);
6205  else
6206  expr = (yyvsp[(5) - (5)].expr);
6207 
6208  /* We ensure we have some type, so CallTemplate, Template and friends
6209  * are happy. */
6210  if(!isParsingWithParam && !type)
6211  type = CommonSequenceTypes::ZeroOrMoreItems;
6212 
6213  if((yyvsp[(1) - (5)].enums.Bool))
6214  /* TODO, handle tunnel parameters. */;
6215  else
6216  {
6217  if((!isParsingWithParam && VariableDeclaration::contains(parseInfo->templateParameters, (yyvsp[(3) - (5)].qName))) ||
6218  (isParsingWithParam && parseInfo->templateWithParams.contains((yyvsp[(3) - (5)].qName))))
6219  {
6220  parseInfo->staticContext->error(QtXmlPatterns::tr("Each name of a template parameter must be unique; %1 is duplicated.")
6221  .arg(formatKeyword(parseInfo->staticContext->namePool(), (yyvsp[(3) - (5)].qName))),
6222  isParsingWithParam ? ReportContext::XTSE0670 : ReportContext::XTSE0580, fromYYLTYPE((yyloc), parseInfo));
6223  }
6224  else
6225  {
6226  if(isParsingWithParam)
6227  parseInfo->templateWithParams[(yyvsp[(3) - (5)].qName)] = WithParam::Ptr(new WithParam((yyvsp[(3) - (5)].qName), (yyvsp[(4) - (5)].sequenceType), expr));
6228  else
6229  {
6230  Q_ASSERT(type);
6231  pushVariable((yyvsp[(3) - (5)].qName), type, expr, VariableDeclaration::TemplateParameter, (yyloc), parseInfo);
6232  parseInfo->templateParameters.append(parseInfo->variables.top());
6233  }
6234  }
6235  }
6236  }
6237  break;
6238 
6239  case 288:
6240 /* Line 1269 of yacc.c. */
6241 #line 3359 "querytransformparser.ypp"
6242  {
6243  (yyval.enums.Bool) = false;
6244  }
6245  break;
6246 
6247  case 289:
6248 /* Line 1269 of yacc.c. */
6249 #line 3363 "querytransformparser.ypp"
6250  {
6251  (yyval.enums.Bool) = true;
6252  }
6253  break;
6254 
6255  case 290:
6256 /* Line 1269 of yacc.c. */
6257 #line 3368 "querytransformparser.ypp"
6258  {
6259  (yyval.expr) = Expression::Ptr();
6260  }
6261  break;
6262 
6263  case 291:
6264 /* Line 1269 of yacc.c. */
6265 #line 3372 "querytransformparser.ypp"
6266  {
6267  (yyval.expr) = (yyvsp[(2) - (2)].expr);
6268  }
6269  break;
6270 
6271  case 292:
6272 /* Line 1269 of yacc.c. */
6273 #line 3381 "querytransformparser.ypp"
6274  {
6275  (yyval.enums.pathKind) = Path::RegularPath;
6276  }
6277  break;
6278 
6279  case 293:
6280 /* Line 1269 of yacc.c. */
6281 #line 3385 "querytransformparser.ypp"
6282  {
6283  (yyval.enums.pathKind) = Path::XSLTForEach;
6284  }
6285  break;
6286 
6287  case 294:
6288 /* Line 1269 of yacc.c. */
6289 #line 3389 "querytransformparser.ypp"
6290  {
6291  (yyval.enums.pathKind) = Path::ForApplyTemplate;
6292  }
6293  break;
6294 
6295  case 296:
6296 /* Line 1269 of yacc.c. */
6297 #line 3395 "querytransformparser.ypp"
6298  {
6299  (yyval.expr) = create(GenericPredicate::create((yyvsp[(1) - (4)].expr), (yyvsp[(3) - (4)].expr), parseInfo->staticContext, fromYYLTYPE((yyloc), parseInfo)), (yyloc), parseInfo);
6300  }
6301  break;
6302 
6303  case 299:
6304 /* Line 1269 of yacc.c. */
6305 #line 3403 "querytransformparser.ypp"
6306  {
6307  if((yyvsp[(1) - (1)].enums.axis) == QXmlNodeModelIndex::AxisAttribute)
6308  parseInfo->nodeTestSource = BuiltinTypes::attribute;
6309  }
6310  break;
6311 
6312  case 300:
6313 /* Line 1269 of yacc.c. */
6314 #line 3408 "querytransformparser.ypp"
6315  {
6316  if((yyvsp[(3) - (3)].itemType))
6317  {
6318  /* A node test was explicitly specified. The un-abbreviated syntax was used. */
6319  (yyval.expr) = create(new AxisStep((yyvsp[(1) - (3)].enums.axis), (yyvsp[(3) - (3)].itemType)), (yyloc), parseInfo);
6320  }
6321  else
6322  {
6323  /* Quote from 3.2.1.1 Axes
6324  *
6325  * [Definition: Every axis has a principal node kind. If an axis
6326  * can contain elements, then the principal node kind is element;
6327  * otherwise, it is the kind of nodes that the axis can contain.] Thus:
6328  * - For the attribute axis, the principal node kind is attribute.
6329  * - For all other axes, the principal node kind is element. */
6330 
6331  if((yyvsp[(1) - (3)].enums.axis) == QXmlNodeModelIndex::AxisAttribute)
6332  (yyval.expr) = create(new AxisStep(QXmlNodeModelIndex::AxisAttribute, BuiltinTypes::attribute), (yyloc), parseInfo);
6333  else
6334  (yyval.expr) = create(new AxisStep((yyvsp[(1) - (3)].enums.axis), BuiltinTypes::element), (yyloc), parseInfo);
6335  }
6336 
6337  parseInfo->restoreNodeTestSource();
6338  }
6339  break;
6340 
6341  case 304:
6342 /* Line 1269 of yacc.c. */
6343 #line 3438 "querytransformparser.ypp"
6344  {
6345  if((yyvsp[(1) - (2)].enums.axis) == QXmlNodeModelIndex::AxisNamespace)
6346  {
6347  /* We don't raise XPST0010 here because the namespace axis isn't an optional
6348  * axis. It simply is not part of the XQuery grammar. */
6349  parseInfo->staticContext->error(QtXmlPatterns::tr("The %1-axis is unsupported in XQuery")
6350  .arg(formatKeyword("namespace")),
6351  ReportContext::XPST0003, fromYYLTYPE((yyloc), parseInfo));
6352  }
6353  else
6354  (yyval.enums.axis) = (yyvsp[(1) - (2)].enums.axis);
6355 
6356  switch((yyvsp[(1) - (2)].enums.axis))
6357  {
6359  {
6363  | QXmlQuery::XSLT20),
6364  parseInfo, (yyloc));
6365  break;
6366  }
6368  {
6373  | QXmlQuery::XSLT20),
6374  parseInfo, (yyloc));
6375  break;
6376  }
6377  default:
6378  {
6381  | QXmlQuery::XSLT20),
6382  parseInfo, (yyloc));
6383  }
6384  }
6385  }
6386  break;
6387 
6388  case 305:
6389 /* Line 1269 of yacc.c. */
6390 #line 3481 "querytransformparser.ypp"
6391  {(yyval.enums.axis) = QXmlNodeModelIndex::AxisAncestorOrSelf ;}
6392  break;
6393 
6394  case 306:
6395 /* Line 1269 of yacc.c. */
6396 #line 3482 "querytransformparser.ypp"
6397  {(yyval.enums.axis) = QXmlNodeModelIndex::AxisAncestor ;}
6398  break;
6399 
6400  case 307:
6401 /* Line 1269 of yacc.c. */
6402 #line 3483 "querytransformparser.ypp"
6403  {(yyval.enums.axis) = QXmlNodeModelIndex::AxisAttribute ;}
6404  break;
6405 
6406  case 308:
6407 /* Line 1269 of yacc.c. */
6408 #line 3484 "querytransformparser.ypp"
6409  {(yyval.enums.axis) = QXmlNodeModelIndex::AxisChild ;}
6410  break;
6411 
6412  case 309:
6413 /* Line 1269 of yacc.c. */
6414 #line 3485 "querytransformparser.ypp"
6415  {(yyval.enums.axis) = QXmlNodeModelIndex::AxisDescendantOrSelf;}
6416  break;
6417 
6418  case 310:
6419 /* Line 1269 of yacc.c. */
6420 #line 3486 "querytransformparser.ypp"
6421  {(yyval.enums.axis) = QXmlNodeModelIndex::AxisDescendant ;}
6422  break;
6423 
6424  case 311:
6425 /* Line 1269 of yacc.c. */
6426 #line 3487 "querytransformparser.ypp"
6427  {(yyval.enums.axis) = QXmlNodeModelIndex::AxisFollowing ;}
6428  break;
6429 
6430  case 312:
6431 /* Line 1269 of yacc.c. */
6432 #line 3488 "querytransformparser.ypp"
6433  {(yyval.enums.axis) = QXmlNodeModelIndex::AxisPreceding ;}
6434  break;
6435 
6436  case 313:
6437 /* Line 1269 of yacc.c. */
6438 #line 3489 "querytransformparser.ypp"
6439  {(yyval.enums.axis) = QXmlNodeModelIndex::AxisFollowingSibling;}
6440  break;
6441 
6442  case 314:
6443 /* Line 1269 of yacc.c. */
6444 #line 3490 "querytransformparser.ypp"
6445  {(yyval.enums.axis) = QXmlNodeModelIndex::AxisPrecedingSibling;}
6446  break;
6447 
6448  case 315:
6449 /* Line 1269 of yacc.c. */
6450 #line 3491 "querytransformparser.ypp"
6451  {(yyval.enums.axis) = QXmlNodeModelIndex::AxisParent ;}
6452  break;
6453 
6454  case 316:
6455 /* Line 1269 of yacc.c. */
6456 #line 3492 "querytransformparser.ypp"
6457  {(yyval.enums.axis) = QXmlNodeModelIndex::AxisSelf ;}
6458  break;
6459 
6460  case 317:
6461 /* Line 1269 of yacc.c. */
6462 #line 3495 "querytransformparser.ypp"
6463  {
6464  parseInfo->nodeTestSource = BuiltinTypes::attribute;
6465  }
6466  break;
6467 
6468  case 318:
6469 /* Line 1269 of yacc.c. */
6470 #line 3499 "querytransformparser.ypp"
6471  {
6473  (yyval.expr) = create(new AxisStep(QXmlNodeModelIndex::AxisAttribute, (yyvsp[(3) - (3)].itemType)), (yyloc), parseInfo);
6474 
6475  parseInfo->restoreNodeTestSource();
6476  }
6477  break;
6478 
6479  case 319:
6480 /* Line 1269 of yacc.c. */
6481 #line 3506 "querytransformparser.ypp"
6482  {
6483  ItemType::Ptr nodeTest;
6484 
6485  if(parseInfo->isParsingPattern && *(yyvsp[(1) - (1)].itemType) == *BuiltinTypes::node)
6486  nodeTest = BuiltinTypes::xsltNodeTest;
6487  else
6488  nodeTest = (yyvsp[(1) - (1)].itemType);
6489 
6490  (yyval.expr) = create(new AxisStep(QXmlNodeModelIndex::AxisChild, nodeTest), (yyloc), parseInfo);
6491  }
6492  break;
6493 
6494  case 320:
6495 /* Line 1269 of yacc.c. */
6496 #line 3517 "querytransformparser.ypp"
6497  {
6498  (yyval.expr) = create(new AxisStep(QXmlNodeModelIndex::AxisAttribute, (yyvsp[(1) - (1)].itemType)), (yyloc), parseInfo);
6499  }
6500  break;
6501 
6502  case 322:
6503 /* Line 1269 of yacc.c. */
6504 #line 3524 "querytransformparser.ypp"
6505  {
6506  (yyval.expr) = create(new AxisStep(QXmlNodeModelIndex::AxisParent, BuiltinTypes::node), (yyloc), parseInfo);
6507  }
6508  break;
6509 
6510  case 324:
6511 /* Line 1269 of yacc.c. */
6512 #line 3530 "querytransformparser.ypp"
6513  {
6515  }
6516  break;
6517 
6518  case 325:
6519 /* Line 1269 of yacc.c. */
6520 #line 3535 "querytransformparser.ypp"
6521  {
6522  (yyval.itemType) = QNameTest::create(parseInfo->nodeTestSource, (yyvsp[(1) - (1)].qName));
6523  }
6524  break;
6525 
6526  case 327:
6527 /* Line 1269 of yacc.c. */
6528 #line 3541 "querytransformparser.ypp"
6529  {
6530  (yyval.itemType) = parseInfo->nodeTestSource;
6531  }
6532  break;
6533 
6534  case 328:
6535 /* Line 1269 of yacc.c. */
6536 #line 3545 "querytransformparser.ypp"
6537  {
6538  const NamePool::Ptr np(parseInfo->staticContext->namePool());
6539  const ReflectYYLTYPE ryy((yyloc), parseInfo);
6540 
6541  const QXmlName::NamespaceCode ns(QNameConstructor::namespaceForPrefix(np->allocatePrefix((yyvsp[(1) - (1)].sval)), parseInfo->staticContext, &ryy));
6542 
6543  (yyval.itemType) = NamespaceNameTest::create(parseInfo->nodeTestSource, ns);
6544  }
6545  break;
6546 
6547  case 329:
6548 /* Line 1269 of yacc.c. */
6549 #line 3554 "querytransformparser.ypp"
6550  {
6552  const QXmlName::LocalNameCode c = parseInfo->staticContext->namePool()->allocateLocalName((yyvsp[(1) - (1)].sval));
6553  (yyval.itemType) = LocalNameTest::create(parseInfo->nodeTestSource, c);
6554  }
6555  break;
6556 
6557  case 331:
6558 /* Line 1269 of yacc.c. */
6559 #line 3562 "querytransformparser.ypp"
6560  {
6562  (yyval.expr) = create(GenericPredicate::create((yyvsp[(1) - (4)].expr), (yyvsp[(3) - (4)].expr), parseInfo->staticContext, fromYYLTYPE((yylsp[(4) - (4)]), parseInfo)), (yyloc), parseInfo);
6563  }
6564  break;
6565 
6566  case 339:
6567 /* Line 1269 of yacc.c. */
6568 #line 3575 "querytransformparser.ypp"
6569  {
6570  (yyval.expr) = create(new ApplyTemplate(parseInfo->modeFor((yyvsp[(2) - (5)].qName)),
6571  parseInfo->templateWithParams,
6572  parseInfo->modeFor(QXmlName(StandardNamespaces::InternalXSLT,
6574  (yylsp[(1) - (5)]), parseInfo);
6575  parseInfo->templateWithParametersHandled();
6576  }
6577  break;
6578 
6579  case 341:
6580 /* Line 1269 of yacc.c. */
6581 #line 3586 "querytransformparser.ypp"
6582  {
6583  (yyval.expr) = create(new Literal(AtomicString::fromValue((yyvsp[(1) - (1)].sval))), (yyloc), parseInfo);
6584  }
6585  break;
6586 
6587  case 342:
6588 /* Line 1269 of yacc.c. */
6589 #line 3591 "querytransformparser.ypp"
6590  {
6592  (yyval.expr) = createNumericLiteral<Double>((yyvsp[(1) - (1)].sval), (yyloc), parseInfo);
6593  }
6594  break;
6595 
6596  case 343:
6597 /* Line 1269 of yacc.c. */
6598 #line 3596 "querytransformparser.ypp"
6599  {
6601  (yyval.expr) = createNumericLiteral<Numeric>((yyvsp[(1) - (1)].sval), (yyloc), parseInfo);
6602  }
6603  break;
6604 
6605  case 344:
6606 /* Line 1269 of yacc.c. */
6607 #line 3602 "querytransformparser.ypp"
6608  {
6610  (yyval.expr) = resolveVariable((yyvsp[(2) - (2)].qName), (yyloc), parseInfo, false);
6611  }
6612  break;
6613 
6614  case 345:
6615 /* Line 1269 of yacc.c. */
6616 #line 3608 "querytransformparser.ypp"
6617  {
6618  /* See: http://www.w3.org/TR/xpath20/#id-variables */
6619  (yyval.qName) = parseInfo->staticContext->namePool()->allocateQName(QString(), (yyvsp[(1) - (1)].sval));
6620  }
6621  break;
6622 
6623  case 346:
6624 /* Line 1269 of yacc.c. */
6625 #line 3613 "querytransformparser.ypp"
6626  {
6627  (yyval.qName) = (yyvsp[(1) - (1)].qName);
6628  }
6629  break;
6630 
6631  case 347:
6632 /* Line 1269 of yacc.c. */
6633 #line 3618 "querytransformparser.ypp"
6634  {
6636  (yyval.expr) = (yyvsp[(2) - (3)].expr);
6637  }
6638  break;
6639 
6640  case 348:
6641 /* Line 1269 of yacc.c. */
6642 #line 3623 "querytransformparser.ypp"
6643  {
6645  (yyval.expr) = create(new EmptySequence, (yyloc), parseInfo);
6646  }
6647  break;
6648 
6649  case 349:
6650 /* Line 1269 of yacc.c. */
6651 #line 3629 "querytransformparser.ypp"
6652  {
6653  (yyval.expr) = create(new ContextItem(), (yyloc), parseInfo);
6654  }
6655  break;
6656 
6657  case 350:
6658 /* Line 1269 of yacc.c. */
6659 #line 3634 "querytransformparser.ypp"
6660  {
6661  (yyval.expr) = (yyvsp[(2) - (2)].expr);
6662  }
6663  break;
6664 
6665  case 351:
6666 /* Line 1269 of yacc.c. */
6667 #line 3639 "querytransformparser.ypp"
6668  {
6670  if(XPathHelper::isReservedNamespace((yyvsp[(1) - (4)].qName).namespaceURI()) || (yyvsp[(1) - (4)].qName).namespaceURI() == StandardNamespaces::InternalXSLT)
6671  { /* We got a call to a builtin function. */
6672  const ReflectYYLTYPE ryy((yyloc), parseInfo);
6673 
6674  const Expression::Ptr
6675  func(parseInfo->staticContext->
6676  functionSignatures()->createFunctionCall((yyvsp[(1) - (4)].qName), (yyvsp[(3) - (4)].expressionList), parseInfo->staticContext, &ryy));
6677 
6678  if(func)
6679  (yyval.expr) = create(func, (yyloc), parseInfo);
6680  else
6681  {
6682  parseInfo->staticContext->error(QtXmlPatterns::tr("No function with name %1 is available.")
6683  .arg(formatKeyword(parseInfo->staticContext->namePool(), (yyvsp[(1) - (4)].qName))),
6684  ReportContext::XPST0017, fromYYLTYPE((yyloc), parseInfo));
6685  }
6686  }
6687  else /* It's a call to a function created with 'declare function'.*/
6688  {
6689  (yyval.expr) = create(new UserFunctionCallsite((yyvsp[(1) - (4)].qName), (yyvsp[(3) - (4)].expressionList).count()), (yyloc), parseInfo);
6690 
6691  (yyval.expr)->setOperands((yyvsp[(3) - (4)].expressionList));
6692  parseInfo->userFunctionCallsites.append((yyval.expr));
6693  }
6694  }
6695  break;
6696 
6697  case 352:
6698 /* Line 1269 of yacc.c. */
6699 #line 3668 "querytransformparser.ypp"
6700  {
6701  (yyval.expressionList) = Expression::List();
6702  }
6703  break;
6704 
6705  case 353:
6706 /* Line 1269 of yacc.c. */
6707 #line 3673 "querytransformparser.ypp"
6708  {
6709  Expression::List list;
6710  list.append((yyvsp[(1) - (1)].expr));
6711  (yyval.expressionList) = list;
6712  }
6713  break;
6714 
6715  case 355:
6716 /* Line 1269 of yacc.c. */
6717 #line 3682 "querytransformparser.ypp"
6718  {
6719  allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc));
6720  }
6721  break;
6722 
6723  case 360:
6724 /* Line 1269 of yacc.c. */
6725 #line 3726 "querytransformparser.ypp"
6726  {
6727  (yyval.enums.tokenizerPosition) = parseInfo->tokenizer->commenceScanOnly();
6728  parseInfo->scanOnlyStack.push(true);
6729  }
6730  break;
6731 
6732  case 361:
6733 /* Line 1269 of yacc.c. */
6734 #line 3735 "querytransformparser.ypp"
6735  {
6736  ++parseInfo->elementConstructorDepth;
6737  Expression::List constructors;
6738 
6739  parseInfo->resolvers.push(parseInfo->staticContext->namespaceBindings());
6740 
6741  /* Fix up attributes and namespace declarations. */
6742  const NamespaceResolver::Ptr resolver(new DelegatingNamespaceResolver(parseInfo->staticContext->namespaceBindings()));
6743  const NamePool::Ptr namePool(parseInfo->staticContext->namePool());
6744  const int len = (yyvsp[(4) - (4)].attributeHolders).size();
6745  QSet<QXmlName::PrefixCode> usedDeclarations;
6746 
6747  /* Whether xmlns="" has been encountered. */
6748  bool hasDefaultDeclaration = false;
6749 
6750  /* For each attribute & namespace declaration, do: */
6751  for(int i = 0; i < len; ++i)
6752  {
6753  QString strLocalName;
6754  QString strPrefix;
6755 
6756  XPathHelper::splitQName((yyvsp[(4) - (4)].attributeHolders).at(i).first, strPrefix, strLocalName);
6757  const QXmlName::PrefixCode prefix = namePool->allocatePrefix(strPrefix);
6758 
6759  /* This can seem a bit weird. However, this name is ending up in a QXmlName
6760  * which consider its prefix a... prefix. So, a namespace binding name can in some cases
6761  * be a local name, but that's just as the initial syntactical construct. */
6762  const QXmlName::LocalNameCode localName = namePool->allocatePrefix(strLocalName);
6763 
6764  /* Not that localName is "foo" in "xmlns:foo" and that prefix is "xmlns". */
6765 
6766  if(prefix == StandardPrefixes::xmlns ||
6767  (prefix == StandardPrefixes::empty && localName == StandardPrefixes::xmlns))
6768  {
6769  if(localName == StandardPrefixes::xmlns)
6770  hasDefaultDeclaration = true;
6771 
6772  /* We have a namespace declaration. */
6773 
6774  const Expression::Ptr nsExpr((yyvsp[(4) - (4)].attributeHolders).at(i).second);
6775 
6776  const QString strNamespace(nsExpr->is(Expression::IDEmptySequence) ? QString() : nsExpr->as<Literal>()->item().stringValue());
6777 
6778  const QXmlName::NamespaceCode ns = namePool->allocateNamespace(strNamespace);
6779 
6780  if(ns == StandardNamespaces::empty)
6781  {
6782  if(localName != StandardPrefixes::xmlns)
6783  {
6784  parseInfo->staticContext->error(QtXmlPatterns::tr("The namespace URI cannot be the empty string when binding to a prefix, %1.")
6785  .arg(formatURI(strPrefix)),
6786  ReportContext::XQST0085, fromYYLTYPE((yyloc), parseInfo));
6787  }
6788  }
6789  else if(!AnyURI::isValid(strNamespace))
6790  {
6791  parseInfo->staticContext->error(QtXmlPatterns::tr("%1 is an invalid namespace URI.").arg(formatURI(strNamespace)),
6792  ReportContext::XQST0022, fromYYLTYPE((yyloc), parseInfo));
6793  }
6794 
6795  if(prefix == StandardPrefixes::xmlns && localName == StandardPrefixes::xmlns)
6796  {
6797  parseInfo->staticContext->error(QtXmlPatterns::tr("It is not possible to bind to the prefix %1")
6798  .arg(formatKeyword("xmlns")),
6799  ReportContext::XQST0070, fromYYLTYPE((yyloc), parseInfo));
6800  }
6801 
6802  if(ns == StandardNamespaces::xml && localName != StandardPrefixes::xml)
6803  {
6804  parseInfo->staticContext->error(QtXmlPatterns::tr("Namespace %1 can only be bound to %2 (and it is, in either case, pre-declared).")
6805  .arg(formatURI(namePool->stringForNamespace(StandardNamespaces::xml)))
6806  .arg(formatKeyword("xml")),
6807  ReportContext::XQST0070, fromYYLTYPE((yyloc), parseInfo));
6808  }
6809 
6810  if(localName == StandardPrefixes::xml && ns != StandardNamespaces::xml)
6811  {
6812  parseInfo->staticContext->error(QtXmlPatterns::tr("Prefix %1 can only be bound to %2 (and it is, in either case, pre-declared).")
6813  .arg(formatKeyword("xml"))
6814  .arg(formatURI(namePool->stringForNamespace(StandardNamespaces::xml))),
6815  ReportContext::XQST0070, fromYYLTYPE((yyloc), parseInfo));
6816  }
6817 
6818  QXmlName nb;
6819 
6820  if(localName == StandardPrefixes::xmlns)
6821  nb = QXmlName(ns, StandardLocalNames::empty);
6822  else
6823  nb = QXmlName(ns, StandardLocalNames::empty, localName);
6824 
6825  if(usedDeclarations.contains(nb.prefix()))
6826  {
6827  parseInfo->staticContext->error(QtXmlPatterns::tr("Two namespace declaration attributes have the same name: %1.")
6828  .arg(formatKeyword(namePool->stringForPrefix(nb.prefix()))),
6829  ReportContext::XQST0071, fromYYLTYPE((yyloc), parseInfo));
6830 
6831  }
6832  else
6833  usedDeclarations.insert(nb.prefix());
6834 
6835  /* If the user has bound the XML namespace correctly, we in either
6836  * case don't want to output it.
6837  *
6838  * We only have to check the namespace parts since the above checks has ensured
6839  * consistency in the prefix parts. */
6840  if(ns != StandardNamespaces::xml)
6841  {
6842  /* We don't want default namespace declarations when the
6843  * default namespace already is empty. */
6844  if(!(ns == StandardNamespaces::empty &&
6845  localName == StandardNamespaces::xmlns &&
6846  resolver->lookupNamespaceURI(StandardPrefixes::empty) == StandardNamespaces::empty))
6847  {
6848  constructors.append(create(new NamespaceConstructor(nb), (yyloc), parseInfo));
6849  resolver->addBinding(nb);
6850  }
6851  }
6852  }
6853  }
6854 
6855  if(parseInfo->elementConstructorDepth == 1 && !hasDefaultDeclaration)
6856  {
6857  /* TODO But mostly this isn't needed, since the default element
6858  * namespace is empty? How does this at all work? */
6859  const QXmlName def(resolver->lookupNamespaceURI(StandardPrefixes::empty), StandardLocalNames::empty);
6860  constructors.append(create(new NamespaceConstructor(def), (yyloc), parseInfo));
6861  }
6862 
6863  parseInfo->staticContext->setNamespaceBindings(resolver);
6864  (yyval.expressionList) = constructors;
6865 
6866  /* Resolve the name of the element, now that the namespace attributes are read. */
6867  {
6868  const ReflectYYLTYPE ryy((yyloc), parseInfo);
6869 
6870  const QXmlName ele = QNameConstructor::expandQName<StaticContext::Ptr,
6871  ReportContext::XPST0081,
6872  ReportContext::XPST0081>((yyvsp[(2) - (4)].sval), parseInfo->staticContext, resolver, &ryy);
6873  parseInfo->tagStack.push(ele);
6874  }
6875 
6876  parseInfo->tokenizer->resumeTokenizationFrom((yyvsp[(3) - (4)].enums.tokenizerPosition));
6877  }
6878  break;
6879 
6880  case 362:
6881 /* Line 1269 of yacc.c. */
6882 #line 3881 "querytransformparser.ypp"
6883  {
6884  /* We add the content constructor after the attribute constructors. This might result
6885  * in nested ExpressionSequences, but it will be optimized away later on. */
6886 
6887  Expression::List attributes((yyvsp[(5) - (8)].expressionList));
6888  const NamePool::Ptr namePool(parseInfo->staticContext->namePool());
6889  const int len = (yyvsp[(7) - (8)].attributeHolders).size();
6890  QSet<QXmlName> declaredAttributes;
6891  declaredAttributes.reserve(len);
6892 
6893  /* For each namespace, resolve its name(now that we have resolved the namespace declarations) and
6894  * turn it into an attribute constructor. */
6895  for(int i = 0; i < len; ++i)
6896  {
6897  QString strLocalName;
6898  QString strPrefix;
6899 
6900  XPathHelper::splitQName((yyvsp[(7) - (8)].attributeHolders).at(i).first, strPrefix, strLocalName);
6901  const QXmlName::PrefixCode prefix = namePool->allocatePrefix(strPrefix);
6902  const QXmlName::LocalNameCode localName = namePool->allocateLocalName(strLocalName);
6903 
6904  if(prefix == StandardPrefixes::xmlns ||
6905  (prefix == StandardPrefixes::empty && localName == StandardLocalNames::xmlns))
6906  {
6907  const Expression::ID id = (yyvsp[(7) - (8)].attributeHolders).at(i).second->id();
6908 
6909  if(id == Expression::IDStringValue || id == Expression::IDEmptySequence)
6910  {
6911  /* It's a namespace declaration, and we've already handled those above. */
6912  continue;
6913  }
6914  else
6915  {
6916  parseInfo->staticContext->error(QtXmlPatterns::tr("The namespace URI must be a constant and cannot "
6917  "use enclosed expressions."),
6918  ReportContext::XQST0022, fromYYLTYPE((yyloc), parseInfo));
6919  }
6920 
6921  }
6922  else
6923  {
6924  const ReflectYYLTYPE ryy((yyloc), parseInfo);
6925  const QXmlName att = QNameConstructor::expandQName<StaticContext::Ptr,
6926  ReportContext::XPST0081,
6927  ReportContext::XPST0081>((yyvsp[(7) - (8)].attributeHolders).at(i).first, parseInfo->staticContext,
6928  parseInfo->staticContext->namespaceBindings(),
6929  &ryy, true);
6930  if(declaredAttributes.contains(att))
6931  {
6932  parseInfo->staticContext->error(QtXmlPatterns::tr("An attribute with name %1 has already appeared on this element.")
6933  .arg(formatKeyword(parseInfo->staticContext->namePool(), att)),
6934  ReportContext::XQST0040, fromYYLTYPE((yyloc), parseInfo));
6935 
6936  }
6937  else
6938  declaredAttributes.insert(att);
6939 
6940  /* wrapLiteral() needs the SourceLocationReflection of the AttributeConstructor, but
6941  * it's unknown inside the arguments to its constructor. Hence we have to do this workaround of setting
6942  * it twice.
6943  *
6944  * The AttributeConstructor's arguments are just dummies. */
6945  const Expression::Ptr ctor(create(new AttributeConstructor((yyvsp[(7) - (8)].attributeHolders).at(i).second, (yyvsp[(7) - (8)].attributeHolders).at(i).second), (yyloc), parseInfo));
6946 
6947  Expression::List ops;
6948  ops.append(wrapLiteral(toItem(QNameValue::fromValue(namePool, att)), parseInfo->staticContext, ctor.data()));
6949  ops.append((yyvsp[(7) - (8)].attributeHolders).at(i).second);
6950  ctor->setOperands(ops);
6951 
6952  attributes.append(ctor);
6953  }
6954  }
6955 
6956  Expression::Ptr contentOp;
6957 
6958  if(attributes.isEmpty())
6959  contentOp = (yyvsp[(8) - (8)].expr);
6960  else
6961  {
6962  attributes.append((yyvsp[(8) - (8)].expr));
6963  contentOp = create(new ExpressionSequence(attributes), (yyloc), parseInfo);
6964  }
6965 
6966  const Expression::Ptr name(create(new Literal(toItem(QNameValue::fromValue(parseInfo->staticContext->namePool(), parseInfo->tagStack.top()))), (yyloc), parseInfo));
6967  (yyval.expr) = create(new ElementConstructor(name, contentOp, parseInfo->isXSLT()), (yyloc), parseInfo);
6968 
6969  /* Restore the old context. We don't want the namespaces
6970  * to be in-scope for expressions appearing after the
6971  * element they appeared on. */
6972  parseInfo->staticContext->setNamespaceBindings(parseInfo->resolvers.pop());
6973  parseInfo->tagStack.pop();
6974 
6975  --parseInfo->elementConstructorDepth;
6976  }
6977  break;
6978 
6979  case 363:
6980 /* Line 1269 of yacc.c. */
6981 #line 3977 "querytransformparser.ypp"
6982  {
6983  (yyval.expr) = create(new EmptySequence(), (yyloc), parseInfo);
6984  }
6985  break;
6986 
6987  case 364:
6988 /* Line 1269 of yacc.c. */
6989 #line 3981 "querytransformparser.ypp"
6990  {
6991  if(!(yyvsp[(4) - (5)].qName).isLexicallyEqual(parseInfo->tagStack.top()))
6992  {
6993  parseInfo->staticContext->error(QtXmlPatterns::tr("A direct element constructor is not "
6994  "well-formed. %1 is ended with %2.")
6995  .arg(formatKeyword(parseInfo->staticContext->namePool()->toLexical(parseInfo->tagStack.top())),
6996  formatKeyword(parseInfo->staticContext->namePool()->toLexical((yyvsp[(4) - (5)].qName)))),
6997  ReportContext::XPST0003, fromYYLTYPE((yyloc), parseInfo));
6998  }
6999 
7000  if((yyvsp[(2) - (5)].expressionList).isEmpty())
7001  (yyval.expr) = create(new EmptySequence(), (yyloc), parseInfo);
7002  else if((yyvsp[(2) - (5)].expressionList).size() == 1)
7003  (yyval.expr) = (yyvsp[(2) - (5)].expressionList).first();
7004  else
7005  (yyval.expr) = create(new ExpressionSequence((yyvsp[(2) - (5)].expressionList)), (yyloc), parseInfo);
7006  }
7007  break;
7008 
7009  case 365:
7010 /* Line 1269 of yacc.c. */
7011 #line 4000 "querytransformparser.ypp"
7012  {
7013  (yyval.attributeHolders) = AttributeHolderVector();
7014  }
7015  break;
7016 
7017  case 366:
7018 /* Line 1269 of yacc.c. */
7019 #line 4004 "querytransformparser.ypp"
7020  {
7021  (yyvsp[(1) - (2)].attributeHolders).append((yyvsp[(2) - (2)].attributeHolder));
7022  (yyval.attributeHolders) = (yyvsp[(1) - (2)].attributeHolders);
7023  }
7024  break;
7025 
7026  case 367:
7027 /* Line 1269 of yacc.c. */
7028 #line 4010 "querytransformparser.ypp"
7029  {
7030  (yyval.attributeHolder) = qMakePair((yyvsp[(1) - (3)].sval), (yyvsp[(3) - (3)].expr));
7031  }
7032  break;
7033 
7034  case 368:
7035 /* Line 1269 of yacc.c. */
7036 #line 4015 "querytransformparser.ypp"
7037  {
7038  (yyval.expr) = createDirAttributeValue((yyvsp[(2) - (3)].expressionList), parseInfo, (yyloc));
7039  }
7040  break;
7041 
7042  case 369:
7043 /* Line 1269 of yacc.c. */
7044 #line 4020 "querytransformparser.ypp"
7045  {
7046  (yyval.expr) = createDirAttributeValue((yyvsp[(2) - (3)].expressionList), parseInfo, (yyloc));
7047  }
7048  break;
7049 
7050  case 370:
7051 /* Line 1269 of yacc.c. */
7052 #line 4025 "querytransformparser.ypp"
7053  {
7054  (yyval.expressionList) = Expression::List();
7055  }
7056  break;
7057 
7058  case 371:
7059 /* Line 1269 of yacc.c. */
7060 #line 4029 "querytransformparser.ypp"
7061  {
7062  Expression::Ptr content((yyvsp[(1) - (2)].expr));
7063 
7064  if(parseInfo->isBackwardsCompat.top())
7065  content = create(GenericPredicate::createFirstItem(content), (yyloc), parseInfo);
7066 
7067  (yyvsp[(2) - (2)].expressionList).prepend(createSimpleContent(content, (yyloc), parseInfo));
7068  (yyval.expressionList) = (yyvsp[(2) - (2)].expressionList);
7069  }
7070  break;
7071 
7072  case 372:
7073 /* Line 1269 of yacc.c. */
7074 #line 4039 "querytransformparser.ypp"
7075  {
7076  (yyvsp[(2) - (2)].expressionList).prepend(create(new Literal(AtomicString::fromValue((yyvsp[(1) - (2)].sval))), (yyloc), parseInfo));
7077  (yyval.expressionList) = (yyvsp[(2) - (2)].expressionList);
7078  }
7079  break;
7080 
7081  case 373:
7082 /* Line 1269 of yacc.c. */
7083 #line 4045 "querytransformparser.ypp"
7084  {
7085  (yyval.expressionList) = Expression::List();
7086  parseInfo->isPreviousEnclosedExpr = false;
7087  }
7088  break;
7089 
7090  case 374:
7091 /* Line 1269 of yacc.c. */
7092 #line 4050 "querytransformparser.ypp"
7093  {
7094  (yyvsp[(1) - (2)].expressionList).append((yyvsp[(2) - (2)].expr));
7095  (yyval.expressionList) = (yyvsp[(1) - (2)].expressionList);
7096  parseInfo->isPreviousEnclosedExpr = false;
7097  }
7098  break;
7099 
7100  case 375:
7101 /* Line 1269 of yacc.c. */
7102 #line 4056 "querytransformparser.ypp"
7103  {
7104  if(parseInfo->staticContext->boundarySpacePolicy() == StaticContext::BSPStrip &&
7105  XPathHelper::isWhitespaceOnly((yyvsp[(2) - (2)].sval)))
7106  {
7107  (yyval.expressionList) = (yyvsp[(1) - (2)].expressionList);
7108  }
7109  else
7110  {
7111  (yyvsp[(1) - (2)].expressionList).append(create(new TextNodeConstructor(create(new Literal(AtomicString::fromValue((yyvsp[(2) - (2)].sval))), (yyloc), parseInfo)), (yyloc), parseInfo));
7112  (yyval.expressionList) = (yyvsp[(1) - (2)].expressionList);
7113  parseInfo->isPreviousEnclosedExpr = false;
7114  }
7115  }
7116  break;
7117 
7118  case 376:
7119 /* Line 1269 of yacc.c. */
7120 #line 4070 "querytransformparser.ypp"
7121  {
7122  (yyvsp[(1) - (2)].expressionList).append(create(new TextNodeConstructor(create(new Literal(AtomicString::fromValue((yyvsp[(2) - (2)].sval))), (yyloc), parseInfo)), (yyloc), parseInfo));
7123  (yyval.expressionList) = (yyvsp[(1) - (2)].expressionList);
7124  parseInfo->isPreviousEnclosedExpr = false;
7125  }
7126  break;
7127 
7128  case 377:
7129 /* Line 1269 of yacc.c. */
7130 #line 4076 "querytransformparser.ypp"
7131  {
7132  /* We insert a text node constructor that send an empty text node between
7133  * the two enclosed expressions, in order to ensure that no space is inserted.
7134  *
7135  * However, we only do it when we have no node constructors. */
7136  if(parseInfo->isPreviousEnclosedExpr &&
7137  BuiltinTypes::xsAnyAtomicType->xdtTypeMatches((yyvsp[(2) - (2)].expr)->staticType()->itemType()) &&
7138  BuiltinTypes::xsAnyAtomicType->xdtTypeMatches((yyvsp[(1) - (2)].expressionList).last()->staticType()->itemType()))
7139  (yyvsp[(1) - (2)].expressionList).append(create(new TextNodeConstructor(create(new Literal(AtomicString::fromValue(QString())), (yyloc), parseInfo)), (yyloc), parseInfo));
7140  else
7141  parseInfo->isPreviousEnclosedExpr = true;
7142 
7143  (yyvsp[(1) - (2)].expressionList).append(createCopyOf((yyvsp[(2) - (2)].expr), parseInfo, (yyloc)));
7144  (yyval.expressionList) = (yyvsp[(1) - (2)].expressionList);
7145  }
7146  break;
7147 
7148  case 378:
7149 /* Line 1269 of yacc.c. */
7150 #line 4093 "querytransformparser.ypp"
7151  {
7152  (yyval.expr) = create(new CommentConstructor(create(new Literal(AtomicString::fromValue((yyvsp[(2) - (2)].sval))), (yyloc), parseInfo)), (yyloc), parseInfo);
7153  }
7154  break;
7155 
7156  case 379:
7157 /* Line 1269 of yacc.c. */
7158 #line 4098 "querytransformparser.ypp"
7159  {
7160  const ReflectYYLTYPE ryy((yyloc), parseInfo);
7161  NCNameConstructor::validateTargetName<StaticContext::Ptr,
7162  ReportContext::XPST0003,
7163  ReportContext::XPST0003>((yyvsp[(2) - (3)].sval),
7164  parseInfo->staticContext, &ryy);
7165 
7166  (yyval.expr) = create(new ProcessingInstructionConstructor(
7167  create(new Literal(AtomicString::fromValue((yyvsp[(2) - (3)].sval))), (yyloc), parseInfo),
7168  create(new Literal(AtomicString::fromValue((yyvsp[(3) - (3)].sval))), (yyloc), parseInfo)), (yyloc), parseInfo);
7169  }
7170  break;
7171 
7172  case 387:
7173 /* Line 1269 of yacc.c. */
7174 #line 4119 "querytransformparser.ypp"
7175  {
7176  allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc), (yyvsp[(2) - (3)].enums.Bool));
7177 
7178  (yyval.expr) = create(new DocumentConstructor((yyvsp[(3) - (3)].expr)), (yyloc), parseInfo);
7179  }
7180  break;
7181 
7182  case 388:
7183 /* Line 1269 of yacc.c. */
7184 #line 4126 "querytransformparser.ypp"
7185  {
7186  /* This value is incremented before the action below is executed. */
7187  ++parseInfo->elementConstructorDepth;
7188  }
7189  break;
7190 
7191  case 389:
7192 /* Line 1269 of yacc.c. */
7193 #line 4131 "querytransformparser.ypp"
7194  {
7195  Q_ASSERT(5);
7196  allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc), (yyvsp[(2) - (5)].enums.Bool));
7197 
7198  Expression::Ptr effExpr;
7199 
7200  if((yyvsp[(5) - (5)].expr))
7201  effExpr = createCopyOf((yyvsp[(5) - (5)].expr), parseInfo, (yyloc));
7202  else
7203  effExpr = create(new EmptySequence(), (yyloc), parseInfo);
7204 
7205  const QXmlName::NamespaceCode ns = parseInfo->resolvers.top()->lookupNamespaceURI(StandardPrefixes::empty);
7206 
7207  /* Ensure the default namespace gets counted as an in-scope binding, if such a one exists. If we're
7208  * a child of another constructor, it has already been done. */
7209  if(parseInfo->elementConstructorDepth == 1 && ns != StandardNamespaces::empty)
7210  {
7211  Expression::List exprList;
7212 
7213  /* We append the namespace constructor before the body, in order to
7214  * comply with QAbstractXmlPushHandler's contract. */
7215  const QXmlName def(parseInfo->resolvers.top()->lookupNamespaceURI(StandardPrefixes::empty), StandardLocalNames::empty);
7216  exprList.append(create(new NamespaceConstructor(def), (yyloc), parseInfo));
7217 
7218  exprList.append(effExpr);
7219 
7220  effExpr = create(new ExpressionSequence(exprList), (yyloc), parseInfo);
7221  }
7222 
7223  --parseInfo->elementConstructorDepth;
7224  (yyval.expr) = create(new ElementConstructor((yyvsp[(3) - (5)].expr), effExpr, parseInfo->isXSLT()), (yyloc), parseInfo);
7225  }
7226  break;
7227 
7228  case 390:
7229 /* Line 1269 of yacc.c. */
7230 #line 4165 "querytransformparser.ypp"
7231  {
7232  (yyval.enums.Bool) = false;
7233  }
7234  break;
7235 
7236  case 391:
7237 /* Line 1269 of yacc.c. */
7238 #line 4169 "querytransformparser.ypp"
7239  {
7240  (yyval.enums.Bool) = true;
7241  }
7242  break;
7243 
7244  case 392:
7245 /* Line 1269 of yacc.c. */
7246 #line 4177 "querytransformparser.ypp"
7247  {
7248  allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc), (yyvsp[(2) - (4)].enums.Bool));
7249 
7250  const Expression::Ptr name(create(new AttributeNameValidator((yyvsp[(3) - (4)].expr)), (yyloc), parseInfo));
7251 
7252  if((yyvsp[(4) - (4)].expr))
7253  (yyval.expr) = create(new AttributeConstructor(name, createSimpleContent((yyvsp[(4) - (4)].expr), (yyloc), parseInfo)), (yyloc), parseInfo);
7254  else
7255  (yyval.expr) = create(new AttributeConstructor(name, create(new EmptySequence(), (yyloc), parseInfo)), (yyloc), parseInfo);
7256  }
7257  break;
7258 
7259  case 393:
7260 /* Line 1269 of yacc.c. */
7261 #line 4189 "querytransformparser.ypp"
7262  {
7263  (yyval.expr) = create(new TextNodeConstructor(createSimpleContent((yyvsp[(3) - (3)].expr), (yyloc), parseInfo)), (yyloc), parseInfo);
7264  }
7265  break;
7266 
7267  case 394:
7268 /* Line 1269 of yacc.c. */
7269 #line 4194 "querytransformparser.ypp"
7270  {
7271  allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc), (yyvsp[(2) - (3)].enums.Bool));
7272 
7273  (yyval.expr) = create(new CommentConstructor(createSimpleContent((yyvsp[(3) - (3)].expr), (yyloc), parseInfo)), (yyloc), parseInfo);
7274  }
7275  break;
7276 
7277  case 395:
7278 /* Line 1269 of yacc.c. */
7279 #line 4201 "querytransformparser.ypp"
7280  {
7281  allowedIn(QXmlQuery::XQuery10, parseInfo, (yyloc), (yyvsp[(2) - (3)].expr));
7282 
7283  if((yyvsp[(3) - (3)].expr))
7284  {
7285  (yyval.expr) = create(new ProcessingInstructionConstructor((yyvsp[(2) - (3)].expr), createSimpleContent((yyvsp[(3) - (3)].expr), (yyloc), parseInfo)), (yyloc), parseInfo);
7286  }
7287  else
7288  (yyval.expr) = create(new ProcessingInstructionConstructor((yyvsp[(2) - (3)].expr), create(new EmptySequence(), (yyloc), parseInfo)), (yyloc), parseInfo);
7289  }
7290  break;
7291 
7292  case 396:
7293 /* Line 1269 of yacc.c. */
7294 #line 4212 "querytransformparser.ypp"
7295  {
7296  parseInfo->nodeTestSource = BuiltinTypes::attribute;
7297  }
7298  break;
7299 
7300  case 397:
7301 /* Line 1269 of yacc.c. */
7302 #line 4216 "querytransformparser.ypp"
7303  {
7304  parseInfo->restoreNodeTestSource();
7305  }
7306  break;
7307 
7308  case 398:
7309 /* Line 1269 of yacc.c. */
7310 #line 4219 "querytransformparser.ypp"
7311  {
7312  (yyval.expr) = create(new Literal(toItem(QNameValue::fromValue(parseInfo->staticContext->namePool(), (yyvsp[(2) - (3)].qName)))), (yyloc), parseInfo);
7313  }
7314  break;
7315 
7316  case 400:
7317 /* Line 1269 of yacc.c. */
7318 #line 4225 "querytransformparser.ypp"
7319  {
7320  (yyval.expr) = create(new Literal(toItem(QNameValue::fromValue(parseInfo->staticContext->namePool(), (yyvsp[(1) - (1)].qName)))), (yyloc), parseInfo);
7321  }
7322  break;
7323 
7324  case 402:
7325 /* Line 1269 of yacc.c. */
7326 #line 4231 "querytransformparser.ypp"
7327  {
7328  if(BuiltinTypes::xsQName->xdtTypeMatches((yyvsp[(1) - (1)].expr)->staticType()->itemType()))
7329  (yyval.expr) = (yyvsp[(1) - (1)].expr);
7330  else
7331  {
7332  (yyval.expr) = create(new QNameConstructor((yyvsp[(1) - (1)].expr),
7333  parseInfo->staticContext->namespaceBindings()),
7334  (yyloc), parseInfo);
7335  }
7336  }
7337  break;
7338 
7339  case 403:
7340 /* Line 1269 of yacc.c. */
7341 #line 4246 "querytransformparser.ypp"
7342  {
7343  (yyval.expr) = create(new NCNameConstructor(create(new Literal(AtomicString::fromValue((yyvsp[(1) - (1)].sval))), (yyloc), parseInfo)), (yyloc), parseInfo);
7344  }
7345  break;
7346 
7347  case 404:
7348 /* Line 1269 of yacc.c. */
7349 #line 4250 "querytransformparser.ypp"
7350  {
7351  (yyval.expr) = create(new NCNameConstructor((yyvsp[(1) - (1)].expr)), (yyloc), parseInfo);
7352  }
7353  break;
7354 
7355  case 405:
7356 /* Line 1269 of yacc.c. */
7357 #line 4259 "querytransformparser.ypp"
7358  {
7359  (yyval.expr) = create(new ComputedNamespaceConstructor((yyvsp[(2) - (3)].expr), (yyvsp[(3) - (3)].expr)), (yyloc), parseInfo);
7360 }
7361  break;
7362 
7363  case 406:
7364 /* Line 1269 of yacc.c. */
7365 #line 4264 "querytransformparser.ypp"
7366  {
7367  (yyval.sequenceType) = makeGenericSequenceType((yyvsp[(1) - (1)].itemType), Cardinality::exactlyOne());
7368  }
7369  break;
7370 
7371  case 407:
7372 /* Line 1269 of yacc.c. */
7373 #line 4268 "querytransformparser.ypp"
7374  {
7375  (yyval.sequenceType) = makeGenericSequenceType((yyvsp[(1) - (2)].itemType), Cardinality::zeroOrOne());
7376  }
7377  break;
7378 
7379  case 408:
7380 /* Line 1269 of yacc.c. */
7381 #line 4273 "querytransformparser.ypp"
7382  {
7383  (yyval.sequenceType) = CommonSequenceTypes::ZeroOrMoreItems;
7384  }
7385  break;
7386 
7387  case 409:
7388 /* Line 1269 of yacc.c. */
7389 #line 4277 "querytransformparser.ypp"
7390  {
7391  (yyval.sequenceType) = (yyvsp[(2) - (2)].sequenceType);
7392  }
7393  break;
7394 
7395  case 410:
7396 /* Line 1269 of yacc.c. */
7397 #line 4282 "querytransformparser.ypp"
7398  {
7399  (yyval.sequenceType) = makeGenericSequenceType((yyvsp[(1) - (2)].itemType), (yyvsp[(2) - (2)].cardinality));
7400  }
7401  break;
7402 
7403  case 411:
7404 /* Line 1269 of yacc.c. */
7405 #line 4287 "querytransformparser.ypp"
7406  {
7407  (yyval.sequenceType) = CommonSequenceTypes::Empty;
7408  }
7409  break;
7410 
7411  case 412:
7412 /* Line 1269 of yacc.c. */
7413 #line 4291 "querytransformparser.ypp"
7414  {(yyval.cardinality) = Cardinality::exactlyOne();}
7415  break;
7416 
7417  case 413:
7418 /* Line 1269 of yacc.c. */
7419 #line 4292 "querytransformparser.ypp"
7420  {(yyval.cardinality) = Cardinality::oneOrMore();}
7421  break;
7422 
7423  case 414:
7424 /* Line 1269 of yacc.c. */
7425 #line 4293 "querytransformparser.ypp"
7426  {(yyval.cardinality) = Cardinality::zeroOrMore();}
7427  break;
7428 
7429  case 415:
7430 /* Line 1269 of yacc.c. */
7431 #line 4294 "querytransformparser.ypp"
7432  {(yyval.cardinality) = Cardinality::zeroOrOne();}
7433  break;
7434 
7435  case 419:
7436 /* Line 1269 of yacc.c. */
7437 #line 4300 "querytransformparser.ypp"
7438  {
7439  (yyval.itemType) = BuiltinTypes::item;
7440  }
7441  break;
7442 
7443  case 420:
7444 /* Line 1269 of yacc.c. */
7445 #line 4305 "querytransformparser.ypp"
7446  {
7447  const SchemaType::Ptr t(parseInfo->staticContext->schemaDefinitions()->createSchemaType((yyvsp[(1) - (1)].qName)));
7448 
7449  if(!t)
7450  {
7451  parseInfo->staticContext->error(QtXmlPatterns::tr("The name %1 does not refer to any schema type.")
7452  .arg(formatKeyword(parseInfo->staticContext->namePool(), (yyvsp[(1) - (1)].qName))), ReportContext::XPST0051, fromYYLTYPE((yyloc), parseInfo));
7453  }
7455  (yyval.itemType) = AtomicType::Ptr(t);
7456  else
7457  {
7458  /* Try to give an intelligent message. */
7459  if(t->isComplexType())
7460  {
7461  parseInfo->staticContext->error(QtXmlPatterns::tr("%1 is an complex type. Casting to complex "
7462  "types is not possible. However, casting "
7463  "to atomic types such as %2 works.")
7464  .arg(formatType(parseInfo->staticContext->namePool(), t))
7465  .arg(formatType(parseInfo->staticContext->namePool(), BuiltinTypes::xsInteger)),
7466  ReportContext::XPST0051, fromYYLTYPE((yyloc), parseInfo));
7467  }
7468  else
7469  {
7470  parseInfo->staticContext->error(QtXmlPatterns::tr("%1 is not an atomic type. Casting "
7471  "is only possible to atomic types.")
7472  .arg(formatType(parseInfo->staticContext->namePool(), t)),
7473  ReportContext::XPST0051, fromYYLTYPE((yyloc), parseInfo));
7474  }
7475  }
7476  }
7477  break;
7478 
7479  case 428:
7480 /* Line 1269 of yacc.c. */
7481 #line 4349 "querytransformparser.ypp"
7482  {
7483  (yyval.itemType) = BuiltinTypes::node;
7484  }
7485  break;
7486 
7487  case 429:
7488 /* Line 1269 of yacc.c. */
7489 #line 4354 "querytransformparser.ypp"
7490  {
7491  (yyval.itemType) = BuiltinTypes::document;
7492  }
7493  break;
7494 
7495  case 430:
7496 /* Line 1269 of yacc.c. */
7497 #line 4359 "querytransformparser.ypp"
7498  {
7499  // TODO support for document element testing
7500  (yyval.itemType) = BuiltinTypes::document;
7501  }
7502  break;
7503 
7504  case 433:
7505 /* Line 1269 of yacc.c. */
7506 #line 4368 "querytransformparser.ypp"
7507  {
7508  (yyval.itemType) = BuiltinTypes::text;
7509  }
7510  break;
7511 
7512  case 434:
7513 /* Line 1269 of yacc.c. */
7514 #line 4373 "querytransformparser.ypp"
7515  {
7516  (yyval.itemType) = BuiltinTypes::comment;
7517  }
7518  break;
7519 
7520  case 435:
7521 /* Line 1269 of yacc.c. */
7522 #line 4378 "querytransformparser.ypp"
7523  {
7524  (yyval.itemType) = BuiltinTypes::pi;
7525  }
7526  break;
7527 
7528  case 436:
7529 /* Line 1269 of yacc.c. */
7530 #line 4383 "querytransformparser.ypp"
7531  {
7532  (yyval.itemType) = LocalNameTest::create(BuiltinTypes::pi, parseInfo->staticContext->namePool()->allocateLocalName((yyvsp[(3) - (4)].sval)));
7533  }
7534  break;
7535 
7536  case 437:
7537 /* Line 1269 of yacc.c. */
7538 #line 4388 "querytransformparser.ypp"
7539  {
7540  if(QXmlUtils::isNCName((yyvsp[(3) - (4)].sval)))
7541  {
7542  (yyval.itemType) = LocalNameTest::create(BuiltinTypes::pi, parseInfo->staticContext->namePool()->allocateLocalName((yyvsp[(3) - (4)].sval)));
7543  }
7544  else
7545  {
7546  parseInfo->staticContext->error(QtXmlPatterns::tr("%1 is not a valid name for a "
7547  "processing-instruction.")
7548  .arg(formatKeyword((yyvsp[(3) - (4)].sval))),
7549  ReportContext::XPTY0004,
7550  fromYYLTYPE((yyloc), parseInfo));
7551  }
7552  }
7553  break;
7554 
7555  case 440:
7556 /* Line 1269 of yacc.c. */
7557 #line 4407 "querytransformparser.ypp"
7558  {
7559  (yyval.itemType) = BuiltinTypes::attribute;
7560  }
7561  break;
7562 
7563  case 441:
7564 /* Line 1269 of yacc.c. */
7565 #line 4412 "querytransformparser.ypp"
7566  {
7567  (yyval.itemType) = BuiltinTypes::attribute;
7568  }
7569  break;
7570 
7571  case 442:
7572 /* Line 1269 of yacc.c. */
7573 #line 4417 "querytransformparser.ypp"
7574  {
7575  (yyval.itemType) = QNameTest::create(BuiltinTypes::attribute, (yyvsp[(3) - (4)].qName));
7576  }
7577  break;
7578 
7579  case 443:
7580 /* Line 1269 of yacc.c. */
7581 #line 4421 "querytransformparser.ypp"
7582  {
7583  const SchemaType::Ptr t(parseInfo->staticContext->schemaDefinitions()->createSchemaType((yyvsp[(5) - (6)].qName)));
7584 
7585  if(t)
7586  (yyval.itemType) = BuiltinTypes::attribute;
7587  else
7588  {
7589  parseInfo->staticContext->error(unknownType().arg(formatKeyword(parseInfo->staticContext->namePool(), (yyvsp[(5) - (6)].qName))),
7590  ReportContext::XPST0008, fromYYLTYPE((yyloc), parseInfo));
7591  }
7592  }
7593  break;
7594 
7595  case 444:
7596 /* Line 1269 of yacc.c. */
7597 #line 4433 "querytransformparser.ypp"
7598  {
7599  const SchemaType::Ptr t(parseInfo->staticContext->schemaDefinitions()->createSchemaType((yyvsp[(5) - (6)].qName)));
7600 
7601  if(t)
7602  (yyval.itemType) = BuiltinTypes::attribute;
7603  else
7604  {
7605  parseInfo->staticContext->error(unknownType().arg(formatKeyword(parseInfo->staticContext->namePool(), (yyvsp[(5) - (6)].qName))),
7606  ReportContext::XPST0008, fromYYLTYPE((yyloc), parseInfo));
7607  }
7608  }
7609  break;
7610 
7611  case 445:
7612 /* Line 1269 of yacc.c. */
7613 #line 4446 "querytransformparser.ypp"
7614  {
7615  parseInfo->staticContext->error(QtXmlPatterns::tr("%1 is not in the in-scope attribute "
7616  "declarations. Note that the schema import "
7617  "feature is not supported.")
7618  .arg(formatKeyword(parseInfo->staticContext->namePool(), (yyvsp[(3) - (4)].qName))),
7619  ReportContext::XPST0008, fromYYLTYPE((yyloc), parseInfo));
7620  (yyval.itemType).reset();
7621  }
7622  break;
7623 
7624  case 446:
7625 /* Line 1269 of yacc.c. */
7626 #line 4456 "querytransformparser.ypp"
7627  {
7628  (yyval.itemType) = BuiltinTypes::element;
7629  }
7630  break;
7631 
7632  case 447:
7633 /* Line 1269 of yacc.c. */
7634 #line 4461 "querytransformparser.ypp"
7635  {
7636  (yyval.itemType) = BuiltinTypes::element;
7637  }
7638  break;
7639 
7640  case 448:
7641 /* Line 1269 of yacc.c. */
7642 #line 4466 "querytransformparser.ypp"
7643  {
7644  (yyval.itemType) = QNameTest::create(BuiltinTypes::element, (yyvsp[(3) - (4)].qName));
7645  }
7646  break;
7647 
7648  case 449:
7649 /* Line 1269 of yacc.c. */
7650 #line 4471 "querytransformparser.ypp"
7651  {
7652  const SchemaType::Ptr t(parseInfo->staticContext->schemaDefinitions()->createSchemaType((yyvsp[(5) - (7)].qName)));
7653 
7654  if(t)
7655  (yyval.itemType) = BuiltinTypes::element;
7656  else
7657  {
7658  parseInfo->staticContext->error(unknownType()
7659  .arg(formatKeyword(parseInfo->staticContext->namePool(), (yyvsp[(5) - (7)].qName))),
7660  ReportContext::XPST0008, fromYYLTYPE((yyloc), parseInfo));
7661  }
7662  }
7663  break;
7664 
7665  case 450:
7666 /* Line 1269 of yacc.c. */
7667 #line 4485 "querytransformparser.ypp"
7668  {
7669  const SchemaType::Ptr t(parseInfo->staticContext->schemaDefinitions()->createSchemaType((yyvsp[(5) - (7)].qName)));
7670 
7671  if(t)
7672  (yyval.itemType) = BuiltinTypes::element;
7673  else
7674  {
7675  parseInfo->staticContext->error(QtXmlPatterns::tr("%1 is an unknown schema type.")
7676  .arg(formatKeyword(parseInfo->staticContext->namePool(), (yyvsp[(5) - (7)].qName))),
7677  ReportContext::XPST0008, fromYYLTYPE((yyloc), parseInfo));
7678  }
7679  }
7680  break;
7681 
7682  case 453:
7683 /* Line 1269 of yacc.c. */
7684 #line 4502 "querytransformparser.ypp"
7685  {
7686  parseInfo->staticContext->error(QtXmlPatterns::tr("%1 is not in the in-scope attribute "
7687  "declarations. Note that the schema import "
7688  "feature is not supported.")
7689  .arg(formatKeyword(parseInfo->staticContext->namePool(), (yyvsp[(3) - (4)].qName))),
7690  ReportContext::XPST0008, fromYYLTYPE((yyloc), parseInfo));
7691  (yyval.itemType).reset();
7692  }
7693  break;
7694 
7695  case 455:
7696 /* Line 1269 of yacc.c. */
7697 #line 4514 "querytransformparser.ypp"
7698  {
7699  (yyval.qName) = parseInfo->staticContext->namePool()->allocateQName(StandardNamespaces::empty, (yyvsp[(1) - (1)].sval));
7700  }
7701  break;
7702 
7703  case 457:
7704 /* Line 1269 of yacc.c. */
7705 #line 4526 "querytransformparser.ypp"
7706  {
7707  if(parseInfo->nodeTestSource == BuiltinTypes::element)
7708  (yyval.qName) = parseInfo->staticContext->namePool()->allocateQName(parseInfo->staticContext->namespaceBindings()->lookupNamespaceURI(StandardPrefixes::empty), (yyvsp[(1) - (1)].sval));
7709  else
7710  (yyval.qName) = parseInfo->staticContext->namePool()->allocateQName(StandardNamespaces::empty, (yyvsp[(1) - (1)].sval));
7711  }
7712  break;
7713 
7714  case 462:
7715 /* Line 1269 of yacc.c. */
7716 #line 4540 "querytransformparser.ypp"
7717  {
7718  (yyval.qName) = parseInfo->staticContext->namePool()->allocateQName(parseInfo->staticContext->defaultFunctionNamespace(), (yyvsp[(1) - (1)].sval));
7719  }
7720  break;
7721 
7722  case 463:
7723 /* Line 1269 of yacc.c. */
7724 #line 4544 "querytransformparser.ypp"
7725  {
7726  (yyval.qName) = parseInfo->staticContext->namePool()->allocateQName(StandardNamespaces::InternalXSLT, (yyvsp[(2) - (2)].sval));
7727  }
7728  break;
7729 
7730  case 466:
7731 /* Line 1269 of yacc.c. */
7732 #line 4552 "querytransformparser.ypp"
7733  {
7734  parseInfo->staticContext->error(QtXmlPatterns::tr("The name of an extension expression must be in "
7735  "a namespace."),
7736  ReportContext::XPST0081, fromYYLTYPE((yyloc), parseInfo));
7737  }
7738  break;
7739 
7740  case 469:
7741 /* Line 1269 of yacc.c. */
7742 #line 4562 "querytransformparser.ypp"
7743  {
7745  }
7746  break;
7747 
7748  case 470:
7749 /* Line 1269 of yacc.c. */
7750 #line 4566 "querytransformparser.ypp"
7751  {
7753  }
7754  break;
7755 
7756  case 471:
7757 /* Line 1269 of yacc.c. */
7758 #line 4571 "querytransformparser.ypp"
7759  {
7760 
7761  const ReflectYYLTYPE ryy((yyloc), parseInfo);
7762 
7763  (yyval.qName) = QNameConstructor::
7764  expandQName<StaticContext::Ptr,
7765  ReportContext::XPST0081,
7766  ReportContext::XPST0081>((yyvsp[(1) - (1)].sval), parseInfo->staticContext,
7767  parseInfo->staticContext->namespaceBindings(), &ryy);
7768 
7769  }
7770  break;
7771 
7772  case 472:
7773 /* Line 1269 of yacc.c. */
7774 #line 4583 "querytransformparser.ypp"
7775  {
7776  (yyval.qName) = parseInfo->staticContext->namePool()->fromClarkName((yyvsp[(1) - (1)].sval));
7777  }
7778  break;
7779 
7780 
7781 /* Line 1269 of yacc.c. */
7782 #line 7763 "qquerytransformparser.cpp"
7783  default: break;
7784  }
7785  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
7786 
7787  YYPOPSTACK (yylen);
7788  yylen = 0;
7789  YY_STACK_PRINT (yyss, yyssp);
7790 
7791  *++yyvsp = yyval;
7792  *++yylsp = yyloc;
7793 
7794  /* Now `shift' the result of the reduction. Determine what state
7795  that goes to, based on the state we popped back to and the rule
7796  number reduced by. */
7797 
7798  yyn = yyr1[yyn];
7799 
7800  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
7801  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
7802  yystate = yytable[yystate];
7803  else
7804  yystate = yydefgoto[yyn - YYNTOKENS];
7805 
7806  goto yynewstate;
7807 
7808 
7809 /*------------------------------------.
7810 | yyerrlab -- here on detecting error |
7811 `------------------------------------*/
7812 yyerrlab:
7813  /* If not already recovering from an error, report this error. */
7814  if (!yyerrstatus)
7815  {
7816  ++yynerrs;
7817 #if ! YYERROR_VERBOSE
7818  yyerror (&yylloc, parseInfo, YY_("syntax error"));
7819 #else
7820  {
7821  YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
7822  if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
7823  {
7824  YYSIZE_T yyalloc = 2 * yysize;
7825  if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
7826  yyalloc = YYSTACK_ALLOC_MAXIMUM;
7827  if (yymsg != yymsgbuf)
7828  YYSTACK_FREE (yymsg);
7829  yymsg = (char *) YYSTACK_ALLOC (yyalloc);
7830  if (yymsg)
7831  yymsg_alloc = yyalloc;
7832  else
7833  {
7834  yymsg = yymsgbuf;
7835  yymsg_alloc = sizeof yymsgbuf;
7836  }
7837  }
7838 
7839  if (0 < yysize && yysize <= yymsg_alloc)
7840  {
7841  (void) yysyntax_error (yymsg, yystate, yychar);
7842  yyerror (&yylloc, parseInfo, yymsg);
7843  }
7844  else
7845  {
7846  yyerror (&yylloc, parseInfo, YY_("syntax error"));
7847  if (yysize != 0)
7848  goto yyexhaustedlab;
7849  }
7850  }
7851 #endif
7852  }
7853 
7854  yyerror_range[0] = yylloc;
7855 
7856  if (yyerrstatus == 3)
7857  {
7858  /* If just tried and failed to reuse lookahead token after an
7859  error, discard it. */
7860 
7861  if (yychar <= YYEOF)
7862  {
7863  /* Return failure if at end of input. */
7864  if (yychar == YYEOF)
7865  YYABORT;
7866  }
7867  else
7868  {
7869  yydestruct ("Error: discarding",
7870  yytoken, &yylval, &yylloc, parseInfo);
7871  yychar = YYEMPTY;
7872  }
7873  }
7874 
7875  /* Else will try to reuse lookahead token after shifting the error
7876  token. */
7877  goto yyerrlab1;
7878 
7879 
7880 /*---------------------------------------------------.
7881 | yyerrorlab -- error raised explicitly by YYERROR. |
7882 `---------------------------------------------------*/
7883 yyerrorlab:
7884 
7885  /* Pacify compilers like GCC when the user code never invokes
7886  YYERROR and the label yyerrorlab therefore never appears in user
7887  code. */
7888  if (/*CONSTCOND*/ 0)
7889  goto yyerrorlab;
7890 
7891  yyerror_range[0] = yylsp[1-yylen];
7892  /* Do not reclaim the symbols of the rule which action triggered
7893  this YYERROR. */
7894  YYPOPSTACK (yylen);
7895  yylen = 0;
7896  YY_STACK_PRINT (yyss, yyssp);
7897  yystate = *yyssp;
7898  goto yyerrlab1;
7899 
7900 
7901 /*-------------------------------------------------------------.
7902 | yyerrlab1 -- common code for both syntax error and YYERROR. |
7903 `-------------------------------------------------------------*/
7904 yyerrlab1:
7905  yyerrstatus = 3; /* Each real token shifted decrements this. */
7906 
7907  for (;;)
7908  {
7909  yyn = yypact[yystate];
7910  if (yyn != YYPACT_NINF)
7911  {
7912  yyn += YYTERROR;
7913  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
7914  {
7915  yyn = yytable[yyn];
7916  if (0 < yyn)
7917  break;
7918  }
7919  }
7920 
7921  /* Pop the current state because it cannot handle the error token. */
7922  if (yyssp == yyss)
7923  YYABORT;
7924 
7925  yyerror_range[0] = *yylsp;
7926  yydestruct ("Error: popping",
7927  yystos[yystate], yyvsp, yylsp, parseInfo);
7928  YYPOPSTACK (1);
7929  yystate = *yyssp;
7930  YY_STACK_PRINT (yyss, yyssp);
7931  }
7932 
7933  *++yyvsp = yylval;
7934 
7935  yyerror_range[1] = yylloc;
7936  /* Using YYLLOC is tempting, but would change the location of
7937  the lookahead. YYLOC is available though. */
7938  YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
7939  *++yylsp = yyloc;
7940 
7941  /* Shift the error token. */
7942  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
7943 
7944  yystate = yyn;
7945  goto yynewstate;
7946 
7947 
7948 /*-------------------------------------.
7949 | yyacceptlab -- YYACCEPT comes here. |
7950 `-------------------------------------*/
7951 yyacceptlab:
7952  yyresult = 0;
7953  goto yyreturn;
7954 
7955 /*-----------------------------------.
7956 | yyabortlab -- YYABORT comes here. |
7957 `-----------------------------------*/
7958 yyabortlab:
7959  yyresult = 1;
7960  goto yyreturn;
7961 
7962 #ifndef yyoverflow
7963 /*-------------------------------------------------.
7964 | yyexhaustedlab -- memory exhaustion comes here. |
7965 `-------------------------------------------------*/
7966 yyexhaustedlab:
7967  yyerror (&yylloc, parseInfo, YY_("memory exhausted"));
7968  yyresult = 2;
7969  /* Fall through. */
7970 #endif
7971 
7972 yyreturn:
7973  if (yychar != YYEMPTY)
7974  yydestruct ("Cleanup: discarding lookahead",
7975  yytoken, &yylval, &yylloc, parseInfo);
7976  /* Do not reclaim the symbols of the rule which action triggered
7977  this YYABORT or YYACCEPT. */
7978  YYPOPSTACK (yylen);
7979  YY_STACK_PRINT (yyss, yyssp);
7980  while (yyssp != yyss)
7981  {
7982  yydestruct ("Cleanup: popping",
7983  yystos[*yyssp], yyvsp, yylsp, parseInfo);
7984  YYPOPSTACK (1);
7985  }
7986 #ifndef yyoverflow
7987  if (yyss != yyssa)
7988  YYSTACK_FREE (yyss);
7989 #endif
7990 #if YYERROR_VERBOSE
7991  if (yymsg != yymsgbuf)
7992  YYSTACK_FREE (yymsg);
7993 #endif
7994  /* Make sure YYID is used. */
7995  return YYID (yyresult);
7996 }
static QString formatFunction(const UserFunctionCallsite::Ptr &func)
Formats UserFunctionCallsite.
#define YYLAST
static Expression::Ptr createDirAttributeValue(const Expression::List &content, const ParserContext *const parseInfo, const YYLTYPE &sourceLocator)
#define YYMAXDEPTH
static QString formatKeyword(const VariableDeclaration::Ptr &var, const NamePool::Ptr &np)
Formats var appropriately for display.
#define YYINITDEPTH
static const yytype_int16 yycheck[]
static SequenceType::Ptr makeGenericSequenceType(const ItemType::Ptr &itemType, const Cardinality &cardinality)
An object generator for GenericSequenceType.
int type
Definition: qmetatype.cpp:239
unsigned char c[8]
Definition: qnumeric_p.h:62
NamespaceCode LocalNameCode
Definition: qxmlname.h:84
#define YYTERROR
#define yylloc
static Expression::Ptr typeCheckTemplateBody(const Expression::Ptr &body, const SequenceType::Ptr &reqType, const ParserContext *const parseInfo)
The QRegExp class provides pattern matching using regular expressions.
Definition: qregexp.h:61
#define it(className, varName)
#define yyerror
qint16 NamespaceCode
Definition: qxmlname.h:82
qint64 xsInteger
QString formatType(const NamePool::Ptr &np, const T &type)
Formats ItemType and SequenceType.
#define at(className, varName)
static Expression::Ptr findAxisStep(const Expression::Ptr &expr, const bool throughStructures=true)
static const yytype_uint16 yydefact[]
QVector< AttributeHolder > AttributeHolderVector
Definition: qtokenizer_p.h:75
#define YYSTACK_FREE
#define YYID(n)
Expression::Ptr wrapLiteral(const Item &item, const StaticContext::Ptr &context, const SourceLocationReflection *const r)
Creates a Literal that wraps item, and returns it.
Definition: qliteral_p.h:131
static void loadPattern(const Expression::Ptr &matchPattern, TemplatePattern::Vector &ourPatterns, const TemplatePattern::ID id, const PatternPriority priority, const Template::Ptr &temp)
Item toItem(const QExplicitlySharedDataPointer< T > atomicValue)
Definition: qitem_p.h:431
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QUrl class provides a convenient interface for working with URLs.
Definition: qurl.h:61
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QHash class is a template class that provides a hash-table-based dictionary.
Definition: qdatastream.h:66
#define YYEMPTY
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
static Expression::Ptr createSimpleContent(const Expression::Ptr &source, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
xsDouble xsDecimal
static bool isVariableReference(const Expression::ID id)
static ReturnOrderBy * locateReturnClause(const Expression::Ptr &expr)
static Expression::Ptr createPatternPath(const Expression::Ptr &operand1, const Expression::Ptr &operand2, const QXmlNodeModelIndex::Axis axis, const YYLTYPE &sl, const ParserContext *const parseInfo)
Writes operand1 and operand2, two operands in an XSL-T pattern, into an equivalent XPath expression...
QString prefix(const QXmlNamePool &query) const
Returns the prefix.
Definition: qxmlname.cpp:370
static const yytype_int16 yypgoto[]
#define YYSTACK_ALLOC_MAXIMUM
static SequenceType::Ptr quantificationType(const SequenceType::Ptr &type)
static void checkVariableCircularity(const VariableDeclaration::Ptr &var, const Expression::Ptr &checkee, const VariableDeclaration::Type type, FunctionSignature::List &signList, const ParserContext *const parseInfo)
Checks for variable initialization circularity.
#define YYABORT
static const uint Default
Definition: qsplitter_p.h:61
static int sign(int x)
#define YY_REDUCE_PRINT(Rule)
static const yytype_int16 yydefgoto[]
static const yytype_uint8 yyr2[]
QTextStream & reset(QTextStream &stream)
Calls QTextStream::reset() on stream and returns stream.
static void registerNamedTemplate(const QXmlName &name, const Expression::Ptr &body, ParserContext *const parseInfo, const YYLTYPE &sourceLocator, const Template::Ptr &temp)
static bool isEmpty(const char *str)
static const yytype_int16 yypact[]
static QString unknownType()
Centralizes a translation string for the purpose of increasing consistency.
bool contains(const T &value) const
Definition: qset.h:91
const char * name
const QLatin1String XML("http://www.w3.org/XML/1998/namespace")
A Path object defines a path for use by PathView .
static const yytype_int16 yytable[]
void append(const T &t)
Inserts value at the end of the vector.
Definition: qvector.h:573
const_iterator insert(const T &value)
Definition: qset.h:179
static Expression::Ptr createReturnOrderBy(const OrderSpecTransfer::List &orderSpecTransfer, const Expression::Ptr &returnExpr, const OrderBy::Stability stability, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
#define YYEOF
static const yytype_uint16 yyr1[]
static Expression::Ptr createCopyOf(const Expression::Ptr &operand, const ParserContext *const parseInfo, const YYLTYPE &sl)
#define YYDPRINTF(Args)
static Expression::Ptr createIdPatternPath(const Expression::Ptr &operand1, const Expression::Ptr &operand2, const QXmlNodeModelIndex::Axis axis, const YYLTYPE &sl, const ParserContext *const parseInfo)
Performs the same role as createPatternPath(), but is tailored for fn:key() and fn:id().
static void allowedIn(const QueryLanguages allowedLanguages, const ParserContext *const parseInfo, const YYLTYPE &sourceLocator, const bool isInternal=false)
Flags invalid expressions and declarations in the currently parsed language.
#define YYSTYPE
Definition: qtokenizer_p.h:137
#define YYACCEPT
static Expression::Ptr create(const Expression::Ptr &expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
static Expression::Ptr createRootExpression(const ParserContext *const parseInfo, const YYLTYPE &sl)
Creates an Expression that corresponds to /. This is literally fn:root(self::node()) treat as documen...
The QXmlName class represents the name of an XML node, in an efficient, namespace-aware way...
Definition: qxmlname.h:58
#define YYTABLE_NINF
#define yynerrs
static const yytype_uint16 yystos[]
static bool wxsTypeMatches(const SchemaType::Ptr &type, const SchemaType::Ptr &otherType, QSet< SchemaType::Ptr > &visitedTypes, SchemaType::Ptr &conflictingType)
static Expression::Ptr pushVariable(const QXmlName name, const SequenceType::Ptr &seqType, const Expression::Ptr &expr, const VariableDeclaration::Type type, const YYLTYPE &sourceLocator, ParserContext *const parseInfo, const bool checkSource=true)
#define yylval
static Expression::Ptr createSlashSlashPath(const Expression::Ptr &begin, const Expression::Ptr &end, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
Creates a path expression which contains the step // between begin and and end.
#define YYLEX
xsAnyAtomicType numeric xsDuration xsAnyAtomicType xsAnyAtomicType xsAnyAtomicType xsAnyAtomicType xsAnyAtomicType xsAnyAtomicType xsQName
Q_OUTOFLINE_TEMPLATE QPair< T1, T2 > qMakePair(const T1 &x, const T2 &y)
Definition: qpair.h:102
int key
xsAnyAtomicType xsDouble
#define YYFINAL
#define YY_STACK_PRINT(Bottom, Top)
static QString formatExpression(const QString &expr)
QFactoryLoader * l
#define YYPOPSTACK(N)
static QList< QByteArray > enums
Definition: qaxserver.cpp:443
static YYSIZE_T yysyntax_error(char *yyresult, int yystate, int yychar)
static QSourceLocation fromYYLTYPE(const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
Axis
Identify the axes emanating from a node.
static QString prologMessage(const char *const msg)
Centralizes a translation message, for the purpose of consistency and modularization.
static bool isPredicate(const Expression::ID id)
static qreal toDouble(const QChar *&str)
#define YYNTOKENS
#define YYPACT_NINF
QFlags< QXmlQuery::QueryLanguage > QueryLanguages
static QString formatURI(const NamePool::Ptr &np, const QXmlName::NamespaceCode &uri)
Formats uri, that&#39;s considered to be a URI, for display.
Definition: qanyuri_p.h:202
#define yychar
#define YYSIZE_T
#define YY_(msgid)
static const KeyPair *const end
#define YYTRANSLATE(YYX)
static bool isNCName(const QStringRef &ncName)
Determines whether c is a valid instance of production [4]NCName in the XML 1.0 Namespaces specificat...
Definition: qxmlutils.cpp:377
static VariableDeclaration::Ptr variableByName(const QXmlName name, const ParserContext *const parseInfo)
#define YYSTACK_ALLOC
static Expression::Ptr resolveVariable(const QXmlName &name, const YYLTYPE &sourceLocator, ParserContext *const parseInfo, const bool raiseErrorOnUnavailability)
int ImportPrecedence
static void yydestruct(const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, ParserContext *const parseInfo)
static bool isNull(const QVariant::Private *d)
Definition: qvariant.cpp:300
#define text
Definition: qobjectdefs.h:80
#define YYLLOC_DEFAULT(Current, Rhs, N)
static QString formatData(const QXmlNodeModelIndex node)
Definition: qitem_p.h:440
static Expression::Ptr createCompatStore(const Expression::Ptr &expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
#define YY_SYMBOL_PRINT(Title, Type, Value, Location)
void reserve(int size)
Definition: qset.h:241
NamespaceCode PrefixCode
Definition: qxmlname.h:83

◆ yystpcpy()

static char* QPatternist::yystpcpy ( char *  yydest,
const char *  yysrc 
)
static

Definition at line 3175 of file qquerytransformparser.cpp.

Referenced by yysyntax_error(), and yytnamerr().

3182 {
3183  char *yyd = yydest;
3184  const char *yys = yysrc;
3185 
3186  while ((*yyd++ = *yys++) != '\0')
3187  continue;
3188 
3189  return yyd - 1;
3190 }

◆ yystrlen()

static YYSIZE_T QPatternist::yystrlen ( const char *  yystr)
static

Definition at line 3151 of file qquerytransformparser.cpp.

Referenced by yysyntax_error(), and yytnamerr().

3157 {
3158  YYSIZE_T yylen;
3159  for (yylen = 0; yystr[yylen]; yylen++)
3160  continue;
3161  return yylen;
3162 }
#define YYSIZE_T

◆ yysyntax_error()

static YYSIZE_T QPatternist::yysyntax_error ( char *  yyresult,
int  yystate,
int  yychar 
)
static

Definition at line 3250 of file qquerytransformparser.cpp.

Referenced by yyparse().

3251 {
3252  int yyn = yypact[yystate];
3253 
3254  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
3255  return 0;
3256  else
3257  {
3258  int yytype = YYTRANSLATE (yychar);
3259  YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
3260  YYSIZE_T yysize = yysize0;
3261  YYSIZE_T yysize1;
3262  int yysize_overflow = 0;
3263  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
3264  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
3265  int yyx;
3266 
3267 # if 0
3268  /* This is so xgettext sees the translatable formats that are
3269  constructed on the fly. */
3270  YY_("syntax error, unexpected %s");
3271  YY_("syntax error, unexpected %s, expecting %s");
3272  YY_("syntax error, unexpected %s, expecting %s or %s");
3273  YY_("syntax error, unexpected %s, expecting %s or %s or %s");
3274  YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
3275 # endif
3276  char *yyfmt;
3277  char const *yyf;
3278  static char const yyunexpected[] = "syntax error, unexpected %s";
3279  static char const yyexpecting[] = ", expecting %s";
3280  static char const yyor[] = " or %s";
3281  char yyformat[sizeof yyunexpected
3282  + sizeof yyexpecting - 1
3283  + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
3284  * (sizeof yyor - 1))];
3285  char const *yyprefix = yyexpecting;
3286 
3287  /* Start YYX at -YYN if negative to avoid negative indexes in
3288  YYCHECK. */
3289  int yyxbegin = yyn < 0 ? -yyn : 0;
3290 
3291  /* Stay within bounds of both yycheck and yytname. */
3292  int yychecklim = YYLAST - yyn + 1;
3293  int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3294  int yycount = 1;
3295 
3296  yyarg[0] = yytname[yytype];
3297  yyfmt = yystpcpy (yyformat, yyunexpected);
3298 
3299  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3300  if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3301  {
3302  if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
3303  {
3304  yycount = 1;
3305  yysize = yysize0;
3306  yyformat[sizeof yyunexpected - 1] = '\0';
3307  break;
3308  }
3309  yyarg[yycount++] = yytname[yyx];
3310  yysize1 = yysize + yytnamerr (0, yytname[yyx]);
3311  yysize_overflow |= (yysize1 < yysize);
3312  yysize = yysize1;
3313  yyfmt = yystpcpy (yyfmt, yyprefix);
3314  yyprefix = yyor;
3315  }
3316 
3317  yyf = YY_(yyformat);
3318  yysize1 = yysize + yystrlen (yyf);
3319  yysize_overflow |= (yysize1 < yysize);
3320  yysize = yysize1;
3321 
3322  if (yysize_overflow)
3323  return YYSIZE_MAXIMUM;
3324 
3325  if (yyresult)
3326  {
3327  /* Avoid sprintf, as that infringes on the user's name space.
3328  Don't have undefined behavior even if the translation
3329  produced a string with the wrong number of "%s"s. */
3330  char *yyp = yyresult;
3331  int yyi = 0;
3332  while ((*yyp = *yyf) != '\0')
3333  {
3334  if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
3335  {
3336  yyp += yytnamerr (yyp, yyarg[yyi++]);
3337  yyf += 2;
3338  }
3339  else
3340  {
3341  yyp++;
3342  yyf++;
3343  }
3344  }
3345  }
3346  return yysize;
3347  }
3348 }
#define YYLAST
static const yytype_int16 yycheck[]
#define YYTERROR
static YYSIZE_T yystrlen(const char *yystr)
static const yytype_int16 yypact[]
static char * yystpcpy(char *yydest, const char *yysrc)
#define YYSIZE_MAXIMUM
static const char *const yytname[]
#define YYNTOKENS
#define YYPACT_NINF
#define yychar
#define YYSIZE_T
#define YY_(msgid)
#define YYTRANSLATE(YYX)
static YYSIZE_T yytnamerr(char *yyres, const char *yystr)

◆ yytnamerr()

static YYSIZE_T QPatternist::yytnamerr ( char *  yyres,
const char *  yystr 
)
static

Definition at line 3203 of file qquerytransformparser.cpp.

Referenced by yysyntax_error().

3204 {
3205  if (*yystr == '"')
3206  {
3207  YYSIZE_T yyn = 0;
3208  char const *yyp = yystr;
3209 
3210  for (;;)
3211  switch (*++yyp)
3212  {
3213  case '\'':
3214  case ',':
3215  goto do_not_strip_quotes;
3216 
3217  case '\\':
3218  if (*++yyp != '\\')
3219  goto do_not_strip_quotes;
3220  /* Fall through. */
3221  default:
3222  if (yyres)
3223  yyres[yyn] = *yyp;
3224  yyn++;
3225  break;
3226 
3227  case '"':
3228  if (yyres)
3229  yyres[yyn] = '\0';
3230  return yyn;
3231  }
3232  do_not_strip_quotes: ;
3233  }
3234 
3235  if (! yyres)
3236  return yystrlen (yystr);
3237 
3238  return yystpcpy (yyres, yystr) - yyres;
3239 }
static YYSIZE_T yystrlen(const char *yystr)
static char * yystpcpy(char *yydest, const char *yysrc)
#define YYSIZE_T

Variable Documentation

◆ mergeIterator

const MergeIterator QPatternist::mergeIterator
static

Definition at line 493 of file qabstractxmlnodemodel.cpp.

Referenced by QAbstractXmlNodeModel::iterate(), and mergeIterators().

◆ yycheck

const yytype_int16 QPatternist::yycheck[]
static

Definition at line 2561 of file qquerytransformparser.cpp.

◆ yydefact

const yytype_uint16 QPatternist::yydefact[]
static

Definition at line 2113 of file qquerytransformparser.cpp.

◆ yydefgoto

const yytype_int16 QPatternist::yydefgoto[]
static
Initial value:
=
{
-1, 2, 3, 185, 7, 8, 9, 10, 77, 593,
669, 756, 366, 367, 78, 79, 320, 80, 81, 350,
82, 83, 84, 85, 86, 87, 88, 458, 89, 356,
532, 90, 91, 92, 386, 93, 383, 560, 606, 94,
641, 676, 95, 353, 96, 664, 589, 590, 730, 341,
97, 631, 632, 633, 634, 635, 98, 99, 100, 733,
189, 753, 324, 101, 102, 678, 709, 738, 806, 809,
553, 103, 686, 717, 796, 718, 719, 720, 579, 580,
619, 659, 692, 512, 104, 105, 654, 687, 722, 797,
803, 106, 644, 677, 707, 794, 800, 708, 107, 567,
614, 725, 774, 784, 656, 785, 804, 108, 109, 110,
111, 112, 113, 287, 114, 292, 115, 116, 295, 298,
117, 118, 119, 120, 121, 122, 123, 124, 281, 125,
282, 126, 283, 127, 128, 129, 306, 130, 131, 393,
132, 133, 134, 253, 626, 437, 438, 520, 468, 521,
522, 694, 312, 135, 136, 137, 314, 427, 138, 139,
140, 190, 141, 142, 143, 144, 145, 146, 147, 148,
149, 150, 219, 151, 152, 153, 154, 433, 155, 156,
157, 380, 554, 681, 479, 555, 650, 342, 710, 158,
159, 160, 161, 162, 475, 193, 163, 164, 165, 166,
338, 339, 526, 375, 340, 246, 167, 505, 477, 498,
573, 499, 500, 168, 169, 170, 370, 171, 172, 173,
174, 175, 176, 177, 598, 178, 194, 335, 179, 524,
180, 181, 556, 241, 541, 182, 183
}

Definition at line 2200 of file qquerytransformparser.cpp.

◆ yypact

const yytype_int16 QPatternist::yypact[]
static

Definition at line 2231 of file qquerytransformparser.cpp.

◆ yypgoto

const yytype_int16 QPatternist::yypgoto[]
static
Initial value:
=
{
-668, -668, -668, -668, -668, -668, -668, 613, -668, -668,
-668, -668, -668, -668, -668, -668, -285, -668, -668, -668,
-668, -668, -668, -668, -668, 418, -668, 5, -668, -668,
-668, -668, -668, -668, -668, -668, -668, 142, -668, -668,
-668, -668, -668, -668, -668, -668, -668, 4, -668, -51,
-668, -668, -35, -668, -397, -340, -47, 317, -255, -668,
-668, -668, -641, -668, -619, -668, -668, -174, -668, -668,
-142, -583, -668, -159, -668, -657, -109, 216, -668, 27,
-668, -668, -668, -668, -668, -668, -668, -668, -157, -668,
-668, -668, -668, -668, -152, -668, -668, -667, -668, -668,
-125, -668, -668, -668, -668, -668, -668, -668, -668, 387,
385, 131, 366, -668, 397, -668, 361, 359, -668, -668,
362, -668, -668, -668, 535, -668, -668, -668, -668, -668,
-668, -668, -668, -668, -668, -668, -245, -668, 526, -668,
-668, 279, -294, -668, -668, 313, -668, 194, -91, 85,
-668, -668, -668, -87, -668, -668, -668, -668, -668, -668,
-668, -668, -668, -668, -175, -668, -668, -668, -668, -668,
-668, -668, -183, -668, -668, -668, -538, -668, -668, -42,
-668, -668, -668, -668, 67, -668, -668, -327, -668, -668,
-668, -668, -668, -668, -668, 3, -668, -668, -668, -668,
-668, -668, -668, -668, 458, -668, -668, 252, -341, -412,
-668, -668, -55, -394, -668, -668, -668, -668, -668, -668,
-304, -668, -668, 467, 124, 469, -11, -668, -24, -170,
321, -668, 639, -668, -308, 15, -30
}

Definition at line 2318 of file qquerytransformparser.cpp.

◆ yyr1

const yytype_uint16 QPatternist::yyr1[]
static

Definition at line 2005 of file qquerytransformparser.cpp.

◆ yyr2

const yytype_uint8 QPatternist::yyr2[]
static

Definition at line 2058 of file qquerytransformparser.cpp.

◆ yystos

const yytype_uint16 QPatternist::yystos[]
static

Definition at line 2773 of file qquerytransformparser.cpp.

◆ yytable

const yytype_int16 QPatternist::yytable[]
static

Definition at line 2351 of file qquerytransformparser.cpp.

◆ yytname

const char* const QPatternist::yytname[]
static

Definition at line 1880 of file qquerytransformparser.cpp.

◆ yytranslate

const yytype_uint8 QPatternist::yytranslate[]
static

Definition at line 1578 of file qquerytransformparser.cpp.