Menu
  • HOME
  • TAGS

Using variables in parboiled

java,parsing,parser-generator,parboiled

Came up with an answer. Including it here for any other parboiled newbie who may struggle with the same issue. The problem was that any access to the variable's content must happen in a parser action to ensure that it takes place in the parse-phase, rather than in the rule...

NoSuchMethodError: org.objectweb.asm.tree.ClassNode.(I)V while using Parboiled

java,maven,parboiled

The error is due to the presence of dcevm.jar present in my jre\lib\ext folder. The jdk which I have used for the project contains the dcevm.jar file and that this jar contains the package org.objectweb.asm.tree which containsClassNodewith no constructor like ClassNode(int). The jvm is using this jar instead of the...

parboiled2 and Spray cause conflicting cross-version suffixes

scala,sbt,spray,sbt-assembly,parboiled

The same answer as for Scala 2.11 should work here as well: replace spray-routing with spray-routing-shapeless2.

Parboiled2 causes “missing or invalid dependency detected while loading class file 'Prepender.class'”

scala,sbt,spray,sbt-assembly,parboiled

If you want to use shapeless2 you need to depend on spray-routing-shapeless2 instead of spray-routing. See the example dependency declaration: https://github.com/spray/spray-template/blob/on_spray-can_1.3_shapeless2_scala-2.11/build.sbt...

String ending with character in parboiled2, when the string can contain that character

scala,peg,parboiled,parboiled2

I think that the following should work for your problem description: def noColons = rule { zeroOrMore(noneOf(":")) } def colonWithNext = rule { ':' ~ &(noColons ~ ':') } def address = rule { capture(oneOrMore(noColons).separatedBy(colonWithNext)) ~ ':' } The problem with your code was the usage of the ~ combinator,...

Using parboiled2 to parse multiple lines instead of a String

scala,parsing,csv,parboiled

I've done this for CSV files of over 1 million records, in a project that requires high speed and low resources, and I find it works well to instantiate a new parser for each line. I tried this approach after I noticed that the parboiled2 readme mentions that the parsers...

How to make parboiled2 match the whole input?

scala,parsing,parboiled,parboiled2

This is expected behavior. parboiled2 is a PEG parser, and as described in the Common Mistakes section in the documentation, it eats everything it can find. To avoid such a problem, make sure that you expect the end-of-input symbol at the end of your string: def Expr: Rule1[Int] = rule...

Is there a rule to match unicode printable characters in parboiled2?

scala,unicode,character-encoding,peg,parboiled

Take a look at https://github.com/sirthias/parboiled2/blob/master/parboiled-core/src/main/scala/org/parboiled2/CharPredicate.scala#L112 - it is very easy to do your own predicates, for instance: val latinSupplementCharsPredicate = CharPredicate('\u00c0' to '\u00dc') ++ CharPredicate('\u00e0' to '\u00fd') ...