Skip to content
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

Truffle - Regex Parsing Error #2652

Closed
bjfish opened this Issue Mar 5, 2015 · 1 comment

Comments

Projects
None yet
3 participants
@bjfish
Copy link
Contributor

commented Mar 5, 2015

I get the following error when trying to parse this regex:

/" ((?:[^\x0-\x1f"\\] |
                                   # escaped special characters:
                                  \\["\\\/bfnrt] |
                                  \\u[0-9a-fA-F]{4} |
                                   # match all but escaped special characters:
                                  \\[\x20-\x21\x23-\x2e\x30-\x5b\x5d-\x61\x63-\x65\x67-\x6d\x6f-\x71\x73\x75-\xff])*)
                              "/nx

Error output

Truffle internal error: java.lang.NumberFormatException: For input string: "0-"
java.lang.NumberFormatException: For input string: "0-"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:492)
    at org.jruby.truffle.translator.BodyTranslator.all7Bit(BodyTranslator.java:2426)
    at org.jruby.truffle.translator.BodyTranslator.visitRegexpNode(BodyTranslator.java:2398)
    at org.jruby.truffle.translator.BodyTranslator.visitRegexpNode(BodyTranslator.java:78)
    at org.jruby.ast.RegexpNode.accept(RegexpNode.java:66)
    at org.jruby.truffle.translator.BodyTranslator.visitNewlineNode(BodyTranslator.java:2143)
    at org.jruby.truffle.translator.BodyTranslator.visitNewlineNode(BodyTranslator.java:78)
    at org.jruby.ast.NewlineNode.accept(NewlineNode.java:71)
    at org.jruby.truffle.translator.TranslatorDriver.parse(TranslatorDriver.java:159)
    at org.jruby.truffle.translator.TranslatorDriver.parse(TranslatorDriver.java:119)
    at org.jruby.truffle.runtime.RubyContext.execute(RubyContext.java:242)
    at org.jruby.truffle.runtime.RubyContext.execute(RubyContext.java:237)
    at org.jruby.truffle.runtime.RubyContext.load(RubyContext.java:188)
    at org.jruby.truffle.TruffleBridgeImpl.execute(TruffleBridgeImpl.java:177)
    at org.jruby.truffle.TruffleBridgeImpl.execute(TruffleBridgeImpl.java:154)
    at org.jruby.Ruby.runInterpreter(Ruby.java:866)
    at org.jruby.Ruby.runInterpreter(Ruby.java:880)
    at org.jruby.Ruby.runNormally(Ruby.java:755)
    at org.jruby.Ruby.runFromMain(Ruby.java:572)
    at org.jruby.Main.doRunFromMain(Main.java:404)
    at org.jruby.Main.internalRun(Main.java:299)
    at org.jruby.Main.run(Main.java:226)
    at org.jruby.Main.main(Main.java:198)
@chrisseaton

This comment has been minimized.

Copy link
Contributor

commented Mar 5, 2015

This is due to bad code in BodyTranslator#all7Bit which tries to parse the escapes in the regex and gets it wrong. We're probably doing this all wrong - not sure how to approach fixing it at the moment.

(sorry closed by accident)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.