rubyx/stash/constants.rb

37 lines
660 B
Ruby
Raw Normal View History

2015-10-22 17:16:29 +02:00
module Register
2015-10-22 17:16:29 +02:00
class Constant < ::Register::Object
end
class TrueConstant < Constant
end
class FalseConstant < Constant
end
class NilConstant < Constant
end
# another abstract "marker" class (so we can check for it)
# derived classes are Boot/Meta Class and StringConstant
class ObjectConstant < Constant
2015-07-02 08:49:52 +02:00
# def type
# Phisol::Reference
2015-07-02 08:49:52 +02:00
# end
def clazz
raise "abstract #{self}"
end
end
class IntegerConstant < Constant
def initialize int
@integer = int
end
attr_reader :integer
def type
:Integer
end
def fits_u8?
integer >= 0 and integer <= 255
end
end
2015-07-02 08:49:52 +02:00
end