Packages

package ast

Abstract syntax tree of XPath expressions, as produced by the parsers specified in the 'parse' package.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ast
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. sealed trait AbbrevForwardStep extends ForwardStep
  2. sealed trait AdditionOp extends XPathElem with LeafElem
  3. sealed trait AdditiveExpr extends SimpleRangeExpr
  4. sealed trait AndExpr extends SimpleOrExpr
  5. sealed trait Argument extends XPathElem
  6. final case class ArgumentList(arguments: IndexedSeq[Argument]) extends Postfix with Product with Serializable
  7. sealed trait ArrayConstructor extends PrimaryExpr
  8. sealed trait ArrayTest extends ItemType
  9. sealed trait ArrowExpr extends SimpleCastExpr
  10. final case class ArrowFunctionCall(arrowFunctionSpecifier: ArrowFunctionSpecifier, argumentList: ArgumentList) extends XPathElem with Product with Serializable
  11. sealed trait ArrowFunctionSpecifier extends XPathElem
  12. final case class AtomicOrUnionType(tpe: EQName) extends ItemType with LeafElem with Product with Serializable
  13. final case class AttributeAxisAbbrevForwardStep(nodeTest: NodeTest) extends AbbrevForwardStep with Product with Serializable
  14. final case class AttributeNameAndTypeTest(name: EQName, tpe: EQName) extends AttributeTest with LeafElem with Product with Serializable
  15. final case class AttributeNameTest(name: EQName) extends AttributeTest with LeafElem with Product with Serializable
  16. sealed trait AttributeTest extends KindTest
  17. final case class AttributeTypeTest(tpe: EQName) extends AttributeTest with LeafElem with Product with Serializable
  18. sealed trait AxisStep extends StepExpr

    Axis step.

    Axis step. For example: "child::book[@pageCount > 800]".

  19. final case class BracedUriLiteral(namespaceOption: Option[String]) extends Product with Serializable

    Braced URI literal.

  20. sealed trait CastExpr extends SimpleCastableExpr
  21. sealed trait CastableExpr extends SimpleTreatExpr
  22. sealed trait Comp extends XPathElem with LeafElem
  23. sealed trait ComparisonExpr extends SimpleAndExpr

    Comparison expression, where the optional comparison operator is a value comparison operator, general comparison operator or node comparison operator.

  24. final case class CompoundAdditiveExpr(firstExpr: MultiplicativeExpr, operatorExprPairs: IndexedSeq[(AdditionOp, MultiplicativeExpr)]) extends AdditiveExpr with Product with Serializable
  25. final case class CompoundAndExpr(comparisonExprs: IndexedSeq[ComparisonExpr]) extends AndExpr with Product with Serializable
  26. final case class CompoundArrowExpr(unaryExpr: UnaryExpr, arrowFunctionCalls: IndexedSeq[ArrowFunctionCall]) extends ArrowExpr with Product with Serializable
  27. final case class CompoundCastExpr(arrowExpr: ArrowExpr, singleType: SingleType) extends CastExpr with Product with Serializable
  28. final case class CompoundCastableExpr(castExpr: CastExpr, singleType: SingleType) extends CastableExpr with Product with Serializable
  29. final case class CompoundComparisonExpr(stringConcatExpr1: StringConcatExpr, comp: Comp, stringConcatExpr2: StringConcatExpr) extends ComparisonExpr with Product with Serializable
  30. final case class CompoundExpr(exprSingleSeq: IndexedSeq[ExprSingle]) extends Expr with Product with Serializable
  31. final case class CompoundInstanceOfExpr(treatExpr: TreatExpr, sequenceType: SequenceType) extends InstanceOfExpr with Product with Serializable
  32. final case class CompoundIntersectExceptExpr(firstExpr: InstanceOfExpr, operatorExprPairs: IndexedSeq[(IntersectExceptOp, InstanceOfExpr)]) extends IntersectExceptExpr with Product with Serializable
  33. final case class CompoundMultiplicativeExpr(firstExpr: UnionExpr, operatorExprPairs: IndexedSeq[(MultiplicativeOp, UnionExpr)]) extends MultiplicativeExpr with Product with Serializable
  34. final case class CompoundOrExpr(andExprs: IndexedSeq[AndExpr]) extends OrExpr with Product with Serializable
  35. final case class CompoundPostfixExpr(primaryExpr: PrimaryExpr, postfixes: IndexedSeq[Postfix]) extends PostfixExpr with Product with Serializable
  36. final case class CompoundRangeExpr(additiveExpr1: AdditiveExpr, additiveExpr2: AdditiveExpr) extends RangeExpr with Product with Serializable
  37. final case class CompoundRelativePathExpr(firstExpr: StepExpr, operatorExprPairs: IndexedSeq[(StepOp, StepExpr)]) extends RelativePathExpr with Product with Serializable
  38. final case class CompoundSimpleMapExpr(pathExprs: IndexedSeq[PathExpr]) extends SimpleMapExpr with Product with Serializable
  39. final case class CompoundStringConcatExpr(rangeExprs: IndexedSeq[RangeExpr]) extends StringConcatExpr with Product with Serializable
  40. final case class CompoundTreatExpr(castableExpr: CastableExpr, sequenceType: SequenceType) extends TreatExpr with Product with Serializable
  41. final case class CompoundUnaryExpr(ops: IndexedSeq[UnaryOp], valueExpr: ValueExpr) extends UnaryExpr with Product with Serializable
  42. final case class CompoundUnionExpr(intersectExceptExprs: IndexedSeq[IntersectExceptExpr]) extends UnionExpr with Product with Serializable
  43. final case class CurlyArrayConstructor(expr: EnclosedExpr) extends ArrayConstructor with Product with Serializable
  44. final case class DataPITest(data: StringLiteral) extends PITest with Product with Serializable
  45. final case class DecimalLiteral(value: BigDecimal) extends NumericLiteral with LeafElem with Product with Serializable
  46. sealed trait DocumentTest extends KindTest
  47. final case class DocumentTestContainingElementTest(elementTest: ElementTest) extends DocumentTest with Product with Serializable
  48. final case class DocumentTestContainingSchemaElementTest(schemaElementTest: SchemaElementTest) extends DocumentTest with Product with Serializable
  49. final case class DoubleLiteral(value: Double) extends NumericLiteral with LeafElem with Product with Serializable
  50. sealed trait EQName extends AnyRef

    EQName, so either a URIQualifiedName or a QName.

  51. final case class EQNameAsArrowFunctionSpecifier(eqName: EQName) extends ArrowFunctionSpecifier with LeafElem with Product with Serializable
  52. final case class ElementNameAndTypeTest(name: EQName, tpe: EQName) extends ElementTest with LeafElem with Product with Serializable
  53. final case class ElementNameTest(name: EQName) extends ElementTest with LeafElem with Product with Serializable
  54. sealed trait ElementTest extends KindTest
  55. final case class ElementTypeTest(tpe: EQName) extends ElementTest with LeafElem with Product with Serializable
  56. final case class EnclosedExpr(exprOption: Option[Expr]) extends XPathElem with Product with Serializable

    Optional expression enclosed in braces.

  57. final case class ExactlyOneSequenceType(itemType: ItemType) extends SequenceType with Product with Serializable
  58. sealed trait Expr extends XPathExpr

    Expression, which is a sequence of 1 or more ExprSingle objects, separated by commas.

  59. sealed trait ExprSingle extends SimpleExpr

    Expression-single, that is, an expression without any top-level commas.

    Expression-single, that is, an expression without any top-level commas. Most XPath expressions are expression-singles.

  60. final case class ExprSingleArgument(exprSingle: ExprSingle) extends Argument with Product with Serializable
  61. final case class ForExpr(simpleForBindings: IndexedSeq[SimpleForBinding], returnExpr: ExprSingle) extends ExprSingle with VariableIntroducingExpr with Product with Serializable
  62. sealed trait ForwardAxis extends XPathElem with LeafElem
  63. final case class ForwardAxisStep(step: ForwardStep, predicateList: IndexedSeq[Predicate]) extends AxisStep with Product with Serializable
  64. sealed trait ForwardStep extends XPathElem
  65. final case class FunctionCall(functionName: EQName, argumentList: ArgumentList) extends PrimaryExpr with Product with Serializable
  66. sealed trait FunctionItemExpr extends PrimaryExpr
  67. sealed trait FunctionTest extends ItemType
  68. sealed trait GeneralComp extends Comp
  69. final case class IfExpr(condition: Expr, thenExpr: ExprSingle, elseExpr: ExprSingle) extends ExprSingle with Product with Serializable
  70. final case class InlineFunctionExpr(paramListOption: Option[ParamList], resultTypeOption: Option[SequenceType], body: EnclosedExpr) extends FunctionItemExpr with Product with Serializable
  71. sealed trait InstanceOfExpr extends SimpleIntersectExceptExpr
  72. final case class IntegerLiteral(value: BigInt) extends NumericLiteral with LeafElem with Product with Serializable
  73. sealed trait IntersectExceptExpr extends SimpleUnionExpr

    Intersect or except expression, optionally using the "intersect" or "except" operator.

  74. sealed trait IntersectExceptOp extends XPathElem with LeafElem
  75. sealed trait ItemType extends XPathElem
  76. sealed trait KeySpecifier extends XPathElem
  77. sealed trait KindTest extends NodeTest
  78. final case class KindTestItemType(kindTest: KindTest) extends ItemType with Product with Serializable
  79. sealed trait LeafElem extends XPathElem

    Any leaf element in the AST of an XPath expression.

  80. final case class LetExpr(simpleLetBindings: IndexedSeq[SimpleLetBinding], returnExpr: ExprSingle) extends ExprSingle with VariableIntroducingExpr with Product with Serializable
  81. sealed trait Literal extends PrimaryExpr
  82. final case class LocalNameWildcard(localName: NCName) extends Wildcard with LeafElem with Product with Serializable
  83. final case class MapConstructor(entries: IndexedSeq[MapConstructorEntry]) extends PrimaryExpr with Product with Serializable
  84. final case class MapConstructorEntry(keyExpr: ExprSingle, valueExpr: ExprSingle) extends XPathElem with Product with Serializable
  85. sealed trait MapTest extends ItemType
  86. sealed trait MultiplicativeExpr extends SimpleAdditiveExpr
  87. sealed trait MultiplicativeOp extends XPathElem with LeafElem
  88. final case class NCName(name: String) extends Product with Serializable

    NCName, that is, a non-colon name.

  89. sealed trait NameTest extends NodeTest
  90. final case class NamedFunctionRef(functionName: EQName, arity: BigInt) extends FunctionItemExpr with LeafElem with Product with Serializable
  91. final case class NamedKeySpecifier(ncName: NCName) extends KeySpecifier with LeafElem with Product with Serializable
  92. final case class NamespaceWildcard(bracedUriLiteral: BracedUriLiteral) extends Wildcard with LeafElem with Product with Serializable
  93. final case class NillableElementNameAndTypeTest(name: EQName, tpe: EQName) extends ElementTest with LeafElem with Product with Serializable
  94. final case class NillableElementTypeTest(tpe: EQName) extends ElementTest with LeafElem with Product with Serializable
  95. sealed trait NodeComp extends Comp
  96. sealed trait NodeTest extends XPathElem
  97. final case class NonAbbrevForwardStep(forwardAxis: ForwardAxis, nodeTest: NodeTest) extends ForwardStep with Product with Serializable
  98. final case class NonAbbrevReverseStep(reverseAxis: ReverseAxis, nodeTest: NodeTest) extends ReverseStep with Product with Serializable
  99. final case class NonEmptySingleType(name: EQName) extends SingleType with LeafElem with Product with Serializable
  100. sealed trait NumericLiteral extends Literal
  101. final case class OneOrMoreSequenceType(itemType: ItemType) extends SequenceType with Product with Serializable
  102. sealed trait OrExpr extends ExprSingle
  103. sealed trait PITest extends KindTest
  104. final case class Param(paramName: EQName, typeDeclarationOption: Option[TypeDeclaration]) extends XPathElem with Product with Serializable
  105. final case class ParamList(params: IndexedSeq[Param]) extends XPathElem with Product with Serializable
  106. final case class ParenthesizedExpr(exprOption: Option[Expr]) extends PrimaryExpr with Product with Serializable
  107. final case class ParenthesizedExprAsArrowFunctionSpecifier(parenthesizedExpr: ParenthesizedExpr) extends ArrowFunctionSpecifier with Product with Serializable
  108. final case class ParenthesizedExprKeySpecifier(parenthesizedExpr: ParenthesizedExpr) extends KeySpecifier with Product with Serializable
  109. final case class ParenthesizedItemType(itemType: ItemType) extends ItemType with Product with Serializable
  110. sealed trait PathExpr extends SimpleSimpleMapExpr

    Path expression, so a relative path expression possibly preceded by "/" or "//" (or the expression "/" itself).

    Path expression, so a relative path expression possibly preceded by "/" or "//" (or the expression "/" itself). Path expressions are used to locate nodes within trees.

  111. final case class PathExprStartingWithDoubleSlash(relativePathExpr: RelativePathExpr) extends PathExpr with Product with Serializable
  112. final case class PathExprStartingWithSingleSlash(relativePathExpr: RelativePathExpr) extends PathExpr with Product with Serializable
  113. final case class PositionalKeySpecifier(integerLiteral: IntegerLiteral) extends KeySpecifier with Product with Serializable
  114. sealed trait Postfix extends XPathElem
  115. sealed trait PostfixExpr extends StepExpr

    Postfix expression, which is a primary expression succeeded by 0 or more predicates, arguments lists and/or lookups.

  116. final case class PostfixLookup(keySpecifier: KeySpecifier) extends Postfix with Product with Serializable
  117. final case class PotentiallyEmptySingleType(name: EQName) extends SingleType with LeafElem with Product with Serializable
  118. final case class Predicate(expr: Expr) extends Postfix with Product with Serializable
  119. final case class PrefixWildcard(prefix: NCName) extends Wildcard with LeafElem with Product with Serializable
  120. sealed trait PrimaryExpr extends SimplePostfixExpr

    Primary expression, which are the basic primitives of the language.

    Primary expression, which are the basic primitives of the language. Examples are literals, variable references, function calls etc. Note that primary expressions can be rather simple but they do not have to be simple. For example, function calls can have arguments that are themselves quite complex expressions.

  121. final case class QuantifiedExpr(quantifier: Quantifier, simpleBindings: IndexedSeq[SimpleBindingInQuantifiedExpr], satisfiesExpr: ExprSingle) extends ExprSingle with VariableIntroducingExpr with Product with Serializable
  122. sealed trait Quantifier extends XPathElem with LeafElem
  123. sealed trait RangeExpr extends SimpleStringConcatExpr

    Range expression, where the optional range uses keyword "to" as operator.

  124. sealed trait RelativePathExpr extends PathExpr

    Relative path expression, consisting of a number of step expressions separated by step operators ("/" and "//").

  125. sealed trait ReverseAxis extends XPathElem with LeafElem
  126. final case class ReverseAxisStep(step: ReverseStep, predicateList: IndexedSeq[Predicate]) extends AxisStep with Product with Serializable
  127. sealed trait ReverseStep extends XPathElem
  128. final case class SchemaAttributeTest(name: EQName) extends KindTest with LeafElem with Product with Serializable
  129. final case class SchemaElementTest(name: EQName) extends KindTest with LeafElem with Product with Serializable
  130. sealed trait SequenceType extends XPathElem
  131. final case class SimpleAbbrevForwardStep(nodeTest: NodeTest) extends AbbrevForwardStep with Product with Serializable
  132. sealed trait SimpleAdditiveExpr extends AdditiveExpr
  133. sealed trait SimpleAndExpr extends AndExpr
  134. sealed trait SimpleArrowExpr extends ArrowExpr
  135. final case class SimpleBindingInQuantifiedExpr(varName: EQName, expr: ExprSingle) extends VariableBinding with Product with Serializable
  136. sealed trait SimpleCastExpr extends CastExpr
  137. sealed trait SimpleCastableExpr extends CastableExpr
  138. sealed trait SimpleComparisonExpr extends ComparisonExpr
  139. sealed trait SimpleExpr extends Expr
  140. final case class SimpleForBinding(varName: EQName, expr: ExprSingle) extends VariableBinding with Product with Serializable
  141. sealed trait SimpleInstanceOfExpr extends InstanceOfExpr
  142. sealed trait SimpleIntersectExceptExpr extends IntersectExceptExpr
  143. final case class SimpleLetBinding(varName: EQName, expr: ExprSingle) extends VariableBinding with Product with Serializable
  144. sealed trait SimpleMapExpr extends ValueExpr

    Simple map expression, using the optional map operator ("!").

  145. sealed trait SimpleMultiplicativeExpr extends MultiplicativeExpr
  146. final case class SimpleNameTest(name: EQName) extends NameTest with LeafElem with Product with Serializable
  147. sealed trait SimpleOrExpr extends OrExpr
  148. sealed trait SimplePostfixExpr extends PostfixExpr
  149. sealed trait SimpleRangeExpr extends RangeExpr
  150. sealed trait SimpleRelativePathExpr extends RelativePathExpr
  151. sealed trait SimpleSimpleMapExpr extends SimpleMapExpr
  152. sealed trait SimpleStringConcatExpr extends StringConcatExpr
  153. sealed trait SimpleTreatExpr extends TreatExpr
  154. sealed trait SimpleUnaryExpr extends UnaryExpr
  155. sealed trait SimpleUnionExpr extends UnionExpr
  156. sealed trait SingleType extends XPathElem
  157. final case class SquareArrayConstructor(members: IndexedSeq[ExprSingle]) extends ArrayConstructor with Product with Serializable
  158. sealed trait StepExpr extends SimpleRelativePathExpr

    Single step in an absolute or relative path expression.

    Single step in an absolute or relative path expression. Note that step expressions are either postfix expressions or axis steps.

  159. sealed trait StepOp extends XPathElem with LeafElem
  160. sealed trait StringConcatExpr extends SimpleComparisonExpr

    String concatenation expression, where the optional string concatenation uses the "||" operator.

  161. final case class StringLiteral(value: String) extends Literal with LeafElem with Product with Serializable
  162. final case class TargetPITest(target: NCName) extends PITest with LeafElem with Product with Serializable
  163. sealed trait TreatExpr extends SimpleInstanceOfExpr
  164. final case class TypeDeclaration(tpe: SequenceType) extends XPathElem with Product with Serializable
  165. final case class TypedArrayTest(elementType: SequenceType) extends ArrayTest with Product with Serializable
  166. final case class TypedFunctionTest(argumentTypes: IndexedSeq[SequenceType], resultType: SequenceType) extends FunctionTest with Product with Serializable
  167. final case class TypedMapTest(keyType: AtomicOrUnionType, valueType: SequenceType) extends MapTest with Product with Serializable
  168. sealed trait UnaryExpr extends SimpleArrowExpr
  169. final case class UnaryLookup(keySpecifier: KeySpecifier) extends PrimaryExpr with Product with Serializable
  170. sealed trait UnaryOp extends XPathElem with LeafElem
  171. sealed trait UnionExpr extends SimpleMultiplicativeExpr

    Union expression, where the optional union uses operator "union" or "|".

  172. sealed trait ValueComp extends Comp
  173. sealed trait ValueExpr extends SimpleUnaryExpr
  174. final case class VarRef(varName: EQName) extends PrimaryExpr with LeafElem with Product with Serializable
  175. final case class VarRefAsArrowFunctionSpecifier(varRef: VarRef) extends ArrowFunctionSpecifier with Product with Serializable
  176. sealed trait VariableBinding extends XPathElem

    Binding of a variable name to an expression.

  177. sealed trait VariableIntroducingExpr extends XPathElem

    XPathElem that can introduce one or more variable bindings.

  178. sealed trait Wildcard extends NameTest
  179. sealed trait XPathElem extends ElemLike[XPathElem]

    XPath 3.1 AST.

    XPath 3.1 AST. The root of the type hierarchy is XPathElem. It offers the ElemApi query API.

    The requirements on this AST are as follows:

    • It must represent the syntax tree of a successfully parsed XPath expression
    • It is not annotated with more semantic information, like type information that is not included in the XPath expression
    • It does not know anything about the context in which it runs, like bound namespaces etc.
    • It is rich enough to be able to serialize the AST back to XPath, knowing exactly where to place parentheses, braces, etc.
    • It is rich enough to contain operator precedence in the AST itself
    • It must be readable in that object composition trees are not unnecessarily deep and therefore hard to comprehend
    • Serialization of the AST to XPath may lead to differences in whitespace (and operator aliases), but other than that the result must be the same
    • The AST class hierarchy does not have to use the exact same names as the XPath grammar
    • Instances of the AST classes are easy to create in an ad-hoc manner, so they contain no parsing state
    • The AST classes are case classes, with value equality and good support for pattern matching

    It would be natural for the AST types to have IS-A relationships modeled as type inheritance, and HAS-A relationships modeled as composition. Where feasible, this approach has been followed.

    Having such an AST of a successfully parsed XPath expression, it must be easy to reliably find used namespace prefixes, for example.

    TODO Improve several class names.

  180. sealed trait XPathExpr extends XPathElem

    XPath expression.

  181. final case class ZeroOrMoreSequenceType(itemType: ItemType) extends SequenceType with Product with Serializable
  182. final case class ZeroOrOneSequenceType(itemType: ItemType) extends SequenceType with Product with Serializable

Value Members

  1. object AbbrevReverseStep extends ReverseStep with Product with Serializable
  2. object AdditionOp
  3. object AdditiveExpr
  4. object AndExpr
  5. object AnyArrayTest extends ArrayTest with LeafElem with Product with Serializable
  6. object AnyAttributeTest extends AttributeTest with LeafElem with Product with Serializable
  7. object AnyElementTest extends ElementTest with LeafElem with Product with Serializable
  8. object AnyFunctionTest extends FunctionTest with LeafElem with Product with Serializable
  9. object AnyItemType extends ItemType with LeafElem with Product with Serializable
  10. object AnyKindTest extends KindTest with LeafElem with Product with Serializable
  11. object AnyMapTest extends MapTest with LeafElem with Product with Serializable
  12. object AnyWildcard extends Wildcard with LeafElem with Product with Serializable
  13. object ArgumentPlaceholder extends Argument with LeafElem with Product with Serializable
  14. object ArrowExpr
  15. object BracedUriLiteral extends Serializable
  16. object CastExpr
  17. object CastableExpr
  18. object CommentTest extends KindTest with LeafElem with Product with Serializable
  19. object ContextItemExpr extends PrimaryExpr with LeafElem with Product with Serializable
  20. object EQName
  21. object EmptySequenceType extends SequenceType with LeafElem with Product with Serializable
  22. object Expr
  23. object ForwardAxis
  24. object GeneralComp
  25. object InstanceOfExpr
  26. object IntersectExceptExpr
  27. object IntersectExceptOp
  28. object MultiplicativeExpr
  29. object MultiplicativeOp
  30. object NCName extends Serializable
  31. object Names

    Names, as per the XML specification.

    Names, as per the XML specification. See for example https://www.w3.org/TR/REC-xml/#NT-Name.

    Only characters in the Unicode BMP (max. ￿) are considered. So the range from #x10000 to #xEFFFF is not recognized as valid name characters in this implementation.

    The functions of this class must be fast, because they are typically called very many times during parsing of XPath expressions.

    Classes like NCName lean on this object. An NCName is an XML name without colon.

  32. object NamespaceNodeTest extends KindTest with LeafElem with Product with Serializable
  33. object NodeComp
  34. object OrExpr
  35. object PostfixExpr
  36. object Quantifier
  37. object RelativePathExpr
  38. object ReverseAxis
  39. object SimpleDocumentTest extends DocumentTest with LeafElem with Product with Serializable
  40. object SimpleMapExpr
  41. object SimplePITest extends PITest with LeafElem with Product with Serializable
  42. object SlashOnlyPathExpr extends PathExpr with LeafElem with Product with Serializable
  43. object StepOp
  44. object StringConcatExpr
  45. object TextTest extends KindTest with LeafElem with Product with Serializable
  46. object TreatExpr
  47. object UnaryExpr
  48. object UnaryOp
  49. object UnionExpr
  50. object ValueComp
  51. object WildcardKeySpecifier extends KeySpecifier with LeafElem with Product with Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped