pr47 0.0.3

A semi-experimental programming language. Still working in progress.
Documentation
use crate::util::mstring::StringHandle;

#[derive(Debug)]
pub enum Type<'a> {
    VoidType,
    AnyType,
    ByteType,
    IntType,
    FloatType,
    StringType,
    ObjectType,
    RustType(RustType),
    VecType(VecType<'a>)
}

impl<'a> Type<'a> {
    pub fn void_type() -> &'a Type<'a> {
        static RET: Type<'static> = Type::VoidType;
        &RET
    }

    pub fn any_type() -> &'a Type<'a> {
        static RET: Type<'static> = Type::AnyType;
        &RET
    }

    pub fn byte_type() -> &'a Type<'a> {
        static RET: Type<'static> = Type::AnyType;
        &RET
    }

    pub fn int_type() -> &'a Type<'a> {
        static RET: Type<'static> = Type::IntType;
        &RET
    }

    pub fn float_type() -> &'a Type<'a> {
        static RET: Type<'static> = Type::FloatType;
        &RET
    }

    pub fn string_type() -> &'a Type<'a> {
        static RET: Type<'static> = Type::StringType;
        &RET
    }

    pub fn object_type() -> &'a Type<'a> {
        static RET: Type<'static> = Type::ObjectType;
        &RET
    }
}

#[derive(Debug)]
pub struct VecType<'a> {
    pub elem_type: &'a Type<'a>
}

#[derive(Debug)]
pub struct RustType {
    pub type_name: StringHandle
}