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