Exemplo 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;
        }
Exemplo 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;
        }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo 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();
            }
        }
Exemplo 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();
            }
        }