class 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
(ProgramNode value, Array[MagicComment] magic_comments, Location? data_loc, Array[ParseError] errors, Array[ParseWarning] warnings, bool continuable, Source source) → void
Source
# File lib/prism/parse_result.rb, line 1012 def initialize(value, magic_comments, data_loc, errors, warnings, continuable, source) @value = value super(magic_comments, data_loc, errors, warnings, continuable, source) end
Create a new parse result object with the given values.
Calls superclass method
Prism::Result::new
Public Instance Methods
() → String
Source
# File lib/prism/parse_result.rb, line 1036 def errors_format Errors.new(self).format end
Returns a string representation of the syntax tree with the errors displayed inline.
() → void
Source
# File lib/prism/parse_result.rb, line 1028 def mark_newlines! value.accept(Newlines.new(source.offsets.size)) # steep:ignore end
Walk the tree and mark nodes that are on a new line, loosely emulating the behavior of CRuby’s :line tracepoint event.