Пример #1
0
        public override async Task <int> Handle(CArgument argument, IHost host, CancellationToken cancellationToken)
        {
            Workspace workspace = host.Services.GetRequiredService <Workspace>();
            ILogger <CompleteCommand> logger = host.Services.GetRequiredService <ILogger <CompleteCommand> >();

            await foreach (var id in workspace.Local.PostService.All(cancellationToken))
            {
                var post = await workspace.Local.PostService.Get(id, cancellationToken);

                if (post is null)
                {
                    continue;
                }
                if (argument.Force)
                {
                    var meta = workspace.Local.InnerPostService.InnerRepository.GetDefaultMetadata(id);
                    meta.ApplyTo(post);
                }
                await workspace.Local.PostService.Update(post, cancellationToken);

                logger.LogInformation($"Complete {post.Title}.");
            }

            return(0);
        }
Пример #2
0
        public override async Task <int> Handle(CArgument argument, IHost host, CancellationToken cancellationToken)
        {
            Workspace workspace = host.Services.GetRequiredService <Workspace>();

            IBlogService service;

            if (argument.Remote)
            {
                await workspace.Connect();

                service = workspace.Remote;
            }
            else
            {
                service = workspace.Local;
            }

            await foreach (var id in service.PostService.All(cancellationToken))
            {
                var item = await service.PostService.Get(id, cancellationToken);

                if (item is not null)
                {
                    Console.WriteLine(item.Title);
                }
            }
            return(0);
        }
        public override async Task <int> Handle(CArgument argument, ParserContext parser, PipelineContext pipeline, CancellationToken cancellationToken)
        {
            IWorkspace workspace = pipeline.Services.GetWorkspace();
            ITerminal  terminal  = pipeline.Services.GetTerminal();

            if (!argument.Clear)
            {
                IWorkItem?res = await workspace.Create("", null,
                                                       (vars, resolveContext) => Utils.ResolveCallback(vars, resolveContext, parser, pipeline));

                if (res != null)
                {
                    pipeline.Services.Replace <IWorkItem>(res);
                }
                else
                {
                    terminal.Output.WriteErrorLine("Create work-item failed.");
                    return(-1);
                }
            }
            else
            {
                pipeline.Services.Remove <IWorkItem>();
            }
            return(0);
        }
Пример #4
0
        public override async Task <int> Handle(CArgument argument, IHost host, CancellationToken cancellationToken)
        {
            Workspace workspace = host.Services.GetRequiredService <Workspace>();

            if (workspace.Option.Remotes.TryGetValue(argument.Name, out var remote))
            {
                if (argument.Token != null)
                {
                    remote.Token = argument.Token;
                }
                if (argument.Type != null)
                {
                    remote.Type = argument.Type.Value;
                }
                if (argument.Uri != null)
                {
                    if (remote.Type == RemoteType.LocalFS)
                    {
                        remote.Uri = new DirectoryInfo(argument.Uri).FullName;
                    }
                    else
                    {
                        remote.Uri = argument.Uri;
                    }
                }
            }
            await workspace.Save();

            return(0);
        }
Пример #5
0
        public override async Task <int> Handle(CArgument argument, IHost host, CancellationToken cancellationToken)
        {
            Workspace workspace = host.Services.GetRequiredService <Workspace>();
            await workspace.Initialize();

            return(0);
        }
        public override Task <int> Handle(CArgument argument, ParserContext parser, PipelineContext pipeline, CancellationToken cancellationToken)
        {
            ITerminal terminal = pipeline.Services.GetTerminal();

            terminal.Clear();
            return(Task.FromResult(0));
        }
Пример #7
0
        protected override Task <int> Handle(CArgument argument, IConsole console, InvocationContext context, PipelineContext pipeline, CancellationToken cancellationToken)
        {
            IHost host = pipeline.Services.Get <IHost>();

            host.Shutdown();
            return(Task.FromResult(0));
        }
Пример #8
0
        protected override async Task <int> Handle(CArgument argument, IConsole console, InvocationContext context, PipelineContext pipeline, CancellationToken cancellationToken)
        {
            IWorkspace workspace = pipeline.Services.GetWorkspace();
            ITerminal  terminal  = console.GetTerminal();
            string     template  = argument.Template;

            Packagings.Package <BaseTemplate>?tplItem = await workspace.Templates.GetValue(template);

            if (tplItem == null)
            {
                terminal.OutputErrorLine($"No this template: {template}.");
                return(1);
            }
            BaseTemplate?tpl = tplItem.Data;

            if (tpl == null)
            {
                terminal.OutputErrorLine($"Can not load this template: {template}.");
                return(1);
            }

            IWorkItem?item = null;

            try
            {
                item = await workspace.Create(argument.Name, tpl,
                                              (vars, resolveContext) => Utils.ResolveCallback(vars, resolveContext, context, pipeline));
            }
            catch (ArgumentException)
            {
                return(-1);
            }
            return(0);
        }
        public override Task <int> Handle(CArgument argument, ParserContext parser, PipelineContext pipeline, CancellationToken cancellationToken)
        {
            IHost host = pipeline.Services.GetService <IHost>();

            host.Shutdown();
            return(Task.FromResult(0));
        }
Пример #10
0
        public override async Task <int> Handle(CArgument argument, IConsole console, InvocationContext context, CancellationToken cancellationToken)
        {
            Workspace workspace = Program.Workspace;

            workspace.Configuration.Remote = null;
            workspace.Configuration.Token  = "";
            await workspace.Save();

            {
                DirectoryInfo di = new DirectoryInfo(workspace.GetPostRoot());
                if (!di.Exists)
                {
                    di.Create();
                }
            }
            {
                DirectoryInfo di = new DirectoryInfo(workspace.GetCategoryRoot());
                if (!di.Exists)
                {
                    di.Create();
                }
            }
            {
                DirectoryInfo di = new DirectoryInfo(workspace.GetKeywordRoot());
                if (!di.Exists)
                {
                    di.Create();
                }
            }
            return(0);
        }
Пример #11
0
        public override async Task <int> Handle(CArgument argument, IHost host, CancellationToken cancellationToken)
        {
            Workspace             workspace = host.Services.GetRequiredService <Workspace>();
            ILogger <PostCommand> logger    = host.Services.GetRequiredService <ILogger <PostCommand> >();

            Post post = new Post
            {
                Id               = argument.Id,
                Title            = argument.Title,
                CreationTime     = DateTimeOffset.Now,
                ModificationTime = DateTimeOffset.Now,
                Type             = argument.Type,
            };
            var id = await workspace.Local.PostService.Create(post, cancellationToken);

            if (string.IsNullOrEmpty(id))
            {
                logger.LogError("Create failed.");
                return(1);
            }
            else
            {
                logger.LogInformation($"Create post: {id}.");
                return(0);
            }
        }
Пример #12
0
        public object CreateParameters(CArgument arg, ParameterInfo info)
        {
            if (arg is CFunction)
            {
                CFunction f = arg as CFunction;
                if (f.Name.Equals("null"))
                {
                    return(null);
                }
                if (info.ParameterType.BaseType == typeof(ValueType) || info.ParameterType.BaseType == typeof(Enum))
                {
                    return(CreateBase(f, info.ParameterType));
                }
                else if (info.ParameterType.BaseType == typeof(Array) && f.Name.Equals("a"))
                {
                    Array array = info.ParameterType.GetConstructors()[0].Invoke(new object[] { f.Arguments.Count }) as Array;
                    for (int i = 0; i < array.Length; i++)
                    {
                        if (f.Arguments[i] is CFunction)
                        {
                            object param = CreateBase(f.Arguments[i] as CFunction, info.ParameterType);
                            array.SetValue(param, i);
                        }
                    }
                    return(array);
                }
                else
                {
                    if (f.Name.Equals("ctor"))
                    {
                        CFunction target = f.Arguments[0] as CFunction;
                        int       index  = int.Parse(f.Arguments[1].Text);

                        if (!info.ParameterType.Name.Equals(f.Arguments[0]))
                        {
                            throw new EntryPointNotFoundException("Could not find Constructor for: " + info.ParameterType.Name);
                        }

                        ConstructorInfo constructor = info.ParameterType.GetConstructors()[index];
                        ParameterInfo[] infos       = constructor.GetParameters();
                        object[]        args        = new object[infos.Length];
                        for (int i = 0; i < infos.Length; i++)
                        {
                            args[i] = CreateParameters(target.Arguments[i], infos[i]);
                        }
                        return(constructor.Invoke(args));
                    }
                    else
                    {
                        throw new Exception("Could not handle CFunction");
                    }
                }
            }
            else
            {
                return((arg as CText)?.Text);
            }
        }
Пример #13
0
        public override async Task <int> Handle(CArgument argument, IConsole console, InvocationContext context, CancellationToken cancellationToken)
        {
            Workspace workspace = Program.Workspace;

            using var client = new HttpClient();
            await workspace.Connect(client);

            return(0);
        }
Пример #14
0
        public override async Task <int> Handle(CArgument argument, IConsole console, InvocationContext context, CancellationToken cancellationToken)
        {
            Workspace workspace = Program.Workspace;

            workspace.Configuration.Token = "";
            await workspace.Save();

            return(0);
        }
Пример #15
0
        protected override Task <int> Handle(CArgument argument, IConsole console, InvocationContext context, PipelineContext pipeline, CancellationToken cancellationToken)
        {
            ITerminal         terminal = console.GetTerminal();
            CommandCollection manager  = pipeline.Services.GetCommands();

            terminal.OutputTable(manager,
                                 new OutputTableColumnStringView <ICommandBuilder>(x => x.Name, nameof(ICommandBuilder.Name)),
                                 new OutputTableColumnStringView <ICommandBuilder>(x => manager.GetExtension(x)?.Name ?? "N/A", "Extension")
                                 );
            return(Task.FromResult(0));
        }
Пример #16
0
        public override async Task <int> Handle(CArgument argument, IConsole console, InvocationContext context, CancellationToken cancellationToken)
        {
            Workspace workspace = Program.Workspace;

            workspace.Configuration.Remote = new ServerConfiguration(argument.Uri !, argument.Static);
            using var client = new HttpClient();
            await workspace.Connect(client);

            await workspace.Save();

            return(0);
        }
Пример #17
0
        protected override Task <int> Handle(CArgument argument, IConsole console, InvocationContext context, PipelineContext pipeline, CancellationToken cancellationToken)
        {
            ITerminal terminal = console.GetTerminal();

            terminal.Clear();
            terminal.SetCursorPosition(0, 0);
            if (console is SystemConsole)
            {
                System.Console.Clear();
                System.Console.SetCursorPosition(0, 0);
            }
            return(Task.FromResult(0));
        }
Пример #18
0
        protected override Task <int> Handle(CArgument argument, IConsole console, InvocationContext context, PipelineContext pipeline, CancellationToken cancellationToken)
        {
            ITerminal           terminal = console.GetTerminal();
            ExtensionCollection manager  = pipeline.Services.GetExtensions();

            terminal.OutputTable(manager,
                                 new OutputTableColumnStringView <ExtensionLoader>(x => x.Extension.Name, nameof(IExtension.Name)),
                                 new OutputTableColumnStringView <ExtensionLoader>(x => x.Extension.Description ?? "N/A", nameof(IExtension.Description)),
                                 new OutputTableColumnStringView <ExtensionLoader>(x => x.Extension.Publisher ?? "N/A", nameof(IExtension.Publisher)),
                                 new OutputTableColumnStringView <ExtensionLoader>(x => x.Extension.Version.ToString() ?? "N/A", nameof(IExtension.Version))
                                 );
            return(Task.FromResult(0));
        }
Пример #19
0
        public override async Task <int> Handle(CArgument argument, IHost host, CancellationToken cancellationToken)
        {
            Workspace workspace = host.Services.GetRequiredService <Workspace>();

            workspace.Option.Remotes.Remove(argument.Name);
            if (workspace.Option.CurrentRemote == argument.Name)
            {
                workspace.Option.CurrentRemote = string.Empty;
            }
            await workspace.Save();

            return(0);
        }
Пример #20
0
        public override async Task <int> Handle(CArgument argument, IHost host, CancellationToken cancellationToken)
        {
            Workspace workspace = host.Services.GetRequiredService <Workspace>();
            var       logger    = host.Services.GetRequiredService <ILogger <LoginCommand> >();

            if (string.IsNullOrWhiteSpace(argument.Name))
            {
                argument.Name = workspace.Option.CurrentRemote;
            }
            if (workspace.Option.Remotes.TryGetValue(argument.Name, out var remote))
            {
                await workspace.Connect(remote.Name);

                string userName = string.Empty, password = string.Empty;

                {
                    if (string.IsNullOrEmpty(userName))
                    {
                        userName = ConsoleExtensions.Input("Input username: "******"Input password: "******"Login failed.");
                    }
                    else
                    {
                        remote.Token = token;
                        await workspace.Save();
                    }
                }
                catch
                {
                    logger.LogError("Login failed.");
                }
            }
            return(0);
        }
Пример #21
0
        public void Loop(string cmd, LightingConsole console)
        {
            CArgument a = ParseString(cmd);

            if (a is CText)
            {
                throw new Exception("No Function in Command");
            }
            else
            {
                CFunction func = a as CFunction;
                HandleFunction(func, console);
            }
        }
Пример #22
0
        protected override Task <int> Handle(CArgument argument, IConsole console, InvocationContext context, PipelineContext pipeline, CancellationToken cancellationToken)
        {
            ILogger   logger   = pipeline.Services.GetLogger();
            ITerminal terminal = console.GetTerminal();

            {
                terminal.OutputTable(logger.View(),
                                     new OutputTableColumnLogLevelView(nameof(LogItem.Level)),
                                     new OutputTableColumnStringView <LogItem>(x => x.Scope, nameof(LogItem.Scope)),
                                     new OutputTableColumnStringView <LogItem>(x => x.Time.ToString(CultureInfo.InvariantCulture.DateTimeFormat), nameof(LogItem.Time)),
                                     new OutputTableColumnStringView <LogItem>(x => x.Content, nameof(LogItem.Content))
                                     );
            }
            return(Task.FromResult(0));
        }
        public override async Task <int> Handle(CArgument argument, ParserContext parser, PipelineContext pipeline, CancellationToken cancellationToken)
        {
            IWorkspace workspace = pipeline.Services.GetWorkspace();

            if (argument.Delete)
            {
                await workspace.Clear();
            }
            else
            {
                await workspace.Initialize();

                await workspace.Templates.SetValue("c", Resources.Programming.FileTemplates.C);

                await workspace.Templates.SetValue("python", Resources.Programming.FileTemplates.Python);

                await workspace.Templates.SetValue("cpp", Resources.Programming.FileTemplates.Cpp);

                await workspace.Templates.SetValue("csharp", Resources.Programming.FileTemplates.CSharp);

                await workspace.Templates.SetValue("python", Resources.Programming.FileTemplates.Python);

                await workspace.Templates.SetValue("fsharp", Resources.Programming.FileTemplates.FSharp);

                await workspace.Templates.SetValue("go", Resources.Programming.FileTemplates.Go);

                await workspace.Templates.SetValue("java", Resources.Programming.FileTemplates.Java);

                await workspace.Templates.SetValue("dir", new Package <ITemplate>(FileBasedCommandLineOperation.GetDirectoryTemplate()));

                await workspace.Operations.SetValue("c", Resources.Programming.FileOperations.C);

                await workspace.Operations.SetValue("python", Resources.Programming.FileOperations.Python);

                await workspace.Operations.SetValue("cpp", Resources.Programming.FileOperations.Cpp);

                await workspace.Operations.SetValue("python", Resources.Programming.FileOperations.Python);

                await workspace.Operations.SetValue("go", Resources.Programming.FileOperations.Go);

                await workspace.Operations.SetValue("ruby", Resources.Programming.FileOperations.Ruby);

                await workspace.Operations.SetValue("javascript", Resources.Programming.FileOperations.JavaScript);

                await workspace.Operations.SetValue("dir", new Package <IOperation>(new FileBasedCommandLineOperation()));
            }
            return(0);
        }
Пример #24
0
        protected override async Task <int> Handle(CArgument argument, IConsole console, InvocationContext context, PipelineContext pipeline, CancellationToken cancellationToken)
        {
            Manager manager = pipeline.Services.GetManager();

            if (argument.Delete)
            {
                await manager.Clear();
            }
            else
            {
                await manager.Initialize();
            }
            CodeRunner.Extensions.IHost host = pipeline.Services.GetHost();
            ((ExtensionHost)host).Restart();
            return(0);
        }
Пример #25
0
        public override async Task <int> Handle(CArgument argument, IHost host, CancellationToken cancellationToken)
        {
            Workspace workspace = host.Services.GetRequiredService <Workspace>();

            if (argument.Current is null)
            {
                Console.WriteLine($"Current: {workspace.Option.CurrentRemote}");
                foreach (var item in workspace.Option.Remotes.Values)
                {
                    Console.WriteLine($"{item.Name} ({Enum.GetName(typeof(RemoteType), item.Type)}): {item.Uri}");
                }
            }
            else
            {
                workspace.Option.CurrentRemote = argument.Current;
                await workspace.Save();
            }
            return(0);
        }
Пример #26
0
        public override async Task <int> Handle(CArgument argument, IConsole console, InvocationContext context, CancellationToken cancellationToken)
        {
            Workspace workspace = Program.Workspace;

            using var client = new HttpClient();
            await workspace.Connect(client);

            var service = workspace.Remote !.PostService;
            var list    = (await service.All(cancellationToken)).ToList();

            console.Out.WriteLine($"Founded {list.Count} posts.");
            var items = await Task.WhenAll(list.Select(id => service.Get(id, cancellationToken)));

            foreach (var item in items)
            {
                cancellationToken.ThrowIfCancellationRequested();
                console.Out.WriteLine(item !.Title);
            }
            return(0);
        }
Пример #27
0
        public override async Task <int> Handle(CArgument argument, IHost host, CancellationToken cancellationToken)
        {
            Workspace workspace = host.Services.GetRequiredService <Workspace>();

            if (argument.Type == RemoteType.LocalFS)
            {
                argument.Uri = new DirectoryInfo(argument.Uri).FullName;
            }
            workspace.Option.Remotes.Add(argument.Name, new RemoteOption
            {
                Name  = argument.Name,
                Uri   = argument.Uri,
                Type  = argument.Type,
                Token = argument.Token
            });
            if (string.IsNullOrEmpty(workspace.Option.CurrentRemote))
            {
                workspace.Option.CurrentRemote = argument.Name;
            }
            await workspace.Save();

            return(0);
        }
Пример #28
0
        protected override async Task <int> Handle(CArgument argument, IConsole console, InvocationContext context, PipelineContext pipeline, CancellationToken cancellationToken)
        {
            Environment.CurrentDirectory = argument.Directory !.FullName;
            pipeline.Services.Add <IWorkspace>(new Managements.FSBased.Workspace(argument.Directory));
            ILogger logger = pipeline.Services.GetLogger();

            if (argument.Command != "")
            {
                Parser repl = CommandLines.CreateDefaultParser(pipeline.Services.GetReplCommand(), pipeline);
                pipeline.IsStopped = true;
                return(await repl.InvokeAsync(argument.Command, console));
            }

            if (argument.Verbose)
            {
            }
            else
            {
                _ = logger.UseLevelFilter(LogLevel.Information);
            }

            return(0);
        }
Пример #29
0
        protected override Task <int> Handle(CArgument argument, IConsole console, InvocationContext context, PipelineContext pipeline, CancellationToken cancellationToken)
        {
            Environment.CurrentDirectory = argument.Directory !.FullName;

            {
                Manager manager = new Manager(new DirectoryInfo(Environment.CurrentDirectory));
                pipeline.Services.Add <Manager>(manager);
            }

            pipeline.Services.Add <string>("fs", ServicesExtensions.ArgWorkspaceNameId);
            pipeline.Services.Add <string>(argument.Command, ServicesExtensions.ArgCommandId);

            ILogger logger = pipeline.Services.GetLogger();

            if (argument.Verbose)
            {
            }
            else
            {
                _ = logger.UseLevelFilter(LogLevel.Information);
            }

            return(Task.FromResult(0));
        }
Пример #30
0
        public void VisitFile(CFile file)
        {
            if (!canGenerate(file))
            {
                return;
            }

            visitor.PreVisitFile(file);

            filenamesrc = file.Token;

            new CNewline(null).Accept(visitor);

            if (instrument)
            {
                COption cCodeCoverage =
                    new COption(new CToken(file.Filename, TokenTypes.keyword, "option"),
                                new CToken(file.Filename, TokenTypes.keyword, "include"),
                                new CToken(file.Filename, TokenTypes.str, "cCodeCoverage.asp"));
                cCodeCoverage.Accept(this);
            }

            visitor.VisitFile(file);

            if (file.Attributes.contains("GenerateProcessAjaxFunction"))
            {
                CFunction unicoderequest = CProgram.Global.FindFunction("unicoderequest");
                CFunction intrequest     = CProgram.Global.FindFunction("intrequest");
                CFunction boolrequest    = CProgram.Global.FindFunction("boolrequest");

                CToken    tok         = CreateTokenWithAdditionalInfo("ProcessAjax", "processajax", TokenTypes.identifier);
                CFunction processAjax =
                    new CFunction(tok, tok.RawValue, tok.Value, TokenTypes.visPublic, CFunction.vbSub, null,
                                  new CTypeRef(null, BuiltIns.Void));

                CAccess pivotitem = new CAccess(unicoderequest.Token, unicoderequest.Token);
                pivotitem.ReferenceTarget = unicoderequest;
                CParameters pivotparams = new CParameters();
                pivotparams.Unnamed.Add(
                    new CConstantExpression(CreateTokenWithAdditionalInfo("sFunction", TokenTypes.str)));
                CSelect select =
                    new CSelect(CreateTokenWithAdditionalInfo("select", TokenTypes.controlFlow),
                                new CDefaultAccess(pivotitem.Token, pivotitem, pivotparams));

                IEnumerator      it   = CProgram.Global.Functions.GetEnumerator();
                List <CVariable> vars = new List <CVariable>();
                while (it.MoveNext())
                {
                    CFunction func = (CFunction)it.Current;
                    if (!func.Attributes.contains("ExecuteOnServer"))
                    {
                        continue;
                    }

                    CStatementBlock block      = new CStatementBlock();
                    CParameters     funcParams = new CParameters();
                    for (int ixArg = 0; ixArg < func.Arguments.Count - 3; ixArg++)
                    {
                        CArgument arg = func.Arguments[ixArg];

                        tok =
                            CreateTokenWithAdditionalInfo("vParam" + (ixArg + 1), "vparam" + (ixArg + 1),
                                                          TokenTypes.identifier);
                        if (ixArg >= vars.Count)
                        {
                            vars.Add(new CVariable(tok, false, new CTypeRef(null, BuiltIns.Variant), null, null, null));
                        }

                        CAssignment assign = new CAssignment(tok);

                        CAccess left = new CAccess(tok, tok);
                        left.ReferenceTarget = vars[ixArg];
                        assign.Target        = left;
                        funcParams.Unnamed.Add(left);

                        CFunction rightfunc = intrequest;
                        if (arg.Type.RawName == "Boolean")
                        {
                            rightfunc = boolrequest;
                        }
                        else if (arg.Type.RawName == "String")
                        {
                            rightfunc = unicoderequest;
                        }

                        CParameters parameters = new CParameters();
                        parameters.Unnamed.Add(
                            new CConstantExpression(CreateTokenWithAdditionalInfo(tok.RawValue, TokenTypes.str)));

                        CAccess rightitem = new CAccess(rightfunc.Token, rightfunc.Token);
                        rightitem.ReferenceTarget = rightfunc;

                        assign.Source = new CDefaultAccess(rightfunc.Token, rightitem, parameters);
                        assign.Source.RhsAssignmentSource = true;

                        block.Add(assign);
                    }

                    CAccess        calledItem = new CAccess(func.Token, func.Token);
                    CDefaultAccess called     = new CDefaultAccess(func.Token, calledItem, funcParams);
                    calledItem.ReferenceTarget = calledItem.ReferenceTarget = func;

                    if (func.Attributes.contains("picture") || func.FunctionType == CFunction.vbFunction)
                    {
                        CAccess returnItem = new CAccess(processAjax.Token, processAjax.Token);
                        returnItem.ReferenceTarget = processAjax;

                        CAssignment assign = new CAssignment(processAjax.Token);
                        assign.Target = returnItem;

                        if (func.FunctionType == CFunction.vbFunction)
                        {
                            assign.Source = called;
                        }
                        else
                        {
                            assign.Source = new CPictureOfExpression(tok, called);
                        }

                        block.Add(assign);
                    }
                    else
                    {
                        block.Add(new CExpressionStatement(called));
                    }

                    tok = CreateTokenWithAdditionalInfo("case", TokenTypes.controlFlow);
                    CExpression exp =
                        new CConstantExpression(CreateTokenWithAdditionalInfo(func.RawName, TokenTypes.str));
                    select.Cases.Add(new CCase(tok, exp, block));
                }

                CDim dim = new CDim(CreateTokenWithAdditionalInfo("Dim", TokenTypes.declaration));
                dim.Variables.AddRange(vars);
                processAjax.Statements.Add(dim);
                processAjax.Statements.Add(select);

                CNewline nl = new CNewline(CreateTokenWithAdditionalInfo("\n", TokenTypes.newline));
                nl.Accept(this);
                processAjax.Accept(this);
                nl.Accept(this);
            }
        }