object Parser extends ParserMain
Contains Parser implementation helper methods not typically needed for using parsers.
- Alphabetic
- By Inheritance
- Parser
- ParserMain
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def and[T](a: Parser[T], b: Parser[_]): Parser[T]
-
def
apply[T](p: Parser[T])(s: String): Parser[T]
Applies parser
p
to inputs
.Applies parser
p
to inputs
.- Definition Classes
- ParserMain
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- def bindParser[A, B](a: Parser[A], f: (A) ⇒ Parser[B]): Parser[B]
-
def
charClass(f: (Char) ⇒ Boolean, label: String = "<unspecified>"): Parser[Char]
Defines a Parser that parses a single character only if the predicate
f
returns true for that character.Defines a Parser that parses a single character only if the predicate
f
returns true for that character. If this parser fails,label
is used as the failure message.- Definition Classes
- ParserMain
-
def
chars(legal: String): Parser[Char]
Defines a Parser that parses a single character only if it is contained in
legal
.Defines a Parser that parses a single character only if it is contained in
legal
.- Definition Classes
- ParserMain
- def choiceParser[A, B](a: Parser[A], b: Parser[B]): Parser[Either[A, B]]
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
completions(p: Parser[_], s: String, level: Int): Completions
Applies parser
p
to inputs
and returns the completions at verbositylevel
.Applies parser
p
to inputs
and returns the completions at verbositylevel
. The interpretation oflevel
is up to parser definitions, but 0 is the default by convention, with increasing positive numbers corresponding to increasing verbosity. Typically no more than a few levels are defined.- Definition Classes
- ParserMain
-
def
derive1[T](p: Parser[T], c: Char): Parser[T]
Applies parser
p
to a single character of input.Applies parser
p
to a single character of input.- Definition Classes
- ParserMain
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
examples[A](a: Parser[A], completions: ExampleSource, maxNumberOfExamples: Int, removeInvalidExamples: Boolean): Parser[A]
- A
the type of values that are returned by the parser.
- a
the parser to decorate with a source of examples. All validation and parsing is delegated to this parser, only Parser.completions is modified.
- completions
the source of examples when displaying completions to the user.
- maxNumberOfExamples
limits the number of examples that the source of examples should return. This can prevent lengthy pauses and avoids bad interactive user experience.
- removeInvalidExamples
indicates whether completion examples should be checked for validity (against the given parser). An exception is thrown if the example source contains no valid completion suggestions.
- Definition Classes
- ParserMain
-
def
examples[A](a: Parser[A], completions: Set[String], check: Boolean = false): Parser[A]
- Definition Classes
- ParserMain
-
def
failure(msg: ⇒ String, definitive: Boolean = false): Parser[Nothing]
Defines a parser that always fails on any input with message
msg
.Defines a parser that always fails on any input with message
msg
. Ifdefinitive
istrue
, any failures by later alternatives are discarded.- Definition Classes
- ParserMain
- def filterParser[T](a: Parser[T], f: (T) ⇒ Boolean, seen: String, msg: (String) ⇒ String): Parser[T]
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
homParser[A](a: Parser[A], b: Parser[A]): Parser[A]
- Definition Classes
- ParserMain
-
def
invalid(msgs: ⇒ Seq[String], definitive: Boolean = false): Parser[Nothing]
Defines a parser that always fails on any input with messages
msgs
.Defines a parser that always fails on any input with messages
msgs
. Ifdefinitive
istrue
, any failures by later alternatives are discarded.- Definition Classes
- ParserMain
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
implicit
def
literal(s: String): Parser[String]
Presents a literal String
s
as a Parser that only parses that exact text and provides it as the result.Presents a literal String
s
as a Parser that only parses that exact text and provides it as the result.- Definition Classes
- ParserMain
-
implicit
def
literal(ch: Char): Parser[Char]
Presents a single Char
ch
as a Parser that only parses that exact character.Presents a single Char
ch
as a Parser that only parses that exact character.- Definition Classes
- ParserMain
-
implicit
def
literalRichCharParser(c: Char): RichParser[Char]
- Definition Classes
- ParserMain
-
implicit
def
literalRichStringParser(s: String): RichParser[String]
- Definition Classes
- ParserMain
- def mapParser[A, B](a: Parser[A], f: (A) ⇒ B): Parser[B]
-
def
matched(t: Parser[_], seen: Vector[Char] = Vector.empty, partial: Boolean = false): Parser[String]
- Definition Classes
- ParserMain
- def mkFailure(error: ⇒ String, definitive: Boolean = false): Failure
- def mkFailures(errors: ⇒ Seq[String], definitive: Boolean = false): Failure
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
not(p: Parser[_], failMessage: String): Parser[Unit]
- Definition Classes
- ParserMain
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def onFailure[T](delegate: Parser[T], msg: String): Parser[T]
-
def
oneOf[T](p: Seq[Parser[T]]): Parser[T]
- Definition Classes
- ParserMain
- def oneOrMore[T](p: Parser[T]): Parser[Seq[T]]
- def opt[T](a: Parser[T]): Parser[Option[T]]
-
def
parse[T](str: String, parser: Parser[T]): Either[String, T]
Parses input
str
usingparser
.Parses input
str
usingparser
. If successful, the result is provided wrapped inRight
. If unsuccessful, an error message is provided inLeft
.- Definition Classes
- ParserMain
-
def
range(r: NumericRange[Char], label: String): Parser[Char]
Presents a Char range as a Parser.
Presents a Char range as a Parser. A single Char is parsed only if it is in the given range.
- Definition Classes
- ParserMain
-
implicit
def
range(r: NumericRange[Char]): Parser[Char]
Presents a Char range as a Parser.
Presents a Char range as a Parser. A single Char is parsed only if it is in the given range.
- Definition Classes
- ParserMain
- def repeat[T](p: Parser[T], min: Int = 0, max: UpperBound = Infinite): Parser[Seq[T]]
-
def
result[T](p: Parser[T], s: String): Either[() ⇒ (Seq[String], Int), T]
- Definition Classes
- ParserMain
-
implicit
def
richParser[A](a: Parser[A]): RichParser[A]
Provides combinators for Parsers.
Provides combinators for Parsers.
- Definition Classes
- ParserMain
-
def
sample(str: String, parser: Parser[_], completions: Boolean = false): Unit
Convenience method to use when developing a parser.
Convenience method to use when developing a parser.
parser
is applied to the inputstr
. Ifcompletions
is true, the available completions for the input are displayed. Otherwise, the result of parsing is printed using the result'stoString
method. If parsing fails, the error message is displayed.See also sampleParse and sampleCompletions.
- Definition Classes
- ParserMain
-
def
sampleCompletions(str: String, parser: Parser[_], level: Int = 1): Unit
Convenience method to use when developing a parser.
Convenience method to use when developing a parser.
parser
is applied to the inputstr
and the available completions are displayed on separate lines. If parsing fails, the error message is displayed.- Definition Classes
- ParserMain
-
def
sampleParse(str: String, parser: Parser[_]): Unit
Convenience method to use when developing a parser.
Convenience method to use when developing a parser.
parser
is applied to the inputstr
and the result of parsing is printed using the result'stoString
method. If parsing fails, the error message is displayed.- Definition Classes
- ParserMain
-
def
seq[T](p: Seq[Parser[T]]): Parser[Seq[T]]
- Definition Classes
- ParserMain
-
def
seq0[T](p: Seq[Parser[T]], errors: ⇒ Seq[String]): Parser[Seq[T]]
- Definition Classes
- ParserMain
- def seqParser[A, B](a: Parser[A], b: Parser[B]): Parser[(A, B)]
-
def
stringLiteral(s: String, start: Int): Parser[String]
- Definition Classes
- ParserMain
-
def
success[T](value: T): Parser[T]
Defines a parser that always succeeds on empty input with the result
value
.Defines a parser that always succeeds on empty input with the result
value
.- Definition Classes
- ParserMain
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
token[T](t: Parser[T], complete: TokenCompletions): Parser[T]
- Definition Classes
- ParserMain
-
def
token[T](t: Parser[T], description: String): Parser[T]
Establishes delegate parser
t
as a single token of tab completion.Establishes delegate parser
t
as a single token of tab completion. When tab completion of part of this token is requested,description
is displayed for suggestions and no completions are ever performed.- Definition Classes
- ParserMain
-
def
token[T](t: Parser[T], hide: (Int) ⇒ Boolean): Parser[T]
Establishes delegate parser
t
as a single token of tab completion.Establishes delegate parser
t
as a single token of tab completion. When tab completion of part of this token is requested, no completions are returned ifhide
returns true for the current tab completion level. Otherwise, the completions provided by the delegatet
or a later derivative are appended to the prefix String already seen by this parser.- Definition Classes
- ParserMain
-
def
token[T](t: Parser[T]): Parser[T]
Establishes delegate parser
t
as a single token of tab completion.Establishes delegate parser
t
as a single token of tab completion. When tab completion of part of this token is requested, the completions provided by the delegatet
or a later derivative are appended to the prefix String already seen by this parser.- Definition Classes
- ParserMain
-
def
tokenDisplay[T](t: Parser[T], display: String): Parser[T]
Establishes delegate parser
t
as a single token of tab completion.Establishes delegate parser
t
as a single token of tab completion. When tab completion of part of this token is requested,display
is used as the printed suggestion, but the completions from the delegate parsert
are used to complete if unambiguous.- Definition Classes
- ParserMain
- def trapAndFail[T](delegate: Parser[T]): Parser[T]
- def tuple[A, B](a: Option[A], b: Option[B]): Option[(A, B)]
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
- def zeroOrMore[T](p: Parser[T]): Parser[Seq[T]]
-
object
~
See unapply.
See unapply.
- Definition Classes
- ParserMain