Class

com.github.kmizu.scomb.SCombinator

Parser

Related Doc: package SCombinator

Permalink

abstract class Parser[+T] extends (Int) ⇒ ParseResult[T]

A Parser is used to parse the input from the outer class instances. It returns the result of type T as the ParseResult.

T

the result type

Source
SCombinator.scala
Linear Supertypes
(Int) ⇒ ParseResult[T], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Parser
  2. Function1
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Parser()

    Permalink

Abstract Value Members

  1. abstract def apply(index: Int): ParseResult[T]

    Permalink

    Parses input from the start index

    Parses input from the start index

    index

    the start index

    returns

    the parse result, which type is T

    Definition Classes
    Parser → Function1

Concrete Value Members

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  3. def *: Parser[List[T]]

    Permalink

    Returns a Parser that represents repetition (0 or more)

  4. def +: Parser[List[T]]

    Permalink

    Returns a Parser that represents repetition (1 or more).

    Returns a Parser that represents repetition (1 or more). It is same as

      (this ~ this.*).map { case hd ~ tl => hd :: tl }
    

  5. def <<[U](rhs: Parser[U]): Parser[T]

    Permalink

    Returns a sequential Parser consists of this and rhs.

    Returns a sequential Parser consists of this and rhs. Note that the result of rhs is ignored. It is same as

      for {
        t <- this
        _ <- rhs
      } yield t
    

  6. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  7. def >>[U](rhs: Parser[U]): Parser[U]

    Permalink

    Returns a sequential Parser consists of this and rhs.

    Returns a sequential Parser consists of this and rhs. Note that the result of this is ignored. It is same as

      for {
        _ <- this
        u <- rhs
      } yield u
    

  8. def ?: Parser[Option[T]]

    Permalink

    Returns a repetition Parser (0 or 1)

  9. def ^^[U](function: (T) ⇒ U): Parser[U]

    Permalink

    It is same as map

    It is same as map

  10. def andThen[A](g: (ParseResult[T]) ⇒ A): (Int) ⇒ A

    Permalink
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  11. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  12. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @throws( ... )
  13. def compose[A](g: (A) ⇒ Int): (A) ⇒ ParseResult[T]

    Permalink
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  14. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  16. def filter(predicate: (T) ⇒ Boolean, message: String = "not matched to predicate"): Parser[T]

    Permalink

    Returns a Parser which only succeeds iff predicate(result) is true.

    Returns a Parser which only succeeds iff predicate(result) is true.

    message

    the error message in that predicate(result) is false

  17. def flatMap[U](function: (T) ⇒ Parser[U]): Parser[U]

    Permalink

    Returns a parser such that 1.

    Returns a parser such that 1. this parses from current position 2. convert the intermediate result of type T to a parser. 3. the parser parses from the next position and returns the result of type U

  18. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  19. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  20. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  21. def l(newLabel: String): Parser[T]

    Permalink
  22. def labeled(newLabel: String): Parser[T]

    Permalink
  23. def map[U](function: (T) ⇒ U): Parser[U]

    Permalink

    Returns a parser that the result is converted from T to U

    Returns a parser that the result is converted from T to U

    function

    the result converter

  24. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  25. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  26. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  27. def repeat0By(separator: Parser[Any]): Parser[List[T]]

    Permalink

    Returns a repetition Parser (0 or more), which separator is separator

    Returns a repetition Parser (0 or more), which separator is separator

    separator

    this parses separator, which result is ignored

  28. def repeat1By(separator: Parser[Any]): Parser[List[T]]

    Permalink

    Returns a repetition Parser (1 or more), which separator is separator

    Returns a repetition Parser (1 or more), which separator is separator

    separator

    this parses separator, which result is ignored

  29. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  30. def toString(): String

    Permalink
    Definition Classes
    Function1 → AnyRef → Any
  31. final def wait(arg0: Long, arg1: Int): Unit

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. def withFilter(predicate: (T) ⇒ Boolean): Parser[T]

    Permalink

    It is same as filter

    It is same as filter

  35. def |[U >: T](rhs: Parser[U]): Parser[U]

    Permalink

    Returns an alternation Parser.

    Returns an alternation Parser. It first trys this. It trys rhs iff this failed.

    U

    the result type of rhs

    rhs

    the alternation

  36. def |||[U >: T](rhs: Parser[U]): Parser[U]

    Permalink

    Returns a alternation parser.

    Returns a alternation parser. It selects longest match.

  37. def |~[U >: T](rhs: Parser[U], catchLabels: String*): Parser[U]

    Permalink

    Returns an alternation parser.

    Returns an alternation parser. It first trys this. It trys <cdde>rhs> iff this failed and parameters are appropriate catchLabels.

  38. def ~[U](right: Parser[U]): Parser[~[T, U]]

    Permalink

    Returns a sequential Parser consists of this and rhs.

    Returns a sequential Parser consists of this and rhs.

  39. def ~<[U](rhs: Parser[U]): Parser[T]

    Permalink

    This method is same as << method.

    This method is same as << method. The only difference is operator precedence.

  40. def ~>[U](rhs: Parser[U]): Parser[U]

    Permalink

    This method is same as >> method.

    This method is same as >> method. The only difference is operator precedence.

Deprecated Value Members

  1. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @Deprecated @deprecated @throws( classOf[java.lang.Throwable] )
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from (Int) ⇒ ParseResult[T]

Inherited from AnyRef

Inherited from Any

Ungrouped