[ruby-core:114601] [Ruby master Bug#18988] Ripper cannot parse some code that has regexp named capture

Issue #18988 has been updated by jeremyevans0 (Jeremy Evans). It appears that YARP parses all of these correctly: ```ruby YARP.parse("/(?<a>)/ =~ ''; x = a **a, a if false").success? => true YARP.parse("/(?<a>)/ =~ ''; x = a **a, **a if false").success? => false YARP.parse("/(?<a>)/ =~ ''; a %(exit)") # includes: ([CallNode(20...24)(nil, nil, (20...24), nil, nil, nil, nil, 2, "exit")]) ``` ---------------------------------------- Bug #18988: Ripper cannot parse some code that has regexp named capture https://bugs.ruby-lang.org/issues/18988#change-104422 * Author: tompng (tomoya ishida) * Status: Open * Priority: Normal * ruby -v: ruby 3.2.0dev (2022-08-29T15:47:09Z :detached: cd7506593a) [x86_64-linux] * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- Ripper does not seems to recognize regexp named capture defining new local variables, fails to parse some code. ~~~ruby requie 'ripper' # expect syntax ok, got syntax error Ripper.sexp("/(?<a>)/ =~ ''; x = a **a, a if false") # expect syntax error, got syntax ok Ripper.sexp("/(?<a>)/ =~ ''; x = a **a, **a if false") # "exit" is a method call, got string_literal Ripper.sexp("/(?<a>)/ =~ ''; a %(exit)") ~~~ -- https://bugs.ruby-lang.org/
participants (1)
-
jeremyevans0 (Jeremy Evans)