object DefaultParsers extends Parsers with ParserMain
Provides common Parser implementations and helper methods.
- Alphabetic
- By Inheritance
- DefaultParsers
- ParserMain
- Parsers
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
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
-
lazy val
BackslashChar: Char
Backslash character.
Backslash character.
- Definition Classes
- Parsers
-
lazy val
Bool: Parser[Boolean]
Parses the lower-case values
true
andfalse
into their corresponding Boolean values.Parses the lower-case values
true
andfalse
into their corresponding Boolean values.- Definition Classes
- Parsers
-
lazy val
CapitalizedID: Parser[String]
Parses a non-symbolic Scala-like identifier.
Parses a non-symbolic Scala-like identifier. The identifier must start with Upper and contain zero or more ScalaIDChars after that.
- Definition Classes
- Parsers
-
lazy val
DQuoteChar: Char
Double quote character.
Double quote character.
- Definition Classes
- Parsers
-
lazy val
DQuoteClass: Parser[Char]
Matches a single double quote.
Matches a single double quote.
- Definition Classes
- Parsers
-
lazy val
Digit: Parser[Char]
Parses any single digit and provides that digit as a Char as the result.
Parses any single digit and provides that digit as a Char as the result.
- Definition Classes
- Parsers
-
lazy val
DigitSet: Set[String]
Set that contains each digit in a String representation.
Set that contains each digit in a String representation.
- Definition Classes
- Parsers
-
lazy val
EOF: Parser[Unit]
Matches the end of input, providing no useful result on success.
Matches the end of input, providing no useful result on success.
- Definition Classes
- Parsers
-
lazy val
EscapeSequence: Parser[Char]
Parses a single escape sequence into the represented Char.
Parses a single escape sequence into the represented Char. Escapes start with a backslash and are followed by
u
for a UnicodeEscape or byb
,t
,n
,f
,r
,"
,'
,\
for standard escapes.- Definition Classes
- Parsers
-
lazy val
HexDigit: Parser[Char]
Parses a single hexadecimal digit (0-9, a-f, A-F).
Parses a single hexadecimal digit (0-9, a-f, A-F).
- Definition Classes
- Parsers
-
lazy val
HexDigitSet: Set[Char]
Set containing Chars for hexadecimal digits 0-9 and A-F (but not a-f).
Set containing Chars for hexadecimal digits 0-9 and A-F (but not a-f).
- Definition Classes
- Parsers
-
lazy val
ID: Parser[String]
Parses an identifier String, which must start with IDStart and contain zero or more IDChars after that.
-
lazy val
IDChar: Parser[Char]
Parses an identifier Char other than the first character.
Parses an identifier Char other than the first character. This includes letters, digits, dash
-
, and underscore_
.- Definition Classes
- Parsers
-
def
IDStart: Parser[Char]
Parses the first Char in an sbt identifier, which must be a Letter.
-
lazy val
IntBasic: Parser[Int]
Parses a signed integer.
Parses a signed integer.
- Definition Classes
- Parsers
-
lazy val
Letter: Parser[Char]
Parses a single letter, according to Char.isLetter, into a Char.
Parses a single letter, according to Char.isLetter, into a Char.
- Definition Classes
- Parsers
-
lazy val
Lower: Parser[Char]
Parses a single letter, according to Char.isLower, into a Char.
Parses a single letter, according to Char.isLower, into a Char.
- Definition Classes
- Parsers
-
lazy val
NatBasic: Parser[Int]
Parses an unsigned integer.
Parses an unsigned integer.
- Definition Classes
- Parsers
-
lazy val
NotDQuoteBackslashClass: Parser[Char]
Matches any character except a double quote or backslash.
Matches any character except a double quote or backslash.
- Definition Classes
- Parsers
-
lazy val
NotDQuoteSpaceClass: Parser[Char]
Matches any character except a double quote or whitespace.
Matches any character except a double quote or whitespace.
- Definition Classes
- Parsers
-
lazy val
NotQuoted: Parser[String]
Parses an unquoted, non-empty String value that cannot start with a double quote and cannot contain whitespace.
Parses an unquoted, non-empty String value that cannot start with a double quote and cannot contain whitespace.
- Definition Classes
- Parsers
-
lazy val
NotQuotedThenQuoted: Parser[String]
Parses a non-empty String value that cannot start with a double quote, but includes double quotes.
Parses a non-empty String value that cannot start with a double quote, but includes double quotes.
- Definition Classes
- Parsers
-
lazy val
NotSpace: Parser[String]
Matches a non-empty String consisting of non-whitespace characters.
Matches a non-empty String consisting of non-whitespace characters.
- Definition Classes
- Parsers
-
lazy val
NotSpaceClass: Parser[Char]
Matches a single character that is not a whitespace character.
Matches a single character that is not a whitespace character.
- Definition Classes
- Parsers
-
lazy val
Op: Parser[String]
Parses a non-empty operator String, which consists only of characters allowed by OpChar.
-
lazy val
OpChar: Parser[Char]
Parses a single operator Char, as allowed by isOpChar.
-
lazy val
OpOrID: Parser[String]
Parses either an operator String defined by Op or a non-symbolic identifier defined by ID.
-
lazy val
OptNotSpace: Parser[String]
Matches a possibly empty String consisting of non-whitespace characters.
Matches a possibly empty String consisting of non-whitespace characters.
- Definition Classes
- Parsers
-
lazy val
OptSpace: Parser[Seq[Char]]
Matches a possibly empty String consisting of whitespace characters.
Matches a possibly empty String consisting of whitespace characters. The suggested tab completion is a single, constant space character.
- Definition Classes
- Parsers
-
lazy val
Port: Parser[Int]
Parses a port number.
Parses a port number. Currently, this accepts any integer and presents a tab completion suggestion of
<port>
.- Definition Classes
- Parsers
-
lazy val
ScalaID: Parser[String]
Parses a non-symbolic Scala-like identifier.
Parses a non-symbolic Scala-like identifier. The identifier must start with IDStart and contain zero or more ScalaIDChars after that.
- Definition Classes
- Parsers
-
lazy val
ScalaIDChar: Parser[Char]
Parses a single, non-symbolic Scala identifier Char.
Parses a single, non-symbolic Scala identifier Char. Valid characters are letters, digits, and the underscore character
_
.- Definition Classes
- Parsers
-
lazy val
Size: Parser[Long]
Parses a size unit string.
Parses a size unit string. For example,
128K
parsers to128L * 1024
, and1.25g
parses to1024L * 1024 * 1024 * 5 / 4
.- Definition Classes
- Parsers
-
lazy val
Space: Parser[Seq[Char]]
Matches a non-empty String consisting of whitespace characters.
Matches a non-empty String consisting of whitespace characters. The suggested tab completion is a single, constant space character.
- Definition Classes
- Parsers
-
lazy val
SpaceClass: Parser[Char]
Matches a single whitespace character, as determined by Char.isWhitespace.
Matches a single whitespace character, as determined by Char.isWhitespace.
- Definition Classes
- Parsers
-
lazy val
StringBasic: Parser[String]
Parses a potentially quoted String value.
Parses a potentially quoted String value. The value may be verbatim quoted (StringVerbatim), quoted with interpreted escapes (StringEscapable), or unquoted (NotQuoted).
- Definition Classes
- Parsers
-
lazy val
StringEscapable: Parser[String]
Parses a string value, interpreting escapes and discarding the surrounding quotes in the result.
Parses a string value, interpreting escapes and discarding the surrounding quotes in the result. See EscapeSequence for supported escapes.
- Definition Classes
- Parsers
-
lazy val
StringVerbatim: Parser[String]
Parses a verbatim quoted String value, discarding the quotes in the result.
Parses a verbatim quoted String value, discarding the quotes in the result. This kind of quoted text starts with triple quotes
"""
and ends at the next triple quotes and may contain any character in between.- Definition Classes
- Parsers
-
lazy val
URIChar: Parser[Char]
Matches a single character that is valid somewhere in a URI.
Matches a single character that is valid somewhere in a URI.
- Definition Classes
- Parsers
-
lazy val
URIClass: Parser[String]
Parses a non-empty String that contains only valid URI characters, as defined by URIChar.
-
lazy val
UnicodeEscape: Parser[Char]
Parses a single unicode escape sequence into the represented Char.
Parses a single unicode escape sequence into the represented Char. A unicode escape begins with a backslash, followed by a
u
and 4 hexadecimal digits representing the unicode value.- Definition Classes
- Parsers
-
lazy val
Upper: Parser[Char]
Parses a single letter, according to Char.isUpper, into a Char.
Parses a single letter, according to Char.isUpper, into a Char.
- Definition Classes
- Parsers
-
def
Uri(ex: Set[URI]): Parser[URI]
Parses a URI that is valid according to the single argument java.net.URI constructor, using
ex
as tab completion examples.Parses a URI that is valid according to the single argument java.net.URI constructor, using
ex
as tab completion examples.- Definition Classes
- Parsers
-
lazy val
VerbatimDQuotes: String
Triple-quotes, as used for verbatim quoting.
Triple-quotes, as used for verbatim quoting.
- Definition Classes
- Parsers
-
def
alphanum(c: Char): Boolean
Returns true if
c
is an ASCII letter or digit.Returns true if
c
is an ASCII letter or digit.- Definition Classes
- Parsers
-
lazy val
any: Parser[Char]
Parses any single character and provides that character as the result.
Parses any single character and provides that character as the result.
- Definition Classes
- Parsers
-
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
-
lazy val
basicUri: Parser[URI]
Parses a URI that is valid according to the single argument java.net.URI constructor.
Parses a URI that is valid according to the single argument java.net.URI constructor.
- Definition Classes
- Parsers
-
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
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
fileParser(base: File): Parser[File]
- base
the directory used for completion proposals (when the user presses the TAB key). Only paths under this directory will be proposed.
- returns
the file that was parsed from the input string. The returned path may or may not exist.
- Definition Classes
- Parsers
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
flag[T](p: Parser[T]): Parser[Boolean]
Applies
p
and usestrue
as the result if it succeeds and turns failure into a result offalse
.Applies
p
and usestrue
as the result if it succeeds and turns failure into a result offalse
.- Definition Classes
- Parsers
-
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
identifier(start: Parser[Char], rep: Parser[Char]): Parser[String]
Parses a String that starts with
start
and is followed by zero or more characters parsed byrep
.Parses a String that starts with
start
and is followed by zero or more characters parsed byrep
.- Definition Classes
- Parsers
-
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
-
def
isDelimiter(c: Char): Boolean
- Definition Classes
- Parsers
-
def
isIDChar(c: Char): Boolean
Returns true if
c
is a dash-
, a letter, digit, or an underscore_
.Returns true if
c
is a dash-
, a letter, digit, or an underscore_
.- Definition Classes
- Parsers
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isOpChar(c: Char): Boolean
Returns true if
c
an operator character.Returns true if
c
an operator character.- Definition Classes
- Parsers
-
def
isOpType(cat: Int): Boolean
- Definition Classes
- Parsers
-
def
isScalaIDChar(c: Char): Boolean
Returns true if
c
is a letter, digit, or an underscore_
.Returns true if
c
is a letter, digit, or an underscore_
.- Definition Classes
- Parsers
-
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
mapOrFail[S, T](p: Parser[S])(f: (S) ⇒ T): Parser[T]
Applies
f
to the result ofp
, transforming any exception when evaluatingf
into a parse failure with the exceptiontoString
as the message.Applies
f
to the result ofp
, transforming any exception when evaluatingf
into a parse failure with the exceptiontoString
as the message.- Definition Classes
- Parsers
-
def
matched(t: Parser[_], seen: Vector[Char] = Vector.empty, partial: Boolean = false): Parser[String]
- Definition Classes
- ParserMain
-
def
matches(p: Parser[_], s: String): Boolean
Applies parser
p
to inputs
and returnstrue
if the parse was successful. -
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
oneOf[T](p: Seq[Parser[T]]): Parser[T]
- Definition Classes
- ParserMain
-
def
opOrIDSpaced(s: String): Parser[Char]
- Definition Classes
- Parsers
-
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
rep1sep[T](rep: Parser[T], sep: Parser[_]): Parser[Seq[T]]
Applies
rep
one or more times, separated bysep
.Applies
rep
one or more times, separated bysep
. The result is the non-empty sequence of results from the multiplerep
applications. Thesep
results are discarded.- Definition Classes
- Parsers
-
def
repeatDep[A](p: (Seq[A]) ⇒ Parser[A], sep: Parser[Any]): Parser[Seq[A]]
Defines a sequence parser where the parser used for each part depends on the previously parsed values.
Defines a sequence parser where the parser used for each part depends on the previously parsed values.
p
is applied to the (possibly empty) sequence of already parsed values to obtain the next parser to use. The parsers obtained in this way are separated bysep
, whose result is discarded and only the sequence of values from the parsers returned byp
is used for the result.- Definition Classes
- Parsers
-
def
repsep[T](rep: Parser[T], sep: Parser[_]): Parser[Seq[T]]
Applies
rep
zero or more times, separated bysep
.Applies
rep
zero or more times, separated bysep
. The result is the (possibly empty) sequence of results from the multiplerep
applications. Thesep
results are discarded.- Definition Classes
- Parsers
-
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
some[T](p: Parser[T]): Parser[Option[T]]
Wraps the result of
p
inSome
.Wraps the result of
p
inSome
.- Definition Classes
- Parsers
-
def
spaceDelimited(display: String): Parser[Seq[String]]
Parses a space-delimited, possibly empty sequence of arguments.
Parses a space-delimited, possibly empty sequence of arguments. The arguments may use quotes and escapes according to StringBasic.
- Definition Classes
- Parsers
-
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
trimmed(p: Parser[String]): Parser[String]
Applies String.trim to the result of
p
.Applies String.trim to the result of
p
.- Definition Classes
- Parsers
-
def
validID(s: String): Boolean
Returns
true
ifs
parses successfully according to ID. -
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()
-
object
~
See unapply.
See unapply.
- Definition Classes
- ParserMain