Syntax::ASTNode
Base class for nodes in the grammar.
Class methods
Instance methods
Sets this node's location and end location to those
of node, and returns self
Returns a deep copy of this node. Copied nodes retain the location and end location of the original nodes.
Returns the doc comment attached to this node. Not every node
supports having doc comments, so by default this returns nil.
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.
The location where this node ends, or nil
if the location is not known.
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>
The location where this node starts, or nil
if the location is not known.
It yields itself for any node, but Expressions yields first node
if it holds only a node.
It yields nil always.
(It is overridden by Expressions to implement #single_expression.)
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>