403Webshell
Server IP : 66.29.153.156  /  Your IP : 216.73.216.226
Web Server : LiteSpeed
System : Linux premium322.web-hosting.com 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User : lastyfjz ( 1521)
PHP Version : 8.1.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/thread-self/root/proc/self/root/opt/alt/ruby40/share/ruby/prism/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/thread-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