class Syntax[+Err, -In, +Out, Value] extends AnyRef

Syntax defines a parser and a printer together and provides combinators to simultaneously build them up from smaller syntax fragments.

Err

Custom error type

In

Element type of the input stream of parsing

Out

Element type of the output stream of printing

Value

The type of the value to be parsed or printed

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

Value Members

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

    Symbolic alias for repeat0

  4. final def +: Syntax[Err, In, Out, Chunk[Value]]

    Symbolic alias for repeat

  5. final def <+>[Err2 >: Err, In2 <: In, Out2 >: Out, Value2](that: => Syntax[Err2, In2, Out2, Value2]): Syntax[Err2, In2, Out2, Either[Value, Value2]]

    Symbolic alias for orElseEither

  6. final def <>[Err2 >: Err, In2 <: In, Out2 >: Out](that: => Syntax[Err2, In2, Out2, Value]): Syntax[Err2, In2, Out2, Value]

    Symbolic alias for orElse

  7. final def <~[Err2 >: Err, In2 <: In, Out2 >: Out](that: => Syntax[Err2, In2, Out2, Unit]): Syntax[Err2, In2, Out2, Value]

    Symbolic alias for zipLeft

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

    Symbolic alias for optional

  10. final def ??(name: String): Syntax[Err, In, Out, Value]

    Symbolic alias for named

  11. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  12. val asParser: Parser[Err, In, Value]
  13. final def asPrinted[Value2](result: Value2, value: Value): Syntax[Err, In, Out, Value2]

    Sets the result to 'result' and the value to be printed to 'value'

  14. val asPrinter: Printer[Err, Out, Value]
  15. final def atLeast(min: Int): Syntax[Err, In, Out, Chunk[Value]]

    This syntax repeated at least 'min' times.

    This syntax repeated 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.

    When printing, the input is a chunk of values and each element gets printed.

  16. final def autoBacktracking: Syntax[Err, In, Out, Value]

    Enables auto-backtracking for this syntax

  17. def backtrack: Syntax[Err, In, Out, Value]

    Syntax that resets the parsing position in case it fails.

    Syntax 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.

    Does not affect printing.

  18. final def between[Err2 >: Err, In2 <: In, Out2 >: Out](left: Syntax[Err2, In2, Out2, Unit], right: Syntax[Err2, In2, Out2, Unit]): Syntax[Err2, In2, Out2, Value]

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

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

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

    Note that the 'left' and 'right' syntaxes must have a 'Value' type of Unit. Otherwise the printer could not produce an arbitrary input value for them as their result is discarded.

  19. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  20. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  22. final def filter[Err2 >: Err, Value2 <: Value](condition: (Value2) => Boolean, failure: Err2)(implicit ev: <:<[Value, Value2]): Syntax[Err2, In, Out, Value2]

    Specifies a filter condition 'condition' that gets checked in both parser and printer mode and in case it evaluates to false, fails with 'failure'.

  23. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  24. final def flatten(implicit ev1: <:<[Chunk[String], Value], ev2: <:<[Value, Chunk[String]]): Syntax[Err, In, Out, String]

    Flattens a result of parsed strings to a single string

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

    Disables auto-backtracking for this syntax

  29. final def mapError[Err2](f: (Err) => Err2): Syntax[Err2, In, Out, Value]

    Maps the error with the given function 'f'

  30. final def named(name: String): Syntax[Err, In, Out, Value]

    Associates a name with this syntax.

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

  31. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  32. final def not[Err2 >: Err](failure: Err2): Syntax[Err2, In, Out, Unit]

    Syntax that succeeds only if this syntax fails

  33. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  34. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  35. final def optional: Syntax[Err, In, Out, Option[Value]]

    Make this syntax optional.

    Make this syntax optional.

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

  36. final def orElse[Err2 >: Err, In2 <: In, Out2 >: Out](that: => Syntax[Err2, In2, Out2, Value]): Syntax[Err2, In2, Out2, Value]

    Assigns 'that' syntax as a fallback of this.

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

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

  37. final def orElseEither[Err2 >: Err, In2 <: In, Out2 >: Out, Value2](that: => Syntax[Err2, In2, Out2, Value2]): Syntax[Err2, In2, Out2, Either[Value, Value2]]

    Assigns 'that' syntax as a fallback of this.

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

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

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

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

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

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

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

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

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

    Run this parser on the given 'input' string

  42. final def print(value: Value): Either[Err, Chunk[Out]]

    Prints a value 'value' and get back the chunk of output elements'

  43. final def print[Out2 >: Out](value: Value, target: Target[Out2]): Either[Err, Unit]

    Prints a value 'value' to the target implementation 'target'

  44. final def printString(value: Value)(implicit ev: <:<[Out, Char]): Either[Err, String]

    Prints a value 'value' to a string

  45. final def repeat: Syntax[Err, In, Out, Chunk[Value]]

    This syntax repeated at least once.

    This syntax repeated 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.

    When printing, the input is a chunk of values and each element gets printed.

  46. final def repeat0: Syntax[Err, In, Out, Chunk[Value]]

    This syntax repeated zero or more times.

    This syntax repeated 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.

    When printing, the input is a chunk of values and each element gets printed.

  47. final def repeatUntil[Err2 >: Err, In2 <: In, Out2 >: Out](stopCondition: Syntax[Err2, In2, Out2, Unit]): Syntax[Err2, In2, Out2, Chunk[Value]]

    Repeats this syntax until 'stopCondition', performed after each element, results in success.

  48. final def repeatWithSep[Err2 >: Err, In2 <: In, Out2 >: Out](sep: Syntax[Err2, In2, Out2, Unit]): Syntax[Err2, In2, Out2, Chunk[Value]]

    Repeats this syntax at least once and with 'sep' injected between each element

  49. final def repeatWithSep0[Err2 >: Err, In2 <: In, Out2 >: Out](sep: Syntax[Err2, In2, Out2, Unit]): Syntax[Err2, In2, Out2, Chunk[Value]]

    Repeats this syntax zero or more times and with 'sep' injected between each element

  50. final def setAutoBacktracking(enabled: Boolean): Syntax[Err, In, Out, Value]

    Enables or disables auto-backtracking for this syntax

  51. final def string(implicit ev1: <:<[Char, In]): Syntax[Err, Char, Char, String]

    Ignores this syntax's result and instead captures the parsed string fragment / directly print the input string

  52. def strip: Syntax[Err, In, Out, Value]

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

  53. final def surroundedBy[Err2 >: Err, In2 <: In, Out2 >: Out](other: Syntax[Err2, In2, Out2, Unit]): Syntax[Err2, In2, Out2, Value]

    Surrounds this parser with the 'other' parser.

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

  54. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  55. final def toList[Item](implicit ev1: <:<[Chunk[Item], Value], ev2: <:<[Value, Chunk[Item]]): Syntax[Err, In, Out, List[Item]]

    Converts a Chunk syntax to a List syntax

  56. def toString(): String
    Definition Classes
    AnyRef → Any
  57. final def transform[Value2](to: (Value) => Value2, from: (Value2) => Value): Syntax[Err, In, Out, Value2]

    Maps the parser's successful result with the given function 'to', and maps the value to be printed with the given function 'from'

  58. final def transformEither[Err2, Value2](to: (Value) => Either[Err2, Value2], from: (Value2) => Either[Err2, Value]): Syntax[Err2, In, Out, Value2]

    Maps the parser's successful result with the given function 'to', and maps the value to be printed with the given function 'from'.

    Maps the parser's successful result with the given function 'to', and maps the value to be printed with the given function 'from'. Both of the mapping functions can fail the parser/printer.

  59. final def transformOption[Value2](to: (Value) => Option[Value2], from: (Value2) => Option[Value]): Syntax[Option[Err], In, Out, Value2]

    Maps the parser's successful result with the given function 'to', and maps the value to be printed with the given function 'from'.

    Maps the parser's successful result with the given function 'to', and maps the value to be printed with the given function 'from'. Both of the mapping functions can fail the parser/printer. The failure is indicated in the error channel by the value None.

  60. final def transformTo[Err2 >: Err, Value2, Result2](to: (Value) => Value2, from: PartialFunction[Value2, Value], failure: Err2): Syntax[Err2, In, Out, Value2]

    Maps the parsed value with the function 'to', and the value to be printed with the partial function 'from'.

    Maps the parsed value with the function 'to', and the value to be printed with the partial function 'from'. It the partial function is not defined on the value, the printer fails with 'failure'.

    This can be used to define separate syntaxes for subtypes, that can be later combined.

  61. final def unit(printed: Value): Syntax[Err, In, Out, Unit]

    Syntax that does not consume any input but prints 'printed' and results in unit

  62. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  63. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  64. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  65. final def widenWith[Err2 >: Err, Value2](narrow: PartialFunction[Value2, Value], failure: Err2)(implicit ev: <:<[Value, Value2]): Syntax[Err2, In, Out, Value2]

    Widen this syntax's printed value type by specifying a partial function to narrow it back to the set of supported subtypes.

  66. final def zipLeft[Err2 >: Err, In2 <: In, Out2 >: Out](that: => Syntax[Err2, In2, Out2, Unit]): Syntax[Err2, In2, Out2, Value]

    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. The printer passes the value to be printed to this printer, and also executes 'that' printer with unit as the input value.

    Note that the right syntax must have 'Value' defined as Unit, because there is no way for the printer to reconstruct an arbitrary input for the right printer.

  67. final def |[Err2 >: Err, In2 <: In, Out2 >: Out](that: => Syntax[Err2, In2, Out2, Value]): Syntax[Err2, In2, Out2, Value]

    Symbolic alias for orElse

Inherited from AnyRef

Inherited from Any

Ungrouped