rouge-ruby/rouge · error

Improper use of Lexer#lex - this method does not receive opt

Error message

Improper use of Lexer#lex - this method does not receive options. This will become an error in a future version.

What it means

Error "Improper use of Lexer#lex - this method does not receive options. This will become an error in a future version." thrown in rouge-ruby/rouge.

Source

Thrown at lib/rouge/lexer.rb:518

    def reset!
    end

    # Given a string, yield [token, chunk] pairs.  If no block is given,
    # an enumerator is returned.
    #
    # @option opts :continue
    #   Continue the lex from the previous state (i.e. don't call #reset!)
    #
    # @note The use of :continue => true has been deprecated. A warning is
    #       issued if run with `$VERBOSE` set to true.
    #
    # @note The use of arbitrary `opts` has never been supported, but we
    #       previously ignored them with no error. We now warn unconditionally.
    def lex(string, opts=nil, &b)
      if opts
        if (opts.keys - [:continue]).size > 0
          # improper use of options hash
          warn('Improper use of Lexer#lex - this method does not receive options.' +
               ' This will become an error in a future version.')
        end

        if opts[:continue]
          warn '`lex :continue => true` is deprecated, please use #continue_lex instead'
          return continue_lex(string, &b)
        end
      end

      return enum_for(:lex, string) unless block_given?

      Lexer.assert_utf8!(string)
      reset!

      continue_lex(string, &b)
    end

    # Continue the lex from the the current state without resetting

View on GitHub (pinned to bd7dad7b09)

When it happens

Trigger: Thrown at lib/rouge/lexer.rb:518 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of rouge-ruby/rouge@bd7dad7b09 (2026-08-23). Data as JSON: /api/errors/38d3cb2f850d976d. Report an issue: GitHub.