class

Syntax::ASTNode

Inherits Reference < Object

Base class for nodes in the grammar.

Class methods

class_desc
Source

Instance methods

accept(visitor)
Source
accept_children(visitor)
Source
at(node : ASTNode)

Sets this node's location and end location to those of node, and returns self

Source
at(location : Location | Nil)

Updates this node's location and returns self

Source
at_end(node : ASTNode)

Sets this node's end location to those of node and returns self

Source
at_end(end_location : Location | Nil)

Updates this node's end location and returns self

Source
class_desc
Source
class_desc_is_a?(name)
Source
clone

Returns a deep copy of this node. Copied nodes retain the location and end location of the original nodes.

Source
doc

Returns the doc comment attached to this node. Not every node supports having doc comments, so by default this returns nil.

Source
doc=(doc)

Attaches a doc comment to this node. Not every node supports having doc comments, so by default this does nothing and some subclasses implement this.

Source
end_location

The location where this node ends, or nil if the location is not known.

Source
end_location=(end_location : Location | Nil)

The location where this node ends, or nil if the location is not known.

Source
false_literal?
Source
inspect(io : IO) : Nil

Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).inspect # => #<Person:0x10fd31f20 @name="John", @age=32>
Source
location

The location where this node starts, or nil if the location is not known.

Source
location=(location : Location | Nil)

The location where this node starts, or nil if the location is not known.

Source
name_location
Source
name_size
Source
nop?
Source
pretty_print(pp)
Source
single_expression

It yields itself for any node, but Expressions yields first node if it holds only a node.

Source
single_expression?

It yields nil always. (It is overridden by Expressions to implement #single_expression.)

Source
to_s(io : IO, macro_expansion_pragmas = nil, emit_doc = false) : Nil

Appends a short String representation of this object which includes its class name and its object address.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).to_s # => #<Person:0x10a199f20>
Source
true_literal?
Source
visibility
Source
visibility=(visibility : Visibility)
Source