Exemple #1
0
        public bool Execute(DataContext context)
        {
            try
            {
                UserInterfaceVisitor visitor = new UserInterfaceVisitor(context.ValueReferenceTable, context.ASTHandlerExceptions, ElementsToDisplay, _rebuildMethod);
                context.RootNode.Accept(visitor);
            }
            catch (QLError ex)
            {
                context.ASTHandlerExceptions.Add(ex);
                return false;
            }

            return !context.ASTHandlerExceptions.Any();
        }
Exemple #2
0
        public bool Execute(DataContext context)
        {
            context.ASTHandlerExceptions.Clear();
            context.ValueReferenceTable.ClearIdentifiers();

            EvaluatorVisitor evaluator = new EvaluatorVisitor(context.ASTHandlerExceptions, context.ValueReferenceTable);
            try
            {
                context.RootNode.Accept(evaluator);
            }
            catch (QLError ex)
            {   // Exceptions preventing Evaluator from finishing
                context.ASTHandlerExceptions.Add(ex);
                return false;
            }

            return !context.ASTHandlerExceptions.Any();
        }
Exemple #3
0
        public bool Execute(DataContext context)
        {
            if (context.Input != null)
            {
                context.AntlrInput = new AntlrInputStream(context.Input);
            }
            else if (context.InputStream != null)
            {
                context.AntlrInput = new AntlrInputStream(context.InputStream);
            }
            else
            {
                context.ASTHandlerExceptions.Add(new QLError("No proper input provided for building an AST"));
                return false;
            }

            return !context.ASTHandlerExceptions.Any();
        }
Exemple #4
0
        public bool Execute(DataContext context)
        {
            context.ASTHandlerExceptions.Clear();

            IDictionary<string, object> unitsToAnswers = new Dictionary<string, object>();
            ExporterVisitor exporter = new ExporterVisitor(unitsToAnswers);

            try
            {
                context.RootNode.Accept(exporter);
            }
            catch (QLError ex)
            {
                // Errors preventing exporter from finishing
                context.ASTHandlerExceptions.Add(ex);
                return false;
            }
            finally
            {
                context.ExportableRepresentation = JsonConvert.SerializeObject(unitsToAnswers, Formatting.Indented);
            }

            return !context.ASTHandlerExceptions.Any();
        }
Exemple #5
0
 public QLBuilder(Stream input)
     : this()
 {
     DataContext = new DataContext(input);
 }
Exemple #6
0
 public QLBuilder(string input)
     : this()
 {
     DataContext = new DataContext(input);
 }