SharedPackageDefs

fastparse.SharedPackageDefs
See theSharedPackageDefs companion object

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Concise view

Type members

Types

type P0 = ParsingRun[Unit]

Shorthand for P[Unit]

Shorthand for P[Unit]

Attributes

Value members

Concrete methods

def AnyChar(implicit ctx: ParsingRun[_]): ParsingRun[Unit]

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)

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)

Attributes

def End(implicit ctx: ParsingRun[_]): ParsingRun[Unit]

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

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

Attributes

def Fail(implicit ctx: ParsingRun[_]): ParsingRun[Nothing]

No-op parser that always fails, consuming zero characters

No-op parser that always fails, consuming zero characters

Attributes

def Fail(msg: String)(implicit ctx: ParsingRun[_]): ParsingRun[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

Attributes

def IgnoreCase(s: String)(implicit ctx: ParsingRun[Any]): ParsingRun[Unit]

Parses a string value case-insensitively

Parses a string value case-insensitively

Attributes

def Index(implicit ctx: ParsingRun[_]): ParsingRun[Int]

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

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

Attributes

def NoCut[T](parse: => ParsingRun[T])(implicit ctx: ParsingRun[_]): ParsingRun[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.

Attributes

def NoTrace[T](p: => ParsingRun[T])(implicit ctx: ParsingRun[_]): ParsingRun[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.

Attributes

def Pass(implicit ctx: ParsingRun[_]): ParsingRun[Unit]

No-op parser that always succeeds, consuming zero characters

No-op parser that always succeeds, consuming zero characters

Attributes

def Pass[T](v: T)(implicit ctx: ParsingRun[_]): ParsingRun[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

Attributes

def SingleChar(implicit ctx: ParsingRun[_]): ParsingRun[Char]

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

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

Attributes

def Start(implicit ctx: ParsingRun[_]): ParsingRun[Unit]

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

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

Attributes

def parse[T](input: ParserInputSource, parser: ParsingRun[_] => ParsingRun[T], verboseFailures: Boolean, startIndex: Int, instrument: Instrument): 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

Attributes

input

the input to parse

instrument

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

parser

the parser method to use to parse the input

startIndex

where in the input to start parsing

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

def parseInputRaw[T](input: ParserInput, parser: ParsingRun[_] => ParsingRun[T], verboseFailures: Boolean, startIndex: Int, traceIndex: Int, instrument: Instrument, enableLogging: Boolean): ParsingRun[T]