Beispiel #1
0
        public override State Execute(string input)
        {
            if (Repository.GlobalSymbolTable != null && Repository.GlobalSymbolTable.Symbols.Any())
            {
                Console.WriteLine("Press Y to delete current symbols before next query exection.");
                var key = Console.ReadKey(true);

                if (key.KeyChar == 'y' || key.KeyChar == 'Y')
                {
                    clearState.Execute("");
                }
            }

            try
            {
                var queryNode = queryReader.Parse(Repository.Query);
                //funcVisitor.Visit(queryNode); todo user func
                symbolVisitor.Visit(queryNode);
                executionVisitor.Visit(queryNode);

                Repository.GlobalSymbolTable = queryNode.SymbolTable;
            }
            catch (QueryException e)
            {
                Console.Clear();
                Console.WriteLine(e.Message);

                return(queryShowState);
            }


            Repository.Query = string.Empty;

            return(resultShowState);
        }
Beispiel #2
0
        public override State Execute(string input)
        {
            var path = settings.Log.PathQueryFileIn;

            if (!File.Exists(path))
            {
                Console.WriteLine("Query file not found:" + path);
                return(null);
            }
            var text    = File.ReadAllText(path);
            var queries = text.Split('~');

            var j = 0;

            foreach (var query in queries)
            {
                j++;
                for (int i = 0; i < settings.Log.Cycles; i++)
                {
                    Console.WriteLine("Performance testing cycle " + i + ", query " + j);
                    var queryNode = queryReader.Parse(query);
                    //funcVisitor.Visit(queryNode); todo user func
                    symbolVisitor.Visit(queryNode);
                    executionVisitor.Visit(queryNode);
                    Reset();
                }
                logger.Write(j);
            }
            return(null);
        }
Beispiel #3
0
 public override TResult Accept <TResult>(ISymbolVisitor <TResult> visitor)
 {
     return(visitor.Visit(this));
 }
Beispiel #4
0
 public override void Accept(ISymbolVisitor visitor)
 {
     visitor.Visit(this);
 }
Beispiel #5
0
 public void Accept(ISymbolVisitor visitor)
 {
     visitor.Visit(this);
 }
Beispiel #6
0
 T IVisitableSymbol.Visit <T>(ISymbolVisitor <T> visitor)
 => visitor.Visit(this);