object ContextMatcher
- Source
- ContextMatcher.scala
- Alphabetic
- By Inheritance
- ContextMatcher
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- case class Chained[Elem, H, T, F](headM: ContextMatcher[Elem, H], tailM: ContextMatcher[Elem, T])(implicit reduce: Aux[H, T, F]) extends ContextMatcher[Elem, F] with Product with Serializable
Matcher implementation for
headM \ tailM
Matcher implementation for
headM \ tailM
- H
The head result type
- T
The tail result type
- F
The combined result type
- headM
The first matcher in the chain
- tailM
The next matcher in the chain
- reduce
The
TypeReduce
rule to combine the head and tail result types
- case class Mapped[Elem, A, B](inner: ContextMatcher[Elem, A], op: String = "map")(f: (A) => Option[B]) extends ContextMatcher[Elem, B] with Product with Serializable
Matcher implementation for the
map
,flatMap
, andfilter
operations.Matcher implementation for the
map
,flatMap
, andfilter
operations.- A
The type of the matched context.
- B
The transformed context type
- inner
The transformed mapper
- op
The name of the operation, used by
toString
- f
The transform operation
- case class Or[Elem, A](left: ContextMatcher[Elem, A], right: ContextMatcher[Elem, A]) extends ContextMatcher[Elem, A] with Product with Serializable
Matcher implementation for
left | right
.Matcher implementation for
left | right
.- A
The type of the matched context.
- left
The left matcher (i.e. the first choice)
- right
The right matcher (i.e. the fallback)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def greedy[Elem, A](f: (IndexedSeq[Elem], Int, Int) => Option[(A, Int)]): ContextMatcher[Elem, A]
A matcher that uses a custom function
f
to consume the firstN
elements from the input before passing the remainder to the next matcher in the chain.A matcher that uses a custom function
f
to consume the firstN
elements from the input before passing the remainder to the next matcher in the chain.For example:
Matcher.greedy { (stack, offset, avail) => if(avail >= 2 && stack(offset) == "foo" && stack(offset + 1) == "bar"){ Some("yes!" -> 2) } else { None } }
- A
The matcher function's result type
- f
The matching function. Given a reference to the stack elements, an offset position, and the number of elements available starting from the offset,
f
should return an option containing a pair of the matched value and the unconsumed portion of the stack.- returns
A new matcher which uses
f
to determine how (and how much of) the stack is matched
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def noopFailure[Elem]: ContextMatcher[Elem, Unit]
A matcher that quickly rejects any input
- def noopSuccess[Elem]: ContextMatcher[Elem, Unit]
A matcher that quickly matches any input as
()
without consuming any stack. - final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def variableLength[Elem]: ContextMatcher[Elem, Unit]
A matcher that matches any input as long as the next matcher in the chain will match some segment of that input.
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()