コード例 #1
0
 public void Initialize(string input)
 {
     Builder = new QLBuilder(input);
     Builder.RegisterGenericDataHandlers();
     Assert.IsTrue(Builder.RunInit());
     Assert.IsTrue(Builder.RunASTBuilders());
 }
コード例 #2
0
        static void Main(string[] args)
        {
            while (true)
            {
                Console.WriteLine("Please enter QL syntax commit by Ctrl+Z. Quit by Ctrl+C");
                Console.WriteLine();

                Stream inputStream = Console.OpenStandardInput();

                QLBuilder ast = new QLBuilder(inputStream);

                ast.RegisterGenericDataHandlers();
                ast.RunInit();
                ast.RunASTBuilders();
                ast.RunTypeCheckers();
                ast.RunEvaluators();

                foreach (Exception e in ast.UnhandledExceptions)
                {
                    Console.WriteLine(e.ToString());
                }

                Console.Write("Hit <return> to restart");
                Console.ReadLine();
                Console.Clear();
            }
        }
コード例 #3
0
        public void MinusSign()
        {
            string    input   = @"form ExampleBlock {
                statement Smthing1 (number, (1+(2 -3))) ""this "";
                statement Smthing2 (number, (1+(2-3))) ""should"";
                statement Smthing3 (number, (1+(2 --3))) ""be"";
                statement Smthing4 (number, (1+(2-- 3))) ""solved"";

                }

            ";
            QLBuilder Handler = new QLBuilder(input);

            Handler.RegisterGenericDataHandlers();
            Assert.AreEqual(true, Handler.RunInit());
            Assert.AreEqual(true, Handler.RunASTBuilders());
        }