Project

General

Profile

Feature #14170

Add allbits?, anybits and nobits? to Ripper::Lexer::State

Added by aycabta (aycabta .) about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:84211]

Description

nobu (Nobuyoshi Nakada) added Ripper::Lexer::State at @60665
https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/60665/diff/ext/ripper/lib/ripper/lexer.rb
and I think it's necessary for RDoc, I commented it at ruby-core:84111.
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/84111

aycabta (aycabta .) wrote:

In Ruby 2.5, Ripper::Lexer::State is introduced:
https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/60945/entry/ext/ripper/lib/ripper/lexer.rb#L49

It is for lex_state of parse.y, and has #& and #| for bit operations with lex_state_bits:
https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/60945/entry/parse.y#L78

RDoc uses it:
https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/60945/entry/lib/rdoc/parser/ripper_state_lex.rb#L321

If Integer#allbit? is implemented at 2.5, it's good for Ripper::Lexer::State and I'll use it for RDoc on 2.5.

I add allbits?, anybits and nobits? to Ripper::Lexer::State by the attached patch.


Files

ripper_lexer_state_bits.patch (579 Bytes) ripper_lexer_state_bits.patch aycabta (aycabta .), 12/12/2017 12:19 PM

Associated revisions

Revision 32a4b080
Added by nobu (Nobuyoshi Nakada) about 1 year ago

Ripper::Lexer bit predicates

  • ext/ripper/lib/ripper/lexer.rb (Ripper::Lexer): added allbits?, anybits? and nobits? methods, as well as Integer. a patch by aycabta. [Feature #14170]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 61205
Added by nobu (Nobuyoshi Nakada) about 1 year ago

Ripper::Lexer bit predicates

  • ext/ripper/lib/ripper/lexer.rb (Ripper::Lexer): added allbits?, anybits? and nobits? methods, as well as Integer. a patch by aycabta. [Feature #14170]

Revision 61205
Added by nobu (Nobuyoshi Nakada) about 1 year ago

Ripper::Lexer bit predicates

  • ext/ripper/lib/ripper/lexer.rb (Ripper::Lexer): added allbits?, anybits? and nobits? methods, as well as Integer. a patch by aycabta. [Feature #14170]

Revision 61205
Added by nobu (Nobuyoshi Nakada) about 1 year ago

Ripper::Lexer bit predicates

  • ext/ripper/lib/ripper/lexer.rb (Ripper::Lexer): added allbits?, anybits? and nobits? methods, as well as Integer. a patch by aycabta. [Feature #14170]

History

Updated by aycabta (aycabta .) about 1 year ago

If this request is added, I'll add supporting it at upstream:
https://github.com/ruby/rdoc
The corresponding file:
https://github.com/ruby/rdoc/blob/b477af836237a7e2750238b01a3c05d842c28227/lib/rdoc/parser/ripper_state_lex.rb
The RDoc::RipperStateLex is easy to understand use-case for this issue.

#2

Updated by nobu (Nobuyoshi Nakada) about 1 year ago

  • Status changed from Open to Closed

Applied in changeset trunk|r61205.


Ripper::Lexer bit predicates

  • ext/ripper/lib/ripper/lexer.rb (Ripper::Lexer): added allbits?, anybits? and nobits? methods, as well as Integer. a patch by aycabta. [Feature #14170]

Also available in: Atom PDF