Packages

o

laika.parse

builders

object builders extends TextParsers with InlineParsers with BlockParsers

Grouping of all parser builders that allows to construct most common parsers with a single import.

These include the base parsers like opt and not, the text parsers like literal and anyOf(Char*), as well as the more specialized parsers for text markup like spans and blocks.

Alternatively these groups can be brought into scope individually.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. builders
  2. BlockParsers
  3. InlineParsers
  4. TextParsers
  5. Parsers
  6. AnyRef
  7. 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
    Definition Classes
    Parsers
  2. implicit class TryOps[A] extends AnyRef

    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
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. val anyChars: Characters[String]

    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.

    Definition Classes
    TextParsers
  5. def anyNot(chars: NonEmptySet[Char]): Characters[String]

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

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

    Definition Classes
    TextParsers
  6. def anyNot(char: Char, chars: Char*): Characters[String]

    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.

    Definition Classes
    TextParsers
  7. def anyOf(chars: NonEmptySet[Char]): Characters[String]

    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.

    Definition Classes
    TextParsers
  8. def anyOf(char: Char, chars: Char*): Characters[String]

    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.

    Definition Classes
    TextParsers
  9. def anyWhile(p: (Char) ⇒ Boolean): Characters[String]

    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.

    Definition Classes
    TextParsers
  10. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  11. val atStart: Parser[Unit]

    Succeeds at the start of the input.

    Succeeds at the start of the input.

    Definition Classes
    TextParsers
  12. val blankLine: Parser[String]

    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.

    Definition Classes
    TextParsers
  13. val blankLines: Parser[List[String]]

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

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

    Definition Classes
    TextParsers
  14. def block(firstLinePrefix: Parser[Any], linePrefix: ⇒ Parser[Any], nextBlockPrefix: ⇒ Parser[Any]): Parser[BlockSource]

    Parses a full block based on the specified helper parsers.

    Parses a full block based on the specified helper parsers.

    The result of this parser will not contain the characters consumed by any of the specified prefix parsers. The block source returned by this method maintains x-offsets for each individual line so that it can be passed down to recursive block or span parsers without losing position tracking.

    firstLinePrefix

    parser that recognizes the start of the first line of this block

    linePrefix

    parser that recognizes the start of subsequent lines that still belong to the same block

    nextBlockPrefix

    parser that recognizes whether a line after one or more blank lines still belongs to the same block

    Definition Classes
    BlockParsers
  15. def block(firstLinePrefix: Parser[Any], linePrefix: ⇒ Parser[Any]): Parser[BlockSource]

    Parses a full block based on the specified helper parsers.

    Parses a full block based on the specified helper parsers.

    The string result of this parser will not contain the characters consumed by any of the specified prefix parsers.

    firstLinePrefix

    parser that recognizes the start of the first line of this block

    linePrefix

    parser that recognizes the start of subsequent lines that still belong to the same block

    Definition Classes
    BlockParsers
  16. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  17. def consumeAll[T](p: Parser[T]): Parser[T]

    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
  18. def delimitedBy(delimiter: PrefixedParser[String]): DelimitedText

    Consumes any number of consecutive characters until the specified delimiter parser succeeds on the input.

    Consumes any number of consecutive characters until the specified delimiter parser succeeds on the input.

    This constructor is limited to the sub-trait PrefixedParser as only those can be optimized for an assertion that needs to be performed on each character. Most parsers for non-empty text implement this trait, e.g oneOf, someOf, delimiter or the literal parsers for a character or string.

    Definition Classes
    TextParsers
  19. def delimitedBy(str: String): DelimitedText

    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.

    Definition Classes
    TextParsers
  20. def delimitedBy(chars: NonEmptySet[Char]): DelimitedText

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

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

    Definition Classes
    TextParsers
  21. def delimitedBy(char: Char, chars: Char*): DelimitedText

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

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

    Definition Classes
    TextParsers
  22. def delimiter(parser: PrefixedParser[String]): DelimiterParser

    Creates a parser for a delimiter with an API that allows to specify predicates for the characters immediately preceding or following the delimiter, a common task in markup parsing.

    Creates a parser for a delimiter with an API that allows to specify predicates for the characters immediately preceding or following the delimiter, a common task in markup parsing.

    This specified underlying parser needs to implement the sub-trait PrefixedParser as only those can be optimized for an assertion that needs to be performed on each character. Most parsers for non-empty text implement this trait, e.g oneOf, someOf, delimiter or the literal parsers for a character or string.

    Definition Classes
    TextParsers
  23. def delimiter(delim: String): DelimiterParser

    Creates a parser for a delimiter based on a literal string with an API that allows to specify predicates for the characters immediately preceding or following the delimiter, a common task in markup parsing.

    Creates a parser for a delimiter based on a literal string with an API that allows to specify predicates for the characters immediately preceding or following the delimiter, a common task in markup parsing.

    Definition Classes
    TextParsers
  24. def delimiter(char: Char, chars: Char*): DelimiterParser

    Creates a parser for a delimiter based on the given set of delimiter characters with an API that allows to specify predicates for the characters immediately preceding or following the delimiter, a common task in markup parsing.

    Creates a parser for a delimiter based on the given set of delimiter characters with an API that allows to specify predicates for the characters immediately preceding or following the delimiter, a common task in markup parsing.

    Definition Classes
    TextParsers
  25. val eof: Parser[String]

    Succeeds at the end of the input.

    Succeeds at the end of the input.

    Definition Classes
    TextParsers
  26. val eol: Parser[Unit]

    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.

    Definition Classes
    TextParsers
  27. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  28. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  29. def failure(msg: String): Parser[Nothing]

    A parser that always fails with the specified message.

    A parser that always fails with the specified message.

    Definition Classes
    Parsers
  30. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  31. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  32. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  33. def indentedBlock(minIndent: Int = 1, linePredicate: ⇒ Parser[Any] = success(()), endsOnBlankLine: Boolean = false, firstLineIndented: Boolean = false, maxIndent: Int = Int.MaxValue): Parser[BlockSource]

    Parses a full block based on the specified helper parsers, expecting an indentation for all lines except the first.

    Parses a full block based on the specified helper parsers, expecting an indentation for all lines except the first. The indentation may vary between the parts of the indented block, so that this parser only cuts off the minimum indentation shared by all lines, but each line must have at least the specified minimum indentation.

    minIndent

    the minimum indentation that each line in this block must have

    linePredicate

    parser that recognizes the start of subsequent lines that still belong to the same block

    endsOnBlankLine

    indicates whether parsing should end on the first blank line

    firstLineIndented

    indicates whether the first line is expected to be indented, too

    maxIndent

    the maximum indentation that will get dropped from the start of each line of the result

    returns

    a parser that produces the raw text of the parsed block with the indentation removed

    Definition Classes
    BlockParsers
  34. def indentedBlockWithLevel(minIndent: Int = 1, linePredicate: ⇒ Parser[Any] = success(()), endsOnBlankLine: Boolean = false, firstLineIndented: Boolean = false, maxIndent: Int = Int.MaxValue): Parser[(BlockSource, Int)]

    Parses a full block based on the specified helper parsers, expecting an indentation for all lines except the first.

    Parses a full block based on the specified helper parsers, expecting an indentation for all lines except the first. The indentation may vary between the parts of the indented block, so that this parser only cuts off the minimum indentation shared by all lines, but each line must have at least the specified minimum indentation.

    minIndent

    the minimum indentation that each line in this block must have

    linePredicate

    parser that recognizes the start of subsequent lines that still belong to the same block

    endsOnBlankLine

    indicates whether parsing should end on the first blank line

    firstLineIndented

    indicates whether the first line is expected to be indented, too

    maxIndent

    the maximum indentation that will get dropped from the start of each line of the result

    returns

    a parser that produces the raw text of the parsed block with the indentation removed and the indentation level (number of whitespace characters removed from the text lines)

    Definition Classes
    BlockParsers
  35. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  36. def lazily[T](p: ⇒ Parser[T]): Parser[T]

    Constructs a parser lazily, useful when breaking circles in recursive parsing.

    Constructs a parser lazily, useful when breaking circles in recursive parsing.

    Definition Classes
    Parsers
  37. def literal(expected: String): PrefixedParser[String]

    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.

    Definition Classes
    TextParsers
  38. def lookAhead(offset: Int, value: String): Parser[String]

    Attempts to parse the specified literal value at the specified offset behind the current position.

    Attempts to parse the specified literal value at the specified offset behind the current position. Never consumes any input.

    Definition Classes
    Parsers
  39. def lookAhead[T](offset: Int, p: Parser[T]): Parser[T]

    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
  40. def lookAhead(value: String): Parser[String]

    Attempts to parse the specified literal value at the current position.

    Attempts to parse the specified literal value at the current position. Never consumes any input.

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

    Applies the specified parser at the current position.

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

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

    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
  43. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  44. def nextIn(chars: NonEmptySet[Char]): Parser[Unit]

    Verifies that the next character is one of those specified.

    Verifies that the next character is one of those specified. Fails at the end of the input and does not consume any input or produce a result when it succeeds.

    Definition Classes
    TextParsers
  45. def nextIn(char: Char, chars: Char*): Parser[Unit]

    Verifies that the next character is one of those specified.

    Verifies that the next character is one of those specified. Fails at the end of the input and does not consume any input or produce a result when it succeeds.

    Definition Classes
    TextParsers
  46. def nextIs(predicate: (Char) ⇒ Boolean): Parser[Unit]

    Verifies that the next character does not satisfy the specified predicate.

    Verifies that the next character does not satisfy the specified predicate. Fails at the end of the input and does not consume any input or produce a result when it succeeds.

    Definition Classes
    TextParsers
  47. def nextNot(predicate: (Char) ⇒ Boolean): Parser[Unit]

    Verifies that the next character does not satisfy the specified predicate.

    Verifies that the next character does not satisfy the specified predicate. Succeeds at the end of the input and does not consume any input or produce a result when it succeeds.

    Definition Classes
    TextParsers
  48. def nextNot(chars: NonEmptySet[Char]): Parser[Unit]

    Verifies that the next character is not one of those specified.

    Verifies that the next character is not one of those specified. Succeeds at the end of the input and does not consume any input or produce a result when it succeeds.

    Definition Classes
    TextParsers
  49. def nextNot(char: Char, chars: Char*): Parser[Unit]

    Verifies that the next character is not one of those specified.

    Verifies that the next character is not one of those specified. Succeeds at the end of the input and does not consume any input or produce a result when it succeeds.

    Definition Classes
    TextParsers
  50. def not(value: String): Parser[Unit]

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

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

    Definition Classes
    Parsers
  51. def not[T](p: Parser[T]): Parser[Unit]

    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
  52. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  53. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  54. val oneChar: Parser[String]

    Parses exactly one character from the input, fails only at the end of the input.

    Parses exactly one character from the input, fails only at the end of the input.

    Definition Classes
    TextParsers
  55. def oneIf(p: (Char) ⇒ Boolean): Parser[String]

    Consumes one character if it satisfies the specified predicate, fails otherwise.

    Consumes one character if it satisfies the specified predicate, fails otherwise.

    Definition Classes
    TextParsers
  56. def oneNot(chars: NonEmptySet[Char]): Parser[String]

    Consumes one character if it is not one of the specified characters.

    Consumes one character if it is not one of the specified characters.

    Definition Classes
    TextParsers
  57. def oneNot(char: Char, chars: Char*): Parser[String]

    Consumes one character if it is not one of the specified characters.

    Consumes one character if it is not one of the specified characters.

    Definition Classes
    TextParsers
  58. def oneOf(chars: NonEmptySet[Char]): PrefixedParser[String]

    Consumes one character if it matches one of the specified characters, fails otherwise.

    Consumes one character if it matches one of the specified characters, fails otherwise.

    Definition Classes
    TextParsers
  59. def oneOf(char: Char, chars: Char*): PrefixedParser[String]

    Consumes one character if it matches one of the specified characters, fails otherwise.

    Consumes one character if it matches one of the specified characters, fails otherwise.

    Definition Classes
    TextParsers
  60. def opt(value: String): Parser[Option[String]]

    A parser for an optional literal string that always succeeds.

    A parser for an optional literal string 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
  61. def opt[T](p: Parser[T]): Parser[Option[T]]

    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
  62. def prevIn(chars: NonEmptySet[Char]): Parser[Unit]

    Verifies that the previous character is one of those specified.

    Verifies that the previous character is one of those specified. Fails at the start of the input and does not consume any input or produce a result when it succeeds.

    Definition Classes
    TextParsers
  63. def prevIn(char: Char, chars: Char*): Parser[Unit]

    Verifies that the previous character is one of those specified.

    Verifies that the previous character is one of those specified. Fails at the start of the input and does not consume any input or produce a result when it succeeds.

    Definition Classes
    TextParsers
  64. def prevIs(predicate: (Char) ⇒ Boolean): Parser[Unit]

    Verifies that the previous character satisfies the specified predicate.

    Verifies that the previous character satisfies the specified predicate. Fails at the start of the input and does not consume any input or produce a result when it succeeds.

    Definition Classes
    TextParsers
  65. def prevNot(predicate: (Char) ⇒ Boolean): Parser[Unit]

    Verifies that the previous character does not satisfy the specified predicate.

    Verifies that the previous character does not satisfy the specified predicate. Succeeds at the start of the input and does not consume any input or produce a result when it succeeds.

    Definition Classes
    TextParsers
  66. def prevNot(chars: NonEmptySet[Char]): Parser[Unit]

    Verifies that the previous character is not one of those specified.

    Verifies that the previous character is not one of those specified. Succeeds at the start of the input and does not consume any input or produce a result when it succeeds.

    Definition Classes
    TextParsers
  67. def prevNot(char: Char, chars: Char*): Parser[Unit]

    Verifies that the previous character is not one of those specified.

    Verifies that the previous character is not one of those specified. Succeeds at the start of the input and does not consume any input or produce a result when it succeeds.

    Definition Classes
    TextParsers
  68. def range(fromChar: Char, toChar: Char): NonEmptySet[Char]

    Creates a NonEmptySet from a Character range.

    Creates a NonEmptySet from a Character range. This set can then be passed to parsers like anyOf or oneOf which expect a NonEmptySet as a parameter.

    Definition Classes
    TextParsers
  69. val restOfLine: Parser[String]

    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).

    Definition Classes
    TextParsers
  70. def someNot(chars: NonEmptySet[Char]): Characters[String]

    Consumes one or more characters that are not one of the specified characters, fails for empty results.

    Consumes one or more characters that are not one of the specified characters, fails for empty results.

    Definition Classes
    TextParsers
  71. def someNot(char: Char, chars: Char*): Characters[String]

    Consumes one or more characters that are not one of the specified characters, fails for empty results.

    Consumes one or more characters that are not one of the specified characters, fails for empty results.

    Definition Classes
    TextParsers
  72. def someOf(chars: NonEmptySet[Char]): PrefixCharacters[String]

    Consumes one or more characters if they match one of the specified characters, fails if the first character does not match.

    Consumes one or more characters if they match one of the specified characters, fails if the first character does not match.

    Definition Classes
    TextParsers
  73. def someOf(char: Char, chars: Char*): PrefixCharacters[String]

    Consumes one or more characters if they match one of the specified characters, fails if the first character does not match.

    Consumes one or more characters if they match one of the specified characters, fails if the first character does not match.

    Definition Classes
    TextParsers
  74. def someWhile(p: (Char) ⇒ Boolean): Characters[String]

    Consumes one or more characters which satisfy the specified predicate, fails for empty results.

    Consumes one or more characters which satisfy the specified predicate, fails for empty results.

    Definition Classes
    TextParsers
  75. def spans(parser: ⇒ DelimitedText): InlineParser[Span, List[Span]]

    Creates a new parser that reads input until the delimiters in the specified parser are detected.

    Creates a new parser that reads input until the delimiters in the specified parser are detected.

    The returned parser allows to register parsers for child spans with its embed method. Without calling it, the result of this parser would always just be a single span of type Text.

    Definition Classes
    InlineParsers
  76. def success[T](v: T): Parser[T]

    A parser that always succeeds with the specified value.

    A parser that always succeeds with the specified value.

    Definition Classes
    Parsers
  77. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  78. def text(parser: ⇒ DelimitedText): InlineParser[String, String]

    Creates a new parser that reads text until the delimiters in the specified parser are detected.

    Creates a new parser that reads text until the delimiters in the specified parser are detected.

    The returned parser allows to register parsers for child spans with its embed method, for example for reading escape sequences.

    Definition Classes
    InlineParsers
  79. val textLine: Parser[String]

    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).

    Definition Classes
    TextParsers
  80. def toString(): String
    Definition Classes
    AnyRef → Any
  81. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  82. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  83. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  84. lazy val ws: Characters[String]

    Parses horizontal whitespace (space and tab).

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

    Definition Classes
    TextParsers
  85. val wsEol: Parser[Unit]

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

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

    Definition Classes
    TextParsers

Inherited from BlockParsers

Inherited from InlineParsers

Inherited from TextParsers

Inherited from Parsers

Inherited from AnyRef

Inherited from Any

Ungrouped