示例#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));
 }