sirthias / parboiled2

A macro-based PEG parser generator for Scala 2.10+
Other
717 stars 86 forks source link

Can not create "annotation" rule #57

Closed ghost closed 10 years ago

ghost commented 10 years ago
import org.parboiled2._

class TestParser(val input: ParserInput) extends Parser {

 def simpleRule = rule {str("foo") ~ push("Foo")}

 def multiFoo = rule {capture(zeroOrMore("foo"))}

 def annotation = rule { push("bar")}
}

I get:

src/TestParser.scala:7: error: stable identifier required, but TestParser.this.annotation found. def multiFoo = rule {capture(zeroOrMore("foo"))} ^ one error found

It seems there is name conflict which should be fixed or documented.

sirthias commented 10 years ago

Thanks for reporting!

sirthias commented 10 years ago

By the way: I published a new snapshot build with the fix that you can upgrade to if you like.