a try to add non-backtracking ~> and <~ to my parser based on RegexParsers.
RegexParsers implement implicit def literal(s: String): Parser[String]
witch transphorm implicitly a String to a Parser[String]
now i add :
`object implicits{
implicit class helper[T](parser : Parser[T]) {
def ~>! [U](q: => Parser[U]): Parser[U] = parser ~! q ^^ {case a ~ b => b} named ("~>!")
def <~! [U](q: => Parser[U]): Parser[T] = parser ~! q ^^ {case a ~ b => a} named ("<~!")
}
}
Witch is my implicit class.
But i seen a strange thing
def groupe : Parser[Group] = "group(" ~>! identifier <~! ")"
identifier is a Parser
Here i got an error when the string is pass in class parameter "group(" ~>! identifier
because the implicit is not made and the compiler look for ~>! inside String.
but when it's passed in the method parameter identifier <~! ")"
the String->Parser[String] implicit work.
Is it a Scala bug or i just miss something?