class Prism::ParseResult

This is a result specific to the ‘parse` and `parse_file` methods.



The syntax tree that was parsed from the source code.

Public Class Methods

new(value, comments, magic_comments, data_loc, errors, warnings, source) click to toggle source

Create a new parse result object with the given values.

Calls superclass method Prism::Result::new
# File prism/parse_result.rb, line 587
def initialize(value, comments, magic_comments, data_loc, errors, warnings, source)
  @value = value
  super(comments, magic_comments, data_loc, errors, warnings, source)

Public Instance Methods

attach_comments!() click to toggle source

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

# File prism/parse_result.rb, line 598
def attach_comments!! # steep:ignore
deconstruct_keys(keys) click to toggle source

Implement the hash pattern matching interface for ParseResult.

Calls superclass method Prism::Result#deconstruct_keys
# File prism/parse_result.rb, line 593
def deconstruct_keys(keys)
  super.merge!(value: value)
mark_newlines!() click to toggle source

Walk the tree and mark nodes that are on a new line, loosely emulating the behavior of CRuby’s ‘:line` tracepoint event.

# File prism/parse_result.rb, line 604
def mark_newlines!
  value.accept( # steep:ignore