Packages

c

fastparse.WhitespaceApi

CustomSequence

case class CustomSequence[+T, +R, +V](WL: all.P0, p0: all.P[T], p: all.P[V], cut: Boolean)(implicit ev: Sequencer[T, V, R]) extends all.P[R] with Product with Serializable

Custom whitespace-aware semicolon-inference-friendly version of fastparse.parsers.Combinators.Sequence. Consumes whitespace between the LHS p0 and RHS p parsers.

If the whitespace succeeds but the parser on the right succeeds *with no input*, then backtrack to the start of the whitespace and ignore any cuts that came from it. This it meant to avoid capturing trailing whitespace, which needs to be present for semi-colon inference to work properly

Linear Supertypes
Serializable, Serializable, Product, Equals, Parser[R, Char, String], Precedence, ParserResults[R, Char, String], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CustomSequence
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. Parser
  7. Precedence
  8. ParserResults
  9. AnyRef
  10. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new CustomSequence(WL: all.P0, p0: all.P[T], p: all.P[V], cut: Boolean)(implicit ev: Sequencer[T, V, R])

Type Members

  1. type InstrumentCallback = (Parser[_, Char, String], Int, () ⇒ Parsed[_, Char, String]) ⇒ Unit

    Can be passed into a .parse call to let you inject logic around the parsing of top-level parsers, e.g.

    Can be passed into a .parse call to let you inject logic around the parsing of top-level parsers, e.g. for logging and debugging.

    Definition Classes
    Parser

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. val WL: all.P0
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. val cut: Boolean
  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def fail(f: Failure[Char, String], index: Int, traceParsers: Set[Parser[_, Char, String]] = null, cut: Boolean = false): Failure[Char, String]

    Prepares a failure object for a new failure

    Prepares a failure object for a new failure

    f

    The failure object, usually retrieved from the ParseCtx to avoid allocation overhead

    index

    The index at which this failure occurred

    traceParsers

    Any parsers which failed at the current index. These get noted in the error message if traceFailure is set. By default, this is the current parser.

    cut

    Whether or not this failure should prevent backtracking

    Definition Classes
    ParserResults
  10. def failMore(f: Failure[Char, String], index: Int, logDepth: Int, traceParsers: Set[Parser[_, Char, String]] = null, cut: Boolean = false): Failure[Char, String]

    Prepares a failure object to continue an existing failure, e.g.

    Prepares a failure object to continue an existing failure, e.g. if some sub-parser failed and you want to pass the failure up the stack.

    f

    The failure returned by the subparser

    index

    The index of the *current* parser

    traceParsers

    Any parsers which failed at the current index. These get noted in the error message if traceFailure is set. By default, the existing traceParsers from the original failure are left unchanged

    cut

    Whether or not this parser failing should prevent backtracking. ORed with any cuts caused by the existing failure

    Definition Classes
    ParserResults
  11. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. def mergeTrace(traceIndex: Int, lhs: Set[Parser[_, Char, String]], rhs: Set[Parser[_, Char, String]]): Set[Parser[_, Char, String]]
    Definition Classes
    ParserResults
  15. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. final def notify(): Unit
    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  18. def opPred: Int

    Whether or not to surround this parser with parentheses when printing.

    Whether or not to surround this parser with parentheses when printing. By default a top-level parser is always left without parentheses, but if a sub-parser is embedded inside with lower precedence, it will be surrounded. Set to Integer.MaxValue to never be parenthesized

    Definition Classes
    CustomSequenceParserPrecedence
  19. def opWrap(s: Precedence): String
    Attributes
    protected
    Definition Classes
    Precedence
  20. val p: all.P[V]
  21. val p0: all.P[T]
  22. def parse(input: String, index: Int = 0, instrument: InstrumentCallback = null): Parsed[R, Char, String]

    Parses the given input starting from the given index

    Parses the given input starting from the given index

    input

    The string we want to parse

    index

    The index in the string to start from. By default parsing starts from the beginning of a string, but you can start from halfway through the string if you want.

    instrument

    Allows you to pass in a callback that will get called by every named rule, its index, as it itself given a callback that can be used to recurse into the parse and return the result. Very useful for extracting auxiliary information from the parse, e.g. counting rule invocations to locate bottlenecks or unwanted backtracking in the parser.

    Definition Classes
    Parser
  23. def parseInput(input: ParserInput[Char, String], index: Int = 0, instrument: InstrumentCallback = null): Parsed[R, Char, String]
    Definition Classes
    Parser
  24. def parseIterator(input: Iterator[String], index: Int = 0, instrument: InstrumentCallback = null)(implicit ct: ClassTag[Char]): Parsed[R, Char, String]
    Definition Classes
    Parser
  25. def parseRec(cfg: all.ParseCtx, index: Int): Mutable[R, Char, String]

    Parses the given input starting from the given index and logDepth

    Parses the given input starting from the given index and logDepth

    Definition Classes
    CustomSequenceParser
  26. implicit val reprOps: ReprOps[Char, String]
    Definition Classes
    Parser
  27. def shortTraced: Boolean

    Whether or not this parser should show up when Parsed.TracedFailure.trace is called.

    Whether or not this parser should show up when Parsed.TracedFailure.trace is called. If not set, the parser will only show up in Parsed.TracedFailure.fullStack

    Definition Classes
    Parser
  28. def success[T](s: Success[_, Char, String], value: T, index: Int, traceParsers: Set[Parser[_, Char, String]], cut: Boolean): Success[T, Char, String]

    Prepares a success object to be returned.

    Prepares a success object to be returned.

    s

    The existing success object, usually taken from ParseCtx to avoid allocation overhead.

    value

    The value that this parser succeeded with

    index

    The index of the parser *after* having successfully parsed part of the input

    traceParsers

    Any parsers which failed at the current index in the creation of this success. Even though this parser succeeded, failures inside sub-parsers must be reported to ensure proper error reporting.

    cut

    Whether the parse crossed a cut and should prevent backtracking

    Definition Classes
    ParserResults
  29. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  30. def toString(): String
    Definition Classes
    CustomSequence → AnyRef → Any
  31. def unapply(input: String): Option[R]

    Extractor for pattern matching

    Extractor for pattern matching

    For example:

    val p1 = CharIn('a'to'z').! ~ CharIn('0'to'9').rep(1).!.map(_.toInt)
    List("a42x") match {
      case p1(x: String, y: Int) :: _ => // x is "a", y is 42
    }
    Definition Classes
    Parser
  32. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from Parser[R, Char, String]

Inherited from Precedence

Inherited from ParserResults[R, Char, String]

Inherited from AnyRef

Inherited from Any

Ungrouped