p

fastparse

package fastparse

Linear Supertypes
SharedPackageDefs, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. fastparse
  2. SharedPackageDefs
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. trait BufferedParserInput extends ParserInput
  2. final class ByNameOps[T] extends AnyVal
  3. implicit final class EagerOps[T] extends AnyVal

    Provides EagerOps extension methods on P]

  4. case class IndexedParserInput(data: String) extends ParserInput with Product with Serializable
  5. trait IsReachable extends AnyRef

    Trait that represents classes with isReachable method

    Trait that represents classes with isReachable method

    Currently the only use of it is to avoid the cyclic dependencies between Utils and ParserInput

  6. case class IteratorParserInput(data: Iterator[String]) extends ParserInput with BufferedParserInput with Product with Serializable

    Contains buffer - queue of elements that extends from given iterator when particular elements are requested; and shrinks by calling dropBuffer method.

    Contains buffer - queue of elements that extends from given iterator when particular elements are requested; and shrinks by calling dropBuffer method.

    Generally, at any specific time this buffer contains "suffix" of given iterator, e.g. some piece of data from past calls of next, which extends by requesting new batches from iterator. Therefore we can denote the same notation of indices as for regular Array or more abstract IndexedSeq. The only difference is when index doesn't fit into the bounds of current buffer either the new batches are requested to extend the buffer, either it's inaccessible at all, so calling of dropBuffer should guarantee that there won't be any attempts to access to the elements in dropped part of input.

  7. implicit class LogByNameOps[T] extends AnyRef

    Separated out from ByNameOps because .log isn't easy to make an AnyVal extension method, but it doesn't matter since .log calls are only for use in development while the other ByNameOps operators are more performance-sensitive

  8. trait LowestPriSequencer[Sequencer[_, _, _]] extends AnyRef
  9. type P[+T] = ParsingRun[T]

    Shorthand alias for ParsingRun; this is both the parameter-to and the return type for all Fastparse's parsing methods.

  10. type P0 = ParsingRun[Unit]

    Shorthand for P[Unit]

    Shorthand for P[Unit]

    Definition Classes
    SharedPackageDefs
  11. sealed abstract class Parsed[+T] extends AnyRef

    The outcome of a ParsingRun run, either a success (with value and index) or failure (with associated debugging metadata to help figure out what went wrong).

    The outcome of a ParsingRun run, either a success (with value and index) or failure (with associated debugging metadata to help figure out what went wrong).

    Doesn't contain any information not already present in ParsingRun, but packages it up nicely in an immutable case class that's easy for external code to make use of.

  12. abstract class ParserInput extends IsReachable

    ParserInput class represents data that is needed to parse.

    ParserInput class represents data that is needed to parse.

    It can be regular IndexedSeq that behaves as simple array or Iterator of IndexedSeq batches which is optimized by dropBuffer method.

  13. trait ParserInputSource extends AnyRef
  14. trait ParserInputSourceLowPri extends AnyRef
  15. final class ParsingRun[+T] extends AnyRef

    Models an in-progress parsing run; contains all the mutable state that may be necessary during the parse, in order to avoid the individual parsers needing to perform their own allocations and instantiations, and greatly improving performance

    Models an in-progress parsing run; contains all the mutable state that may be necessary during the parse, in order to avoid the individual parsers needing to perform their own allocations and instantiations, and greatly improving performance

    There are a few patterns that let us program with these mutable variables in a sort-of-pure-functional way:

    - If a parser that wishes to ignore changes to a field within their child parsers, a common pattern is to save the value of the field before the wrapped parser runs, and then re-set the field. e.g. this can be used to backtrack index after a lookahead parser finishes

    - If a parser wants to read the value of the field "returned" by multiple child parsers, make sure to read the field into a local variable after each child parser is complete to make sure the value you want from an earlier child isn't stomped over by a later child

    In general, for a parser to "return" a value in a mutable field, it is sufficient to simply set the value of that field before returning. It is the parent-parser's responsibility to make sure it reads out the value of the field to a local variable before running another child parser that will over-write the mutable field

  16. case class ReaderParserInput(data: Reader, bufferSize: Int) extends ParserInput with BufferedParserInput with Product with Serializable

    A ParserInput that pulls data from a given java.io.Reader.

    A ParserInput that pulls data from a given java.io.Reader. Typically not used alone, and instead is used as part of a ParserInputSource.FromReadable

  17. trait SequencerGen[Sequencer[_, _, _]] extends LowestPriSequencer[Sequencer]
  18. trait SharedPackageDefs extends AnyRef
  19. trait Whitespace extends AnyRef

Value Members

  1. def &(parse: ⇒ P[_])(implicit ctx: P[_]): P[Unit]

    Positive lookahead operator: succeeds if the wrapped parser succeeds and fails if the wrapped parser fails, but in all cases consumes zero characters.

  2. def AnyChar(implicit ctx: P[_]): P[Unit]

    Parses a single character, any character, as long as there is at least one character for it to parse (i.e.

    Parses a single character, any character, as long as there is at least one character for it to parse (i.e. the input isn't at its end)

    Definition Classes
    SharedPackageDefs
  3. implicit def ByNameOps[T](parse0: ⇒ P[T]): ByNameOps[T]

    Provides ByNameOps extension methods on Ps

  4. implicit macro def ByNameOpsStr(parse0: String)(implicit ctx: P[Any]): ByNameOps[Unit]

    Provides ByNameOps extension methods on Strings

  5. macro def CharIn(s: String*)(implicit ctx: P[_]): P[Unit]

    Parses a single character in one of the input strings representing character classes

  6. macro def CharPred(p: (Char) ⇒ Boolean)(implicit ctx: P[_]): P[Unit]

    Parses a single character satisfying the given predicate

  7. macro def CharsWhile(p: (Char) ⇒ Boolean, min: Int)(implicit ctx: P[_]): P[Unit]

    Parses min or more characters as long as they satisfy the given predicate

  8. macro def CharsWhile(p: (Char) ⇒ Boolean)(implicit ctx: P[_]): P[Unit]

    Parses one or more characters as long as they satisfy the given predicate

  9. macro def CharsWhileIn(s: String, min: Int)(implicit ctx: P[_]): P[Unit]

    Parses min or more characters as long as they are contained in one of the input strings representing character classes

  10. macro def CharsWhileIn(s: String)(implicit ctx: P[_]): P[Unit]

    Parses one or more characters as long as they are contained in one of the input strings representing character classes

  11. implicit def DiscardParserValue(p: P[_]): P[Unit]
  12. implicit macro def EagerOpsStr(parse0: String)(implicit ctx: P[Any]): EagerOps[Unit]

    Provides EagerOps extension methods on String

  13. def End(implicit ctx: P[_]): P[Unit]

    Parser that is only successful at the end of the input.

    Parser that is only successful at the end of the input. Useful to ensure your parser parses the whole file.

    Definition Classes
    SharedPackageDefs
  14. def Fail(msg: String)(implicit ctx: P[_]): P[Nothing]

    No-op parser with a custom error message that always fails, consuming zero characters

    No-op parser with a custom error message that always fails, consuming zero characters

    Definition Classes
    SharedPackageDefs
  15. def Fail(implicit ctx: P[_]): P[Nothing]

    No-op parser that always fails, consuming zero characters

    No-op parser that always fails, consuming zero characters

    Definition Classes
    SharedPackageDefs
  16. def IgnoreCase(s: String)(implicit ctx: P[Any]): P[Unit]

    Parses a string value case-insensitively

    Parses a string value case-insensitively

    Definition Classes
    SharedPackageDefs
  17. def Index(implicit ctx: P[_]): P[Int]

    Parser that always succeeds and returns the current index into the parsed input.

    Parser that always succeeds and returns the current index into the parsed input. Useful for e.g. capturing source locations so when downstream valiation raises errors you can tell the user where in the input the error originated from

    Definition Classes
    SharedPackageDefs
  18. implicit macro def LiteralStr(s: String)(implicit ctx: P[Any]): P[Unit]

    Parses an exact string value.

  19. implicit macro def LogOpsStr(parse0: String)(implicit ctx: P[Any]): LogByNameOps[Unit]

    Provides logging-related LogByNameOps implicits on String.

  20. def NoCut[T](parse: ⇒ P[T])(implicit ctx: P[_]): P[T]

    Allows backtracking regardless of whether cuts happen within the wrapped parser; this is useful for re-using an existing parser with cuts within it, in other parts of your grammar where backtracking is necessary and unavoidable.

    Allows backtracking regardless of whether cuts happen within the wrapped parser; this is useful for re-using an existing parser with cuts within it, in other parts of your grammar where backtracking is necessary and unavoidable.

    Definition Classes
    SharedPackageDefs
  21. def NoTrace[T](p: ⇒ P[T])(implicit ctx: P[_]): P[T]

    Wraps a parser and ensures that none of the parsers within it leave failure traces in terminalMsgs, though unlike ByNameOps.opaque if there is a failure *within* the wrapped parser the failure's location and error message will still be shown

    Wraps a parser and ensures that none of the parsers within it leave failure traces in terminalMsgs, though unlike ByNameOps.opaque if there is a failure *within* the wrapped parser the failure's location and error message will still be shown

    Useful for wrapping things like whitespace, code-comment, etc. parsers which can be applied everywhere and are not useful to display to the user as part of the error message.

    Definition Classes
    SharedPackageDefs
  22. macro def P[T](t: P[T])(implicit name: Name, ctx: P[_]): P[T]

    Delimits a named parser.

    Delimits a named parser. This name will appear in the parser failure messages and stack traces, and by default is taken from the name of the enclosing method.

  23. val P: ParsingRun.type
  24. def Pass[T](v: T)(implicit ctx: P[_]): P[T]

    No-op parser that always succeeds with the given value, consuming zero characters

    No-op parser that always succeeds with the given value, consuming zero characters

    Definition Classes
    SharedPackageDefs
  25. def Pass(implicit ctx: P[_]): P[Unit]

    No-op parser that always succeeds, consuming zero characters

    No-op parser that always succeeds, consuming zero characters

    Definition Classes
    SharedPackageDefs
  26. def SingleChar(implicit ctx: P[_]): P[Char]

    Like AnyChar, but returns the single character it parses.

    Like AnyChar, but returns the single character it parses. Useful together with EagerOps.flatMapX to provide one-character-lookahead style parsing: SingleChar consumes the single character, and then EagerOps.flatMapX can match on that single character and decide which downstream parser you wish to invoke

    Definition Classes
    SharedPackageDefs
  27. def Start(implicit ctx: P[_]): P[Unit]

    Parser that is only successful at the start of the input.

    Parser that is only successful at the start of the input.

    Definition Classes
    SharedPackageDefs
  28. macro def StringIn(s: String*)(implicit ctx: P[_]): P[Unit]

    Efficiently parses any one of the given Strings; more efficient than chaining EagerOps.| together

  29. macro def StringInIgnoreCase(s: String*)(implicit ctx: P[_]): P[Unit]

    Efficiently parses any one of the given Strings, case-insensitively; more efficient than chaining EagerOps.| together with IgnoreCase

  30. def parse[T](input: ParserInputSource, parser: (P[_]) ⇒ P[T], verboseFailures: Boolean = false, startIndex: Int = 0, instrument: Instrument = null): Parsed[T]

    Parses the given input ParserInput using the given parser and returns a Parsed result containing the success value or failure metadata.

    Parses the given input ParserInput using the given parser and returns a Parsed result containing the success value or failure metadata.

    Can take either a String, an Iterator or strings or a fastparse.ParserInput object

    input

    the input to parse

    parser

    the parser method to use to parse the input

    verboseFailures

    enable this to show a more detailed error message if a parser fails, without needing to run .traced.trace. Defaults to false as it slows down parsing considerably

    startIndex

    where in the input to start parsing

    instrument

    Callbacks that get run before and after every named P(...) parser

    Definition Classes
    SharedPackageDefs
  31. def parseInputRaw[T](input: ParserInput, parser: (P[_]) ⇒ P[T], verboseFailures: Boolean = false, startIndex: Int = 0, traceIndex: Int = -1, instrument: Instrument = null, enableLogging: Boolean = true): ParsingRun[T]
    Definition Classes
    SharedPackageDefs
  32. object CharPredicates

    Fast, pre-computed character predicates for charactes from 0 to 65535

    Fast, pre-computed character predicates for charactes from 0 to 65535

    Useful because FastParse does it's parsing character by character, so although this doesn't have the full range of the java Character.getType(c: Int) functions, it still is good enough for a wide range of use cases

  33. object Implicits

    Container for all the type-level logic around appending things to tuples or flattening Seq[Unit]s into Units.

    Container for all the type-level logic around appending things to tuples or flattening Seq[Unit]s into Units.

    Some of these implicits make liberal use of mutable state, so as to minimize allocations while parsing.

  34. object JavaWhitespace

    Whitespace syntax that supports // line-comments and /* */ multiline-comments, *without nesting* of /* */ comments, as is the case in the Java programming language

  35. object JsonnetWhitespace

    Whitespace syntax that supports // and # line comments, and /* */ multiline-comments, but *without* nesting of /* */ comments.

    Whitespace syntax that supports // and # line comments, and /* */ multiline-comments, but *without* nesting of /* */ comments. This is the case in the Jsonnet programming language

  36. object MultiLineWhitespace

    Whitespace syntax that consumes both single-line " " and "\t" and multiline "\r" and "\n" whitespace characters.

  37. object NoWhitespace

    No-op whitespace syntax that doesn't consume anything

  38. object Parsed
  39. object ParserInput
  40. object ParserInputSource extends ParserInputSourceLowPri
  41. object ParsingRun
  42. object ScalaWhitespace

    Whitespace syntax that supports // line-comments and /* */ multiline-comments, *including nesting* of /* */ comments, as is the case in the Scala programming language

  43. object ScriptWhitespace

    Whitespace syntax that supports # line-comments, as in the case in programming languages such as Bash, Ruby, or Python

  44. object SharedPackageDefs
  45. object SingleLineWhitespace

    Whitespace syntax that consumes only single-line " " and "\t" whitespace characters.

Inherited from SharedPackageDefs

Inherited from AnyRef

Inherited from Any

Ungrouped