Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/exe_root.../opt/alt/ruby30/share/ruby
File: ripper.rb
# frozen_string_literal: true
[0] Fix | Delete
require 'ripper/core'
[1] Fix | Delete
require 'ripper/lexer'
[2] Fix | Delete
require 'ripper/filter'
[3] Fix | Delete
require 'ripper/sexp'
[4] Fix | Delete
[5] Fix | Delete
# Ripper is a Ruby script parser.
[6] Fix | Delete
#
[7] Fix | Delete
# You can get information from the parser with event-based style.
[8] Fix | Delete
# Information such as abstract syntax trees or simple lexical analysis of the
[9] Fix | Delete
# Ruby program.
[10] Fix | Delete
#
[11] Fix | Delete
# == Usage
[12] Fix | Delete
#
[13] Fix | Delete
# Ripper provides an easy interface for parsing your program into a symbolic
[14] Fix | Delete
# expression tree (or S-expression).
[15] Fix | Delete
#
[16] Fix | Delete
# Understanding the output of the parser may come as a challenge, it's
[17] Fix | Delete
# recommended you use PP to format the output for legibility.
[18] Fix | Delete
#
[19] Fix | Delete
# require 'ripper'
[20] Fix | Delete
# require 'pp'
[21] Fix | Delete
#
[22] Fix | Delete
# pp Ripper.sexp('def hello(world) "Hello, #{world}!"; end')
[23] Fix | Delete
# #=> [:program,
[24] Fix | Delete
# [[:def,
[25] Fix | Delete
# [:@ident, "hello", [1, 4]],
[26] Fix | Delete
# [:paren,
[27] Fix | Delete
# [:params, [[:@ident, "world", [1, 10]]], nil, nil, nil, nil, nil, nil]],
[28] Fix | Delete
# [:bodystmt,
[29] Fix | Delete
# [[:string_literal,
[30] Fix | Delete
# [:string_content,
[31] Fix | Delete
# [:@tstring_content, "Hello, ", [1, 18]],
[32] Fix | Delete
# [:string_embexpr, [[:var_ref, [:@ident, "world", [1, 27]]]]],
[33] Fix | Delete
# [:@tstring_content, "!", [1, 33]]]]],
[34] Fix | Delete
# nil,
[35] Fix | Delete
# nil,
[36] Fix | Delete
# nil]]]]
[37] Fix | Delete
#
[38] Fix | Delete
# You can see in the example above, the expression starts with +:program+.
[39] Fix | Delete
#
[40] Fix | Delete
# From here, a method definition at +:def+, followed by the method's identifier
[41] Fix | Delete
# <code>:@ident</code>. After the method's identifier comes the parentheses
[42] Fix | Delete
# +:paren+ and the method parameters under +:params+.
[43] Fix | Delete
#
[44] Fix | Delete
# Next is the method body, starting at +:bodystmt+ (+stmt+ meaning statement),
[45] Fix | Delete
# which contains the full definition of the method.
[46] Fix | Delete
#
[47] Fix | Delete
# In our case, we're simply returning a String, so next we have the
[48] Fix | Delete
# +:string_literal+ expression.
[49] Fix | Delete
#
[50] Fix | Delete
# Within our +:string_literal+ you'll notice two <code>@tstring_content</code>,
[51] Fix | Delete
# this is the literal part for <code>Hello, </code> and <code>!</code>. Between
[52] Fix | Delete
# the two <code>@tstring_content</code> statements is a +:string_embexpr+,
[53] Fix | Delete
# where _embexpr_ is an embedded expression. Our expression consists of a local
[54] Fix | Delete
# variable, or +var_ref+, with the identifier (<code>@ident</code>) of +world+.
[55] Fix | Delete
#
[56] Fix | Delete
# == Resources
[57] Fix | Delete
#
[58] Fix | Delete
# * {Ruby Inside}[http://www.rubyinside.com/using-ripper-to-see-how-ruby-is-parsing-your-code-5270.html]
[59] Fix | Delete
#
[60] Fix | Delete
# == Requirements
[61] Fix | Delete
#
[62] Fix | Delete
# * ruby 1.9 (support CVS HEAD only)
[63] Fix | Delete
# * bison 1.28 or later (Other yaccs do not work)
[64] Fix | Delete
#
[65] Fix | Delete
# == License
[66] Fix | Delete
#
[67] Fix | Delete
# Ruby License.
[68] Fix | Delete
#
[69] Fix | Delete
# - Minero Aoki
[70] Fix | Delete
# - aamine@loveruby.net
[71] Fix | Delete
# - http://i.loveruby.net
[72] Fix | Delete
class Ripper; end
[73] Fix | Delete
[74] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function