dsl - How to use ~> and <~ in grammar rule definition in Scala? -


how can ignore strings in these grammar rules using correct placement of ~> or <~ operators?

def typedefbody = ident ~ ":" ~ ident ~ "{" ~ fieldbody ~ "}"  def fieldbody = "validation" ~ "{" ~ validationbody ~ "}"  def validationbody = length ~ pattern  def length = "length" ~ "=" ~ wholenumber ~ "to" ~ wholenumber  def pattern = "pattern" ~ "=" ~ stringliteral 

i found solution, should break typedefbody 3 none terminal rules below

def typedefbody =  ident ~ typedefbodysequence1  def typedefbodysequence1 = ":" ~> ident ~ typedefbodysequence2  def typedefbodysequence2 = "{" ~> fieldbody <~ "}"  def fieldbody = "validation" ~ "{" ~> validationbody <~ "}"  def validationbody = length ~ pattern  def length = "length" ~ "=" ~> wholenumber ~ "to" ~ wholenumber  def pattern = "pattern" ~ "=" ~> stringliteral 

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -