class RDoc::Parser::RipperStateLex - Documentation for Ruby 3.4
Description: class RDoc::Parser::RipperStateLex: Wrapper for Ripper lex states
Keywords: ruby,class,RDoc::Parser::RipperStateLex

# class RDoc::Parser::RipperStateLex

Wrapper for `Ripper` lex states

### Public Class Methods

end? (token)
Source

    # File lib/rdoc/parser/ripper_state_lex.rb, line 299
    def self.end?(token)
      (token[:state] & EXPR_END)
    end

Returns `true` if lex state will be `END` after `token`.

new (code)
Source

    # File lib/rdoc/parser/ripper_state_lex.rb, line 278
    def initialize(code)
      @buf = []
      @heredoc_queue = []
      @inner_lex = InnerStateLex.new(code)
      @tokens = @inner_lex.parse([])
    end

New lexer for `code`.

parse (code)
Source

    # File lib/rdoc/parser/ripper_state_lex.rb, line 286
    def self.parse(code)
      lex = self.new(code)
      tokens = []
      begin
        while tk = lex.get_squashed_tk
          tokens.push tk
        end
      rescue StopIteration
      end
      tokens
    end

Returns tokens parsed from `code`.