case class ElemsWhileIn[Elem, Repr](name: String, strings: Seq[Seq[Elem]], min: Int = 1)(implicit helper: ElemSetHelper[Elem], repr: ReprOps[Elem, Repr]) extends PrecomputableParser[Elem, Repr] with WhileParser[Elem, Repr] with Product with Serializable
Keeps consuming characters as long as they are within strings
- Alphabetic
- By Inheritance
- ElemsWhileIn
- Serializable
- Serializable
- Product
- Equals
- WhileParser
- PrecomputableParser
- Parser
- Precedence
- ParserResults
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new ElemsWhileIn(name: String, strings: Seq[Seq[Elem]], min: Int = 1)(implicit helper: ElemSetHelper[Elem], repr: ReprOps[Elem, Repr])
Type Members
-
type
InstrumentCallback = (Parser[_, Elem, Repr], Int, () ⇒ Parsed[_, Elem, Repr]) ⇒ Unit
Can be passed into a
.parse
call to let you inject logic around the parsing of top-level parsers, e.g.Can be passed into a
.parse
call to let you inject logic around the parsing of top-level parsers, e.g. for logging and debugging.- Definition Classes
- Parser
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
check(e: Elem): Boolean
- Definition Classes
- PrecomputableParser
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
fail(f: Failure[Elem, Repr], index: Int, traceParsers: Set[Parser[_, Elem, Repr]] = null, cut: Boolean = false): Failure[Elem, Repr]
Prepares a failure object for a new failure
Prepares a failure object for a new failure
- f
The failure object, usually retrieved from the ParseCtx to avoid allocation overhead
- index
The index at which this failure occurred
- traceParsers
Any parsers which failed at the current index. These get noted in the error message if
traceFailure
is set. By default, this is the current parser.- cut
Whether or not this failure should prevent backtracking
- Definition Classes
- ParserResults
-
def
failMore(f: Failure[Elem, Repr], index: Int, logDepth: Int, traceParsers: Set[Parser[_, Elem, Repr]] = null, cut: Boolean = false): Failure[Elem, Repr]
Prepares a failure object to continue an existing failure, e.g.
Prepares a failure object to continue an existing failure, e.g. if some sub-parser failed and you want to pass the failure up the stack.
- f
The failure returned by the subparser
- index
The index of the *current* parser
- traceParsers
Any parsers which failed at the current index. These get noted in the error message if
traceFailure
is set. By default, the existingtraceParsers
from the original failure are left unchanged- cut
Whether or not this parser failing should prevent backtracking. ORed with any cuts caused by the existing failure
- Definition Classes
- ParserResults
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
implicit
val
helper: ElemSetHelper[Elem]
- Definition Classes
- PrecomputableParser
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
mergeTrace(traceIndex: Int, lhs: Set[Parser[_, Elem, Repr]], rhs: Set[Parser[_, Elem, Repr]]): Set[Parser[_, Elem, Repr]]
- Definition Classes
- ParserResults
-
val
min: Int
- Definition Classes
- ElemsWhileIn → WhileParser
- val name: String
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
opPred: Int
Whether or not to surround this parser with parentheses when printing.
Whether or not to surround this parser with parentheses when printing. By default a top-level parser is always left without parentheses, but if a sub-parser is embedded inside with lower precedence, it will be surrounded. Set to
Integer.MaxValue
to never be parenthesized- Definition Classes
- Parser → Precedence
-
def
opWrap(s: Precedence): String
- Attributes
- protected
- Definition Classes
- Precedence
-
def
parse(input: Repr, index: Int = 0, instrument: InstrumentCallback = null): Parsed[Unit, Elem, Repr]
Parses the given
input
starting from the givenindex
Parses the given
input
starting from the givenindex
- input
The string we want to parse
- index
The index in the string to start from. By default parsing starts from the beginning of a string, but you can start from halfway through the string if you want.
- instrument
Allows you to pass in a callback that will get called by every named rule, its index, as it itself given a callback that can be used to recurse into the parse and return the result. Very useful for extracting auxiliary information from the parse, e.g. counting rule invocations to locate bottlenecks or unwanted backtracking in the parser.
- Definition Classes
- Parser
-
def
parseInput(input: ParserInput[Elem, Repr], index: Int = 0, instrument: InstrumentCallback = null): Parsed[Unit, Elem, Repr]
- Definition Classes
- Parser
-
def
parseIterator(input: Iterator[Repr], index: Int = 0, instrument: InstrumentCallback = null)(implicit ct: ClassTag[Elem]): Parsed[Unit, Elem, Repr]
- Definition Classes
- Parser
-
def
parseRec(cfg: ParseCtx[Elem, Repr], index: Int): Mutable[Unit, Elem, Repr]
Parses the given
input
starting from the givenindex
andlogDepth
Parses the given
input
starting from the givenindex
andlogDepth
- Definition Classes
- WhileParser → Parser
-
implicit
val
repr: ReprOps[Elem, Repr]
- Definition Classes
- PrecomputableParser
-
implicit
val
reprOps: ReprOps[Elem, Repr]
- Definition Classes
- Parser
-
def
shortTraced: Boolean
Whether or not this parser should show up when Parsed.TracedFailure.trace is called.
Whether or not this parser should show up when Parsed.TracedFailure.trace is called. If not set, the parser will only show up in Parsed.TracedFailure.fullStack
- Definition Classes
- Parser
- val strings: Seq[Seq[Elem]]
-
def
success[T](s: Success[_, Elem, Repr], value: T, index: Int, traceParsers: Set[Parser[_, Elem, Repr]], cut: Boolean): Success[T, Elem, Repr]
Prepares a success object to be returned.
Prepares a success object to be returned.
- s
The existing success object, usually taken from ParseCtx to avoid allocation overhead.
- value
The value that this parser succeeded with
- index
The index of the parser *after* having successfully parsed part of the input
- traceParsers
Any parsers which failed at the current index in the creation of this success. Even though this parser succeeded, failures inside sub-parsers must be reported to ensure proper error reporting.
- cut
Whether the parse crossed a cut and should prevent backtracking
- Definition Classes
- ParserResults
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- ElemsWhileIn → AnyRef → Any
-
def
unapply(input: Repr): Option[Unit]
Extractor for pattern matching
Extractor for pattern matching
For example:
val p1 = CharIn('a'to'z').! ~ CharIn('0'to'9').rep(1).!.map(_.toInt) List("a42x") match { case p1(x: String, y: Int) :: _ => // x is "a", y is 42 }
- Definition Classes
- Parser
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )