abstract class Parser extends RuleDSL with ParserMacroMethods
- Alphabetic
- By Inheritance
- Parser
- ParserMacroMethods
- RuleDSL
- RuleDSLActions
- RuleDSLCombinators
- RuleDSLBasics
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new Parser(initialValueStackSize: Int = 16, maxValueStackSize: Int = 1024)
Type Members
- class TracingBubbleException extends RuntimeException with NoStackTrace
THIS IS NOT PUBLIC API and might become hidden in future.
THIS IS NOT PUBLIC API and might become hidden in future. Use only if you know what you are doing!
- class __SubParserInput extends ParserInput
- Attributes
- protected
- sealed trait ActionOperator[I <: HList, O <: HList, Ops] extends AnyRef
- Definition Classes
- RuleDSLActions
- sealed trait CharRangeSupport extends AnyRef
- Definition Classes
- RuleDSLBasics
- sealed trait NTimes extends AnyRef
- Definition Classes
- RuleDSLCombinators
- trait WithSeparatedBy[I <: HList, O <: HList] extends AnyRef
- Definition Classes
- RuleDSLCombinators
Abstract Value Members
- abstract def input: ParserInput
The input this parser instance is running against.
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def &(r: Rule[_, _]): Rule0
Runs its inner rule but resets the parser (cursor and value stack) afterwards, succeeds only if its inner rule succeeded.
Runs its inner rule but resets the parser (cursor and value stack) afterwards, succeeds only if its inner rule succeeded.
- Definition Classes
- RuleDSLCombinators
- Annotations
- @compileTimeOnly("Calls to `&` must be inside `rule` macro")
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def ANY: Rule0
Matches any character except EOI.
Matches any character except EOI.
- Definition Classes
- RuleDSLBasics
- Annotations
- @compileTimeOnly("Calls to `ANY` must be inside `rule` macro")
- def EOI: Char
Matches the EOI (end-of-input) character.
Matches the EOI (end-of-input) character.
- Definition Classes
- RuleDSLBasics
- def MATCH: Rule0
Matches no character (i.e.
Matches no character (i.e. doesn't cause the parser to make any progress) but succeeds always (as a rule).
- Definition Classes
- RuleDSLBasics
- def MISMATCH[I <: HList, O <: HList]: Rule[I, O]
A generic Rule that always fails.
A generic Rule that always fails.
- Definition Classes
- RuleDSLBasics
- def MISMATCH0: Rule0
A Rule0 that always fails.
A Rule0 that always fails.
- Definition Classes
- RuleDSLBasics
- def __advance(): Boolean
THIS IS NOT PUBLIC API and might become hidden in future.
THIS IS NOT PUBLIC API and might become hidden in future. Use only if you know what you are doing!
- def __bubbleUp(prefix: List[NonTerminal], terminal: Terminal): Nothing
THIS IS NOT PUBLIC API and might become hidden in future.
THIS IS NOT PUBLIC API and might become hidden in future. Use only if you know what you are doing!
- def __bubbleUp(terminal: Terminal): Nothing
THIS IS NOT PUBLIC API and might become hidden in future.
THIS IS NOT PUBLIC API and might become hidden in future. Use only if you know what you are doing!
- def __enterAtomic(start: Int): Boolean
THIS IS NOT PUBLIC API and might become hidden in future.
THIS IS NOT PUBLIC API and might become hidden in future. Use only if you know what you are doing!
- def __enterNotPredicate(): AnyRef
THIS IS NOT PUBLIC API and might become hidden in future.
THIS IS NOT PUBLIC API and might become hidden in future. Use only if you know what you are doing!
- def __enterQuiet(): Int
THIS IS NOT PUBLIC API and might become hidden in future.
THIS IS NOT PUBLIC API and might become hidden in future. Use only if you know what you are doing!
- def __exitAtomic(saved: Boolean): Unit
THIS IS NOT PUBLIC API and might become hidden in future.
THIS IS NOT PUBLIC API and might become hidden in future. Use only if you know what you are doing!
- def __exitNotPredicate(saved: AnyRef): Unit
THIS IS NOT PUBLIC API and might become hidden in future.
THIS IS NOT PUBLIC API and might become hidden in future. Use only if you know what you are doing!
- def __exitQuiet(saved: Int): Unit
THIS IS NOT PUBLIC API and might become hidden in future.
THIS IS NOT PUBLIC API and might become hidden in future. Use only if you know what you are doing!
- def __hardFail(expected: String): Nothing
THIS IS NOT PUBLIC API and might become hidden in future.
THIS IS NOT PUBLIC API and might become hidden in future. Use only if you know what you are doing!
- def __inErrorAnalysis: Boolean
THIS IS NOT PUBLIC API and might become hidden in future.
THIS IS NOT PUBLIC API and might become hidden in future. Use only if you know what you are doing!
- final def __matchAnyOf(string: String, ix: Int = 0): Boolean
THIS IS NOT PUBLIC API and might become hidden in future.
THIS IS NOT PUBLIC API and might become hidden in future. Use only if you know what you are doing!
- Annotations
- @tailrec()
- final def __matchIgnoreCaseString(string: String, ix: Int = 0): Boolean
THIS IS NOT PUBLIC API and might become hidden in future.
THIS IS NOT PUBLIC API and might become hidden in future. Use only if you know what you are doing!
- Annotations
- @tailrec()
- final def __matchIgnoreCaseStringWrapped(string: String, ix: Int = 0): Boolean
THIS IS NOT PUBLIC API and might become hidden in future.
THIS IS NOT PUBLIC API and might become hidden in future. Use only if you know what you are doing!
- Annotations
- @tailrec()
- def __matchMap(m: Map[String, Any], ignoreCase: Boolean): Boolean
THIS IS NOT PUBLIC API and might become hidden in future.
THIS IS NOT PUBLIC API and might become hidden in future. Use only if you know what you are doing!
- def __matchMapWrapped(m: Map[String, Any], ignoreCase: Boolean): Boolean
THIS IS NOT PUBLIC API and might become hidden in future.
THIS IS NOT PUBLIC API and might become hidden in future. Use only if you know what you are doing!
- final def __matchNoneOf(string: String, ix: Int = 0): Boolean
THIS IS NOT PUBLIC API and might become hidden in future.
THIS IS NOT PUBLIC API and might become hidden in future. Use only if you know what you are doing!
- Annotations
- @tailrec()
- final def __matchString(string: String, ix: Int = 0): Boolean
THIS IS NOT PUBLIC API and might become hidden in future.
THIS IS NOT PUBLIC API and might become hidden in future. Use only if you know what you are doing!
- Annotations
- @tailrec()
- final def __matchStringWrapped(string: String, ix: Int = 0): Boolean
THIS IS NOT PUBLIC API and might become hidden in future.
THIS IS NOT PUBLIC API and might become hidden in future. Use only if you know what you are doing!
- Annotations
- @tailrec()
- def __push(value: Any): Boolean
THIS IS NOT PUBLIC API and might become hidden in future.
THIS IS NOT PUBLIC API and might become hidden in future. Use only if you know what you are doing!
- def __registerMismatch(): Boolean
THIS IS NOT PUBLIC API and might become hidden in future.
THIS IS NOT PUBLIC API and might become hidden in future. Use only if you know what you are doing!
- def __restoreState(mark: Mark): Unit
THIS IS NOT PUBLIC API and might become hidden in future.
THIS IS NOT PUBLIC API and might become hidden in future. Use only if you know what you are doing!
- def __run[L <: HList](rule: => RuleN[L])(implicit scheme: DeliveryScheme[L]): Result
THIS IS NOT PUBLIC API and might become hidden in future.
THIS IS NOT PUBLIC API and might become hidden in future. Use only if you know what you are doing!
- def __saveState: Mark
THIS IS NOT PUBLIC API and might become hidden in future.
THIS IS NOT PUBLIC API and might become hidden in future. Use only if you know what you are doing!
- def __subParserInput: __SubParserInput
- def __updateMaxCursor(): Boolean
THIS IS NOT PUBLIC API and might become hidden in future.
THIS IS NOT PUBLIC API and might become hidden in future. Use only if you know what you are doing!
- def anyOf(chars: String): Rule0
Matches any single one of the given characters.
Matches any single one of the given characters.
Note: This helper has O(n) runtime with n being the length of the given string. If your string consists only of 7-bit ASCII chars using a pre-allocated CharPredicate will be more efficient.
- Definition Classes
- RuleDSLBasics
- Annotations
- @compileTimeOnly("Calls to `anyOf` must be inside `rule` macro")
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def atomic[I <: HList, O <: HList](r: Rule[I, O]): Rule[I, O]
Marks a rule as "undividable" from an error reporting perspective.
Marks a rule as "undividable" from an error reporting perspective. The parser will never report errors *inside* of the marked rule. Rather, if the rule mismatches, the error will be reported at the very beginning of the attempted rule match.
- Definition Classes
- RuleDSLCombinators
- Annotations
- @compileTimeOnly("Calls to `atomic` must be inside `rule` macro")
- def capture[I <: HList, O <: HList](r: Rule[I, O])(implicit p: Prepend[O, ::[String, HNil]]): Rule[I, Out]
Pushes the input text matched by its inner rule onto the value stack after its inner rule has been run successfully (and only then).
Pushes the input text matched by its inner rule onto the value stack after its inner rule has been run successfully (and only then).
- Definition Classes
- RuleDSLActions
- Annotations
- @compileTimeOnly("Calls to `capture` must be inside `rule` macro")
- implicit def ch(c: Char): Rule0
Matches the given single character.
Matches the given single character.
- Definition Classes
- RuleDSLBasics
- Annotations
- @compileTimeOnly("Calls to `ch` must be inside `rule` macro")
- def charAt(offset: Int): Char
Returns the character at the input index with the given delta to the cursor.
Returns the character at the input index with the given delta to the cursor. Note: for performance optimization this method does *not* do a range check, i.e. depending on the ParserInput implementation you might get an exception when calling this method before any character was matched by the parser.
- def charAtRC(offset: Int): Char
Same as
charAtbut range-checked.Same as
charAtbut range-checked. Returns the input character at the index with the given offset from the cursor. If this index is out of range the method returnsEOI. - def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def copyStateFrom(other: Parser, offset: Int): Unit
- def cursor: Int
The index of the next (yet unmatched) input character.
The index of the next (yet unmatched) input character. Might be equal to
input.length! - def cursorChar: Char
The next (yet unmatched) input character, i.e.
The next (yet unmatched) input character, i.e. the one at the
cursorindex. Identical toif (cursor < input.length) input.charAt(cursor) else EOIbut more efficient. - def drop[T](implicit h: HListable[T]): PopRule[Out]
Drops one or more values from the top of the value stack.
Drops one or more values from the top of the value stack. E.g.
drop[Int]will drop the topvalue andIntdrop[Int :: String :: HNil]will drop the top two values, which must be anunderneath aInt(the string being the top stack element).String- Definition Classes
- RuleDSLActions
- Annotations
- @compileTimeOnly("Calls to `drop` must be inside `rule` macro")
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def errorTraceCollectionLimit: Int
The maximum number of error traces that parser will collect in case of a parse error.
The maximum number of error traces that parser will collect in case of a parse error. Override with a custom value if required. Set to zero to completely disable error trace collection (which will cause
formatErrorto no be able to render any "expected" string!). - def fail(expected: String): Rule0
A rule that always fails and causes the parser to immediately terminate the parsing run.
A rule that always fails and causes the parser to immediately terminate the parsing run. The resulting parse error only has a single trace with a single frame which holds the given error message.
- Definition Classes
- RuleDSLBasics
- def failX[I <: HList, O <: HList](expected: String): Rule[I, O]
Fully generic variant of fail.
Fully generic variant of fail.
- Definition Classes
- RuleDSLBasics
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def formatError(error: ParseError, formatter: ErrorFormatter = new ErrorFormatter()): String
Formats the given ParseError into a String using the given formatter instance.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def ignoreCase(s: String): Rule0
Matches the given string of characters case insensitively.
Matches the given string of characters case insensitively. Note: the given string must be specified in all lower-case! This requirement is currently NOT enforced!
- Definition Classes
- RuleDSLBasics
- Annotations
- @compileTimeOnly("Calls to `ignoreCase` must be inside `rule` macro")
- def ignoreCase(c: Char): Rule0
Matches the given single character case insensitively.
Matches the given single character case insensitively. Note: the given character must be specified in lower-case! This requirement is currently NOT enforced!
- Definition Classes
- RuleDSLBasics
- Annotations
- @compileTimeOnly("Calls to `ignoreCase` must be inside `rule` macro")
- implicit def int2NTimes(i: Int): NTimes
- Definition Classes
- RuleDSLCombinators
- Annotations
- @compileTimeOnly("Calls to `int2NTimes` must be inside `rule` macro")
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def lastChar: Char
Returns the last character that was matched, i.e.
Returns the last character that was matched, i.e. the one at index cursor - 1 Note: for performance optimization this method does *not* do a range check, i.e. depending on the ParserInput implementation you might get an exception when calling this method before any character was matched by the parser.
- macro def namedRule[I <: HList, O <: HList](name: String)(r: Rule[I, O]): Rule[I, O]
Converts a compile-time only rule definition into the corresponding rule method implementation with an explicitly given name.
Converts a compile-time only rule definition into the corresponding rule method implementation with an explicitly given name.
- Definition Classes
- ParserMacroMethods
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def noneOf(chars: String): Rule0
Matches any single character except the ones in the given string and except EOI.
Matches any single character except the ones in the given string and except EOI.
Note: This helper has O(n) runtime with n being the length of the given string. If your string consists only of 7-bit ASCII chars using a pre-allocated CharPredicate will be more efficient.
- Definition Classes
- RuleDSLBasics
- Annotations
- @compileTimeOnly("Calls to `noneOf` must be inside `rule` macro")
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def oneOrMore[I <: HList, O <: HList](r: Rule[I, O])(implicit l: Lifter[Seq, I, O]): Rule[In, StrictOut] with Repeated
Runs its inner rule until it fails, succeeds if its inner rule succeeded at least once.
Runs its inner rule until it fails, succeeds if its inner rule succeeded at least once. Resulting rule type is Rule0 if r == Rule0 Rule1[Seq[T]] if r == Rule1[T] Rule[I, O] if r == Rule[I, O <: I] // so called "reduction", which leaves the value stack unchanged on a type level
- Definition Classes
- RuleDSLCombinators
- Annotations
- @compileTimeOnly("Calls to `oneOrMore` must be inside `rule` macro")
- def optional[I <: HList, O <: HList](r: Rule[I, O])(implicit l: Lifter[Option, I, O]): Rule[In, OptionalOut]
Runs its inner rule and succeeds even if the inner rule doesn't.
Runs its inner rule and succeeds even if the inner rule doesn't. Resulting rule type is Rule0 if r == Rule0 Rule1[Option[T]] if r == Rule1[T] Rule[I, O] if r == Rule[I, O <: I] // so called "reduction", which leaves the value stack unchanged on a type level
- Definition Classes
- RuleDSLCombinators
- Annotations
- @compileTimeOnly("Calls to `optional` must be inside `rule` macro")
- implicit def predicate(p: CharPredicate): Rule0
Matches any (single) character matched by the given
CharPredicate.Matches any (single) character matched by the given
CharPredicate.- Definition Classes
- RuleDSLBasics
- Annotations
- @compileTimeOnly("Calls to `predicate` must be inside `rule` macro")
- def push[T](value: T)(implicit h: HListable[T]): RuleN[Out]
Pushes the given value onto the value stack.
Pushes the given value onto the value stack. - if
TisUnitnothing is pushed (i.e.pushwith a block/expression evaluating toUnitis identical torun) - ifT <: HListall values of the HList is pushed as individual elements - otherwise a single value of typeTis pushed.- Definition Classes
- RuleDSLActions
- Annotations
- @compileTimeOnly("Calls to `push` must be inside `rule` macro")
- def quiet[I <: HList, O <: HList](r: Rule[I, O]): Rule[I, O]
Marks a rule as "quiet" from an error reporting perspective.
Marks a rule as "quiet" from an error reporting perspective. Quiet rules only show up in error rule traces if no "unquiet" rules match up to the error location. This marker frequently used for low-level syntax rules (like whitespace or comments) that might be matched essentially everywhere and are therefore not helpful when appearing in the "expected" set of an error report.
- Definition Classes
- RuleDSLCombinators
- Annotations
- @compileTimeOnly("Calls to `atomic` must be inside `rule` macro")
- implicit def range2NTimes(range: Range): NTimes
- Definition Classes
- RuleDSLCombinators
- Annotations
- @compileTimeOnly("Calls to `range2NTimes` must be inside `rule` macro")
- macro def rule[I <: HList, O <: HList](r: Rule[I, O]): Rule[I, O]
Converts a compile-time only rule definition into the corresponding rule method implementation.
Converts a compile-time only rule definition into the corresponding rule method implementation.
- Definition Classes
- ParserMacroMethods
- implicit def rule2ActionOperator[I <: HList, O <: HList](r: Rule[I, O])(implicit ops: ActionOps[I, O]): ActionOperator[I, O, Out]
- Definition Classes
- RuleDSLActions
- Annotations
- @compileTimeOnly("Calls to `rule2ActionOperator` must be inside `rule` macro")
- implicit def rule2WithSeparatedBy[I <: HList, O <: HList](r: Rule[I, O] with Repeated): WithSeparatedBy[I, O]
- Definition Classes
- RuleDSLCombinators
- Annotations
- @compileTimeOnly("Calls to `rule2WithSeparatedBy` constructor must be inside `rule` macro")
- def run[T](arg: T)(implicit rr: RunResult[T]): Out
Runs the given block / expression / action function.
Runs the given block / expression / action function. A
runrule can have several shapes, depending on its argument type. If theargevaluates to- a rule (i.e. has type
R <: Rule[_, _]) the result type ofrunis this rule's type (i.e.R) and the produced rule is immediately executed.- a function with 1 to 5 parameters these parameters are mapped against the top of the value stack, popped and the function executed. Thereby the function behaves just like an action function for the
~>operator, i.e. if it produces a Unit value this result is simply dropped. HList results are pushed onto the value stack (all their elements individually), rule results are immediately executed and other result values are pushed onto the value stack as a single element.- a function with one HList parameter the behavior is similar to the previous case with the difference that the elements of this parameter HList are mapped against the value stack top. This allows for consumption of an arbitrary number of value stack elements. (Note: This feature of
is not yet currently implemented.)run- any other value the result type of
runis an always succeedingRule0.NOTE: Even though the block is not a call-by-name parameter it will be executed for every rule application anew! (Since the expression is directly transplanted into the rule method by the
rulemacro.- Definition Classes
- RuleDSLActions
- Annotations
- @compileTimeOnly("Calls to `run` must be inside `rule` macro")
- def runSubParser[I <: HList, O <: HList](f: (ParserInput) => Rule[I, O]): Rule[I, O]
Allows creation of a sub parser and running of one of its rules as part of the current parsing process.
Allows creation of a sub parser and running of one of its rules as part of the current parsing process. The subparser will start parsing at the current input position and the outer parser (this parser) will continue where the sub-parser stopped.
- Definition Classes
- RuleDSLCombinators
- Annotations
- @compileTimeOnly("Calls to `runSubParser` must be inside `rule` macro")
- implicit def str(s: String): Rule0
Matches the given string of characters.
Matches the given string of characters.
- Definition Classes
- RuleDSLBasics
- Annotations
- @compileTimeOnly("Calls to `str` must be inside `rule` macro")
- implicit def str2CharRangeSupport(s: String): CharRangeSupport
- Definition Classes
- RuleDSLBasics
- Annotations
- @compileTimeOnly("Calls to `str2CharRangeSupport` must be inside `rule` macro")
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def test(condition: Boolean): Rule0
Implements a semantic predicate.
Implements a semantic predicate. If the argument expression evaluates to
truethe created rule matches otherwise it doesn't.- Definition Classes
- RuleDSLActions
- Annotations
- @compileTimeOnly("Calls to `test` must be inside `rule` macro")
- def toString(): String
- Definition Classes
- AnyRef → Any
- def valueMap[T](m: Map[String, T], ignoreCase: Boolean = false)(implicit h: HListable[T]): RuleN[Out]
Matches any of the given maps keys and pushes the respective value upon a successful match.
Matches any of the given maps keys and pushes the respective value upon a successful match.
- ignoreCase
a flag that tells if map keys case should be ignored
- Definition Classes
- RuleDSLBasics
- Annotations
- @compileTimeOnly("Calls to `valueMap` must be inside `rule` macro")
- implicit def valueMap[T](m: Map[String, T])(implicit h: HListable[T]): RuleN[Out]
Matches any of the given maps keys and pushes the respective value upon a successful match.
Matches any of the given maps keys and pushes the respective value upon a successful match.
- Definition Classes
- RuleDSLBasics
- Annotations
- @compileTimeOnly("Calls to `valueMap` must be inside `rule` macro")
- def valueStack: ValueStack
Allows "raw" (i.e.
Allows "raw" (i.e. untyped) access to the
ValueStack. In most cases you shouldn't need to access the value stack directly from your code. Use only if you know what you are doing! - 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()
- def zeroOrMore[I <: HList, O <: HList](r: Rule[I, O])(implicit l: Lifter[Seq, I, O]): Rule[In, OptionalOut] with Repeated
Runs its inner rule until it fails, always succeeds.
Runs its inner rule until it fails, always succeeds. Resulting rule type is Rule0 if r == Rule0 Rule1[Seq[T]] if r == Rule1[T] Rule[I, O] if r == Rule[I, O <: I] // so called "reduction", which leaves the value stack unchanged on a type level
- Definition Classes
- RuleDSLCombinators
- Annotations
- @compileTimeOnly("Calls to `zeroOrMore` must be inside `rule` macro")