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 commit: Parser[T]

    Permalink

    This method is same as withErrorMessage() except for no message being specified.

  14. def compose[A](g: (A) ⇒ Int): (A) ⇒ ParseResult[T]

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  17. 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

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

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

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

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

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

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

    Permalink
  24. 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

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  28. 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

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

  30. def replace(message: String): Parser[T]

    Permalink

    Return the same parser except it replace the failure message with message

    Return the same parser except it replace the failure message with message

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

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

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. def withErrorMessage(message: String): Parser[T]

    Permalink

    Replace the failure parser with the error parser.

    Replace the failure parser with the error parser. It is used to suppress backtracks.

    message

    the error message

  37. def withFilter(predicate: (T) ⇒ Boolean): Parser[T]

    Permalink

    It is same as filter

    It is same as filter

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

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

    Permalink

    Returns a alternation parser.

    Returns a alternation parser. It selects longest match.

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

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

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

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