In parboiled2, how do I report a bug in the parser action?
What's the best way to report a bug in the parser action in parboiled2 (I'm using v 2.1.4)?
For example, say I want to read an integer value and report an error if it is not in the expected range? I tried calling fail
, but it doesn't seem like reality in the parser action. Also, I cannot tell how I should provide the stack value to the rule test
. Am I just throwing an exception ParseError
?
To be more specific, consider the following rule:
def Index = rule {
capture(oneOrMore(CharPredicate.Digit)) ~> {s => // s is a String
val i = s.toInt
if(i > SomeMaxIndexValue) ??? // What do I put here?
else i
}
}
+3
source to share