Skip to content

Prism compiler fails with lonely operator in complex call sequence #8832

@headius

Description

@headius

When running with the Prism parser and our compiler for it, a complex sequence of lonely-operator calls appears to be handled improperly.

def foo
  re = /\G((?-mix:(?-mix:(?-mix:[[\x01-\x7f]&&[^[\r\n]]])|(?-mix:[\xC2-\xDF](?-mix:[\x80-\xBF]))|(?-mix:(?-mix:\xE0[\xA0-\xBF](?-mix:[\x80-\xBF]))|(?-mix:\xED[\x80-\x9F](?-mix:[\x80-\xBF]))|(?-mix:[\xE1-\xEC][\x80-\xBF][\x80-\xBF])|(?-mix:[\xEE-\xEF][\x80-\xBF][\x80-\xBF]))|(?-mix:(?-mix:[\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF])|(?-mix:\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF])|(?-mix:\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF])))+))/n
  str = "A004 OK [copyUID 9999 20:19,500:495 92:97,101:100] Done\r\n"
  pos = 51
  re.match(str, pos)
end

def bar
  foo&.[](0)&.force_encoding("UTF-8")
end

p bar

This should print "Done" but when running on the Prism parser it does not:

[] jruby $ jruby blah2.rb                                    
"Done"
[] jruby $ JRUBY_OPTS="-Xparser.prism" jruby blah2.rb        
nil

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions