camunda / feel-scala

FEEL parser and interpreter written in Scala
https://camunda.github.io/feel-scala/
Apache License 2.0
119 stars 46 forks source link

Ammonite REPL fails to parse expressions #848

Closed jonaf closed 1 month ago

jonaf commented 1 month ago

Describe the bug I followed the instructions and downloaded and installed Scala, Ammonite, and the feel-repl.sc script. The setup was mostly smooth and no errors, save some logging-related warnings, but when I tried to evaluate expressions using the feel(string) or feel(string, context) methods defined in feel-repl.sc, I received the following exception:

java.lang.NoSuchMethodError: 'fastparse.ParsingRun fastparse.package$.EagerOps(fastparse.ParsingRun)'
  org.camunda.feel.impl.parser.FeelParser$.fullExpression(FeelParser.scala:134)
  org.camunda.feel.impl.parser.FeelParser$.$anonfun$parseExpression$2(FeelParser.scala:127)
  fastparse.SharedPackageDefs.parseInputRaw(SharedPackageDefs.scala:69)
  fastparse.SharedPackageDefs.parseInputRaw$(SharedPackageDefs.scala:6)
  fastparse.package$.parseInputRaw(package.scala:5)
  fastparse.SharedPackageDefs.parse$$anonfun$1(SharedPackageDefs.scala:35)
  fastparse.ParserInputSource$fromParserInput.parseThrough(ParserInput.scala:25)
  fastparse.SharedPackageDefs.parse(SharedPackageDefs.scala:42)
  fastparse.SharedPackageDefs.parse$(SharedPackageDefs.scala:6)
  fastparse.package$.parse(package.scala:5)
  org.camunda.feel.impl.parser.FeelParser$.parseExpression(FeelParser.scala:127)
  org.camunda.feel.FeelEngine.$anonfun$parseExpression$1(FeelEngine.scala:286)
  org.camunda.feel.FeelEngine.$anonfun$parse$1(FeelEngine.scala:135)
  scala.util.Try$.apply(Try.scala:210)
  org.camunda.feel.FeelEngine.parse(FeelEngine.scala:135)
  org.camunda.feel.FeelEngine.parseExpression(FeelEngine.scala:286)
  org.camunda.feel.FeelEngine.evalExpression(FeelEngine.scala:221)
  org.camunda.feel.FeelEngine.evalExpression(FeelEngine.scala:213)
  ammonite.predef.FilePredef$.feel(feel-repl.sc:18)
  ammonite.$sess.cmd4$.<clinit>(cmd4.sc:1)

To Reproduce Steps to reproduce the behavior:

  1. Setup and run the FEEL REPL.
  2. Attempt to parse any FEEL expression using feel(string) or feel(string, context). For example, feel("{}")

Expected behavior The parsed and evaluated expression's response should be returned instead of an error.

Environment

I also tried a version of Ammonite that runs Scala 2.12, which also did not work. In that case, I got the following error.

(class java.lang.RuntimeException/error reading Scala signature of package.class: Scala signature package has wrong version
 expected: 5.0
 found: 5.2 in package.class)
java.io.IOException: Scala signature FeelEngine has wrong version
 expected: 5.0
 found: 5.2 in FeelEngine.class
jonaf commented 1 month ago

Shucks, I realized I need Ammonite running Scala 2.13, not 2.12, that was the problem. Sorry for the false bug report.