Class: Atomy::Grammar::AST::Literal
- Inherits:
-
Node
show all
- Defined in:
- lib/atomy/grammar.rb,
lib/atomy/node/meta.rb,
lib/atomy/node/pretty.rb,
lib/atomy/node/equality.rb,
lib/atomy/node/constructable.rb
Instance Attribute Summary collapse
Attributes inherited from Node
#line
Instance Method Summary
collapse
Methods inherited from Node
#accept, #attributes, basename, #children, #each_child, #through
Constructor Details
#initialize(value) ⇒ Literal
Returns a new instance of Literal.
103
104
105
|
# File 'lib/atomy/grammar.rb', line 103
def initialize(value)
@value = value
end
|
Instance Attribute Details
Returns the value of attribute value.
106
107
108
|
# File 'lib/atomy/grammar.rb', line 106
def value
@value
end
|
Instance Method Details
#==(other) ⇒ Object
20
21
22
|
# File 'lib/atomy/node/equality.rb', line 20
def ==(other)
super || other.is_a?(self.class) && @value == other.value
end
|
#construct(gen) ⇒ Object
40
41
42
43
44
|
# File 'lib/atomy/node/constructable.rb', line 40
def construct(gen)
push_node(gen, :Literal)
gen.push_literal(@value)
gen.send(:new, 1)
end
|
#each_attribute {|:value, @value| ... } ⇒ Object
69
70
71
|
# File 'lib/atomy/node/meta.rb', line 69
def each_attribute
yield :value, @value
end
|
17
18
19
|
# File 'lib/atomy/node/pretty.rb', line 17
def to_s
@value.to_s
end
|