public static ProtoCore.Type CreateType(ProtoCore.PrimitiveType type) { ProtoCore.Type protoType = new ProtoCore.Type { IsIndexable = false, rank = 0, UID = (int)type }; switch (type) { case ProtoCore.PrimitiveType.kTypeDouble: protoType.Name = ProtoCore.DSDefinitions.Kw.kw_double; break; case ProtoCore.PrimitiveType.kTypeInt: protoType.Name = ProtoCore.DSDefinitions.Kw.kw_int; break; case ProtoCore.PrimitiveType.kTypeBool: protoType.Name = ProtoCore.DSDefinitions.Kw.kw_bool; break; case ProtoCore.PrimitiveType.kTypeChar: protoType.Name = ProtoCore.DSDefinitions.Kw.kw_char; break; case ProtoCore.PrimitiveType.kTypeString: protoType.Name = ProtoCore.DSDefinitions.Kw.kw_string; break; case ProtoCore.PrimitiveType.kTypePointer: case ProtoCore.PrimitiveType.kTypeVar: protoType.Name = ProtoCore.DSDefinitions.Kw.kw_var; break; case ProtoCore.PrimitiveType.kTypeVoid: protoType.Name = ProtoCore.DSDefinitions.Kw.kw_void; break; default: throw new NotSupportedException(string.Format("Primitive type {0} is not supported for marshaling.", type)); } return(protoType); }
public static ProtoCore.AST.AssociativeAST.IdentifierNode BuildAssocIdentifier(Core core, string name, ProtoCore.PrimitiveType type = ProtoCore.PrimitiveType.kTypeVar) { var ident = new ProtoCore.AST.AssociativeAST.IdentifierNode(); ident.Name = ident.Value = name; ident.datatype = TypeSystem.BuildPrimitiveTypeObject(type, 0); return(ident); }
public static bool IsPrimitiveRange(ProtoCore.PrimitiveType type) { return(type > ProtoCore.PrimitiveType.kTypeNull && type < ProtoCore.PrimitiveType.kTypeVar); }
public static ProtoCore.AST.AssociativeAST.IdentifierNode BuildAssocIdentifier(ProtoLanguage.CompileStateTracker compileState, string name, ProtoCore.PrimitiveType type = ProtoCore.PrimitiveType.kTypeVar) { var ident = new ProtoCore.AST.AssociativeAST.IdentifierNode(); ident.Name = ident.Value = name; ident.datatype = compileState.TypeSystem.BuildTypeObject(type, false); return(ident); }