Class: Prism::Translation::RubyParser
- Inherits:
-
Object
- Object
- Prism::Translation::RubyParser
- Defined in:
- lib/prism/translation/ruby_parser.rb
Overview
This module is the entry-point for converting a prism syntax tree into the seattlerb/ruby_parser gem’s syntax tree.
Class Method Summary collapse
-
.parse(source, filepath = "(string)") ⇒ Object
Parse the given source and translate it into the seattlerb/ruby_parser gem’s Sexp format.
-
.parse_file(filepath) ⇒ Object
Parse the given file and translate it into the seattlerb/ruby_parser gem’s Sexp format.
Instance Method Summary collapse
-
#parse(source, filepath = "(string)") ⇒ Object
Parse the given source and translate it into the seattlerb/ruby_parser gem’s Sexp format.
-
#parse_file(filepath) ⇒ Object
Parse the given file and translate it into the seattlerb/ruby_parser gem’s Sexp format.
Class Method Details
.parse(source, filepath = "(string)") ⇒ Object
Parse the given source and translate it into the seattlerb/ruby_parser gem’s Sexp format.
1621 1622 1623 |
# File 'lib/prism/translation/ruby_parser.rb', line 1621 def parse(source, filepath = "(string)") new.parse(source, filepath) end |
.parse_file(filepath) ⇒ Object
Parse the given file and translate it into the seattlerb/ruby_parser gem’s Sexp format.
1627 1628 1629 |
# File 'lib/prism/translation/ruby_parser.rb', line 1627 def parse_file(filepath) new.parse_file(filepath) end |
Instance Method Details
#parse(source, filepath = "(string)") ⇒ Object
Parse the given source and translate it into the seattlerb/ruby_parser gem’s Sexp format.
1608 1609 1610 |
# File 'lib/prism/translation/ruby_parser.rb', line 1608 def parse(source, filepath = "(string)") translate(Prism.parse(source, filepath: filepath, partial_script: true), filepath) end |
#parse_file(filepath) ⇒ Object
Parse the given file and translate it into the seattlerb/ruby_parser gem’s Sexp format.
1614 1615 1616 |
# File 'lib/prism/translation/ruby_parser.rb', line 1614 def parse_file(filepath) translate(Prism.parse_file(filepath, partial_script: true), filepath) end |