コード例 #1
0
 public static void PrintStaticFieldDef(PrintState s, StaticFieldDef a)
 {
     PrintDescWithToken(s, "StaticFieldDef", a.Name);
     Indent(s);
     PrintDescWithAny(s, "Type", a.Type);
     UnIndent(s);
 }
コード例 #2
0
 public static void PrintExpressionStatement(PrintState s, ExpressionStatement a)
 {
     PrintLine(s, "ExpressionStatement");
     Indent(s);
     PrintAny(s, a.Expr);
     UnIndent(s);
 }
コード例 #3
0
 public static void PrintReturnStatement(PrintState s, ReturnStatement a)
 {
     PrintLine(s, "ReturnStatement");
     Indent(s);
     PrintAny(s, a.Expr);
     UnIndent(s);
 }
コード例 #4
0
 public static void PrintCodeUnit(PrintState s, CodeUnit u)
 {
     foreach (var it in u.Contents)
     {
         PrintAny(s, it);
     }
 }
コード例 #5
0
 public static void PrintTypeModifierExpression(PrintState s, TypeModifierExpression a)
 {
     PrintDescWithToken(s, "TypeModifier", a.Modifier);
     Indent(s);
     PrintAny(s, a.Arg);
     UnIndent(s);
 }
コード例 #6
0
 public static void PrintDescWithAny(PrintState s, string desc, object obj)
 {
     PrintLine(s, desc + ":");
     Indent(s);
     PrintAny(s, obj);
     UnIndent(s);
 }
コード例 #7
0
 public static void PrintAttribute(PrintState s, Attribute a)
 {
     PrintDescWithToken(s, "Attribute", a.Name);
     Indent(s);
     PrintDescWithList(s, "Args", a.Args);
     UnIndent(s);
 }
コード例 #8
0
 public static void PrintCallExpression(PrintState s, CallExpression a)
 {
     PrintLine(s, "CallExpression");
     Indent(s);
     PrintDescWithAny(s, "Target", a.Target);
     PrintDescWithList(s, "Args", a.Args);
     UnIndent(s);
 }
コード例 #9
0
 public static void PrintNamespaceDef(PrintState s, NamespaceDef a)
 {
     PrintLine(s, string.Format("NsDef: {0} {1}", a.Name.Value, a.Kind));
     Indent(s);
     PrintDescWithList(s, "Attributes", a.Attributes);
     PrintDescWithList(s, "Contents", a.Contents);
     UnIndent(s);
 }
コード例 #10
0
 public static void PrintWhileStatement(PrintState s, WhileStatement a)
 {
     PrintLine(s, "WhileStatement");
     Indent(s);
     PrintDescWithAny(s, "ConditionExpr", a.ConditionExpr);
     PrintDescWithAny(s, "Body", a.Body);
     UnIndent(s);
 }
コード例 #11
0
 public static void PrintDotExpression(PrintState s, DotExpression a)
 {
     PrintLine(s, "DotExpression");
     Indent(s);
     PrintDescWithAny(s, "Lhs", a.Lhs);
     PrintDescWithAny(s, "Rhs", a.Rhs);
     UnIndent(s);
 }
コード例 #12
0
 public static void PrintPostfixUnaryOperatorExpression(PrintState s, PostfixUnaryOperatorExpression a)
 {
     PrintLine(s, "PostfixUnaryOperatorExpression");
     Indent(s);
     PrintDescWithAny(s, "Op", a.Op);
     PrintDescWithAny(s, "Expr", a.Expr);
     UnIndent(s);
 }
コード例 #13
0
 public static void PrintIndexExpresison(PrintState s, IndexExpression a)
 {
     PrintLine(s, "IndexExpression");
     Indent(s);
     PrintDescWithAny(s, "Target", a.Target);
     PrintDescWithAny(s, "Arg", a.Arg);
     UnIndent(s);
 }
コード例 #14
0
 private static void PrintMatchStatement(PrintState s, MatchStatement a)
 {
     PrintLine(s, "MatchStatement");
     Indent(s);
     PrintDescWithAny(s, "Expr", a.Expr);
     PrintDescWithList(s, "Cases", a.Cases);
     UnIndent(s);
 }
コード例 #15
0
 public static void PrintTernaryOperatorExpression(PrintState s, TernaryOperatorExpression a)
 {
     PrintLine(s, "TernaryOperatorExpression");
     Indent(s);
     PrintDescWithAny(s, "ConditionExpr", a.ConditionExpr);
     PrintDescWithAny(s, "First", a.First);
     PrintDescWithAny(s, "Second", a.Second);
     UnIndent(s);
 }
コード例 #16
0
 public static void PrintIfStatement(PrintState s, IfStatement a)
 {
     PrintLine(s, "IfStatement");
     Indent(s);
     PrintDescWithAny(s, "ConditionExpr", a.ConditionExpr);
     PrintDescWithAny(s, "IfBranch", a.IfBranch);
     PrintDescWithAny(s, "ElseBranch", a.ElseBranch);
     UnIndent(s);
 }
コード例 #17
0
 public static void PrintForEachStatement(PrintState s, ForEachStatement a)
 {
     PrintLine(s, "ForEachStatement");
     Indent(s);
     PrintDescWithAny(s, "IteratorVariable", a.IteratorVariable);
     PrintDescWithAny(s, "SequenceExpression", a.SequenceExpression);
     PrintDescWithAny(s, "Body", a.Body);
     UnIndent(s);
 }
コード例 #18
0
 public static void PrintBinaryOperatorExpression(PrintState s, BinaryOperatorExpression a)
 {
     PrintLine(s, "BinaryOperatorExpression");
     Indent(s);
     PrintDescWithAny(s, "Op", a.Op);
     PrintDescWithAny(s, "Lhs", a.Lhs);
     PrintDescWithAny(s, "Rhs", a.Rhs);
     UnIndent(s);
 }
コード例 #19
0
 public static void PrintBlockStatement(PrintState s, BlockStatement a)
 {
     PrintLine(s, "BlockStatement");
     Indent(s);
     foreach (var it in a.Content)
     {
         PrintAny(s, it);
     }
     UnIndent(s);
 }
コード例 #20
0
 public static void PrintTypeArgsExpression(PrintState s, TypeArgsExpression a)
 {
     PrintDescWithAny(s, "TypeArgs", a.Target);
     Indent(s);
     foreach (var it in a.Args)
     {
         PrintAny(s, it);
     }
     UnIndent(s);
 }
コード例 #21
0
 public static void PrintForIndexStatement(PrintState s, ForIndexStatement a)
 {
     PrintLine(s, "ForIndexStatement");
     Indent(s);
     PrintDescWithAny(s, "InitializerStatement", a.InitializerStatement);
     PrintDescWithAny(s, "ConditionExpr", a.ConditionExpr);
     PrintDescWithAny(s, "NextStatement", a.NextStatement);
     PrintDescWithAny(s, "Body", a.Body);
     UnIndent(s);
 }
コード例 #22
0
 private static void PrintMatchCase(PrintState s, MatchCase a)
 {
     PrintLine(s, "MatchCase");
     Indent(s);
     PrintDescWithAny(s, "Name", a.Token);
     if (a.Second != null)
     {
         PrintDescWithAny(s, "Second", a.Second);
     }
     PrintDescWithAny(s, "Statement", a.Statement);
     UnIndent(s);
 }
コード例 #23
0
 public static void PrintDescWithList <T>(PrintState s, string desc, List <T> list) where T : class
 {
     PrintLine(s, desc + ":");
     if (list == null)
     {
         return;
     }
     Indent(s);
     foreach (var it in list)
     {
         PrintAny(s, it);
     }
     UnIndent(s);
 }
コード例 #24
0
 public static void PrintStructInitializerExpression(PrintState s, StructInitializerExpression a)
 {
     PrintLine(s, "StructInitializerExpression");
     Indent(s);
     PrintDescWithAny(s, "Target", a.Target);
     PrintLine(s, "Args:");
     Indent(s);
     foreach (var it in a.Args)
     {
         PrintToken(s, it.FieldName);
         Indent(s);
         PrintAny(s, it.Expr);
         UnIndent(s);
     }
     UnIndent(s);
     UnIndent(s);
 }
コード例 #25
0
 public static void PrintFunctionDef(PrintState s, FunctionDef a)
 {
     PrintDescWithToken(s, "FunctionDef", a.Name);
     Indent(s);
     PrintLine(s, "Params:");
     Indent(s);
     foreach (var p in a.Params)
     {
         PrintToken(s, p.Name);
         Indent(s);
         PrintAny(s, p.Type);
         UnIndent(s);
     }
     UnIndent(s);
     PrintDescWithAny(s, "ReturnType", a.ReturnType);
     PrintDescWithList(s, "Attributes", a.Attributes);
     PrintDescWithAny(s, "Body", a.Body);
     UnIndent(s);
 }
コード例 #26
0
 public static void UnIndent(PrintState s)
 {
     s.Indent -= 2;
 }
コード例 #27
0
 public static void Indent(PrintState s)
 {
     s.Indent += 2;
 }
コード例 #28
0
 public static void PrintLine(PrintState s, string line)
 {
     Console.Write(new string(' ', s.Indent));
     Console.WriteLine(line);
 }
コード例 #29
0
 public static void PrintDescWithToken(PrintState s, string desc, Token t)
 {
     PrintLine(s, string.Format("{0}: {1}", desc, t.Value));
 }
コード例 #30
0
 public static void PrintToken(PrintState s, Token t)
 {
     PrintLine(s, string.Format("{0} {1}", t.Value, t.Type));
 }