Issues with scala-parser-combinators: parsing text of the form `(typ1: value1) (type2: value2) ... ` -


i want parse text of following form:

"(typ1: value1) (type2: value2) (type3: value3)" 

here code:

  case class word(word: string) extends expression   case class cluster(wrapped: expression) extends expression    def parse(input: string): parseresult[expression] = {     val expressions = "(" ~> expr <~ ")" ^^ {expr => cluster(expr) }     val capture3 = expressions ~> ":" ^^ word     def expr: parser[expression] = rep1(expressions) ^^ { exprs =>         if (exprs.size > 1) concatenate(exprs) else exprs.head       }      parseall(expr, input)   } 

this code far supposed capture types (values added). in form following error:

[1.5] failure: `)' expected `1' found  (typ1: value1) (type2: value2) (type3: value3)     ^ 

any idea how resolve issue?


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -