Esempio n. 1
0
 public override void Write(IndentedStreamWriter w)
 {
     for (int i = 0; i < lines.Count; i++)
     {
         lines[i].Write(w);
     }
 }
Esempio n. 2
0
 private void writeUsingDirectives(IndentedStreamWriter writer)
 {
     for (int i = 0; i < usingDirectives.Count; i++)
     {
         usingDirectives[i].Write(writer);
     }
 }
Esempio n. 3
0
 public void Write(IndentedStreamWriter write)
 {
     writeUsingDirectives(write);
     new EmptyLine().Write(write);
     writeHeader(write);
     writeBody(write);
     //DONE;
 }
 public override void Write(IndentedStreamWriter w)
 {
     if (asInitializer)
     {
         string def = local.GetAsDefinition();
         w.Write(def);
         WriteAssignment(w);
     }
     else
     {
         local.WriteAsReference(w);
         WriteAssignment(w);
     }
 }
        protected void WriteFunctionBody(IndentedStreamWriter writer)
        {
            writer.WriteLine("{");

            //TODO maybe write loclas as initialized list
            writer.IncreaseIndentLevel();

            for (int i = 0; i < codeStructures.Count; i++)
            {
                codeStructures[i].Write(writer);
            }
            writer.DecreaseIndentLevel();
            writer.WriteLine("}\n");
        }
Esempio n. 6
0
 public void Write(string pathDirectory)
 {
     //Write every class in namepace
     for (int i = 0; i < classesInNameSpace.Count; i++)
     {
         //open streamwriter
         using (var sw = new StreamWriter(pathDirectory + $"/{classesInNameSpace[i].Name}.cs"))
         {
             var writer = new IndentedStreamWriter(sw);
             //write namspace header and start body
             WriteHeader(writer);
             WriteBodyStart(writer);
             //write class
             writer.IncreaseIndentLevel();
             classesInNameSpace[0].Write(writer);
             writer.DecreaseIndentLevel();
             //end namespace body
             WriteBodyEnd(writer);
         }
     }
     //done
 }
Esempio n. 7
0
        void writeBody(IndentedStreamWriter writer)
        {
            writer.WriteLine("{");

            writer.IncreaseIndentLevel();
            //Members
            for (int i = 0; i < members.Count; i++)
            {
                //TODO FORMATTING
                members[i].WriteAsDefinition(writer);
            }

            //functions
            for (int i = 0; i < functions.Count; i++)
            {
                functions[i].Write(writer);
            }

            //TODO More formatting
            writer.DecreaseIndentLevel();

            writer.WriteLine("}");
        }
Esempio n. 8
0
 void WriteCtorHeader(IndentedStreamWriter writer)
 {
     writer.WriteLine(BuildFunctionHead());
 }
Esempio n. 9
0
 protected virtual void WriteBodyStart(IndentedStreamWriter writer)
 {
     writer.WriteLine("{");
 }
Esempio n. 10
0
 public override void Write(IndentedStreamWriter writer)
 {
     WriteCtorHeader(writer);
     WriteFunctionBody(writer);
 }
 public void WriteAsReference(IndentedStreamWriter writer)
 {
     writer.Write(name + (name.EndsWith(" ") ? "" : " "));
 }
Esempio n. 12
0
 protected virtual void WriteHeader(IndentedStreamWriter writer)
 {
     writer.WriteLine($"namespace {Name}");
 }
Esempio n. 13
0
 //Maybe unneeded
 public abstract void Write(IndentedStreamWriter w);
Esempio n. 14
0
 protected override void WriteHeader(IndentedStreamWriter writer)
 {
 }
 public override void WriteAsDefinition(IndentedStreamWriter writer)
 {
     writer.Write($"{type} {name}");
 }
Esempio n. 16
0
 protected virtual void WriteBodyEnd(IndentedStreamWriter writer)
 {
     writer.WriteLine("}");
 }
Esempio n. 17
0
 void writeHeader(IndentedStreamWriter writer)
 {
     writer.WriteLine(BuildHeader());
 }
 public override void WriteAsDefinition(IndentedStreamWriter writer)
 {
     writer.WriteLine($"{accessor} {type} {name};");
 }
Esempio n. 19
0
 protected void WriteAssignment(IndentedStreamWriter w)
 {
     w.Write($" = {expresion.GetAsEOL()}");
 }
 protected void WriteFunctionHead(IndentedStreamWriter writer)
 {
     writer.WriteLine(BuildFunctionHead());
 }
 public virtual void Write(IndentedStreamWriter writer)
 {
     WriteFunctionHead(writer);
     WriteFunctionBody(writer);
 }
 public abstract void WriteAsDefinition(IndentedStreamWriter writer);
Esempio n. 23
0
 protected override void WriteBodyStart(IndentedStreamWriter writer)
 {
 }
 public void WriteAsAssignment(IndentedStreamWriter w, Variable v)
 {
     v.WriteAsReference(w);
     w.Write((Content.ToString().StartsWith("=") ? "" : "= ") + GetAsEOL());
 }
 public override void Write(IndentedStreamWriter w)
 {
     w.WriteLine(lineToWrite);
 }
 public void WriteAfterKeyWord(IndentedStreamWriter w, string keyWord)
 {
     w.Write(keyWord + (keyWord.EndsWith(" ") ? "" : " "));
     w.Write(GetAsEOL());
 }
Esempio n. 27
0
 public override void Write(IndentedStreamWriter w)
 {
     w.Write($"{mem.Name}");
     WriteAssignment(w);
 }