rubyx/stash/vm/tree/basic_values.rb

67 lines
1.3 KiB
Ruby
Raw Normal View History

2017-01-14 18:28:44 +01:00
module Vm
2016-12-09 11:13:33 +01:00
module Tree
class IntegerExpression < Expression
2016-12-23 20:31:31 +01:00
include ValuePrinter
2016-12-09 11:13:33 +01:00
attr_accessor :value
def initialize(value)
@value = value
end
end
2016-12-09 11:13:33 +01:00
class FloatExpression < Expression
2016-12-23 20:31:31 +01:00
include ValuePrinter
2016-12-09 11:13:33 +01:00
attr_accessor :value
def initialize(value)
@value = value
end
end
2016-12-09 11:13:33 +01:00
class TrueExpression < Expression
2016-12-23 20:31:31 +01:00
def to_s
"true"
end
end
2016-12-09 11:13:33 +01:00
class FalseExpression < Expression
2016-12-23 20:31:31 +01:00
def to_s
2016-12-28 12:59:02 +01:00
"false"
2016-12-23 20:31:31 +01:00
end
end
2016-12-09 11:13:33 +01:00
class NilExpression < Expression
2016-12-23 20:31:31 +01:00
def to_s
"nil"
end
2016-12-09 11:13:33 +01:00
end
class StringExpression < Expression
2016-12-23 20:31:31 +01:00
include ValuePrinter
2016-12-09 11:13:33 +01:00
attr_accessor :value
def initialize(value)
@value = value
end
end
2016-12-09 11:13:33 +01:00
class NameExpression < Expression
2016-12-23 20:31:31 +01:00
include ValuePrinter
2016-12-09 11:13:33 +01:00
attr_accessor :value
alias :name :value
def initialize(value)
@value = value
end
end
class LocalName < NameExpression
end
class ArgumentName < NameExpression
end
class InstanceName < NameExpression
end
class KnownName < NameExpression
end
2016-12-09 11:13:33 +01:00
class ClassExpression < Expression
2016-12-23 20:31:31 +01:00
include ValuePrinter
2016-12-09 11:13:33 +01:00
attr_accessor :value
def initialize(value)
@value = value
end
end
end
end