[ruby-core:118676] [Ruby master Bug#20649] Ripper fails to tokenize `def f; (x)::A =`
From:
"tompng (tomoya ishida) via ruby-core" <ruby-core@...>
Date:
2024-07-24 07:06:31 UTC
List:
ruby-core #118676
Issue #20649 has been reported by tompng (tomoya ishida).
----------------------------------------
Bug #20649: Ripper fails to tokenize `def f; (x)::A =`
https://bugs.ruby-lang.org/issues/20649
* Author: tompng (tomoya ishida)
* Status: Open
* ruby -v: ruby 3.4.0dev (2024-07-24T05:44:32Z master e642ddf7ae) [x86_64-linux]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
Ripper fails to tokenize some dynamic constant assignment syntax error code.
`''::A=` `(x)::A=` `(x).y::Z=` `[]::A=` `{}::A=` ``` ``::A=``` `//::A=` `%()::A=` in method body seems to fail.
Same for `for ''::A in` and `rescue => ''::A;` in method body.
~~~ruby
Ripper.tokenize 'def f; (x)::A ='
#=>
/opt/ruby/lib/ruby/3.4.0+0/ripper/lexer.rb:245:in 'Ripper::Lexer#on_error2': undefined method 'pos' for nil (NoMethodError)
@errors.push Elem.new(elem.pos, __callee__, elem.tok, elem.state, mesg)
^^^^
from /opt/ruby/lib/ruby/3.4.0+0/ripper/lexer.rb:176:in 'Ripper#parse'
from /opt/ruby/lib/ruby/3.4.0+0/ripper/lexer.rb:176:in 'Ripper::Lexer#parse'
from /opt/ruby/lib/ruby/3.4.0+0/ripper/lexer.rb:150:in 'Ripper::Lexer#tokenize'
from /opt/ruby/lib/ruby/3.4.0+0/ripper/lexer.rb:26:in 'Ripper.tokenize'
from -e:1:in '<main>'
~~~
--
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/lists/ruby-core.ml.ruby-lang.org/