2014-06-26 18:39:02 +03:00
|
|
|
module Virtual
|
2015-05-13 16:17:10 +03:00
|
|
|
|
2014-09-16 17:16:56 +03:00
|
|
|
class Constant < ::Virtual::Object
|
2014-05-13 16:24:19 +03:00
|
|
|
end
|
2014-09-14 18:15:33 +03:00
|
|
|
class TrueConstant < Constant
|
2014-07-15 09:31:25 +03:00
|
|
|
end
|
2014-09-14 18:15:33 +03:00
|
|
|
class FalseConstant < Constant
|
2014-07-15 09:31:25 +03:00
|
|
|
end
|
2014-09-14 18:15:33 +03:00
|
|
|
class NilConstant < Constant
|
2014-07-15 09:31:25 +03:00
|
|
|
end
|
2014-05-13 16:24:19 +03:00
|
|
|
|
2014-06-07 17:59:44 +03:00
|
|
|
# another abstract "marker" class (so we can check for it)
|
2015-05-13 16:17:10 +03:00
|
|
|
# derived classes are Boot/Meta Class and StringConstant
|
2014-06-07 17:59:44 +03:00
|
|
|
class ObjectConstant < Constant
|
2014-08-21 22:57:20 +03:00
|
|
|
def type
|
|
|
|
Virtual::Reference
|
|
|
|
end
|
2014-09-16 17:16:56 +03:00
|
|
|
def clazz
|
2014-08-22 10:21:12 +03:00
|
|
|
raise "abstract #{self}"
|
|
|
|
end
|
2014-06-07 17:59:44 +03:00
|
|
|
end
|
2014-05-13 16:24:19 +03:00
|
|
|
|
|
|
|
class IntegerConstant < Constant
|
2014-05-13 18:21:24 +03:00
|
|
|
def initialize int
|
2014-05-13 16:24:19 +03:00
|
|
|
@integer = int
|
|
|
|
end
|
|
|
|
attr_reader :integer
|
2014-07-14 21:28:21 +03:00
|
|
|
def type
|
|
|
|
Virtual::Integer
|
|
|
|
end
|
2014-09-17 16:23:29 +03:00
|
|
|
def fits_u8?
|
|
|
|
integer >= 0 and integer <= 255
|
|
|
|
end
|
2014-05-13 16:24:19 +03:00
|
|
|
end
|
|
|
|
|
2015-05-13 16:17:10 +03:00
|
|
|
end
|