A Parser consumes a stream of 'In's and either fails with a ParserError possibly holding a custom error of type 'Err' or succeeds with a result of type Result
Parsers can be combined with Printers to get Syntax, or a Parser and a Printer can be built simultaneously by using the combinators of Syntax.
Recursive parsers can be expressed directly by recursing in one of the zipping or or-else combinators.
By default a parser backtracks automatically. This behavior can be changed with the 'manualBacktracking' operator.
Parsers trees get optimized automatically before running the parser. This optimized tree can be examined by the 'optimized' field. For the full list of transformations performed in the optimization phase check each parser node's 'optimizeNode' method.
Type parameters
- Err
-
Custom error type
- In
-
Element type of the input stream of parsing
- Result
-
The type of the parsed result value
Attributes
- Companion
- object
- Graph
-
- Supertypes
- Known subtypes
-
object Endclass Fail[Err]class Failed[Err]object Indexclass ParseRegex[Err]class ParseRegexLastChar[Err]class SkipRegex[Err]class Succeed[Result]Show all
- Self type
-
Members list
Value members
Concrete methods
Symbolic alias for repeat0
Symbolic alias for repeat0
Attributes
Symbolic alias for repeat
Symbolic alias for repeat
Attributes
Symbolic alias for orElseEither
Symbolic alias for orElseEither
Attributes
Combines this parser with that printer to get a syntax.
Combines this parser with that printer to get a syntax.
This operation enables the use of parser or printer-specific operators to build up fragments of a syntax. The resulting syntax can be used as a building block to create bigger syntaxes.
Attributes
Symbolic alias for orElse
Symbolic alias for orElse
Attributes
Symbolic alias for zipLeft
Symbolic alias for zipLeft
Attributes
Symbolic alias for optional
Symbolic alias for optional
Attributes
Symbolic alias for named
Symbolic alias for named
Attributes
Ignores the parser's successful result and result in 'result' instead
Ignores the parser's successful result and result in 'result' instead
Attributes
Repeats this parser at least 'min' times.
Repeats this parser at least 'min' times.
The result is all the parsed elements until the first failure. The failure that stops the repetition gets swallowed and in case auto-backtracking is on, the parser backtracks to the end of the last successful item.
Attributes
Enables auto-backtracking for this parser
Enables auto-backtracking for this parser
Attributes
Parser that resets the parsing position in case it fails.
Parser that resets the parsing position in case it fails.
By default backtracking points are automatically inserted. This behavior can be changed with the autoBacktracking, manualBacktracking and setAutoBacktracking combinators.
Attributes
Concatenates the parsers 'left', then this, then 'right'.
Concatenates the parsers 'left', then this, then 'right'.
All three must succeed. The result is this parser's result.
Attributes
Repeats this parser exactly N times
Repeats this parser exactly N times
Attributes
Checks the result of this parser with the given function. If the 'condition' is false, fails with the given failure 'failure', otherwise results in the this parser's result.
Checks the result of this parser with the given function. If the 'condition' is false, fails with the given failure 'failure', otherwise results in the this parser's result.
Attributes
Determines the continuation of the parser by the result of this parser, expressed by the function 'that'
Determines the continuation of the parser by the result of this parser, expressed by the function 'that'
Attributes
Flattens a result of parsed strings to a single string
Flattens a result of parsed strings to a single string
Attributes
Turns off auto-backtracking for this parser
Turns off auto-backtracking for this parser
Attributes
Maps the parser's successful result with the given function 'to'
Maps the parser's successful result with the given function 'to'
Attributes
Maps the error with the given function 'f'
Maps the error with the given function 'f'
Attributes
Associates a name with this parser. The chain of named parsers are reported in case of failure to help debugging parser issues.
Associates a name with this parser. The chain of named parsers are reported in case of failure to help debugging parser issues.
Attributes
Parser that fails with the given 'failure' if this parser succeeds
Parser that fails with the given 'failure' if this parser succeeds
Attributes
Make this parser optional.
Make this parser optional.
Failure of this parser will be ignored. In case auto-backtracking is enabled, backtracking is performed on it.
Attributes
Assigns 'that' parser as a fallback of this. First this parser gets evaluated. In case it succeeds, the result is this parser's result. In case it fails, the result is 'that' parser's result.
Assigns 'that' parser as a fallback of this. First this parser gets evaluated. In case it succeeds, the result is this parser's result. In case it fails, the result is 'that' parser's result.
If auto-backtracking is on, this parser will backtrack before trying 'that' parser.
Attributes
Assigns 'that' parser as a fallback of this. First this parser gets evaluated. In case it succeeds, the result is this parser's result wrapped in 'Left'. In case it fails, the result is 'that' parser's result, wrapped in 'Right'.
Assigns 'that' parser as a fallback of this. First this parser gets evaluated. In case it succeeds, the result is this parser's result wrapped in 'Left'. In case it fails, the result is 'that' parser's result, wrapped in 'Right'.
Compared to orElse, this version allows the two parsers to have different result types.
If auto-backtracking is on, this parser will backtrack before trying 'that' parser.
Attributes
Run this parser on the given 'input' chunk of characters
Run this parser on the given 'input' chunk of characters
Attributes
Run this parser on the given 'input' chunk of characters using a specific parser implementation
Run this parser on the given 'input' chunk of characters using a specific parser implementation
Attributes
Run this parser on the given 'input' chunk
Run this parser on the given 'input' chunk
Attributes
Run this parser on the given 'input' string
Run this parser on the given 'input' string
Attributes
Run this parser on the given 'input' string using a specific parser implementation
Run this parser on the given 'input' string using a specific parser implementation
Attributes
Repeats this parser at least once.
Repeats this parser at least once.
The result is all the parsed elements until the first failure. The failure that stops the repetition gets swallowed and in case auto-backtracking is on, the parser backtracks to the end of the last successful item.
Attributes
Repeats this parser zero or more times.
Repeats this parser zero or more times.
The result is all the parsed elements until the first failure. The failure that stops the repetition gets swallowed and in case auto-backtracking is on, the parser backtracks to the end of the last successful item.
Attributes
Repeats this parser until the given stopCondition
parser succeeds.
Repeats this parser until the given stopCondition
parser succeeds.
Attributes
Repeats this parser at least once and requires that between each element, the 'sep' parser succeeds
Repeats this parser at least once and requires that between each element, the 'sep' parser succeeds
Attributes
Repeats this parser zero or more times and requires that between each element, the 'sep' parser succeeds
Repeats this parser zero or more times and requires that between each element, the 'sep' parser succeeds
Attributes
Enables or disables auto-backtracking for this parser
Enables or disables auto-backtracking for this parser
Attributes
Ignores this parser's result and instead capture the parsed string fragment
Ignores this parser's result and instead capture the parsed string fragment
Attributes
Strips all the name information from this parser to improve performance but reduces the failure message's verbosity.
Strips all the name information from this parser to improve performance but reduces the failure message's verbosity.
Attributes
Surrounds this parser with the 'other' parser. The result is this parser's result.
Surrounds this parser with the 'other' parser. The result is this parser's result.
Attributes
Maps the parser's successful tuple result to the given case class
Maps the parser's successful tuple result to the given case class
Attributes
Maps the parser's successful result with the given function 'to' that either fails or produces a new result value.
Maps the parser's successful result with the given function 'to' that either fails or produces a new result value.
Attributes
Maps the parser's successful result with the given function 'to' that either produces a new result value or the failure is indicated in the error channel by the value None.
Maps the parser's successful result with the given function 'to' that either produces a new result value or the failure is indicated in the error channel by the value None.
Attributes
Parser that does not consume any input and produces the unit value
Parser that does not consume any input and produces the unit value
Attributes
Concatenates this parser with 'that' parser. In case both parser succeeds, the result is a pair of the results.
Concatenates this parser with 'that' parser. In case both parser succeeds, the result is a pair of the results.
Attributes
Concatenates this parser with 'that' parser. In case both parser succeeds, the result is the result of this parser. Otherwise the parser fails.
Concatenates this parser with 'that' parser. In case both parser succeeds, the result is the result of this parser. Otherwise the parser fails.
Attributes
Concatenates this parser with that parser, and if both succeeds, discard the first result and use the second.
Concatenates this parser with that parser, and if both succeeds, discard the first result and use the second.
Attributes
Symbolic alias for orElse
Symbolic alias for orElse
Attributes
Symbolic alias for zip
Symbolic alias for zip
Attributes
Symbolic alias for zipRight
Symbolic alias for zipRight
Attributes
Inherited methods
Assigns 'that' parser as a fallback of this. First this parser gets evaluated. In case it succeeds, the result is this parser's result. In case it fails, the result is 'that' parser's result.
Assigns 'that' parser as a fallback of this. First this parser gets evaluated. In case it succeeds, the result is this parser's result. In case it fails, the result is 'that' parser's result.
If auto-backtracking is on, this parser will backtrack before trying 'that' parser.
Attributes
- Inherited from:
- VersionSpecificParser