sealed trait Parser[+Err, -In, +Result] extends AnyRef

A Parser consumes a stream of 'In's and either fails with a ParserError possibly holding a custom error of type 'Err' or succeeds with a result of type Result

Parsers can be combined with Printers to get Syntax, or a Parser and a Printer can be built simultaneously by using the combinators of Syntax.

Recursive parsers can be expressed directly by recursing in one of the zipping or or-else combinators.

By default a parser backtracks automatically. This behavior can be changed with the 'manualBacktracking' operator.

Parsers trees get optimized automatically before running the parser. This optimized tree can be examined by the 'optimized' field. For the full list of transformations performed in the optimization phase check each parser node's 'optimizeNode' method.

Err

Custom error type

In

Element type of the input stream of parsing

Result

The type of the parsed result value

Self Type
Parser[Err, In, Result]
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Parser
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def needsBacktrack: Boolean
    Attributes
    protected
  2. abstract def optimizeNode(state: OptimizerState): Parser[Err, In, Result]
    Attributes
    protected
  3. abstract def parseRec(state: ParserState): Result
    Attributes
    protected
  4. abstract def stripNode(state: OptimizerState): Parser[Err, In, Result]
    Attributes
    protected

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def *: Parser[Err, In, Chunk[Result]]

    Symbolic alias for repeat0

  4. final def +: Parser[Err, In, Chunk[Result]]

    Symbolic alias for repeat

  5. final def <+>[Err2 >: Err, In2 <: In, Result2](that: => Parser[Err2, In2, Result2]): Parser[Err2, In2, Either[Result, Result2]]

    Symbolic alias for orElseEither

  6. final def <>[Err2 >: Err, In2 <: In, Result2 >: Result](that: => Parser[Err2, In2, Result2]): Parser[Err2, In2, Result2]

    Symbolic alias for orElse

  7. final def <~[Err2 >: Err, In2 <: In, Result2](that: => Parser[Err2, In2, Unit]): Parser[Err2, In2, Result]

    Symbolic alias for zipLeft

  8. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  9. final def ?: Parser[Err, In, Option[Result]]

    Symbolic alias for optional

  10. final def ??(name: String): Parser[Err, In, Result]

    Symbolic alias for named

  11. final def as[Result2](result: Result2): Parser[Err, In, Result2]

    Ignores the parser's successful result and result in 'result' instead

  12. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  13. final def atLeast(min: Int): Parser[Err, In, Chunk[Result]]

    Repeats this parser at least 'min' times.

    Repeats this parser at least 'min' times.

    The result is all the parsed elements until the first failure. The failure that stops the repetition gets swallowed and in case auto-backtracking is on, the parser backtracks to the end of the last successful item.

  14. final def autoBacktracking: Parser[Err, In, Result]

    Enables auto-backtracking for this parser

  15. final def backtrack: Parser[Err, In, Result]

    Parser that resets the parsing position in case it fails.

    Parser that resets the parsing position in case it fails.

    By default backtracking points are automatically inserted. This behavior can be changed with the autoBacktracking, manualBacktracking and setAutoBacktracking combinators.

  16. final def between[Err2 >: Err, In2 <: In](left: Parser[Err2, In2, Any], right: Parser[Err2, In2, Any]): Parser[Err2, In2, Result]

    Concatenates the parsers 'left', then this, then 'right'.

    Concatenates the parsers 'left', then this, then 'right'.

    All three must succeed. The result is this parser's result.

  17. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  18. lazy val compiledOpStack: InitialParser
  19. lazy val defaultImplementation: ParserImplementation
  20. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  22. final def filter[Result2, Err2 >: Err](condition: (Result2) => Boolean, failure: Err2)(implicit ev: <:<[Result, Result2]): Parser[Err2, In, Result2]

    Checks the result of this parser with the given function.

    Checks the result of this parser with the given function. If the 'condition' is false, fails with the given failure 'failure', otherwise results in the this parser's result.

  23. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  24. final def flatMap[Err2 >: Err, In2 <: In, Result2](that: (Result) => Parser[Err2, In2, Result2]): Parser[Err2, In2, Result2]

    Determines the continuation of the parser by the result of this parser, expressed by the function 'that'

  25. final def flatten(implicit ev2: <:<[Result, Chunk[String]]): Parser[Err, In, String]

    Flattens a result of parsed strings to a single string

  26. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  27. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  28. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  29. final def manualBacktracking: Parser[Err, In, Result]

    Turns off auto-backtracking for this parser

  30. final def map[Result2](to: (Result) => Result2): Parser[Err, In, Result2]

    Maps the parser's successful result with the given function 'to'

  31. final def mapError[Err2](f: (Err) => Err2): Parser[Err2, In, Result]

    Maps the error with the given function 'f'

  32. final def named(name: String): Parser[Err, In, Result]

    Associates a name with this parser.

    Associates a name with this parser. The chain of named parsers are reported in case of failure to help debugging parser issues.

  33. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  34. final def not[Err2 >: Err](failure: => Err2): Parser[Err2, In, Unit]

    Parser that fails with the given 'failure' if this parser succeeds

  35. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  36. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  37. lazy val optimized: Parser[Err, In, Result]

    The optimized parser tree used by the parser implementations

  38. final def optional: Parser[Err, In, Option[Result]]

    Make this parser optional.

    Make this parser optional.

    Failure of this parser will be ignored. In case auto-backtracking is enabled, backtracking is performed on it.

  39. final def orElse[Err2 >: Err, In2 <: In, Result2 >: Result](that: => Parser[Err2, In2, Result2]): Parser[Err2, In2, Result2]

    Assigns 'that' parser as a fallback of this.

    Assigns 'that' parser as a fallback of this. First this parser gets evaluated. In case it succeeds, the result is this parser's result. In case it fails, the result is 'that' parser's result.

    If auto-backtracking is on, this parser will backtrack before trying 'that' parser.

  40. final def orElseEither[Err2 >: Err, In2 <: In, Result2](that: => Parser[Err2, In2, Result2]): Parser[Err2, In2, Either[Result, Result2]]

    Assigns 'that' parser as a fallback of this.

    Assigns 'that' parser as a fallback of this. First this parser gets evaluated. In case it succeeds, the result is this parser's result wrapped in 'Left'. In case it fails, the result is 'that' parser's result, wrapped in 'Right'.

    Compared to orElse, this version allows the two parsers to have different result types.

    If auto-backtracking is on, this parser will backtrack before trying 'that' parser.

  41. final def parseChars(input: Chunk[Char], parserImplementation: ParserImplementation)(implicit ev: <:<[Char, In]): Either[ParserError[Err], Result]

    Run this parser on the given 'input' chunk of characters using a specific parser implementation

  42. final def parseChars(input: Chunk[Char])(implicit ev: <:<[Char, In]): Either[ParserError[Err], Result]

    Run this parser on the given 'input' chunk of characters

  43. final def parseString(input: String, parserImplementation: ParserImplementation)(implicit ev: <:<[Char, In]): Either[ParserError[Err], Result]

    Run this parser on the given 'input' string using a specific parser implementation

  44. final def parseString(input: String)(implicit ev: <:<[Char, In]): Either[ParserError[Err], Result]

    Run this parser on the given 'input' string

  45. final def repeat: Parser[Err, In, Chunk[Result]]

    Repeats this parser at least once.

    Repeats this parser at least once.

    The result is all the parsed elements until the first failure. The failure that stops the repetition gets swallowed and in case auto-backtracking is on, the parser backtracks to the end of the last successful item.

  46. final def repeat0: Parser[Err, In, Chunk[Result]]

    Repeats this parser zero or more times.

    Repeats this parser zero or more times.

    The result is all the parsed elements until the first failure. The failure that stops the repetition gets swallowed and in case auto-backtracking is on, the parser backtracks to the end of the last successful item.

  47. final def repeatUntil[Err2 >: Err, In2 <: In](stopCondition: Parser[Err2, In2, Any]): Parser[Err2, In2, Chunk[Result]]

    Repeats this parser until the given stopCondition parser succeeds.

  48. final def repeatWithSep[Err2 >: Err, In2 <: In](sep: Parser[Err2, In2, Unit]): Parser[Err2, In2, Chunk[Result]]

    Repeats this parser at least once and requires that between each element, the 'sep' parser succeeds

  49. final def repeatWithSep0[Err2 >: Err, In2 <: In](sep: Parser[Err2, In2, Unit]): Parser[Err2, In2, Chunk[Result]]

    Repeats this parser zero or more times and requires that between each element, the 'sep' parser succeeds

  50. def runOptimizeNode(optimizerState: OptimizerState): Parser[Err, In, Result]
    Attributes
    protected
  51. def runStripNode(stripState: OptimizerState): Parser[Err, In, Result]
    Attributes
    protected
  52. final def setAutoBacktracking(enabled: Boolean): Parser[Err, In, Result]

    Enables or disables auto-backtracking for this parser

  53. final def string(implicit ev: <:<[Char, In]): Parser[Err, Char, String]

    Ignores this parser's result and instead capture the parsed string fragment

  54. def strip: Parser[Err, In, Result]

    Strips all the name information from this parser to improve performance but reduces the failure message's verbosity.

  55. final def surroundedBy[Err2 >: Err, In2 <: In](other: Parser[Err2, In2, Any]): Parser[Err2, In2, Result]

    Surrounds this parser with the 'other' parser.

    Surrounds this parser with the 'other' parser. The result is this parser's result.

  56. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  57. def toString(): String
    Definition Classes
    AnyRef → Any
  58. final def transformEither[Err2, Result2](to: (Result) => Either[Err2, Result2]): Parser[Err2, In, Result2]

    Maps the parser's successful result with the given function 'to' that either fails or produces a new result value.

  59. final def transformOption[Result2](to: (Result) => Option[Result2]): Parser[Option[Err], In, Result2]

    Maps the parser's successful result with the given function 'to' that either produces a new result value or the failure is indicated in the error channel by the value None.

  60. final def unit: Parser[Err, In, Unit]

    Parser that does not consume any input and produces the unit value

  61. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  62. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  63. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  64. final def zip[Err2 >: Err, In2 <: In, Result2, ZippedResult](that: => Parser[Err2, In2, Result2])(implicit zippable: Out[Result, Result2, ZippedResult]): Parser[Err2, In2, ZippedResult]

    Concatenates this parser with 'that' parser.

    Concatenates this parser with 'that' parser. In case both parser succeeds, the result is a pair of the results.

  65. final def zipLeft[Err2 >: Err, In2 <: In, Result2](that: => Parser[Err2, In2, Any]): Parser[Err2, In2, Result]

    Concatenates this parser with 'that' parser.

    Concatenates this parser with 'that' parser. In case both parser succeeds, the result is the result of this parser. Otherwise the parser fails.

  66. final def |[Err2 >: Err, In2 <: In, Result2 >: Result](that: => Parser[Err2, In2, Result2]): Parser[Err2, In2, Result2]

    Symbolic alias for orElse

  67. final def ~[Err2 >: Err, In2 <: In, Result2, ZippedResult](that: => Parser[Err2, In2, Result2])(implicit zippable: Out[Result, Result2, ZippedResult]): Parser[Err2, In2, ZippedResult]

    Symbolic alias for zip

Inherited from AnyRef

Inherited from Any

Ungrouped