コード例 #1
0
ファイル: FunctionBlock.cs プロジェクト: thomasd16/willow-old
 public override void Output(CodeWriter s, int bp)
 {
     s.Write('{');
     s.Indent();
     foreach (Statement Stmt in Statements)
     {
         s.NewLine();
         Stmt.Output(s, 0);
     }
     s.Outdent();
     s.NewLine();
     s.Write('}');
 }
コード例 #2
0
ファイル: ObjectLiteral.cs プロジェクト: thomasd16/willow-old
        public override void Output(CodeWriter s, int bp)
        {
            s.Write('{');
            s.Indent();
            foreach (DataPair <string, ExpressionNode> Property in Properties)
            {
                s.NewLine();
                s.Write('"');
                foreach (char x in Property.Key.ToCharArray())
                {
                    switch (x)
                    {
                    case '\b': s.Write("\\b"); break;

                    case '\f': s.Write("\\f"); break;

                    case '\\': s.Write("\\\\"); break;

                    case '\n': s.Write("\\n"); break;

                    case '\r': s.Write("\\r"); break;

                    case '\t': s.Write("\\t"); break;

                    default: s.Write(x); break;
                    }
                }
                s.Write('"');
                s.Write(':');
                Property.Value.Output(s, 0);
                if (Property.Key != Properties.Last().Key)
                {
                    s.Write(',');
                }
            }
            s.Outdent();
            s.NewLine();
            s.Write('}');
        }