Trait/Object

io.dylemma.spac

Parser

Related Docs: object Parser | package spac

Permalink

trait Parser[+Out] extends AbstractHandlerFactory[XMLEvent, Out, Try, [-in, +out]Parser[out]]

A HandlerFactory specialized for XMLEvents, which produces results wrapped in a Try. Parsers can be combined and run to process complex XML structures.

Out

Result type

Self Type
Parser[Out]
Source
Parser.scala
Linear Supertypes
AbstractHandlerFactory[XMLEvent, Out, Try, [-in, +out]Parser[out]], HandlerFactory[XMLEvent, Try[Out]], (Any) ⇒ HandlerFactory[XMLEvent, Try[Out]], AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Parser
  2. AbstractHandlerFactory
  3. HandlerFactory
  4. Function1
  5. AnyRef
  6. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def makeHandler(): Handler[XMLEvent, Try[Out]]

    Permalink
    Definition Classes
    HandlerFactory

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from Parser[Out] to any2stringadd[Parser[Out]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (Parser[Out], B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from Parser[Out] to ArrowAssoc[Parser[Out]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  6. def and[O2](p2: Parser[O2]): Combined2[Out, O2]

    Permalink
  7. def andThen[A](g: (HandlerFactory[XMLEvent, Try[Out]]) ⇒ A): (Any) ⇒ A

    Permalink
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  8. def apply(v1: Any): HandlerFactory[XMLEvent, Try[Out]]

    Permalink

    Always returns this, so that this can be passed to Splitter#through

    Always returns this, so that this can be passed to Splitter#through

    Definition Classes
    HandlerFactory → Function1
  9. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  10. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  11. def compose[A](g: (A) ⇒ Any): (A) ⇒ HandlerFactory[XMLEvent, Try[Out]]

    Permalink
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  12. def ensuring(cond: (Parser[Out]) ⇒ Boolean, msg: ⇒ Any): Parser[Out]

    Permalink
    Implicit information
    This member is added by an implicit conversion from Parser[Out] to Ensuring[Parser[Out]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. def ensuring(cond: (Parser[Out]) ⇒ Boolean): Parser[Out]

    Permalink
    Implicit information
    This member is added by an implicit conversion from Parser[Out] to Ensuring[Parser[Out]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  14. def ensuring(cond: Boolean, msg: ⇒ Any): Parser[Out]

    Permalink
    Implicit information
    This member is added by an implicit conversion from Parser[Out] to Ensuring[Parser[Out]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  15. def ensuring(cond: Boolean): Parser[Out]

    Permalink
    Implicit information
    This member is added by an implicit conversion from Parser[Out] to Ensuring[Parser[Out]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  16. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  18. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  19. object followedBy extends FollowedBy[Parser, Out]

    Permalink

    An intermediate object with an apply and flatMap that both create a sequenced Parser which combines this Parser with a function to create the next one.

    An intermediate object with an apply and flatMap that both create a sequenced Parser which combines this Parser with a function to create the next one.

    Examples:

    val p1: Parser[A] = /* ... */
    def getP2(p1Result: A): Parser[B] = /* ... */
    val combined: Parser[B] = p1.followedBy(getP2)
    
    // alternative `flatMap` syntax
    val combined: Parser[B] = for {
      p1Result <- p1.followedBy
      p2Result <- getP2(p1Result)
    } yield p2Result

    An example of where this is useful is when a parser for XML element depends on values parsed from one of its previous siblings, but where you don't want to wait until the end of their parent element before they can be combined.

    returns

    An intermediate object which has an apply and flatMap that can be used to combine this Parser and another in a sequence.

  20. object followedByStream extends FollowedBy[[+T2]Transformer[XMLEvent, T2], Out]

    Permalink

    An intermediate object that can be used to create a Transformer from result of this Parser.

    An intermediate object that can be used to create a Transformer from result of this Parser.

    Examples:

    val p1: Parser[A] = /* ... */
    def getP2Stream(p1Result: A): Transformer[XMLEvent, B] = /* ... */
    val combined: Transformer[XMLEvent, B] = p1.andThenStream(getP2Stream)
    
    // alternative `flatMap` syntax
    val combined: Transformer[XMLEvent, B] = for {
      p1Result <- p1.andThenStream
      p2Result <- getP2Stream(p1Result)
    } yield p2Result

    An example of where this is useful is when an XML element contains some "dictionary" object at the beginning, followed by a sequence of "data" objects which reference the dictionary. For large sequences, combining them to a List (to use with Parser's and combiners) is undesireable; we can use this approach to avoid doing so.

    returns

    An intermediate object which has an apply and flatMap that can be used to combine this Parser and a Transformer in a sequence.

  21. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from Parser[Out] to StringFormat[Parser[Out]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  22. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  23. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  24. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  25. def map[B](f: (Out) ⇒ B): Parser[B]

    Permalink

    Create a new handler factory whose results are transformed by the given function f.

    Create a new handler factory whose results are transformed by the given function f.

    B

    The mapped result type

    f

    The function to apply to each result

    returns

    A new handler factory which derives its results by applying f to the results generated by this handler factory

    Definition Classes
    AbstractHandlerFactory
    See also

    syntax.FunctorSyntax.NestedFunctorOps#mapF for when Out is a container e.g. Option or List

  26. def mapResult[B](f: (Try[Out]) ⇒ Try[B]): Parser[B]

    Permalink

    Create a new parser whose result containers are transformed by the given function f.

    Create a new parser whose result containers are transformed by the given function f. For Consumers, which use Id as the result container type, mapResult is equivalent to map.

    B

    The mapped result type

    f

    The function applied to each result container

    returns

    a new Parser which derives its results by applying f to the result containers generated by this parser

    Definition Classes
    ParserAbstractHandlerFactory
  27. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  28. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  29. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  30. def parse[XML](xml: XML)(implicit consumeXML: ConsumableLike[XML, XMLEvent]): Try[Out]

    Permalink
  31. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  32. def toConsumer: Consumer[XMLEvent, Try[Out]]

    Permalink

    If a Parser is context-independent, it can be treated to a Consumer.

    If a Parser is context-independent, it can be treated to a Consumer.

    returns

    A representation of this parser as a Consumer

  33. def toString(): String

    Permalink
    Definition Classes
    Function1 → AnyRef → Any
  34. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  37. def ~[O2](p2: Parser[O2]): Combined2[Out, O2]

    Permalink
  38. def [B](y: B): (Parser[Out], B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from Parser[Out] to ArrowAssoc[Parser[Out]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from AbstractHandlerFactory[XMLEvent, Out, Try, [-in, +out]Parser[out]]

Inherited from HandlerFactory[XMLEvent, Try[Out]]

Inherited from (Any) ⇒ HandlerFactory[XMLEvent, Try[Out]]

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from Parser[Out] to any2stringadd[Parser[Out]]

Inherited by implicit conversion StringFormat from Parser[Out] to StringFormat[Parser[Out]]

Inherited by implicit conversion Ensuring from Parser[Out] to Ensuring[Parser[Out]]

Inherited by implicit conversion ArrowAssoc from Parser[Out] to ArrowAssoc[Parser[Out]]

Ungrouped