ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:109798] [Ruby master Bug#18988] # Ripper cannot parse some code that has regexp named capture
@ 2022-08-31 16:05 tompng (tomoya ishida)
  2023-08-31  3:21 ` [ruby-core:114601] [Ruby master Bug#18988] " jeremyevans0 (Jeremy Evans) via ruby-core
  2024-02-20 12:00 ` [ruby-core:116878] " yui-knk (Kaneko Yuichiro) via ruby-core
  0 siblings, 2 replies; 3+ messages in thread
From: tompng (tomoya ishida) @ 2022-08-31 16:05 UTC (permalink / raw)
  To: ruby-core

Issue #18988 has been reported by tompng (tomoya ishida).

----------------------------------------
Bug #18988: # Ripper cannot parse some code that has regexp named capture
https://bugs.ruby-lang.org/issues/18988

* 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/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:114601] [Ruby master Bug#18988] Ripper cannot parse some code that has regexp named capture
  2022-08-31 16:05 [ruby-core:109798] [Ruby master Bug#18988] # Ripper cannot parse some code that has regexp named capture tompng (tomoya ishida)
@ 2023-08-31  3:21 ` jeremyevans0 (Jeremy Evans) via ruby-core
  2024-02-20 12:00 ` [ruby-core:116878] " yui-knk (Kaneko Yuichiro) via ruby-core
  1 sibling, 0 replies; 3+ messages in thread
From: jeremyevans0 (Jeremy Evans) via ruby-core @ 2023-08-31  3:21 UTC (permalink / raw)
  To: ruby-core; +Cc: jeremyevans0 (Jeremy Evans)

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/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:116878] [Ruby master Bug#18988] Ripper cannot parse some code that has regexp named capture
  2022-08-31 16:05 [ruby-core:109798] [Ruby master Bug#18988] # Ripper cannot parse some code that has regexp named capture tompng (tomoya ishida)
  2023-08-31  3:21 ` [ruby-core:114601] [Ruby master Bug#18988] " jeremyevans0 (Jeremy Evans) via ruby-core
@ 2024-02-20 12:00 ` yui-knk (Kaneko Yuichiro) via ruby-core
  1 sibling, 0 replies; 3+ messages in thread
From: yui-knk (Kaneko Yuichiro) via ruby-core @ 2024-02-20 12:00 UTC (permalink / raw)
  To: ruby-core; +Cc: yui-knk (Kaneko Yuichiro)

Issue #18988 has been updated by yui-knk (Kaneko Yuichiro).

Status changed from Open to Closed

This is solved by https://bugs.ruby-lang.org/issues/20257 (https://github.com/ruby/ruby/pull/9923).

----------------------------------------
Bug #18988: Ripper cannot parse some code that has regexp named capture
https://bugs.ruby-lang.org/issues/18988#change-106913

* Author: tompng (tomoya ishida)
* Status: Closed
* 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/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-20 12:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-31 16:05 [ruby-core:109798] [Ruby master Bug#18988] # Ripper cannot parse some code that has regexp named capture tompng (tomoya ishida)
2023-08-31  3:21 ` [ruby-core:114601] [Ruby master Bug#18988] " jeremyevans0 (Jeremy Evans) via ruby-core
2024-02-20 12:00 ` [ruby-core:116878] " yui-knk (Kaneko Yuichiro) via ruby-core

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).