|
kiama 0.9.0 API
|
|
kiama/parsing/Parsers.scala]
abstract
class
Parser[+T]
extends (scala.util.parsing.input.Reader) => ParseResult[T]| Method Summary | |
def
|
*
[U](sep : => Parser[U]) : Parser[scala.List[T]]
Construct a parser that parses zero or more occurrences of
what this parser parses, where each pair of occurrences is
separated by something that sep parses. At the moment, there
is no way to get at the results of sep.
|
def
|
*
: Parser[scala.List[T]]
Construct a parser that parses zero or more occurrences of
what this parser parses. Collect the result values in a
list. Defined in terms of +.
|
def
|
+
[U](sep : => Parser[U]) : Parser[scala.List[T]]
Construct a parser that parses one or more occurrences of
what this parser parses, where each pair of occurrences is
separated by something that sep parses. At the moment, there
is no way to get at the results of sep.
|
def
|
+
: Parser[scala.List[T]]
Construct a parser that parses one or more occurrences of
what this parser parses. Collect the result values in a
list. This parser is right recursive to avoid infinite
recursion.
|
def
|
<~
[U](q : => Parser[U]) : Parser[T]
Construct a parser that applies this parser and then q, returning
the result of this parser if the parses succeed.
|
def
|
>>
[U](f : (T) => Parser[U]) : Parser[U]
Construct a parser that runs this parser and, if successful, passes
the result to f and runs the resulting parser, returning the result
of the second parser.
|
def
|
?
: Parser[scala.Option[T]]
Construct a parser that parsers either what this parser parses
or nothing.
|
def
|
^?
[U](f : scala.PartialFunction[T, U]) : Parser[U]
Construct a parser that runs this parser, and if the parse was
successful, applies the partial function f to the result. If
f applies, return its result a successful parse result, otherwise
fail with a generic message.
|
def
|
^?
[U](f : scala.PartialFunction[T, U], error : (T) => java.lang.String) : Parser[U]
Construct a parser that runs this parser, and if the parse was
successful, applies the partial function f to the result. If
f applies, return its result a successful parse result, otherwise
fail with the message produced by error from the result of this
parser.
|
def
|
^^
[U](f : (T) => U) : Parser[U]
Construct a parser that parses what this parser parses and,
if successful, applies f to the result. The starting position
is attached to the result if it holds position information
and doesn't already have some.
|
def
|
^^^
[U](u : => U) : Parser[U]
Construct a parser that parses what this parser parses and,
if it's successful, returns u.
|
def
|
append
[U >: T](q : => Parser[U]) : Parser[U]
Run this parser and, if the parse was successful, return its result.
Otherwise try parsing with q.
|
abstract def
|
apply
(in : scala.util.parsing.input.Reader) : ParseResult[T]
Run this parser.
|
def
|
flatMap
[U](f : (T) => Parser[U]) : Parser[U]
Run this parser and, if the parse was successful, feed the resulting
value to f to continue parsing.
|
def
|
map
[U](f : (T) => U) : Parser[U]
Run this parser and, if the parse was successful, apply f to the
result.
|
def
|
unary_!
: Parser[Unit]
Construct a parser that succeeds if this parser fails and fails if
this parser succeeds. In the case of success (i.e., this parser has
failed), the constructed parser returns ().
|
def
|
unary_+
: Parser[T]
Construct a parser that returns the result of parsing with this
parser, except that it unconditionally backtracks to the input position
when this parser was invoked. I.e., the resulting parser is only useful
for its success or failure result, not its effect on the input.
|
def
|
|
[U >: T](q : => Parser[U]) : Parser[U]
Construct a parser that tries to parse using this parser,
and if successful, returns the result of that parse. If
the parse fails, try parsing with q.
|
def
|
~
[U](q : => Parser[U]) : Parser[~[T, U]]
Construct a parser that applies this parser and then q, returning
a tuple of the results if the parses succeed.
|
def
|
~>
[U](q : => Parser[U]) : Parser[U]
Construct a parser that applies this parser and then q, returning
the result of q if the parses succeed.
|
| Methods inherited from scala.Function1 | |
| scala.Function1.toString, scala.Function1.compose, scala.Function1.andThen |
| Methods inherited from AnyRef | |
| getClass, hashCode, equals, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
| Methods inherited from Any | |
| ==, !=, isInstanceOf, asInstanceOf |
| Method Details |
abstract
def
apply(in : scala.util.parsing.input.Reader) : ParseResult[T]
in - the input on which the parser should run
def
* : Parser[scala.List[T]]
def
*[U](sep : => Parser[U]) : Parser[scala.List[T]]
def
+ : Parser[scala.List[T]]
def
+[U](sep : => Parser[U]) : Parser[scala.List[T]]
def
? : Parser[scala.Option[T]]
def
^?[U](f : scala.PartialFunction[T, U]) : Parser[U]
def
^?[U](f : scala.PartialFunction[T, U], error : (T) => java.lang.String) : Parser[U]
|
kiama 0.9.0 API
|
|