Parser

sbt.internal.util.complete.Parser
See theParser companion object
trait Parser[+A1]

A String parser that provides semi-automatic tab completion. A successful parse results in a value of type A. The methods in this trait are what must be implemented to define a new Parser implementation, but are not typically useful for common usage. Instead, most useful methods for combining smaller parsers into larger parsers are implicitly added by the RichParser type.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait ValidParser[T]

Members list

Value members

Abstract methods

def !!!(msg: String): Parser[A]
Implicitly added by richParser

Uses the specified message if the original Parser fails.

Uses the specified message if the original Parser fails.

Attributes

def &(o: Parser[_]): Parser[A]
Implicitly added by richParser

Apply the original parser, but only succeed if o also succeeds. Note that o does not need to consume the same amount of input to satisfy this condition.

Apply the original parser, but only succeed if o also succeeds. Note that o does not need to consume the same amount of input to satisfy this condition.

Attributes

def *: Parser[Seq[A]]
Implicitly added by richParser

Apply the original Parser zero or more times and provide the (potentially empty) sequence of results.

Apply the original Parser zero or more times and provide the (potentially empty) sequence of results.

Attributes

def +: Parser[Seq[A]]
Implicitly added by richParser

Apply the original Parser one or more times and provide the non-empty sequence of results.

Apply the original Parser one or more times and provide the non-empty sequence of results.

Attributes

def <~[B](b: Parser[B]): Parser[A]
Implicitly added by richParser

Produces a Parser that applies the original Parser and then applies next (in order), discarding the result of next. (The arrow point in the direction of the retained result.)

Produces a Parser that applies the original Parser and then applies next (in order), discarding the result of next. (The arrow point in the direction of the retained result.)

Attributes

def ?: Parser[Option[A]]
Implicitly added by richParser

Apply the original Parser zero or one times, returning None if it was applied zero times or the result wrapped in Some if it was applied once.

Apply the original Parser zero or one times, returning None if it was applied zero times or the result wrapped in Some if it was applied once.

Attributes

def ??[B >: A](alt: B): Parser[B]
Implicitly added by richParser

Apply the original Parser, but provide alt as the result if it fails.

Apply the original Parser, but provide alt as the result if it fails.

Attributes

def ^^^[B](value: B): Parser[B]
Implicitly added by richParser

Apply the original Parser, but provide value as the result if it succeeds.

Apply the original Parser, but provide value as the result if it succeeds.

Attributes

def completions(level: Int): Completions
def derive(i: Char): Parser[A1]
def examples(s: String*): Parser[A]
Implicitly added by richParser

Explicitly defines the completions for the original Parser.

Explicitly defines the completions for the original Parser.

Attributes

def examples(s: Set[String], check: Boolean): Parser[A]
Implicitly added by richParser

Explicitly defines the completions for the original Parser.

Explicitly defines the completions for the original Parser.

Attributes

def examples(exampleSource: ExampleSource, maxNumberOfExamples: Int, removeInvalidExamples: Boolean): Parser[A]
Implicitly added by richParser

Value parameters

exampleSource

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). Invalid examples will be filtered out and only valid suggestions will be displayed.

Attributes

Returns

a new parser with a new source of completions.

Implicitly added by richParser

If an exception is thrown by the original Parser, capture it and fail locally instead of allowing the exception to propagate up and terminate parsing.

If an exception is thrown by the original Parser, capture it and fail locally instead of allowing the exception to propagate up and terminate parsing.

Attributes

def failure: Option[Failure]
def filter(f: A => Boolean, msg: String => String): Parser[A]
Implicitly added by richParser

Produces a Parser that filters the original parser. If 'f' is not true when applied to the output of the original parser, the Parser returned by this method fails. The failure message is constructed by applying msg to the String that was successfully parsed by the original parser.

Produces a Parser that filters the original parser. If 'f' is not true when applied to the output of the original parser, the Parser returned by this method fails. The failure message is constructed by applying msg to the String that was successfully parsed by the original parser.

Attributes

def flatMap[B](f: A => Parser[B]): Parser[B]
Implicitly added by richParser

Applies the original parser, applies f to the result to get the next parser, and applies that parser and uses its result for the overall result.

Applies the original parser, applies f to the result to get the next parser, and applies that parser and uses its result for the overall result.

Attributes

def id: Parser[A]
Implicitly added by richParser

Returns the original parser. This is useful for converting literals to Parsers. For example, 'c'.id or "asdf".id

Returns the original parser. This is useful for converting literals to Parsers. For example, 'c'.id or "asdf".id

Attributes

def ifValid[A2](p: => Parser[A2]): Parser[A2]
def map[B](f: A => B): Parser[B]
Implicitly added by richParser

Apply the original Parser to the input and then apply f to the result.

Apply the original Parser to the input and then apply f to the result.

Attributes

def result: Option[A1]
def resultEmpty: Result[A1]
def string(implicit ev: A <:< Seq[Char]): Parser[String]
Implicitly added by richParser

Converts a Parser returning a Char sequence to a Parser returning a String.

Converts a Parser returning a Char sequence to a Parser returning a String.

Attributes

def valid: Boolean
def |[B >: A](b: Parser[B]): Parser[B]
Implicitly added by richParser

Apply either the original Parser or b.

Apply either the original Parser or b.

Attributes

def ||[B](b: Parser[B]): Parser[Either[A, B]]
Implicitly added by richParser

Apply either the original Parser or b.

Apply either the original Parser or b.

Attributes

def ~[B](next: Parser[B]): Parser[(A, B)]
Implicitly added by richParser

Apply the original Parser and then apply next (in order). The result of both is provides as a pair.

Apply the original Parser and then apply next (in order). The result of both is provides as a pair.

Attributes

def ~>[B](b: Parser[B]): Parser[B]
Implicitly added by richParser

Produces a Parser that applies the original Parser and then applies next (in order), discarding the result of the original parser. (The arrow point in the direction of the retained result.)

Produces a Parser that applies the original Parser and then applies next (in order), discarding the result of the original parser. (The arrow point in the direction of the retained result.)

Attributes

Concrete methods

def examples(exampleSource: ExampleSource): Parser[A]
Implicitly added by richParser

Value parameters

exampleSource

the source of examples when displaying completions to the user.

Attributes

Returns

a new parser with a new source of completions. It displays at most 25 completion examples and does not remove invalid examples.

def isTokenStart: Boolean