class YARP::ParseResult

This represents the result of a call to ::parse or ::parse_file. It contains the AST, any comments that were encounters, and any errors that were encountered.

Attributes

comments[R]
errors[R]
source[R]
value[R]
warnings[R]

Public Class Methods

new(value, comments, errors, warnings, source) click to toggle source
# File yarp.rb, line 232
def initialize(value, comments, errors, warnings, source)
  @value = value
  @comments = comments
  @errors = errors
  @warnings = warnings
  @source = source
end

Public Instance Methods

attach_comments!() click to toggle source

Attach the list of comments to their respective locations in the tree.

# File yarp/parse_result/comments.rb, line 168
def attach_comments!
  Comments.new(self).attach!
end
deconstruct_keys(keys) click to toggle source
# File yarp.rb, line 240
def deconstruct_keys(keys)
  { value: value, comments: comments, errors: errors, warnings: warnings }
end
failure?() click to toggle source
# File yarp.rb, line 248
def failure?
  !success?
end
mark_newlines!() click to toggle source

Walk the tree and mark nodes that are on a new line.

# File yarp/parse_result/newlines.rb, line 56
def mark_newlines!
  value.accept(Newlines.new(Array.new(1 + source.offsets.size, false)))
end
success?() click to toggle source
# File yarp.rb, line 244
def success?
  errors.empty?
end