Class: RDoc::RipperStateLex::InnerStateLex (Ruby 2.5.7)
Description: Class : RDoc::RipperStateLex::InnerStateLex - Ruby 2.5.7

### Home Classes Methods

### In Files

- rdoc/parser/ripper_state_lex.rb

### Parent

Ripper::Filter

### Methods

- ::new
- #each
- #on_CHAR
- #on_backref
- #on_comma
- #on_comment
- #on_const
- #on_cvar
- #on_default
- #on_float
- #on_gvar
- #on_heredoc_end
- #on_ident
- #on_ignored_nl
- #on_ignored_sp
- #on_imaginary
- #on_int
- #on_ivar
- #on_kw
- #on_lbrace
- #on_lbracket
- #on_lparen
- #on_nl
- #on_op
- #on_period
- #on_rational
- #on_rbrace
- #on_rbracket
- #on_rparen
- #on_sp
- #on_symbeg
- #on_tstring_beg
- #on_tstring_end
- #reset

### Class/Module Index

Quicksearch

- RDoc
- RDoc::Alias
- RDoc::AnonClass
- RDoc::AnyMethod
- RDoc::Attr
- RDoc::ClassModule
- RDoc::CodeObject
- RDoc::Comment
- RDoc::Constant
- RDoc::Context
- RDoc::Context::Section
- RDoc::CrossReference
- RDoc::ERBIO
- RDoc::ERBPartial
- RDoc::Encoding
- RDoc::Error
- RDoc::Extend
- RDoc::Generator
- RDoc::Generator::Darkfish
- RDoc::Generator::JsonIndex
- RDoc::Generator::Markup
- RDoc::Generator::POT
- RDoc::Generator::POT::MessageExtractor
- RDoc::Generator::POT::PO
- RDoc::Generator::POT::POEntry
- RDoc::Generator::RI
- RDoc::GhostMethod
- RDoc::I18n
- RDoc::I18n::Locale
- RDoc::I18n::Text
- RDoc::Include
- RDoc::Markdown
- RDoc::Markdown::Literals
- RDoc::Markup
- RDoc::Markup::AttrChanger
- RDoc::Markup::AttrSpan
- RDoc::Markup::AttributeManager
- RDoc::Markup::Attributes
- RDoc::Markup::BlankLine
- RDoc::Markup::BlockQuote
- RDoc::Markup::Document
- RDoc::Markup::Formatter
- RDoc::Markup::FormatterTestCase
- RDoc::Markup::HardBreak
- RDoc::Markup::Include
- RDoc::Markup::IndentedParagraph
- RDoc::Markup::List
- RDoc::Markup::ListItem
- RDoc::Markup::Paragraph
- RDoc::Markup::Parser
- RDoc::Markup::Parser::Error
- RDoc::Markup::Parser::ParseError
- RDoc::Markup::PreProcess
- RDoc::Markup::Raw
- RDoc::Markup::Rule
- RDoc::Markup::Special
- RDoc::Markup::TextFormatterTestCase
- RDoc::Markup::ToAnsi
- RDoc::Markup::ToBs
- RDoc::Markup::ToHtml
- RDoc::Markup::ToHtmlCrossref
- RDoc::Markup::ToHtmlSnippet
- RDoc::Markup::ToJoinedParagraph
- RDoc::Markup::ToLabel
- RDoc::Markup::ToMarkdown
- RDoc::Markup::ToRdoc
- RDoc::Markup::ToTableOfContents
- RDoc::Markup::ToTest
- RDoc::Markup::ToTtOnly
- RDoc::Markup::Verbatim
- RDoc::MetaMethod
- RDoc::MethodAttr
- RDoc::Mixin
- RDoc::NormalClass
- RDoc::NormalModule
- RDoc::Options
- RDoc::Parser
- RDoc::Parser::C
- RDoc::Parser::ChangeLog
- RDoc::Parser::Markdown
- RDoc::Parser::RD
- RDoc::Parser::Ruby
- RDoc::Parser::RubyTools
- RDoc::Parser::Simple
- RDoc::Parser::Text
- RDoc::RD
- RDoc::RD::BlockParser
- RDoc::RD::Inline
- RDoc::RD::InlineParser
- RDoc::RDoc
- RDoc::RI
- RDoc::RI::Driver
- RDoc::RI::Driver::Error
- RDoc::RI::Driver::NotFoundError
- RDoc::RI::Error
- RDoc::RI::Paths
- RDoc::RI::Task
- RDoc::Require
- RDoc::RipperStateLex
- RDoc::RipperStateLex::InnerStateLex
- RDoc::RubygemsHook
- RDoc::Servlet
- RDoc::SingleClass
- RDoc::Stats
- RDoc::Stats::Normal
- RDoc::Stats::Quiet
- RDoc::Stats::Verbose
- RDoc::Store
- RDoc::Store::Error
- RDoc::Store::MissingFileError
- RDoc::Task
- RDoc::TestCase
- RDoc::Text
- RDoc::TokenStream
- RDoc::TomDoc
- RDoc::TopLevel
- RDocTask

No matching classes.

# RDoc::RipperStateLex::InnerStateLex

### Attributes

lex_state[RW]

### Public Class Methods

new(code) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 29
    def initialize(code)
      @lex_state = EXPR_BEG
      @in_fname = false
      @continue = false
      reset
      super(code)
    end

### Public Instance Methods

each(&block) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 285
    def each(&block)
      @callback = block
      parse
    end

on_CHAR(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 134
    def on_CHAR(tok, data)
      @lex_state = EXPR_END
      @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state})
    end

on_backref(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 209
    def on_backref(tok, data)
      @lex_state = EXPR_END
      on_variables(__method__, tok, data)
    end

on_comma(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 260
    def on_comma(tok, data)
      @lex_state = EXPR_BEG | EXPR_LABEL if (EXPR_ARG_ANY & @lex_state) != 0
      @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state})
    end

on_comment(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 265
    def on_comment(tok, data)
      @lex_state = EXPR_BEG unless (EXPR_LABEL & @lex_state) != 0
      @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state})
    end

on_const(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 244
    def on_const(tok, data)
      case @lex_state
      when EXPR_FNAME
        @lex_state = EXPR_ENDFN
      when EXPR_CLASS
        @lex_state = EXPR_ARG
      else
        @lex_state = EXPR_CMDARG
      end
      @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state})
    end

on_cvar(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 199
    def on_cvar(tok, data)
      @lex_state = EXPR_END
      on_variables(__method__, tok, data)
    end

on_default(event, tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 280
    def on_default(event, tok, data)
      reset
      @callback.call({ :line_no => lineno, :char_no => column, :kind => event, :text => tok, :state => @lex_state})
    end

on_float(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 149
    def on_float(tok, data)
      @lex_state = EXPR_END | EXPR_ENDARG
      @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state})
    end

on_gvar(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 204
    def on_gvar(tok, data)
      @lex_state = EXPR_END
      on_variables(__method__, tok, data)
    end

on_heredoc_end(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 275
    def on_heredoc_end(tok, data)
      @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state})
      @lex_state = EXPR_BEG
    end

on_ident(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 190
    def on_ident(tok, data)
      on_variables(__method__, tok, data)
    end

on_ignored_nl(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 53
    def on_ignored_nl(tok, data)
      case @lex_state
      when EXPR_FNAME, EXPR_DOT
        @continue = true
      else
        @continue = false
        @lex_state = EXPR_BEG unless (EXPR_LABEL & @lex_state) != 0
      end
      @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state})
    end

on_ignored_sp(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 270
    def on_ignored_sp(tok, data)
      @lex_state = EXPR_BEG unless (EXPR_LABEL & @lex_state) != 0
      @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state})
    end

on_imaginary(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 159
    def on_imaginary(tok, data)
      @lex_state = EXPR_END | EXPR_ENDARG
      @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state})
    end

on_int(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 144
    def on_int(tok, data)
      @lex_state = EXPR_END | EXPR_ENDARG
      @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state})
    end

on_ivar(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 194
    def on_ivar(tok, data)
      @lex_state = EXPR_END
      on_variables(__method__, tok, data)
    end

on_kw(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 97
    def on_kw(tok, data)
      case tok
      when 'class'
        @lex_state = EXPR_CLASS
        @in_fname = true
      when 'def'
        @lex_state = EXPR_FNAME
        @continue = true
        @in_fname = true
      when 'if', 'unless', 'while', 'until'
        if ((EXPR_END | EXPR_ENDARG | EXPR_ENDFN | EXPR_ARG | EXPR_CMDARG) & @lex_state) != 0 # postfix if
          @lex_state = EXPR_BEG | EXPR_LABEL
        else
          @lex_state = EXPR_BEG
        end
      when 'begin'
        @lex_state = EXPR_BEG
      else
        if @lex_state == EXPR_FNAME
          @lex_state = EXPR_END
        else
          @lex_state = EXPR_END
        end
      end
      @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state})
    end

on_lbrace(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 224
    def on_lbrace(tok, data)
      @lex_state = EXPR_LABEL | EXPR_BEG
      @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state})
    end

on_lbracket(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 234
    def on_lbracket(tok, data)
      @lex_state = EXPR_LABEL | EXPR_BEG
      @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state})
    end

on_lparen(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 214
    def on_lparen(tok, data)
      @lex_state = EXPR_LABEL | EXPR_BEG
      @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state})
    end

on_nl(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 42
    def on_nl(tok, data)
      case @lex_state
      when EXPR_FNAME, EXPR_DOT
        @continue = true
      else
        @continue = false
        @lex_state = EXPR_BEG unless (EXPR_LABEL & @lex_state) != 0
      end
      @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state})
    end

on_op(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 64
    def on_op(tok, data)
      case tok
      when '&', '|', '!', '!=', '!~'
        case @lex_state
        when EXPR_FNAME, EXPR_DOT
          @lex_state = EXPR_ARG
        else
          @lex_state = EXPR_BEG
        end
      when '<<'
        # TODO next token?
        case @lex_state
        when EXPR_FNAME, EXPR_DOT
          @lex_state = EXPR_ARG
        else
          @lex_state = EXPR_BEG
        end
      when '?'
        @lex_state = EXPR_BEG
      when '&&', '||', '+=', '-=', '*=', '**=',
           '&=', '|=', '^=', '<<=', '>>=', '||=', '&&='
        @lex_state = EXPR_BEG
      else
        case @lex_state
        when EXPR_FNAME, EXPR_DOT
          @lex_state = EXPR_ARG
        else
          @lex_state = EXPR_BEG
        end
      end
      @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state})
    end

on_period(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 139
    def on_period(tok, data)
      @lex_state = EXPR_DOT
      @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state})
    end

on_rational(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 154
    def on_rational(tok, data)
      @lex_state = EXPR_END | EXPR_ENDARG
      @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state})
    end

on_rbrace(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 229
    def on_rbrace(tok, data)
      @lex_state = EXPR_ENDARG
      @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state})
    end

on_rbracket(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 239
    def on_rbracket(tok, data)
      @lex_state = EXPR_ENDARG
      @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state})
    end

on_rparen(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 219
    def on_rparen(tok, data)
      @lex_state = EXPR_ENDFN
      @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state})
    end

on_sp(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 256
    def on_sp(tok, data)
      @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state})
    end

on_symbeg(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 164
    def on_symbeg(tok, data)
      @lex_state = EXPR_FNAME
      @continue = true
      @in_fname = true
      @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state})
    end

on_tstring_beg(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 124
    def on_tstring_beg(tok, data)
      @lex_state = EXPR_BEG
      @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state})
    end

on_tstring_end(tok, data) click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 129
    def on_tstring_end(tok, data)
      @lex_state = EXPR_END | EXPR_ENDARG
      @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state})
    end

reset() click to toggle source

                   # File rdoc/parser/ripper_state_lex.rb, line 37
    def reset
      @command_start = false
      @cmd_state = @command_start
    end