fastparse

package fastparse

Members list

Concise view

Type members

Classlikes

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

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

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
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.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
case class IndexedParserInput(data: String) extends ParserInput

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any

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

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
case class IteratorParserInput(data: Iterator[String]) extends BufferedParserInput

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.

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any

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

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

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

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

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

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
implicit class LogByNameOps[T](parse0: => ParsingRun[T])(implicit ctx: ParsingRun[_])

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

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

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
trait LowestPriSequencer[Sequencer[_, _, _]]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait SequencerGen[Sequencer]
object Sequencer.type

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

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

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

No-op whitespace syntax that doesn't consume anything

No-op whitespace syntax that doesn't consume anything

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
sealed abstract class Parsed[+T](val isSuccess: Boolean)

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.

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Failure
class Success[T]
object Parsed

Attributes

Companion:
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Parsed.type

Attributes

Companion:
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
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.

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion:
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object ParserInputSource.type
final class ParsingRun[+T](val input: ParserInput, val startIndex: Int, val originalParser: ParsingRun[_] => ParsingRun[_], val traceIndex: Int, val instrument: Instrument, var terminalMsgs: Msgs, var aggregateMsgs: Msgs, var shortMsg: Msgs, var lastFailureMsg: Msgs, var failureStack: List[(String, Int)], var isSuccess: Boolean, var logDepth: Int, var index: Int, var cut: Boolean, var successValue: Any, var verboseFailures: Boolean, var noDropBuffer: Boolean, val misc: Map[Any, Any])

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

Attributes

cut

Has the current parse been prevented from backtracking? This field starts as true at top-level, since there is nowhere to backtrack to. Upon entering a parser that can backtrack, such as | or .? or .rep, it is set to false, and re-set to true upon encountering a ./ or ~/ cut operator that prevents backtracking.

failureStack

The stack of named P(...) parsers in effect when the failure occured; only constructed when tracing is enabled via traceIndex != -1

index

The current index of the parse

input

The input to the parsing run, as a ParserInput.

instrument

Callbacks that can be injected before/after every P(...) parser.

isSuccess

Whether or not the parse is currently successful

logDepth

How many nested .log calls are currently surrounding us. Used to nicely indent the log output so you can see which parsers are nested within which other parsers; -1 means logging is disabled

misc

Additional key-value metadata that a user can attach to a parsing run, and manage however they like. Not as high performance as the built-in fields of ParsingRun, but perhaps sufficient to satisfy ad-hoc needs e.g. keeping track of indentation or other contextual information

noDropBuffer

Flag that prevents the parser from dropping earlier input. Used for the .! capture operator that needs the input around to return as a string, the NoCut operator that forces backtracking (regardless of internal cuts), or whitespace consumption which implicitly backtracks if the parser on the RHS of the whitespace fails or consumes 0 characters. The value for this field is lexically scoped, but it is up to the individual parser method implementations to set the values and remember to un-set it to the previous value after they finish. Forgetting to re-set it to the previous value can cause strange behavior or crashes.

originalParser

The original parsing function we used to start this run, so as to allow .result.traced to re-create it with tracing enabled.

shortMsg

When tracing is enabled, this contains string representation of the last parser to run. Since parsers aren't really objects, we piece together the string in the parser body and return store it here, and an enclosing parser may fetch it back out to help build its own string representation. If the last parser started before the traceIndex, we only aggregate the portion of the parser msg that takes place after traceIndex

startIndex

Where the parse initially started, so as to allow .result.traced to re-create it with tracing enabled.

successValue

The currently returned success value

terminalMsgs

When tracing is enabled, this collects up all the upper-most failures that happen at traceIndex (in Lazy wrappers) so they can be shown to the user at end-of-parse as suggestions for what could make the parse succeed. For terminal parsers like LiteralStr, it just aggregate's the string representation. For composite parsers like a ~ b or !a which may fail at traceIndex even without any of their wrapped terminal parsers failing there, it makes use of the shortMsg as the string representation of the composite parser.

traceIndex

The index we wish to trace if tracing is enabled, else -1. Used to find failure messages to aggregate into terminalMsgs

verboseFailures

Whether or not we are currently collecting lastFailureMsgs; defaults to false, unless traceIndex is set OR we are inside a LogByNameOps.log call which necessitates tracing in order to print out failure traces during logging

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any
object ParsingRun

Attributes

Companion:
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
case class ReaderParserInput(data: Reader, bufferSize: Int) extends BufferedParserInput

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

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

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any

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

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

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

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

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

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
trait SequencerGen[Sequencer[_, _, _]] extends LowestPriSequencer[Sequencer]

Attributes

Graph
Supertypes
trait LowestPriSequencer[Sequencer]
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion:
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

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

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

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object whitespace.type
object whitespace.type
object whitespace.type
object whitespace.type
object whitespace.type
object whitespace.type

Types

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.

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

Attributes

T

is the type of the value returned by the parser method on success

Inherited types

type P0 = ParsingRun[Unit]

Shorthand for P[Unit]

Shorthand for P[Unit]

Attributes

Inherited from:
SharedPackageDefs

Value members

Concrete methods

inline def &(inline parse: => ParsingRun[_])(implicit ctx: ParsingRun[_]): ParsingRun[Unit]

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

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

Attributes

inline def CharIn(inline s: String*)(using ctx: ParsingRun[_]): ParsingRun[Unit]

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

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

Attributes

inline def CharPred(inline p: Char => Boolean)(implicit ctx: ParsingRun[_]): ParsingRun[Unit]

Parses a single character satisfying the given predicate

Parses a single character satisfying the given predicate

Attributes

inline def CharsWhile(inline p: Char => Boolean, min: Int)(implicit ctx: ParsingRun[_]): ParsingRun[Unit]

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

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

Attributes

inline def CharsWhileIn(inline s: String, min: Int)(implicit ctx: ParsingRun[_]): ParsingRun[Unit]

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

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

Attributes

inline def P[T](inline t: ParsingRun[T])(implicit name: Name, ctx: ParsingRun[_]): ParsingRun[T]

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.

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.

Attributes

inline def StringIn(inline s: String*)(implicit ctx: ParsingRun[_]): ParsingRun[Unit]

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

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

Attributes

inline def StringInIgnoreCase(inline s: String*)(implicit ctx: ParsingRun[_]): ParsingRun[Unit]

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

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

Attributes

Inherited 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

Inherited from:
SharedPackageDefs
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

Inherited from:
SharedPackageDefs
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

Inherited from:
SharedPackageDefs
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

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

Parses a string value case-insensitively

Parses a string value case-insensitively

Attributes

Inherited from:
SharedPackageDefs
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

Inherited from:
SharedPackageDefs
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

Inherited from:
SharedPackageDefs
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

Inherited from:
SharedPackageDefs
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

Inherited from:
SharedPackageDefs
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

Inherited from:
SharedPackageDefs
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

Inherited from:
SharedPackageDefs
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

Inherited from:
SharedPackageDefs
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

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

Attributes

Inherited from:
SharedPackageDefs

Concrete fields

val P: ParsingRun.type

Extensions

Extensions

extension [T](parse0: ParsingRun[T])
inline def !(using ctx: ParsingRun[Any]): ParsingRun[String]

Capture operator; makes the parser return the span of input it parsed as a String, which can then be processed further using ~, map or flatMapX

Capture operator; makes the parser return the span of input it parsed as a String, which can then be processed further using ~, map or flatMapX

Attributes

inline def /(implicit ctx: ParsingRun[_]): ParsingRun[T]

Plain cut operator. Runs the parser, and if it succeeds, backtracking past that point is now prohibited

Plain cut operator. Runs the parser, and if it succeeds, backtracking past that point is now prohibited

Attributes

inline def ?[V](implicit optioner: Optioner[T, V], ctx: ParsingRun[Any]): ParsingRun[V]

Optional operator. Parses the given input to wrap it in a Some, but if parsing fails backtracks and returns None

Optional operator. Parses the given input to wrap it in a Some, but if parsing fails backtracks and returns None

Attributes

inline def collect[V](inline f: PartialFunction[T, V]): ParsingRun[V]

Transforms the result of this parser using the given partial function, failing the parse if the partial function is not defined on the result of the current parser. This is eqivalent to .filter(f.isDefinedAt).map(f.apply)

Transforms the result of this parser using the given partial function, failing the parse if the partial function is not defined on the result of the current parser. This is eqivalent to .filter(f.isDefinedAt).map(f.apply)

Attributes

inline def filter(f: T => Boolean)(using ctx: ParsingRun[Any]): ParsingRun[T]

Tests the output of the parser with a given predicate, failing the parse if the predicate returns false. Useful for doing local validation on bits and pieces of your parsed output

Tests the output of the parser with a given predicate, failing the parse if the predicate returns false. Useful for doing local validation on bits and pieces of your parsed output

Attributes

inline def flatMap[V](f: T => ParsingRun[V])(using whitespace: Whitespace): ParsingRun[V]

Transforms the result of this parser using the given function into a new parser which is applied (after whitespace). Useful for doing dependent parsing, e.g. when parsing JSON you may first parse a character to see if it's a [, {, or ", and then deciding whether you next want to parse an array, dictionary or string.

Transforms the result of this parser using the given function into a new parser which is applied (after whitespace). Useful for doing dependent parsing, e.g. when parsing JSON you may first parse a character to see if it's a [, {, or ", and then deciding whether you next want to parse an array, dictionary or string.

Attributes

inline def flatMapX[V](inline f: T => ParsingRun[V]): ParsingRun[V]

Transforms the result of this parser using the given function into a new parser which is applied (without consuming whitespace). Useful for doing dependent parsing, e.g. when parsing JSON you may first parse a character to see if it's a [, {, or ", and then deciding whether you next want to parse an array, dictionary or string.

Transforms the result of this parser using the given function into a new parser which is applied (without consuming whitespace). Useful for doing dependent parsing, e.g. when parsing JSON you may first parse a character to see if it's a [, {, or ", and then deciding whether you next want to parse an array, dictionary or string.

Attributes

inline def map[V](inline f: T => V): ParsingRun[V]

Transforms the result of this parser using the given function. Useful for turning the Strings captured by ! and the tuples built by ~ into your own case classes or data structure

Transforms the result of this parser using the given function. Useful for turning the Strings captured by ! and the tuples built by ~ into your own case classes or data structure

Attributes

inline def rep[V](using repeater: Repeater[T, V], whitespace: Whitespace, ctx: ParsingRun[Any]): ParsingRun[V]

Repeat operator; runs the LHS parser 0 or more times separated by the given whitespace (in implicit scope), and returns a Seq[T] of the parsed values. On failure, backtracks to the starting index of the last run.

Repeat operator; runs the LHS parser 0 or more times separated by the given whitespace (in implicit scope), and returns a Seq[T] of the parsed values. On failure, backtracks to the starting index of the last run.

Attributes

inline def repX[V](using repeater: Repeater[T, V], ctx: ParsingRun[Any]): ParsingRun[V]

Raw repeat operator; runs the LHS parser 0 or more times without any whitespace in between, and returns a Seq[T] of the parsed values. On failure, backtracks to the starting index of the last run.

Raw repeat operator; runs the LHS parser 0 or more times without any whitespace in between, and returns a Seq[T] of the parsed values. On failure, backtracks to the starting index of the last run.

Attributes

inline def |[V >: T](inline other: ParsingRun[V])(using ctx: ParsingRun[Any]): ParsingRun[V]

Either-or operator: tries to parse the left-hand-side, and if that fails it backtracks and tries to pass the right-hand-side. Can be chained more than once to parse larger numbers of alternatives.

Either-or operator: tries to parse the left-hand-side, and if that fails it backtracks and tries to pass the right-hand-side. Can be chained more than once to parse larger numbers of alternatives.

Attributes

inline def ~[V, R](inline other: ParsingRun[V])(using s: Sequencer[T, V, R], whitespace: Whitespace, ctx: ParsingRun[_]): ParsingRun[R]

Sequence operator. Runs two parsers one after the other, with optional whitespace in between.If both parsers return a value, this returns a tuple.

Sequence operator. Runs two parsers one after the other, with optional whitespace in between.If both parsers return a value, this returns a tuple.

Attributes

inline def ~/[V, R](inline other: ParsingRun[V])(using s: Sequencer[T, V, R], whitespace: Whitespace, ctx: ParsingRun[_]): ParsingRun[R]

Sequence-with-cut operator. Runs two parsers one after the other, with optional whitespace in between. If the first parser completes successfully, backtracking is now prohibited. If both parsers return a value, this returns a tuple.

Sequence-with-cut operator. Runs two parsers one after the other, with optional whitespace in between. If the first parser completes successfully, backtracking is now prohibited. If both parsers return a value, this returns a tuple.

Attributes

inline def ~~[V, R](inline other: ParsingRun[V])(using s: Sequencer[T, V, R], ctx: ParsingRun[_]): ParsingRun[R]

Raw sequence operator. Runs two parsers one after the other, without whitespace in between. If both parsers return a value, this returns a tuple.

Raw sequence operator. Runs two parsers one after the other, without whitespace in between. If both parsers return a value, this returns a tuple.

Attributes

inline def ~~/[V, R](inline other: ParsingRun[V])(using s: Sequencer[T, V, R], ctx: ParsingRun[_]): ParsingRun[R]

Raw sequence-with-cut operator. Runs two parsers one after the other, without whitespace in between. If the first parser completes successfully, backtracking is no longer prohibited. If both parsers return a value, this returns a tuple.

Raw sequence-with-cut operator. Runs two parsers one after the other, without whitespace in between. If the first parser completes successfully, backtracking is no longer prohibited. If both parsers return a value, this returns a tuple.

Attributes

extension [T](parse0: => ParsingRun[T])
inline def opaque(msg: String)(implicit ctx: ParsingRun[Any]): ParsingRun[T]

Hides the internals of the given parser when it fails, such that it only succeeds completely or fails completely, and none of it's internal parsers end up in the failure traces or failure stack to be displayed to the user.

Hides the internals of the given parser when it fails, such that it only succeeds completely or fails completely, and none of it's internal parsers end up in the failure traces or failure stack to be displayed to the user.

Attributes

inline def rep[V](inline min: Int, inline sep: => ParsingRun[_], inline max: Int, inline exactly: Int)(using repeater: Repeater[T, V], whitespace: Whitespace, ctx: ParsingRun[Any]): ParsingRun[V]

Repeat operator; runs the LHS parser at least min to at most max times separated by the given whitespace (in implicit scope) and separator sep, and returns a Seq[T] of the parsed values. On failure, backtracks to the starting index of the last run.

Repeat operator; runs the LHS parser at least min to at most max times separated by the given whitespace (in implicit scope) and separator sep, and returns a Seq[T] of the parsed values. On failure, backtracks to the starting index of the last run.

The convenience parameter exactly is provided to set both min and max to the same value.

Attributes

inline def repX[V](inline min: Int, inline sep: => ParsingRun[_], inline max: Int, inline exactly: Int)(implicit repeater: Repeater[T, V], ctx: ParsingRun[Any]): ParsingRun[V]

Raw repeat operator; runs the LHS parser at least min to at most max times separated by the separator sep without any whitespace in between, and returns a Seq[T] of the parsed values. On failure, backtracks to the starting index of the last run.

Raw repeat operator; runs the LHS parser at least min to at most max times separated by the separator sep without any whitespace in between, and returns a Seq[T] of the parsed values. On failure, backtracks to the starting index of the last run.

The convenience parameter exactly is provided to set both min and max to the same value.

Attributes

inline def unary_!(implicit ctx: ParsingRun[Any]): ParsingRun[Unit]

Negative lookahead operator: succeeds if the wrapped parser fails and fails if the wrapped parser succeeds. In all cases, it ends up consuming zero characters.

Negative lookahead operator: succeeds if the wrapped parser fails and fails if the wrapped parser succeeds. In all cases, it ends up consuming zero characters.

Attributes

Implicits

Implicits

implicit def DiscardParserValue(p: ParsingRun[_]): ParsingRun[Unit]
implicit inline def LiteralStr(s: String)(implicit ctx: ParsingRun[Any]): ParsingRun[Unit]

Parses an exact string value.

Parses an exact string value.

Attributes

final implicit def LogByNameOps[T](parse0: => ParsingRun[T])(implicit ctx: ParsingRun[_]): LogByNameOps[T]

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

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

Attributes

implicit def LogOpsStr(parse0: String)(implicit ctx: ParsingRun[Any]): LogByNameOps[Unit]

Provides logging-related LogByNameOps implicits on String.

Provides logging-related LogByNameOps implicits on String.

Attributes