1. Prism::
  2. ProgramNode

class Prism::ProgramNode

The top level node of any parse tree.

Attributes

locals[R]

attr_reader locals:Array

statements[R]

attr_reader statements:StatementsNode

Public Class Methods

Source
# File lib/prism/node.rb, line 15081definitialize(source,node_id,location,flags,locals,statements)@source =source@node_id =node_id@location =location@flags =flags@locals =locals@statements =statementsend

Initialize a newProgramNode node.

Source
# File lib/prism/node.rb, line 15140defself.type:program_nodeend

Return a symbol representation of this node type. SeeNode::type.

Public Instance Methods

Source
# File lib/prism/node.rb, line 15146def===(other)other.is_a?(ProgramNode)&&    (locals.length==other.locals.length)&&locals.zip(other.locals).all? {|left,right|left===right }&&    (statements===other.statements)end

Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.

Source
# File lib/prism/node.rb, line 15091defaccept(visitor)visitor.visit_program_node(self)end

def accept: (Visitor visitor) -> void

Source
# File lib/prism/node.rb, line 15096defchild_nodes  [statements]end

defchild_nodes: () ->Array

Also aliased as:deconstruct
Source
# File lib/prism/node.rb, line 15106defcomment_targets  [statements]#: Array[Prism::node | Location]end

defcomment_targets: () -> Array[Node | Location]

Source
# File lib/prism/node.rb, line 15101defcompact_child_nodes  [statements]end

defcompact_child_nodes: () ->Array

Source
# File lib/prism/node.rb, line 15111defcopy(node_id:self.node_id,location:self.location,flags:self.flags,locals:self.locals,statements:self.statements)ProgramNode.new(source,node_id,location,flags,locals,statements)end

def copy: (?node_id:Integer, ?location:Location, ?flags:Integer, ?locals:Array, ?statements:StatementsNode) ->ProgramNode

def deconstruct: () ->Array

Alias for:child_nodes
Source
# File lib/prism/node.rb, line 15119defdeconstruct_keys(keys)  {node_id:node_id,location:location,locals:locals,statements:statements }end

defdeconstruct_keys: (Array keys) -> { node_id:Integer, location:Location, locals:Array, statements:StatementsNode }

Source
# File lib/prism/node.rb, line 15130definspectInspectVisitor.compose(self)end

def inspect ->String

Source
# File lib/prism/node.rb, line 15135deftype:program_nodeend

Return a symbol representation of this node type. SeeNode#type.