ParseCommand() public method

public ParseCommand ( ) : ICommand
return ICommand
コード例 #1
0
ファイル: Program.cs プロジェクト: tario/AjScript-migrated
        static void Main(string[] args)
        {
            IContext context = new Context();
            Parser parser = new Parser(System.Console.In);
            context.DefineVariable("write");
            context.SetValue("write", new WriteFunction());
            context.DefineVariable("writeln");
            context.SetValue("writeln", new WriteLineFunction());
            context.DefineVariable("Object");
            context.SetValue("Object", new ObjectFunction(context));

            Console.WriteLine("AjScript 0.1 (JavaScript-like Interpreter in C#)");

            for (ICommand cmd = parser.ParseCommand(); cmd != null; cmd = parser.ParseCommand())
                cmd.Execute(context);
        }
コード例 #2
0
        private void EvaluateCommands(string text)
        {
            Parser parser = new Parser(text);

            for (ICommand cmd = parser.ParseCommand(); cmd != null; cmd = parser.ParseCommand())
                cmd.Execute(this.context);
        }
コード例 #3
0
ファイル: FilesTests.cs プロジェクト: tario/AjScript-migrated
        private object EvaluateFile(string filename)
        {
            Parser parser = new Parser(new StreamReader(filename));

            for (ICommand cmd = parser.ParseCommand(); cmd != null; cmd = parser.ParseCommand())
                cmd.Execute(this.context);

            return this.context.GetValue("result");
        }