public NamespaceDefinitionToken(HlNamespace ns, IHlToken[] subtokens, int start) : base(
         HlTokenType.OpNamespaceDefinition,
         subtokens,
         start
         )
 {
     Namespace = ns;
 }
 public HlFunctionDefinition(
     HlTypeSystem ts,
     HlNamespace root,
     string name,
     IHlToken[] mods) : base(name, mods)
 {
     ReturnType = ts.GetType(root, HLBaseTypeNames.s_UintTypeName);
 }
 public CStringTypeDefinition(HlNamespace ns) : base(
         ns,
         HLBaseTypeNames.s_CStringTypeName,
         true,
         false,
         false
         )
 {
 }
Beispiel #4
0
 public HlTypeDefinition(HlNamespace ns, string name, bool isPublic, bool isAbstract, bool isValueType)
 {
     Namespace   = ns;
     IsValueType = isValueType;
     IsPublic    = isPublic;
     IsAbstract  = isAbstract;
     Name        = name;
     m_BaseTypes = new List <IHlToken>();
 }
Beispiel #5
0
 public FloatTypeDefinition(HlNamespace root) : base(
         root,
         HLBaseTypeNames.s_FloatTypeName,
         true,
         false,
         true
         )
 {
 }
Beispiel #6
0
        public HlTypeDefinition GetType(HlNamespace caller, string name)
        {
            if (!m_DefinedTypes.Any(x => x.Name == name && x.Namespace.IsVisibleTo(caller)))
            {
                EventManager <ErrorEvent> .SendEvent(new TypeNotFoundEvent( name ));
            }

            return(m_DefinedTypes.First(x => x.Name == name && x.Namespace.IsVisibleTo(caller)));
        }
 public StringTypeDefinition(HlNamespace root) : base(
         root,
         HLBaseTypeNames.s_StringTypeName,
         true,
         false,
         false
         )
 {
 }
Beispiel #8
0
 public void Import(HlNamespace caller, HlTypeSystem other)
 {
     foreach (HlTypeDefinition otherDef in other)
     {
         if (otherDef.IsPublic && !HasType(caller, otherDef.Name))
         {
             AddItem(otherDef);
         }
     }
 }
Beispiel #9
0
 public ArrayTypeDefintion(HlNamespace root, HlTypeDefinition elementType, uint size) : base(
         root,
         elementType.Name + "[]",
         true,
         false,
         false
         )
 {
     Size        = size;
     ElementType = elementType;
 }
Beispiel #10
0
        public static HlTypeSystem Create(HlNamespace root)
        {
            HlTypeSystem ret = new HlTypeSystem();

            ret.AddItem(new UIntTypeDefinition(root));
            ret.AddItem(new FloatTypeDefinition(root));
            ret.AddItem(new StringTypeDefinition(root));
            ret.AddItem(new CStringTypeDefinition(root));
            ret.AddItem(new HlTypeDefinition(root, "void", false, true, true));

            return(ret);
        }
Beispiel #11
0
 public HlExternalFunctionDefinition(
     HlTypeSystem ts,
     HlNamespace root,
     string name,
     string translated,
     List <IHlToken> mods) : base(
         ts,
         root,
         name,
         mods.ToArray()
         )
 {
     TranslatedFunctionName = translated;
 }
Beispiel #12
0
        public HlTypeDefinition CreateEmptyType(
            HlNamespace ns,
            string name,
            bool isPublic,
            bool isAbstract,
            bool isValueType)
        {
            if (m_DefinedTypes.Any(x => x.Name == name))
            {
                EventManager <ErrorEvent> .SendEvent(new HlTypeRedefinitionEvent( name ));

                return(null);
            }

            HlTypeDefinition def = new HlTypeDefinition(ns, name, isPublic, isAbstract, isValueType);

            AddItem(def);

            return(def);
        }
Beispiel #13
0
 public bool HasType(HlNamespace caller, string name)
 {
     return(m_DefinedTypes.Any(x => x.Name == name && x.Namespace.IsVisibleTo(caller)));
 }