class Object

Public Instance Methods

codify(val) click to toggle source
# File lib/sdx/vm/vm.rb, line 5
def codify(val)
    if val.value.fields["__as_code_str"]
        if val.value.fields["__as_code_str"].respond_to? :call
            (val.value.fields["__as_code_str"].call).internal
        else
            (val.value.fields["__as_code_str"].fields["__call"].call [], val.scope).internal
        end
    else
        val.value.pretty_inspect
    end
end
error(msg) click to toggle source
# File lib/sdx/compiler/parser.rb, line 8
def error(msg)
    puts "\x1b[0;31mError in parser: #{msg}\x1b[0;0m"
end
get_type(x) click to toggle source
# File lib/sdx/vm/datatypes.rb, line 583
def get_type(x)
    case x
    when Int
        :int
    when Str
        :str
    when Bool
        :bool
    when Function
        :fn
    when List
        :list
    when Nil
        :nil
    when Num
        :num
    when Obj
        :object
    when Block
        :block
    end
end
stringify(val) click to toggle source
# File lib/sdx/vm/vm.rb, line 17
def stringify(val)
    if val.value.fields["__as_str"]
        if val.value.fields["__as_str"].respond_to? :fields
            (val.value.fields["__as_str"].fields["__call"].call [], val.scope).internal
        else
            (val.value.fields["__as_str"]).call.internal
        end
    else
        val.value.to_s
    end
end