Esempio n. 1
0
        public int CreateStruct(Name name, Grammar.ASTNodeDeclStruct declASTNode)
        {
            var decl = new DeclStruct();
            decl.declASTNode = declASTNode;
            this.declStructs.Add(decl);

            var declRef = new DeclReference
            {
                kind = DeclReference.Kind.Struct,
                index = this.declStructs.Count - 1
            };

            this.declTree.Add(name, declRef);
            return this.declStructs.Count - 1;
        }
Esempio n. 2
0
        public int CreatePrimitiveStruct(Name name)
        {
            var decl = new DeclStruct();
            decl.primitive = true;
            decl.declASTNode = null;
            this.declStructs.Add(decl);

            var declRef = new DeclReference
            {
                kind = DeclReference.Kind.Struct,
                index = this.declStructs.Count - 1
            };

            this.declTree.Add(name, declRef);
            return this.declStructs.Count - 1;
        }
Esempio n. 3
0
        public int CreateStruct(Name name, Grammar.ASTNodeDeclStruct declASTNode)
        {
            var decl = new DeclStruct();

            decl.declASTNode = declASTNode;
            this.declStructs.Add(decl);

            var declRef = new DeclReference
            {
                kind  = DeclReference.Kind.Struct,
                index = this.declStructs.Count - 1
            };

            this.declTree.Add(name, declRef);
            return(this.declStructs.Count - 1);
        }
Esempio n. 4
0
        public int CreatePrimitiveStruct(Name name)
        {
            var decl = new DeclStruct();

            decl.primitive   = true;
            decl.declASTNode = null;
            this.declStructs.Add(decl);

            var declRef = new DeclReference
            {
                kind  = DeclReference.Kind.Struct,
                index = this.declStructs.Count - 1
            };

            this.declTree.Add(name, declRef);
            return(this.declStructs.Count - 1);
        }
Esempio n. 5
0
        public void PrintStructToConsole(DeclStruct decl, string indentation)
        {
            for (var i = 0; i < decl.fieldTypes.Count; i++)
            {
                Console.ResetColor();
                Console.Out.Write(indentation);

                Name fieldName;
                decl.fieldNames.FindByValue(i, out fieldName);
                Console.Out.Write(fieldName.GetString());
                Console.Out.Write(" ");
                Console.ForegroundColor = ConsoleColor.DarkGray;
                Console.Out.Write(decl.fieldTypes[i].GetString(this));
                Console.ResetColor();
                Console.Out.WriteLine();
            }
        }
Esempio n. 6
0
        public void PrintStructToConsole(DeclStruct decl, string indentation)
        {
            for (var i = 0; i < decl.fieldTypes.Count; i++)
            {
                Console.ResetColor();
                Console.Out.Write(indentation);

                Name fieldName;
                decl.fieldNames.FindByValue(i, out fieldName);
                Console.Out.Write(fieldName.GetString());
                Console.Out.Write(" ");
                Console.ForegroundColor = ConsoleColor.DarkGray;
                Console.Out.Write(decl.fieldTypes[i].GetString(this));
                Console.ResetColor();
                Console.Out.WriteLine();
            }
        }