cats.parse
Type members
Classlikes
Creates an appender given the first item to be added This is used to build the result in Parser.repAs
Creates an appender given the first item to be added This is used to build the result in Parser.repAs
- Companion
- object
Creates an appender This is used to build the result in Parser.repAs0
Creates an appender This is used to build the result in Parser.repAs0
- Companion
- object
A limited Builder-like value we use for portability
A limited Builder-like value we use for portability
- Companion
- object
This is a class to convert linear offset in a string into lines, or the column and line numbers.
This is a class to convert linear offset in a string into lines, or the column and line numbers.
This is useful for display to humans who in text editors think in terms of line and column numbers
- Companion
- object
Parser[A] is a Parser0[A] that will always consume one-or-more characters on a successful parse.
Parser[A] is a Parser0[A] that will always consume one-or-more characters on a successful parse.
Since Parser is guaranteed to consume input it provides additional
methods which would be unsafe when used on parsers that succeed
without consuming input, such as rep0
.
When a Parser is composed with a Parser0 the result is usually a
Parser. Parser overrides many of Parser0's methods to refine the
return type. In other cases, callers may need to use the with1
helper method to refine the type of their expressions.
Parser doesn't provide any additional guarantees over Parser0 on what kind of parsing failures it can return.
- Companion
- object
Parser0[A] attempts to extract an A
value from the given input,
potentially moving its offset forward in the process.
Parser0[A] attempts to extract an A
value from the given input,
potentially moving its offset forward in the process.
When calling parse
, one of three outcomes occurs:
-
Success: The parser consumes zero-or-more characters of input and successfully extracts a value. The input offset will be moved forward by the number of characters consumed.
-
Epsilon failure: The parser fails to extract a value without consuming any characters of input. The input offset will not be changed.
-
Arresting failure: The parser fails to extract a value but does consume one-or-more characters of input. The input offset will be moved forward by the number of characters consumed and all parsing will stop (unless a higher-level parser backtracks).
Operations such as x.orElse(y)
will only consider parser y
if
x
returns an epsilon failure; these methods cannot recover from
an arresting failure. Arresting failures can be "rewound" using
methods such as x.backtrack
(which converts arresting failures
from x
into epsilon failures), or softProduct(x, y)
(which can
rewind successful parses by x
that are followed by epsilon
failures for y
).
Rewinding tends to make error reporting more difficult and can lead to exponential parser behavior it is not the default behavior.
- Companion
- object
Parsers for the common rules of RFC5234. These rules are referenced by several RFCs.
Parsers for the common rules of RFC5234. These rules are referenced by several RFCs.
- See also
SemVer 2.0.0 Parser based on https://semver.org
SemVer 2.0.0 Parser based on https://semver.org