-
Notifications
You must be signed in to change notification settings - Fork 408
PayrollParser parseAll returning RuntimeException #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
You're probably right. Thanks for reporting it. dean |
I don't know if it would be possible to change the locale "on the go" of the Scala REPL. I have already had a similar problem converting from string to double and vice versa in other languages, such as C++. |
I would just modify the code to use your locale. A good DSL should support local conventions. I didn't go that far for this simple example, but you could modify it as you want. The code should really make API calls to determine local conventions for number formatting, etc. and expect the user-supplied DSL code to use those conventions. |
@lopezavila85 see the PR #42 that I just merged, which explicitly sets the locale in |
Closing this one as it should be resolved now. |
Hello,
I have run the PayrollUseCases example ("The Parthenon Architecture" section).
However, the toDeduction method throws a
I suspect it could be due to the locale on my computer (ES, Spanish), as the decimal places are separated with a comma, not a point. The rule String passed to the toDeduction method is:
So the parseAll method does not retrieve anything at all. The full stack trace:
java.lang.RuntimeException: No result when parsing failed at scala.sys.package$.error(package.scala:27) at scala.util.parsing.combinator.Parsers$NoSuccess.get(Parsers.scala:176) at scala.util.parsing.combinator.Parsers$NoSuccess.get(Parsers.scala:162) at progscala2.appdesign.parthenon.PayrollParthenon$.progscala2$appdesign$parthenon$PayrollParthenon$$toDeduction(PayrollUseCases.scala:33) at progscala2.appdesign.parthenon.PayrollParthenon$$anonfun$processRules$2.apply(PayrollUseCases.scala:42) at progscala2.appdesign.parthenon.PayrollParthenon$$anonfun$processRules$2.apply(PayrollUseCases.scala:41) at scala.collection.TraversableLike$WithFilter$$anonfun$map$2.apply(TraversableLike.scala:728) at scala.collection.Iterator$class.foreach(Iterator.scala:742) at scala.collection.AbstractIterator.foreach(Iterator.scala:1194) at scala.collection.IterableLike$class.foreach(IterableLike.scala:72) at scala.collection.AbstractIterable.foreach(Iterable.scala:54) at scala.collection.TraversableLike$WithFilter.map(TraversableLike.scala:727) at progscala2.appdesign.parthenon.PayrollParthenon$.processRules(PayrollUseCases.scala:41) at progscala2.appdesign.parthenon.PayrollParthenon$.main(PayrollUseCases.scala:72) at progscala2.appdesign.parthenon.PayrollParthenon.main(PayrollUseCases.scala) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) [trace] Stack trace suppressed: run last compile:runMain for the full output.
Regards,
Álvaro López
The text was updated successfully, but these errors were encountered: