예제 #1
0
파일: SyntaxTree.cs 프로젝트: Xed89/luna
 public override void WriteTree(IndentedTextWriter writer)
 {
     writer.WriteLine($"{GetType().Name}");
     writer.Indent += 1;
     expression.WriteTree(writer);
     writer.Indent -= 1;
 }
예제 #2
0
파일: SyntaxTree.cs 프로젝트: Xed89/luna
        public override void WriteTree(IndentedTextWriter writer)
        {
            writer.WriteLine(GetType().Name);
            writer.Indent += 1;

            if (value != null)
            {
                writer.WriteLine($"value:");
                writer.Indent += 1;
                value.WriteTree(writer);
                writer.Indent -= 1;
            }

            writer.Indent -= 1;
        }
예제 #3
0
파일: SyntaxTree.cs 프로젝트: Xed89/luna
        public override void WriteTree(IndentedTextWriter writer)
        {
            writer.WriteLine(GetType().Name);
            writer.Indent += 1;

            varOrCallChainSyntax.WriteTree(writer);
            if (valueToAssignExpression != null)
            {
                writer.Indent += 1;
                valueToAssignExpression.WriteTree(writer);
                writer.Indent -= 1;
            }

            writer.Indent -= 1;
        }
예제 #4
0
파일: SyntaxTree.cs 프로젝트: Xed89/luna
        public override void WriteTree(IndentedTextWriter writer)
        {
            writer.WriteLine(GetType().Name);
            writer.Indent += 1;

            var letOrVarStr = isVar ? "var" : "let";

            writer.WriteLine($"{letOrVarStr} {identifierToken.value}");
            if (initializer != null)
            {
                writer.Indent += 1;
                initializer.WriteTree(writer);
                writer.Indent -= 1;
            }

            writer.Indent -= 1;
        }
예제 #5
0
파일: SyntaxTree.cs 프로젝트: Xed89/luna
        public override void WriteTree(IndentedTextWriter writer)
        {
            writer.WriteLine($"{GetType().Name}");
            writer.Indent += 1;

            writer.WriteLine($"Op: '{op.value}'");

            writer.WriteLine($"left: ");
            writer.Indent += 1;
            leftExpressionSyntax.WriteTree(writer);
            writer.Indent -= 1;

            writer.WriteLine($"right: ");
            writer.Indent += 1;
            rightExpressionSyntax.WriteTree(writer);
            writer.Indent -= 1;

            writer.Indent -= 1;
        }
예제 #6
0
파일: SyntaxTree.cs 프로젝트: Xed89/luna
        public override void WriteTree(IndentedTextWriter writer)
        {
            writer.WriteLine(GetType().Name);
            writer.Indent += 1;

            writer.WriteLine($"condition:");
            writer.Indent += 1;
            condition.WriteTree(writer);
            writer.Indent -= 1;

            writer.WriteLine("true branch statements:");
            for (var i = 0; i < trueBranchStatements.Count; i++)
            {
                writer.Indent += 1;
                writer.WriteLine($"[{i}]: ");
                writer.Indent += 1;
                trueBranchStatements[i].WriteTree(writer);
                writer.Indent -= 1;
                writer.Indent -= 1;
            }

            if (falseBranchStatements.Count > 0)
            {
                writer.WriteLine("false branch statements:");
                for (var i = 0; i < falseBranchStatements.Count; i++)
                {
                    writer.Indent += 1;
                    writer.WriteLine($"[{i}]: ");
                    writer.Indent += 1;
                    falseBranchStatements[i].WriteTree(writer);
                    writer.Indent -= 1;
                    writer.Indent -= 1;
                }
            }

            writer.Indent -= 1;
        }