class Object
Constants
- Ripper
This class provides a compatibility layer between prism and
Ripper. It functions by parsing the entire tree first and then walking it and executing each of theRippercallbacks as it goes. To use this class, you treat `Prism::Translation::Ripper` effectively as you would treat the `Ripper` class.Note that this class will serve the most common use cases, but Ripper's API is extensive and undocumented. It relies on reporting the state of the parser at any given time. We do our best to replicate that here, but because it is a different architecture it is not possible to perfectly replicate the behavior of
Ripper.The main known difference is that we may omit dispatching some events in some cases. This impacts the following events:
-
on_assign_error
-
on_comma
-
on_ignored_nl
-
on_ignored_sp
-
on_kw
-
on_label_end
-
on_lbrace
-
on_lbracket
-
on_lparen
-
on_nl
-
on_op
-
on_operator_ambiguous
-
on_rbrace
-
on_rbracket
-
on_rparen
-
on_semicolon
-
on_sp
-
on_symbeg
-
on_tstring_beg
-
on_tstring_end
-
Public Instance Methods
# File ext/prism/extconf.rb, line 116 def add_libprism_source(path) $VPATH << path src_list path end
If this gem is being build from a git source, then we need to run templating if it hasn't been run yet. In normal packaging, we would have shipped the templated files with the gem, so this wouldn't be necessary.
# File ext/prism/extconf.rb, line 37 def generate_templates Dir.chdir(File.expand_path("../..", __dir__)) do if !File.exist?("include/prism/ast.h") && Dir.exist?(".git") system(RbConfig.ruby, "templates/template.rb", exception: true) end end end
Runs `make` in the root directory of the project. Note that this is the `Makefile` for the overall project, not the `Makefile` that is being generated by this script.`
# File ext/prism/extconf.rb, line 48 def make(env, target) puts "Running make #{target} with #{env.inspect}" Dir.chdir(File.expand_path("../..", __dir__)) do system( env, RUBY_PLATFORM.match?(/openbsd|freebsd/) ? "gmake" : "make", target, exception: true ) end end
# File ext/prism/extconf.rb, line 110 def src_list(path) srcdir = path.dup RbConfig.expand(srcdir) # mutates srcdir :-/ Dir[File.join(srcdir, "*.{#{SRC_EXT.join(%q{,})}}")] end