-
Notifications
You must be signed in to change notification settings - Fork 85
Open
Description
parboiled2
type system should catch errors in a grammar as follows:
class SomeParser extends Parser {
def test = rule { push("x") ~ (a | b) }
def a = rule { str("a") ~> { (i: Int) => push("a") } }
def b = rule { str("b") ~> { (i: String) => push("b") } }
}
Currently it fails in runtime:
scala> new org.parboiled2.examples.SomeParser("a").test.run()
res0: scala.util.Try[String] = Failure(java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer)
scala> new org.parboiled2.examples.SomeParser("b").test.run()
res1: scala.util.Try[String] = Success(b)
Metadata
Metadata
Assignees
Labels
No labels