class DelimitedText extends Parser[String]
A parser for text that ends with a specific delimiter condition, either marking the end of the text span or the start of an embedded inner span.
- Alphabetic
 - By Inheritance
 
- DelimitedText
 - Parser
 - AnyRef
 - Any
 
- Hide All
 - Show All
 
- Public
 - All
 
Instance Constructors
-  new DelimitedText(delimiter: TextDelimiter)
 
Value Members
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        !=(arg0: Any): Boolean
      
      
      
- Definition Classes
 - AnyRef → Any
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        ##(): Int
      
      
      
- Definition Classes
 - AnyRef → Any
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        *: Repeat[String]
      
      
      
Returns a parser that repeatedly applies this parser.
Returns a parser that repeatedly applies this parser. It will always succeed, potentially with an empty list as the result.
- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        +: Repeat[String]
      
      
      
Returns a parser that repeatedly applies this parser (at least once).
Returns a parser that repeatedly applies this parser (at least once).
- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        <~[U](p: Parser[U]): Parser[String]
      
      
      
Applies the specified parser to the input left over by this parser, but only keeps the left result.
Applies the specified parser to the input left over by this parser, but only keeps the left result.
a <~ bonly succeeds if both parsers succeed.- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        <~(value: String): Parser[String]
      
      
      
Attempts to parse the specified literal string from the input left over by this parser, but only keeps the left result.
Attempts to parse the specified literal string from the input left over by this parser, but only keeps the left result.
a <~ bonly succeeds if both parsers succeed.- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        ==(arg0: Any): Boolean
      
      
      
- Definition Classes
 - AnyRef → Any
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        >>[U](fq: (String) ⇒ Parser[U]): Parser[U]
      
      
      
Operator synonym for
flatMap.Operator synonym for
flatMap.- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        ?: Parser[Option[String]]
      
      
      
Returns a parser that optionally parses what this parser parses.
Returns a parser that optionally parses what this parser parses.
- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        ^^[U](f: (String) ⇒ U): Parser[U]
      
      
      
A synonym for
map, allowing the grammar to be declared in a concise way.A synonym for
map, allowing the grammar to be declared in a concise way.- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        acceptEOF: DelimitedText
      
      
      
Creates a delimiter that also allows reaching the end of the input.
Creates a delimiter that also allows reaching the end of the input. By default a delimiter based parser fails in that case.
 - 
      
      
      
        
      
    
      
        
        def
      
      
        as[U](v: ⇒ U): Parser[U]
      
      
      
Returns a parser that ignores the result of this parser (if it succeeds) and returns the specified result instead.
Returns a parser that ignores the result of this parser (if it succeeds) and returns the specified result instead.
Subclasses may override this method to avoid any expensive result processing.
- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        asInstanceOf[T0]: T0
      
      
      
- Definition Classes
 - Any
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        clone(): AnyRef
      
      
      
- Attributes
 - protected[lang]
 - Definition Classes
 - AnyRef
 - Annotations
 - @throws( ... ) @native() @HotSpotIntrinsicCandidate()
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        collect[U, V >: String](f: PartialFunction[String, U], error: (V) ⇒ String = ...): Parser[U]
      
      
      
Returns a parser that applies a partial function to the result of this parser.
Returns a parser that applies a partial function to the result of this parser.
p.collect(f)succeeds ifpsucceeds andfis defined at the result ofp, In that case it returnsfapplied to the result ofp.- f
 a partial function that will be applied to this parser's result.
- error
 an optional function that takes the same argument as
fand produces an error message.
- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        count: Parser[Int]
      
      
      
Returns a parser that produces the number of characters consumed by this parser while discarding the original result.
Returns a parser that produces the number of characters consumed by this parser while discarding the original result.
- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        cursor: Parser[SourceFragment]
      
      
      
Provides a cursor over the input consumed by this parser while discarding the actual result.
Provides a cursor over the input consumed by this parser while discarding the actual result. Use
withCursorif you also need access to the result.This is required for parsers that create AST nodes that need to be resolved in a rewrite step and need to report the source location in case of failure. It is also required when passing a result of a first-pass parser to a recursive parser to preserve line positions.
- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        eq(arg0: AnyRef): Boolean
      
      
      
- Definition Classes
 - AnyRef
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        equals(arg0: Any): Boolean
      
      
      
- Definition Classes
 - AnyRef → Any
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        evalMap[U](f: (String) ⇒ Either[String, U]): Parser[U]
      
      
      
Returns a parser that applies a function to the result of this parser producing an
EitherwhereLeftis interpreted as failure.Returns a parser that applies a function to the result of this parser producing an
EitherwhereLeftis interpreted as failure. It is an alternative to^?for scenarios where the conditional check cannot be easily performed in a pattern match.p.evalMap(f)succeeds ifpsucceeds andfreturns aRightwhen applied to the result ofp.- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        failOn(chars: Char*): DelimitedText
      
      
      
Creates a delimiter that fails when parsing any of the specified characters before a delimiter is encountered.
 - 
      
      
      
        
      
    
      
        
        def
      
      
        flatMap[U](f: (String) ⇒ Parser[U]): Parser[U]
      
      
      
Builds a new parser by applying the specified function to the result of this parser and subsequently applying the parser returned by that function to the input left over by this parser.
Builds a new parser by applying the specified function to the result of this parser and subsequently applying the parser returned by that function to the input left over by this parser.
- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        getClass(): Class[_]
      
      
      
- Definition Classes
 - AnyRef → Any
 - Annotations
 - @native() @HotSpotIntrinsicCandidate()
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        handleErrorWith[U >: String](f: (Failure) ⇒ Parser[U]): Parser[U]
      
      
      
Handle any error, potentially recovering from it, by mapping it to a new parser that will be applied at the same starting position than the failing parser.
Handle any error, potentially recovering from it, by mapping it to a new parser that will be applied at the same starting position than the failing parser.
This is similar to the
orElseor|method, but allows the alternative parser to inspect the error of the preceding one.- Definition Classes
 - Parser
 - See also
 recoverWith to recover from only certain errors.
 - 
      
      
      
        
      
    
      
        
        def
      
      
        hashCode(): Int
      
      
      
- Definition Classes
 - AnyRef → Any
 - Annotations
 - @native() @HotSpotIntrinsicCandidate()
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        isInstanceOf[T0]: Boolean
      
      
      
- Definition Classes
 - Any
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        keepDelimiter: DelimitedText
      
      
      
Creates a delimiter that keeps the delimiter itself on the remaining input.
Creates a delimiter that keeps the delimiter itself on the remaining input. By default all delimiter characters are consumed.
 - 
      
      
      
        
      
    
      
        
        def
      
      
        map[U](f: (String) ⇒ U): Parser[U]
      
      
      
Builds a new parser by applying the specified function to the result of this parser.
Builds a new parser by applying the specified function to the result of this parser.
- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        ne(arg0: AnyRef): Boolean
      
      
      
- Definition Classes
 - AnyRef
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        nonEmpty: DelimitedText
      
      
      
Creates a delimiter that also allows empty result, meaning reaching the delimiter before any non-delimiter characters have been parsed.
Creates a delimiter that also allows empty result, meaning reaching the delimiter before any non-delimiter characters have been parsed. By default a delimiter based parser fails in that case.
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        notify(): Unit
      
      
      
- Definition Classes
 - AnyRef
 - Annotations
 - @native() @HotSpotIntrinsicCandidate()
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        notifyAll(): Unit
      
      
      
- Definition Classes
 - AnyRef
 - Annotations
 - @native() @HotSpotIntrinsicCandidate()
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        orElse[U >: String](p0: ⇒ Parser[U]): Parser[U]
      
      
      
Applies the specified parser when this parser fails.
Applies the specified parser when this parser fails.
a orElse bsucceeds if either of the parsers succeeds.In case both parsers fail, the
Failureinstance will be from the parser with the most successfully read characters. In the case of multiple failures having the same number of characters, the one with the highest precedence (this parser) will be chosen.Implementation note: The parameter is by-name to allow the definition of recursive parsers. In contrast to the former SDK parser combinators this is the only place where a parser with a by-name parameter is used whereas in all other places the additional cost is avoided.
- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        parse(source: SourceCursor): Parsed[String]
      
      
      
Parses the string content in the specified context and returns the result.
Parses the string content in the specified context and returns the result.
This is the only abstract method in
Parserthat concrete implementations need to implement.- Definition Classes
 - DelimitedText → Parser
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        parse(in: String): Parsed[String]
      
      
      
Parses the specified string and returns the result.
Parses the specified string and returns the result.
- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        recoverWith[U >: String](pf: PartialFunction[Failure, Parser[U]]): Parser[U]
      
      
      
Handle certain errors, potentially recovering from it, by mapping them to a new parser that will be applied at the same starting position than the failing parser.
Handle certain errors, potentially recovering from it, by mapping them to a new parser that will be applied at the same starting position than the failing parser.
- Definition Classes
 - Parser
 - See also
 handleErrorWith to handle any/all errors.
 - 
      
      
      
        
      
    
      
        
        def
      
      
        rep(separator: String): Repeat[String]
      
      
      
Returns a parser that repeatedly applies this parser with the specified separator string between those invocations.
Returns a parser that repeatedly applies this parser with the specified separator string between those invocations.
p.rep(sep).min(1)is equivalent to(p ~ (sep ~> p).rep).concat.The returned parser offers an API to specify further constraints like
minormax.- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        rep(separator: Parser[Unit]): Repeat[String]
      
      
      
Returns a parser that repeatedly applies this parser with the specified separator parser between those invocations.
Returns a parser that repeatedly applies this parser with the specified separator parser between those invocations.
p.rep(sep).min(1)is equivalent to(p ~ (sep ~> p).rep).concat.The returned parser offers an API to specify further constraints like
minormax.- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        rep: Repeat[String]
      
      
      
Returns a parser that repeatedly applies this parser.
Returns a parser that repeatedly applies this parser. The returned parser offers an API to specify further constraints like
minormax.- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        repUntil[U](endCondition: Parser[U]): Parser[(List[String], Option[U])]
      
      
      
Returns a parser that repeatedly applies this parser until either this parser fails or the specified end condition is met.
Returns a parser that repeatedly applies this parser until either this parser fails or the specified end condition is met. The end condition will be applied after each successful invocation of this parser.
The result of the returned parser is a tuple consisting of the list containing the result of the invocations of this parser plus the result of the end condition. The latter is returned as an
Optionas it might be empty when the parsing finished because of this parser failing.Note that it is more convenient to include the end condition in the repeating parser itself and use the simpler
repmethod. This combinator is an alternative if you need to know the result of the end condition.- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        repWith[U >: String](next: (U) ⇒ Parser[U]): Parser[List[U]]
      
      
      
Returns a parser that invokes the specified function repeatedly, passing the result of this parser if it succeeds, to produce new parsers that get applied until one of them fails.
Returns a parser that invokes the specified function repeatedly, passing the result of this parser if it succeeds, to produce new parsers that get applied until one of them fails.
The result of the returned parser is a list containing the result of this parser (if it succeeds) plus the results of successful invocations of the parsers returned by the specified function.
- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        source: Parser[String]
      
      
      
Retrieves the part of the input consumed by this parser while discarding the result.
Retrieves the part of the input consumed by this parser while discarding the result.
This is useful in scenarios where many string-based parsers are combined and produce a deeply nested result like
String ~ Option[String] ~ List[String]where it would require some boilerplate to concatenate the results. Using the source method, the entire text consumed by this combination of parsers will be returned.If you also need the position within the input or need to pass the result to a recursive parser manually, use the
cursormethod instead.- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        synchronized[T0](arg0: ⇒ T0): T0
      
      
      
- Definition Classes
 - AnyRef
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        toString(): String
      
      
      
- Definition Classes
 - AnyRef → Any
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        void: Parser[Unit]
      
      
      
Discards the result of a successful parser.
Discards the result of a successful parser.
- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        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()
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        wait(): Unit
      
      
      
- Definition Classes
 - AnyRef
 - Annotations
 - @throws( ... )
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        withCursor: Parser[(String, SourceFragment)]
      
      
      
Provides the result of this parser together with a cursor over the input, capturing the consumed source string and its position within the root input.
Provides the result of this parser together with a cursor over the input, capturing the consumed source string and its position within the root input. Use
cursorif you do not need access to the actual result.This is required for parsers that create AST nodes that need to be resolved in a rewrite step and need to report the source location in case of failure. It is also required when passing a result of a first-pass parser to a recursive parser to preserve line positions.
- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        withFailureMessage(msg: String): Parser[String]
      
      
      
Changes the failure message produced by a parser.
Changes the failure message produced by a parser.
- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        |(value: String)(implicit ev: <:<[String, String]): Parser[String]
      
      
      
Attempts to parse the specified literal string when this parser fails.
Attempts to parse the specified literal string when this parser fails.
a | bsucceeds if either of the parsers succeeds.- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        |[U >: String](p: ⇒ Parser[U]): Parser[U]
      
      
      
Applies the specified parser when this parser fails.
Applies the specified parser when this parser fails.
a | bsucceeds if either of the parsers succeeds.Implementation note: The parameter is by-name to allow the definition of recursive parsers. In contrast to the former SDK parser combinators this is the only place where a parser with a by-name parameter is used whereas in all other places the additional cost is avoided.
- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        ~[U](p: Parser[U]): Parser[~[String, U]]
      
      
      
Applies the specified parser to the input left over by this parser and combines the two results.
Applies the specified parser to the input left over by this parser and combines the two results.
a ~ bonly succeeds if both parsers succeed, with the results in a wrapper class named~for convenient pattern matching:a ~ b ~ c ^^ { case a ~ b ~ c => processResult(a, b, c) }- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        ~(value: String): Parser[~[String, String]]
      
      
      
Attempts to parse the specified literal string from the input left over by this parser and combines the two results.
Attempts to parse the specified literal string from the input left over by this parser and combines the two results.
a ~ bonly succeeds if both parsers succeed, with the results in a wrapper class named~for convenient pattern matching:a ~ b ~ c ^^ { case a ~ b ~ c => processResult(a, b, c) }- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        ~>[U](p: Parser[U]): Parser[U]
      
      
      
Applies the specified parser to the input left over by this parser, but only keeps the right result.
Applies the specified parser to the input left over by this parser, but only keeps the right result.
a ~> bonly succeeds if both parsers succeed.- Definition Classes
 - Parser
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        ~>(value: String): Parser[String]
      
      
      
Attempts to parse the specified literal string from the input left over by this parser, but only keeps the right result.
Attempts to parse the specified literal string from the input left over by this parser, but only keeps the right result.
a ~> bonly succeeds if both parsers succeed.- Definition Classes
 - Parser
 
 
Deprecated Value Members
- 
      
      
      
        
      
    
      
        
        def
      
      
        finalize(): Unit
      
      
      
- Attributes
 - protected[lang]
 - Definition Classes
 - AnyRef
 - Annotations
 - @throws( classOf[java.lang.Throwable] ) @Deprecated
 - Deprecated