class Ruby::Prism::ParseResult
This is a result specific to the parse and parse_file methods.
Attributes
The syntax tree that was parsed from the source code.
Public Class Methods
Create a new parse result object with the given values.
: (ProgramNode value, Array comments, Array magic_comments, Location? data_loc, Array errors, Array warnings, bool continuable, Source source) -> void
Calls superclass method
Ruby::Prism::Result::new
# File lib/ruby/prism/parse_result.rb, line 1018 def initialize(value, comments, magic_comments, data_loc, errors, warnings, continuable, source) @value = value super(comments, magic_comments, data_loc, errors, warnings, continuable, source) end
Public Instance Methods
Attach the list of comments to their respective locations in the tree.
: () -> void
# File lib/ruby/prism/parse_result.rb, line 1033 def attach_comments! Comments.new(self).attach! # steep:ignore end
Returns a string representation of the syntax tree with the errors displayed inline.
: () -> String
# File lib/ruby/prism/parse_result.rb, line 1049 def errors_format Errors.new(self).format end
Walk the tree and mark nodes that are on a new line, loosely emulating the behavior of CRuby’s :line tracepoint event.
: () -> void
# File lib/ruby/prism/parse_result.rb, line 1041 def mark_newlines! value.accept(Newlines.new(source.offsets.size)) # steep:ignore end