403Webshell
Server IP : 51.79.230.26  /  Your IP : 216.73.217.43
Web Server : LiteSpeed
System : Linux sg2.exonhost.com 5.14.0-611.55.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 19 15:19:29 EDT 2026 x86_64
User : mukutpub ( 1151)
PHP Version : 8.2.33
Disable Function : eval, show_source, system, shell_exec, passthru, exec, popen, proc_open, allow_url_fopen, symlink, mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/proc/self/root/opt/alt/ruby40/share/ruby/prism/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/proc/self/root/opt/alt/ruby40/share/ruby/prism/lex_ripper.rb
# frozen_string_literal: true
# :markup: markdown

require "ripper"

module Prism
  # This is a class that wraps the Ripper lexer to produce almost exactly the
  # same tokens.
  class LexRipper # :nodoc:
    attr_reader :source

    def initialize(source)
      @source = source
    end

    def result
      previous = [] #: [[Integer, Integer], Symbol, String, untyped] | []
      results = [] #: Array[[[Integer, Integer], Symbol, String, untyped]]

      lex(source).each do |token|
        case token[1]
        when :on_sp
          # skip
        when :on_tstring_content
          if previous[1] == :on_tstring_content && (token[2].start_with?("\#$") || token[2].start_with?("\#@"))
            previous[2] << token[2]
          else
            results << token
            previous = token
          end
        when :on_words_sep
          if previous[1] == :on_words_sep
            previous[2] << token[2]
          else
            results << token
            previous = token
          end
        else
          results << token
          previous = token
        end
      end

      results
    end

    private

    if Ripper.method(:lex).parameters.assoc(:keyrest)
      def lex(source)
        Ripper.lex(source, raise_errors: true)
      end
    else
      def lex(source)
        ripper = Ripper::Lexer.new(source)
        ripper.lex.tap do |result|
          raise SyntaxError, ripper.errors.map(&:message).join(' ;') if ripper.errors.any?
        end
      end
    end
  end

  private_constant :LexRipper
end

Youez - 2016 - github.com/yon3zu
LinuXploit