Packages

  • package root
    Definition Classes
    root
  • package io
    Definition Classes
    root
  • package dylemma
    Definition Classes
    io
  • package spac

    SPaC (short for "Streaming Parser Combinators") is a library for building stream consumers in a declarative style, specialized for tree-like data types like XML and JSON.

    SPaC (short for "Streaming Parser Combinators") is a library for building stream consumers in a declarative style, specialized for tree-like data types like XML and JSON.

    Many utilities for handling XML and JSON data involve parsing the entire "document" to some DOM model, then inspecting and transforming that model to extract information. The downside to these utilities is that when the document is very large, the DOM may not fit in memory. The workaround for this type of problem is to treat the document as a stream of "events", e.g. "StartElement" and "EndElement" for XML, or "StartObject" and "EndObject" for JSON. The downside to this workaround is that writing code to handle these streams can be complicated and error-prone, especially when the DOM is complicated.

    SPaC's goal is to drastically simplify the process of creating code to handle these streams.

    This package contains the "core" SPaC traits; Parser, Transformer, Splitter, and ContextMatcher.

    See the xml and json subpackages (provided by the xml-spac and json-spac libraries respectively) for specific utilities related to handling XML and JSON event streams.

    Definition Classes
    dylemma
  • package interop
    Definition Classes
    spac
  • package fs2

    Provides implicits to allow for interop between the core SPaC classes and fs2 / cats-effect.

    Provides implicits to allow for interop between the core SPaC classes and fs2 / cats-effect.

    - Parser gets toPipe and parseF - Transformer gets toPipe - Source gets toResource and toStream

    Definition Classes
    interop
  • ParserFs2Ops
  • SourceFs2Ops
  • TransformerFs2Ops

implicit final class ParserFs2Ops[In, Out] extends AnyVal

Since Parser is by design a stream consumer, we can provide the parseF helper which consumes a fs2.Stream in an effectful way. We can also provide the toPipe method, which transforms an input fs2.Stream to a new stream which emits exactly one value or raises an error.

Source
package.scala
Linear Supertypes
AnyVal, Any
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. ParserFs2Ops
  2. AnyVal
  3. 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

Instance Constructors

  1. new ParserFs2Ops(parser: Parser[In, Out])

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    Any
  2. final def ##(): Int
    Definition Classes
    Any
  3. def +(other: String): String
    Implicit
    This member is added by an implicit conversion from ParserFs2Ops[In, Out] toany2stringadd[ParserFs2Ops[In, Out]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (ParserFs2Ops[In, Out], B)
    Implicit
    This member is added by an implicit conversion from ParserFs2Ops[In, Out] toArrowAssoc[ParserFs2Ops[In, Out]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def ensuring(cond: (ParserFs2Ops[In, Out]) => Boolean, msg: => Any): ParserFs2Ops[In, Out]
    Implicit
    This member is added by an implicit conversion from ParserFs2Ops[In, Out] toEnsuring[ParserFs2Ops[In, Out]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  8. def ensuring(cond: (ParserFs2Ops[In, Out]) => Boolean): ParserFs2Ops[In, Out]
    Implicit
    This member is added by an implicit conversion from ParserFs2Ops[In, Out] toEnsuring[ParserFs2Ops[In, Out]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  9. def ensuring(cond: Boolean, msg: => Any): ParserFs2Ops[In, Out]
    Implicit
    This member is added by an implicit conversion from ParserFs2Ops[In, Out] toEnsuring[ParserFs2Ops[In, Out]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  10. def ensuring(cond: Boolean): ParserFs2Ops[In, Out]
    Implicit
    This member is added by an implicit conversion from ParserFs2Ops[In, Out] toEnsuring[ParserFs2Ops[In, Out]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  11. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from ParserFs2Ops[In, Out] toStringFormat[ParserFs2Ops[In, Out]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  12. def getClass(): Class[_ <: AnyVal]
    Definition Classes
    AnyVal → Any
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. def parseF[F[_], G[_]](stream: Stream[F, In])(implicit compiler: Compiler[F, G], G: MonadError[G, Throwable], pos: CallerPos): G[Out]

    Convenience for stream.through(parser.toPipe).compile.lastOrError.

    Convenience for stream.through(parser.toPipe).compile.lastOrError.

    Uses this parser to pull from the stream until the parser emits a result or the stream is depleted.

    F

    The stream effect type, e.g. cats.effect.IO

    G

    The stream-compiler output type. Usually the same as F

    stream

    The stream of events (of type In) to consume

    compiler

    The fs2 stream compiler

    G

    Evidence that the G effect type can raise Throwables as errors

    pos

    call-point information used to generate the top SpacTraceElement for error handling

  15. def toPipe[F[_]](implicit pos: CallerPos): Pipe[F, In, Out]

    Convert this parser to a FS2 "Pipe".

    Convert this parser to a FS2 "Pipe". The resulting pipe will forward inputs from the upstream into this parser, emitting a single value to the downstream when this parser finishes. Since a Parser may abort early (e.g. with Parser.first), the pipe may not pull the entire input stream.

  16. def toString(): String
    Definition Classes
    Any

Deprecated Value Members

  1. def [B](y: B): (ParserFs2Ops[In, Out], B)
    Implicit
    This member is added by an implicit conversion from ParserFs2Ops[In, Out] toArrowAssoc[ParserFs2Ops[In, Out]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Use -> instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.

Inherited from AnyVal

Inherited from Any

Inherited by implicit conversion any2stringadd fromParserFs2Ops[In, Out] to any2stringadd[ParserFs2Ops[In, Out]]

Inherited by implicit conversion StringFormat fromParserFs2Ops[In, Out] to StringFormat[ParserFs2Ops[In, Out]]

Inherited by implicit conversion Ensuring fromParserFs2Ops[In, Out] to Ensuring[ParserFs2Ops[In, Out]]

Inherited by implicit conversion ArrowAssoc fromParserFs2Ops[In, Out] to ArrowAssoc[ParserFs2Ops[In, Out]]

consumers

Ungrouped