コード例 #1
0
        public override string AST(int depth = 0)
        {
            var sb = new StringBuilder($"{Spaces(depth)}[{Name}\n" +
                                       (Type != null ? $"{Type.AST(depth + 1)}" : "") +
                                       $"{Id.AST(depth + 1)}");

            foreach (var s in Parameters)
            {
                sb.Append(s.AST(depth + 1));
            }

            sb.Append($"{Statement.AST(depth + 1)}{Spaces(depth)}]\n");

            return(sb.ToString());
        }