Object

laika.parse.text

TextParsers

Related Doc: package text

Permalink

object TextParsers extends Parsers

Base text parsers that provide optimized low-level parsers for typical requirements of text markup parsers. In particular they are meant as an efficient replacement for scenarios where usually regex parsers are used. In cases where different parsers need to be tried for relatively short input sequences, regex parsers tend to be less efficient. Furthermore, these base parsers may also improve readability, as it allows to combine simple low-level parsers to higher-level parsers based on the Laika combinator API, instead of producing long regexes which may be hard to read.

Linear Supertypes
Parsers, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TextParsers
  2. Parsers
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. case class ParserException(result: Failure) extends RuntimeException with Product with Serializable

    Permalink
    Definition Classes
    Parsers
  2. implicit class TryOps[A] extends AnyRef

    Permalink

    Provides additional methods to Try via implicit conversion.

    Provides additional methods to Try via implicit conversion.

    Definition Classes
    Parsers

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. val any: Characters[String]

    Permalink

    Consumes any kind of input, always succeeds.

    Consumes any kind of input, always succeeds. This parser would consume the entire input unless a max constraint is specified.

  5. def anyBut(chars: Char*): Characters[String]

    Permalink

    Consumes any number of consecutive characters that are not one of the specified characters.

    Consumes any number of consecutive characters that are not one of the specified characters. Always succeeds unless a minimum number of required matches is specified.

  6. def anyIn(ranges: Iterable[Char]*): Characters[String]

    Permalink

    Consumes any number of consecutive characters that are in one of the specified character ranges.

    Consumes any number of consecutive characters that are in one of the specified character ranges. Always succeeds unless a minimum number of required matches is specified.

  7. def anyOf(chars: Char*): Characters[String]

    Permalink

    Consumes any number of consecutive occurrences of the specified characters.

    Consumes any number of consecutive occurrences of the specified characters. Always succeeds unless a minimum number of required matches is specified.

  8. def anyWhile(p: (Char) ⇒ Boolean): Characters[String]

    Permalink

    Consumes any number of consecutive characters which satisfy the specified predicate.

    Consumes any number of consecutive characters which satisfy the specified predicate. Always succeeds unless a minimum number of required matches is specified.

  9. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  10. val atStart: Parser[Unit]

    Permalink

    Succeeds at the start of the input.

  11. val blankLine: Parser[String]

    Permalink

    Parses a blank line from the current input offset (which may not be at the start of the line).

    Parses a blank line from the current input offset (which may not be at the start of the line). Fails for lines that contain any non-whitespace character. Does always produce an empty string as the result, discarding any whitespace characters found in the line.

    Since it also succeeds at the end of the input it should never be used in the form of (blankLine *) or (blankLine +). Use the blankLines parser instead in these cases.

  12. val blankLines: Parser[List[String]]

    Permalink

    Parses one or more blanklines, producing a list of empty strings corresponding to the number of blank lines consumed.

  13. implicit def char(expected: Char): Parser[Char]

    Permalink

    A parser that matches only the specified character.

    A parser that matches only the specified character.

    The method is implicit so that characters can automatically be lifted to their parsers.

  14. implicit def charToIterable(char: Char): Iterable[Char]

    Permalink

    Implicit conversion that allows to pass a single character to the range-based anyIn parser.

  15. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  16. def consumeAll[T](p: Parser[T]): Parser[T]

    Permalink

    A parser that succeeds if the specified parser succeeds and all input has been consumed.

    A parser that succeeds if the specified parser succeeds and all input has been consumed.

    Definition Classes
    Parsers
  17. def delimitedBy(str: String, postCondition: Parser[Any]): DelimitedText[String] with DelimiterOptions

    Permalink

    Consumes any number of consecutive characters until the specified string delimiter is encountered on the input string.

    Consumes any number of consecutive characters until the specified string delimiter is encountered on the input string.

    Only succeeds if the specified postCondition parser succeeds at the offset after the consumed delimiter string.

  18. def delimitedBy(str: String): DelimitedText[String] with DelimiterOptions

    Permalink

    Consumes any number of consecutive characters until the specified string delimiter is encountered on the input string.

  19. def delimitedBy(chars: Char*): DelimitedText[String] with DelimiterOptions

    Permalink

    Consumes any number of consecutive characters until one of the specified characters is encountered on the input string.

  20. def documentParserFunction[T, U](parser: Parser[T], docF: (Path, T) ⇒ U): (Input) ⇒ U

    Permalink

    A parser function for the specified parser that is expected to consume all input and always succeed, throwing unexpected parser failures as exceptions instead.

    A parser function for the specified parser that is expected to consume all input and always succeed, throwing unexpected parser failures as exceptions instead.

    The docF function turns the result of the parser into a document instance.

    Definition Classes
    Parsers
  21. val eof: Parser[String]

    Permalink

    Succeeds at the end of the input.

  22. val eol: Parser[Unit]

    Permalink

    Succeeds at the end of a line, including the end of the input.

    Succeeds at the end of a line, including the end of the input. Produces an empty string as a result and consumes any new line characters.

  23. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  24. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  25. def failure(msg: String): Parser[Nothing]

    Permalink

    A parser that always fails with the specified message.

    A parser that always fails with the specified message.

    Definition Classes
    Parsers
  26. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  27. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  28. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  29. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  30. implicit def literal(expected: String): Parser[String]

    Permalink

    A parser that matches only the specified literal string.

    A parser that matches only the specified literal string.

    The method is implicit so that strings can automatically be lifted to their parsers.

  31. def lookAhead[T](offset: Int, p: Parser[T]): Parser[T]

    Permalink

    Applies the specified parser at the specified offset behind the current position.

    Applies the specified parser at the specified offset behind the current position. Never consumes any input.

    Definition Classes
    Parsers
  32. def lookAhead[T](p: Parser[T]): Parser[T]

    Permalink

    Applies the specified parser at the current position.

    Applies the specified parser at the current position. Never consumes any input.

    Definition Classes
    Parsers
  33. def lookBehind[T](offset: Int, parser: ⇒ Parser[T]): Parser[T]

    Permalink

    Applies the specified parser at the specified offset behind the current position.

    Applies the specified parser at the specified offset behind the current position. Never consumes any input.

    Definition Classes
    Parsers
  34. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  35. def not[T](p: Parser[T]): Parser[Unit]

    Permalink

    A parser that only succeeds if the specified parser fails and vice versa, it never consumes any input.

    A parser that only succeeds if the specified parser fails and vice versa, it never consumes any input.

    Definition Classes
    Parsers
  36. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  37. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  38. def opt[T](p: Parser[T]): Parser[Option[T]]

    Permalink

    A parser for an optional element that always succeeds.

    A parser for an optional element that always succeeds.

    If the underlying parser succeeds this parser will contain its result as a Some, if it fails this parser will succeed with a None.

    Definition Classes
    Parsers
  39. val refName: Parser[String]

    Permalink

    Parses a simple reference name that only allows alphanumerical characters and the punctuation characters -, _, ., :, +.

  40. val restOfLine: Parser[String]

    Permalink

    Parses the rest of the line from the current input offset no matter whether it consist of whitespace only or some text.

    Parses the rest of the line from the current input offset no matter whether it consist of whitespace only or some text. Does not include the eol character(s).

  41. val sizeAndUnit: Parser[Size]

    Permalink

    Parses a size and its amount, e.g.

    Parses a size and its amount, e.g. 12px. The unit is mandatory and not validated.

  42. def success[T](v: T): Parser[T]

    Permalink

    A parser that always succeeds with the specified value.

    A parser that always succeeds with the specified value.

    Definition Classes
    Parsers
  43. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  44. val textLine: Parser[String]

    Permalink

    Parses a single text line from the current input offset (which may not be at the start of the line).

    Parses a single text line from the current input offset (which may not be at the start of the line). Fails for blank lines. Does not include the eol character(s).

  45. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  46. def unsafeParserFunction[T](parser: Parser[T]): (ParserContext) ⇒ T

    Permalink

    A parser function for the specified parser that is expected to consume all input and always succeed, throwing unexpected parser failures as exceptions instead.

    A parser function for the specified parser that is expected to consume all input and always succeed, throwing unexpected parser failures as exceptions instead.

    Definition Classes
    Parsers
  47. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  48. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  49. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  50. lazy val ws: Characters[String]

    Permalink

    Parses horizontal whitespace (space and tab).

    Parses horizontal whitespace (space and tab). Always succeeds, consuming all whitespace found.

  51. val wsEol: Parser[Unit]

    Permalink

    Parses any number of whitespace characters followed by a newline character.

Inherited from Parsers

Inherited from AnyRef

Inherited from Any

Ungrouped