fastparse.core

Parser

trait Parser[+T] extends ParserResults[T] with Precedence

A single, self-contained, immutable parser. The primary method is parse, which returns a T on success and a stack trace on failure.

Some small optimizations are performed in-line: collapsing parsers.Combinators.Either cells into large ones and collapsing parsers.Combinators.Sequence cells into parsers.Combinators.Sequence.Flats. These optimizations together appear to make things faster but any 10%, whether or not you activate tracing.

Linear Supertypes
Precedence, ParserResults[T], AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Parser
  2. Precedence
  3. ParserResults
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def parseRec(cfg: ParseCtx, index: Int): Mutable[T]

    Parses the given input starting from the given index and logDepth

Concrete Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. final def eq(arg0: AnyRef): Boolean

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

    Definition Classes
    AnyRef → Any
  10. def fail(f: Failure, index: Int, traceParsers: List[Parser[_]] = null, cut: Boolean = false): Failure

    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
  11. def failMore(f: Failure, index: Int, logDepth: Int, traceParsers: List[Parser[_]] = null, cut: Boolean = false): Failure

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

    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
  12. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. final def getClass(): Class[_]

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

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

    Definition Classes
    Any
  16. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  17. final def notify(): Unit

    Definition Classes
    AnyRef
  18. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  19. 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
    ParserPrecedence
  20. def opWrap(s: Precedence): String

    Attributes
    protected
    Definition Classes
    Precedence
  21. def parse(input: String, index: Int = 0, instrument: (Parser[_], Int, () ⇒ Result[_]) ⇒ Unit = null): Result[T]

    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.

  22. def shortTraced: Boolean

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

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

  23. def success[T](s: Success[_], value: T, index: Int, traceParsers: List[Parser[_]], cut: Boolean): Success[T]

    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
  24. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  25. def toString(): String

    Definition Classes
    AnyRef → Any
  26. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Precedence

Inherited from ParserResults[T]

Inherited from AnyRef

Inherited from Any

Ungrouped