You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not able to generate a custom failure message in the parser combinator library. For a rule like ..
defbuy_sell:Parser[BuySell] ="to"~>"buy"^^^BUY|"to"~>"sell"^^^SELL|
failure("buy or sell expected")
If the input has something (say "bought") other than "buy" or "sell", then the message that gets printed is the default one ..
``sell_ expected but identifier bought found
The main parse call is like the following :-
valstr=//.. the string to parsevaltokens=new lexical.Scanner(str)
phrase(order)(tokens) match {
caseSuccess(order, _) =>
println(order)
caseFailure(msg, _) => println("Failure: "+ msg)
caseError(msg, _) => println("Error: "+ msg)
}
I posted this to scala-user and Martin Odersky responded here - [http://thread.gmane.org/gmane.comp.lang.scala.user/24426/focus=24510] and asked to file a ticket.