Class

org.bitbucket.inkytonik.kiama.parsing.ParsersBase

PackratParser

Related Doc: package ParsersBase

Permalink

class PackratParser[T] extends Parser[T] with Rule

A parser that is a memoising, left recursion-detecting encapsulation of a normal parser that returns a value of a particular type. This type of parser must be used if any of the alternatives are left recursive. Otherwise a plain Parser can be used if memoisation is not desired.

Note that it is non-trivial (impossible?) to combine this class with Parser. We need the latter to be covariant but this class can't be because T occurs in an invariant position in MemoEntry.

Self Type
PackratParser[T]
Source
Parsers.scala
Linear Supertypes
Rule, Parser[T], (Input) ⇒ ParseResult[T], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. PackratParser
  2. Rule
  3. Parser
  4. Function1
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new PackratParser(body: ⇒ Parser[T])

    Permalink

Type Members

  1. case class MemoEntry(ans: Answer[T], in: Input) extends Product with Serializable

    Permalink

    Memo table entries.

Value Members

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  3. def <~[U](q: ⇒ Parser[U]): Parser[T]

    Permalink

    Sequential composition ignoring right side.

    Sequential composition ignoring right side.

    Definition Classes
    Parser
  4. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  5. def ?: Parser[Option[T]]

    Permalink

    Optional parsing.

    Optional parsing.

    Definition Classes
    Parser
  6. def ^^[U](f: (T) ⇒ U): Parser[U]

    Permalink

    Apply function to successful result.

    Apply function to successful result.

    Definition Classes
    Parser
  7. def ^^^[U](u: ⇒ U): Parser[U]

    Permalink

    Turn a successful result into a specific value which is evaluated each each time this parser is used.

    Turn a successful result into a specific value which is evaluated each each time this parser is used.

    Definition Classes
    Parser
  8. def andThen[A](g: (ParseResult[T]) ⇒ A): (Input) ⇒ A

    Permalink
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  9. def append[U >: T](q: ⇒ Parser[U]): Parser[U]

    Permalink
    Definition Classes
    Parser
  10. def apply(in: Input): ParseResult[T]

    Permalink

    Apply this rule to the given input, memoising the result.

    Apply this rule to the given input, memoising the result.

    Definition Classes
    PackratParser → Function1
  11. def apply(str: String): ParseResult[T]

    Permalink

    Alternative entry point to directly parse a string.

    Alternative entry point to directly parse a string.

    Definition Classes
    Parser
  12. final def asInstanceOf[T0]: T0

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  14. def compose[A](g: (A) ⇒ Input): (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 finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  18. def flatMap[U](f: (T) ⇒ Parser[U]): Parser[U]

    Permalink
    Definition Classes
    Parser
  19. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  20. def growlr(in: Input, m: MemoEntry, h: Head): ParseResult[T]

    Permalink

    Grow the current parse result according to a left recursion.

  21. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  22. def into[U](fq: (T) ⇒ Parser[U]): Parser[U]

    Permalink

    Parameterise next parse step by result from previous one.

    Parameterise next parse step by result from previous one.

    Definition Classes
    Parser
  23. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  24. def lranswer(in: Input, m: MemoEntry): ParseResult[T]

    Permalink

    Process a given left recursion instance.

  25. def map[U](f: (T) ⇒ U): Parser[U]

    Permalink
    Definition Classes
    Parser
  26. val memo: HashMap[Input, MemoEntry]

    Permalink

    The section of the memo table relating to this rule.

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

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

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

    Permalink
    Definition Classes
    AnyRef
  30. def recall(in: Input): Option[MemoEntry]

    Permalink

    Look up the memoised result for this rule, taking into account that it might be participating in an active left recursion.

  31. def setuplr(l: LR[T]): Unit

    Permalink

    Initialise the left recursion data for a new application of this rule.

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

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

    Permalink
    Definition Classes
    Function1 → AnyRef → Any
  34. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  37. def |[U >: T](q: ⇒ Parser[U]): Parser[U]

    Permalink

    Alternation.

    Alternation.

    Definition Classes
    Parser
  38. def ~[U](q: ⇒ Parser[U]): Parser[~[T, U]]

    Permalink

    Sequential composition.

    Sequential composition.

    Definition Classes
    Parser
  39. def ~>[U](q: ⇒ Parser[U]): Parser[U]

    Permalink

    Sequential composition ignoring left side.

    Sequential composition ignoring left side.

    Definition Classes
    Parser

Inherited from Rule

Inherited from Parser[T]

Inherited from (Input) ⇒ ParseResult[T]

Inherited from AnyRef

Inherited from Any

Ungrouped