Packages

object Parser extends ParserInstances

Source
Parser.scala
Linear Supertypes
ParserInstances, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Parser
  2. ParserInstances
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. final case class Error(failedAtOffset: Int, expected: NonEmptyList[Expectation]) extends Product with Serializable

    Represents where a failure occurred and all the expectations that were broken

  2. sealed abstract class Expectation extends AnyRef

    An expectation reports the kind or parsing error and where it occured.

  3. implicit final class Parser1Methods[A] extends AnyVal

    Methods with complex variance type signatures due to covariance.

  4. sealed class Soft[+A] extends AnyRef

    If we can parse this then that, do so, if we fail that without consuming, rewind before this without consuming.

    If we can parse this then that, do so, if we fail that without consuming, rewind before this without consuming. If either consume 1 or more, do not rewind

  5. final class Soft01[+A] extends AnyVal

    If we can parse this then that, do so, if we fail that without consuming, rewind before this without consuming.

    If we can parse this then that, do so, if we fail that without consuming, rewind before this without consuming. If either consume 1 or more, do not rewind

  6. final class Soft10[+A] extends Soft[A]

    If we can parse this then that, do so, if we fail that without consuming, rewind before this without consuming.

    If we can parse this then that, do so, if we fail that without consuming, rewind before this without consuming. If either consume 1 or more, do not rewind

  7. final class With1[+A] extends AnyVal

    Enables syntax to access product01, product10 and flatMap01 This helps us build Parser1 instances when starting from a Parser

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 Fail: Parser1[Nothing]

    A parser that always fails with an epsilon failure

  5. def anyChar: Parser1[Char]

    Parse 1 character from the string

  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def backtrack[A](pa: Parser[A]): Parser[A]

    If we fail, rewind the offset back so that we can try other branches.

    If we fail, rewind the offset back so that we can try other branches. This tends to harm debuggability and ideally should be minimized

  8. def backtrack1[A](pa: Parser1[A]): Parser1[A]

    If we fail, rewind the offset back so that we can try other branches.

    If we fail, rewind the offset back so that we can try other branches. This tends to harm debuggability and ideally should be minimized

  9. implicit val catInstancesParser: Monad[Parser] with Alternative[Parser] with Defer[Parser]
    Definition Classes
    ParserInstances
  10. implicit val catsInstancesParser1: FlatMap[Parser1] with Defer[Parser1] with MonoidK[Parser1]
  11. def char(c: Char): Parser1[Unit]

    parse a single character

  12. def charIn(c0: Char, cs: Char*): Parser1[Char]

    parse one of a given set of characters

  13. def charIn(cs: Iterable[Char]): Parser1[Char]

    An empty iterable is the same as fail

  14. def charWhere(fn: (Char) ⇒ Boolean): Parser1[Char]

    parse one character that matches a given function

  15. def charsWhile(fn: (Char) ⇒ Boolean): Parser[String]

    Parse a string while the given function is true

  16. def charsWhile1(fn: (Char) ⇒ Boolean): Parser1[String]

    Parse a string while the given function is true parses at least one character

  17. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  18. def defer[A](pa: ⇒ Parser[A]): Parser[A]

    Lazily create a Parser This is useful to create some recursive parsers see Defer[Parser1].fix

  19. def defer1[A](pa: ⇒ Parser1[A]): Parser1[A]

    Lazily create a Parser1 This is useful to create some recursive parsers see Defer[Parser1].fix

  20. def end: Parser[Unit]

    succeeds when we are at the end

  21. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  22. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  23. def fail[A]: Parser1[A]

    A parser that always fails with an epsilon failure

  24. def failWith[A](message: String): Parser1[A]

    A parser that always fails with an epsilon failure and a given message this is generally used with flatMap to validate a result beyond the literal parsing.

    A parser that always fails with an epsilon failure and a given message this is generally used with flatMap to validate a result beyond the literal parsing.

    e.g. parsing a number then validate that it is bounded.

  25. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  26. def flatMap[A, B](pa: Parser[A])(fn: (A) ⇒ Parser[B]): Parser[B]

    Standard monadic flatMap Avoid this function if possible.

    Standard monadic flatMap Avoid this function if possible. If you can instead use product, ~, *>, or <* use that. flatMap always has to allocate a parser, and the parser is less amenable to optimization

  27. def flatMap01[A, B](pa: Parser[A])(fn: (A) ⇒ Parser1[B]): Parser1[B]

    Standard monadic flatMap where you end with a Parser1 Avoid this function if possible.

    Standard monadic flatMap where you end with a Parser1 Avoid this function if possible. If you can instead use product, ~, *>, or <* use that. flatMap always has to allocate a parser, and the parser is less amenable to optimization

  28. def flatMap10[A, B](pa: Parser1[A])(fn: (A) ⇒ Parser[B]): Parser1[B]

    Standard monadic flatMap where you start with a Parser1 Avoid this function if possible.

    Standard monadic flatMap where you start with a Parser1 Avoid this function if possible. If you can instead use product, ~, *>, or <* use that. flatMap always has to allocate a parser, and the parser is less amenable to optimization

  29. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  30. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  31. def ignoreCase(str: String): Parser[Unit]

    Parse a potentially empty string, in a case-insensitive manner, or fail.

    Parse a potentially empty string, in a case-insensitive manner, or fail. This backtracks on failure

  32. def ignoreCase1(str: String): Parser1[Unit]

    Parse a given string, in a case-insensitive manner, or fail.

    Parse a given string, in a case-insensitive manner, or fail. This backtracks on failure this is an error if the string is empty

  33. def ignoreCaseChar(c: Char): Parser1[Unit]

    Ignore the case of a single character If you want to know if it is upper or lower, use .string to capture the string and then map to process the result.

  34. def ignoreCaseCharIn(c0: Char, cs: Char*): Parser1[Char]

    Parse any single character in a set of characters as lower or upper case

  35. def ignoreCaseCharIn(cs: Iterable[Char]): Parser1[Char]

    Parse any single character in a set of characters as lower or upper case

  36. def index: Parser[Int]

    return the current position in the string we are parsing.

    return the current position in the string we are parsing. This lets you record position information in your ASTs you are parsing

  37. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  38. def length(len: Int): Parser[String]

    if len < 1, the same as pure("") else length1(len)

  39. def length1(len: Int): Parser1[String]

    Parse the next len characters where len > 0 if (len < 1) throw IllegalArgumentException

  40. def map[A, B](p: Parser[A])(fn: (A) ⇒ B): Parser[B]

    transform a Parser result

  41. def map1[A, B](p: Parser1[A])(fn: (A) ⇒ B): Parser1[B]

    transform a Parser1 result

  42. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  43. def not(pa: Parser[Any]): Parser[Unit]

    returns a parser that succeeds if the current parser fails.

  44. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  45. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  46. def oneOf[A](ps: List[Parser[A]]): Parser[A]

    go through the list of parsers trying each as long as they are epsilon failures (don't advance) see @backtrack if you want to do backtracking.

    go through the list of parsers trying each as long as they are epsilon failures (don't advance) see @backtrack if you want to do backtracking.

    This is the same as parsers.foldLeft(fail)(_.orElse(_))

  47. def oneOf1[A](parsers: List[Parser1[A]]): Parser1[A]

    go through the list of parsers trying each as long as they are epsilon failures (don't advance) see @backtrack if you want to do backtracking.

    go through the list of parsers trying each as long as they are epsilon failures (don't advance) see @backtrack if you want to do backtracking.

    This is the same as parsers.foldLeft(fail)(_.orElse1(_))

  48. def peek(pa: Parser[Any]): Parser[Unit]

    a parser that consumes nothing when it succeeds, basically rewind on success

  49. def product[A, B](first: Parser[A], second: Parser[B]): Parser[(A, B)]

    parse first then second

  50. def product01[A, B](first: Parser[A], second: Parser1[B]): Parser1[(A, B)]

    product with the second argument being a Parser1

  51. def product10[A, B](first: Parser1[A], second: Parser[B]): Parser1[(A, B)]

    product with the first argument being a Parser1

  52. def pure[A](a: A): Parser[A]

    Don't advance in the parsed string, just return a This is used by the Applicative typeclass.

  53. def rep[A](p1: Parser1[A]): Parser[List[A]]

    Repeat this parser 0 or more times note: this can wind up parsing nothing

  54. def rep1[A](p1: Parser1[A], min: Int): Parser1[NonEmptyList[A]]

    Repeat this parser 1 or more times

  55. def rep1Sep[A](p1: Parser1[A], min: Int, sep: Parser[Any]): Parser1[NonEmptyList[A]]

    Repeat 1 or more times with a separator

  56. def repAs[A, B](p1: Parser1[A])(implicit acc: Accumulator[A, B]): Parser[B]

    Repeat this parser 0 or more times note: this can wind up parsing nothing

  57. def repAs1[A, B](p1: Parser1[A], min: Int)(implicit acc: Accumulator1[A, B]): Parser1[B]

    Repeat this parser 1 or more times

  58. def repSep[A](p1: Parser1[A], min: Int, sep: Parser[Any]): Parser[List[A]]

    Repeat 0 or more times with a separator

  59. def softProduct[A, B](first: Parser[A], second: Parser[B]): Parser[(A, B)]

    softProduct, a variant of product A soft product backtracks if the first succeeds and the second is an epsilon-failure.

    softProduct, a variant of product A soft product backtracks if the first succeeds and the second is an epsilon-failure. By contrast product will be a failure in that case

    see @Parser.soft

  60. def softProduct01[A, B](first: Parser[A], second: Parser1[B]): Parser1[(A, B)]

    softProduct with the second argument being a Parser1 A soft product backtracks if the first succeeds and the second is an epsilon-failure.

    softProduct with the second argument being a Parser1 A soft product backtracks if the first succeeds and the second is an epsilon-failure. By contrast product will be a failure in that case

    see @Parser.soft

  61. def softProduct10[A, B](first: Parser1[A], second: Parser[B]): Parser1[(A, B)]

    softProduct with the first argument being a Parser1 A soft product backtracks if the first succeeds and the second is an epsilon-failure.

    softProduct with the first argument being a Parser1 A soft product backtracks if the first succeeds and the second is an epsilon-failure. By contrast product will be a failure in that case

    see @Parser.soft

  62. def start: Parser[Unit]

    succeeds when we are at the start

  63. def string(pa: Parser[Any]): Parser[String]

    Discard the result A and instead capture the matching string this is optimized to avoid internal allocations

  64. def string(str: String): Parser[Unit]

    Parse a potentially empty string or fail.

    Parse a potentially empty string or fail. This backtracks on failure

  65. def string1(pa: Parser1[Any]): Parser1[String]

    Discard the result A and instead capture the matching string this is optimized to avoid internal allocations

  66. def string1(str: String): Parser1[Unit]

    Parse a given string or fail.

    Parse a given string or fail. This backtracks on failure this is an error if the string is empty

  67. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  68. def tailRecM[A, B](init: A)(fn: (A) ⇒ Parser[Either[A, B]]): Parser[B]

    tail recursive monadic flatMaps This is a rarely used function, but needed to implement cats.FlatMap Avoid this function if possible.

    tail recursive monadic flatMaps This is a rarely used function, but needed to implement cats.FlatMap Avoid this function if possible. If you can instead use product, ~, *>, or <* use that. flatMap always has to allocate a parser, and the parser is less amenable to optimization

  69. def tailRecM1[A, B](init: A)(fn: (A) ⇒ Parser1[Either[A, B]]): Parser1[B]

    tail recursive monadic flatMaps on Parser1 This is a rarely used function, but needed to implement cats.FlatMap Avoid this function if possible.

    tail recursive monadic flatMaps on Parser1 This is a rarely used function, but needed to implement cats.FlatMap Avoid this function if possible. If you can instead use product, ~, *>, or <* use that. flatMap always has to allocate a parser, and the parser is less amenable to optimization

  70. def toString(): String
    Definition Classes
    AnyRef → Any
  71. val unit: Parser[Unit]

    A parser that returns unit

  72. def until(p: Parser[Any]): Parser[String]

    parse zero or more characters as long as they don't match p

  73. def until1(p: Parser[Any]): Parser1[String]

    parse one or more characters as long as they don't match p

  74. def void(pa: Parser[Any]): Parser[Unit]

    discard the value in a Parser.

    discard the value in a Parser. This is an optimization because we remove trailing map operations and don't allocate internal data structures This function is called internal to Functor.as and Apply.*> and Apply.<* so those are good uses.

  75. def void1(pa: Parser1[Any]): Parser1[Unit]

    discard the value in a Parser1.

    discard the value in a Parser1. This is an optimization because we remove trailing map operations and don't allocate internal data structures This function is called internal to Functor.as and Apply.*> and Apply.<* so those are good uses.

  76. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  77. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  78. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  79. object Expectation

Inherited from ParserInstances

Inherited from AnyRef

Inherited from Any

Ungrouped