Syntax defines a parser and a printer together and provides combinators to simultaneously build them up from smaller syntax fragments.
Type parameters
- Err
-
Custom error type
- In
-
Element type of the input stream of parsing
- Out
-
Element type of the output stream of printing
- Value
-
The type of the value to be parsed or printed
Attributes
- Companion
- object
- Graph
-
- Supertypes
- 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
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 result of the syntax and result in 'value' instead
Ignores the result of the syntax and result in 'value' instead
Attributes
Sets the result to 'result' and the value to be printed to 'value'
Sets the result to 'result' and the value to be printed to 'value'
Attributes
This syntax repeated at least 'min' times.
This syntax repeated 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.
When printing, the input is a chunk of values and each element gets printed.
Attributes
Enables auto-backtracking for this syntax
Enables auto-backtracking for this syntax
Attributes
Syntax that resets the parsing position in case it fails.
Syntax 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.
Does not affect printing.
Attributes
Concatenates the syntaxes 'left', then this, then 'right'.
Concatenates the syntaxes 'left', then this, then 'right'.
All three must succeed. The result is this syntax's result.
Note that the 'left' and 'right' syntaxes must have a 'Value' type of Unit. Otherwise the printer could not produce an arbitrary input value for them as their result is discarded.
Attributes
Prints a debug message when this syntax parses a value
Prints a debug message when this syntax parses a value
Attributes
Specifies a filter condition 'condition' that gets checked in both parser and printer mode and in case it evaluates to false, fails with 'failure'.
Specifies a filter condition 'condition' that gets checked in both parser and printer mode and in case it evaluates to false, fails with 'failure'.
Attributes
Flattens a result of parsed strings to a single string
Flattens a result of parsed strings to a single string
Attributes
Disables auto-backtracking for this syntax
Disables auto-backtracking for this syntax
Attributes
Maps the error with the given function 'f'
Maps the error with the given function 'f'
Attributes
Associates a name with this syntax. The chain of named parsers are reported in case of failure to help debugging parser issues.
Associates a name with this syntax. The chain of named parsers are reported in case of failure to help debugging parser issues.
Attributes
Syntax that succeeds only if this syntax fails
Syntax that succeeds only if this syntax fails
Attributes
Transforms the syntax of a tuple to a syntax of a given case class
Transforms the syntax of a tuple to a syntax of a given case class
Attributes
Make this syntax optional.
Make this syntax optional.
Failure of the parser will be ignored. In case auto-backtracking is enabled, backtracking is performed on it.
Attributes
Assigns 'that' syntax as a fallback of this. First this parser or printer gets evaluated. In case it succeeds, the result is this syntax's result. In case it fails, the result is 'that' syntax's result.
Assigns 'that' syntax as a fallback of this. First this parser or printer gets evaluated. In case it succeeds, the result is this syntax's result. In case it fails, the result is 'that' syntax's result.
If auto-backtracking is on, this parser will backtrack before trying 'that' parser.
Attributes
Assigns 'that' syntax as a fallback of this. First this parser or printer gets evaluated. In case it succeeds, the result is this syntax's result wrapped in 'Left'. In case it fails, the result is 'that' syntax's result, wrapped in 'Right'.
Assigns 'that' syntax as a fallback of this. First this parser or printer gets evaluated. In case it succeeds, the result is this syntax's result wrapped in 'Left'. In case it fails, the result is 'that' syntax's result, wrapped in 'Right'.
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
Prints a value 'value' to the target implementation 'target'
Prints a value 'value' to the target implementation 'target'
Attributes
Prints a value 'value' and get back the chunk of output elements'
Prints a value 'value' and get back the chunk of output elements'
Attributes
Prints a value 'value' to a string
Prints a value 'value' to a string
Attributes
This syntax repeated at least once.
This syntax repeated 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.
When printing, the input is a chunk of values and each element gets printed.
Attributes
This syntax repeated zero or more times.
This syntax repeated 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.
When printing, the input is a chunk of values and each element gets printed.
Attributes
Repeats this syntax until 'stopCondition', performed after each element, results in success.
Repeats this syntax until 'stopCondition', performed after each element, results in success.
Attributes
Repeats this syntax at least once and with 'sep' injected between each element
Repeats this syntax at least once and with 'sep' injected between each element
Attributes
Repeats this syntax zero or more times and with 'sep' injected between each element
Repeats this syntax zero or more times and with 'sep' injected between each element
Attributes
Enables or disables auto-backtracking for this syntax
Enables or disables auto-backtracking for this syntax
Attributes
Ignores this syntax's result and instead captures the parsed string fragment / directly print the input string
Ignores this syntax's result and instead captures the parsed string fragment / directly print the input string
Attributes
Strips all the name information from this syntax to improve performance but reduces the failure message's verbosity.
Strips all the name information from this syntax 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
Converts a Chunk syntax to a List syntax
Converts a Chunk syntax to a List syntax
Attributes
Maps the parser's successful result with the given function 'to', and maps the value to be printed with the given function 'from'
Maps the parser's successful result with the given function 'to', and maps the value to be printed with the given function 'from'
Attributes
Maps the parser's successful result with the given function 'to', and maps the value to be printed with the given function 'from'. Both of the mapping functions can fail the parser/printer.
Maps the parser's successful result with the given function 'to', and maps the value to be printed with the given function 'from'. Both of the mapping functions can fail the parser/printer.
Attributes
Maps the parser's successful result with the given function 'to', and maps the value to be printed with the given function 'from'. Both of the mapping functions can fail the parser/printer. The failure is indicated in the error channel by the value None.
Maps the parser's successful result with the given function 'to', and maps the value to be printed with the given function 'from'. Both of the mapping functions can fail the parser/printer. The failure is indicated in the error channel by the value None.
Attributes
Maps the parsed value with the function 'to', and the value to be printed with the partial function 'from'. It the partial function is not defined on the value, the printer fails with 'failure'.
Maps the parsed value with the function 'to', and the value to be printed with the partial function 'from'. It the partial function is not defined on the value, the printer fails with 'failure'.
This can be used to define separate syntaxes for subtypes, that can be later combined.
Attributes
Syntax that does not consume any input but prints 'printed' and results in unit
Syntax that does not consume any input but prints 'printed' and results in unit
Attributes
Widens the parser to a supertype of its result
Widens the parser to a supertype of its result
This is useful in combination with the orElse (<>) operator. For example a JSON parser can be expressed by a combination of parsers for the individual json type widened to Json:
nul.widen[Json] <>
bool.widen[Json] <>
str.widen[Json] <>
num.widen[Json] <>
list.widen[Json] <>
obj.widen[Json]
Attributes
Widen this syntax's printed value type by specifying a partial function to narrow it back to the set of supported subtypes.
Widen this syntax's printed value type by specifying a partial function to narrow it back to the set of supported subtypes.
Attributes
Concatenates this syntax with 'that' syntax. In case both parser succeeds, the result is a pair of the results. The printer destructures a pair and prints the left value with this, the right value with 'that'.
Concatenates this syntax with 'that' syntax. In case both parser succeeds, the result is a pair of the results. The printer destructures a pair and prints the left value with this, the right value with 'that'.
Attributes
Concatenates this parser with 'that' parser. In case both parser succeeds, the result is the result of this parser. Otherwise the parser fails. The printer passes the value to be printed to this printer, and also executes 'that' printer with unit as the input value.
Concatenates this parser with 'that' parser. In case both parser succeeds, the result is the result of this parser. Otherwise the parser fails. The printer passes the value to be printed to this printer, and also executes 'that' printer with unit as the input value.
Note that the right syntax must have 'Value' defined as Unit, because there is no way for the printer to reconstruct an arbitrary input for the right printer.
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' syntax as a fallback of this. First this parser or printer gets evaluated. In case it succeeds, the result is this syntax's result. In case it fails, the result is 'that' syntax's result.
Assigns 'that' syntax as a fallback of this. First this parser or printer gets evaluated. In case it succeeds, the result is this syntax's result. In case it fails, the result is 'that' syntax's result.
If auto-backtracking is on, this parser will backtrack before trying 'that' parser.
Attributes
- Inherited from:
- VersionSpecificSyntax