/// <summary> /// Validate the statements for errors. /// </summary> /// <param name="stmts">Statements to validate</param> /// <returns></returns> public bool Validate(List <Expr> stmts) { if (stmts == null || stmts.Count == 0) { return(true); } _ctx = stmts[0].Ctx; // Reset the errors. _errors.Clear(); _errors = new List <SemActsResult>(); // Use the visitor to walk the AST tree of statements/expressions var visitor = new AstVisitor((astnode) => Validate(astnode)); visitor.Visit(stmts); // Now check for success. bool success = _errors.Count == 0; _results = new SemActsResults(success); _results.Results = _errors; return(success); }
/// <summary> /// Validate the statements for errors. /// </summary> /// <param name="stmts">Statements to validate</param> /// <returns></returns> public RunResult Validate(List <Expr> stmts) { var start = DateTime.Now; if (stmts == null || stmts.Count == 0) { return(new RunResult(start, start, true, "No nodes to validate")); } _ctx = stmts[0].Ctx; // Reset the errors. _errors = new List <ScriptError>(); _parseStk = new ParseStackManager(); // Use the visitor to walk the AST tree of statements/expressions var visitor = new AstVisitor((astnode1) => Validate(astnode1), (astnode2) => OnNodeEnd(astnode2)); visitor.Visit(stmts); var end = DateTime.Now; // Now check for success. var success = _errors.Count == 0; _results = new RunResult(start, end, success, _errors); _results.Errors = _errors; return(_results); }
/// <summary> /// Validate the statements for errors. /// </summary> /// <param name="stmts">Statements to validate</param> /// <returns></returns> public RunResult Validate(List<Expr> stmts) { var start = DateTime.Now; if (stmts == null || stmts.Count == 0) return new RunResult(start, start, true, "No nodes to validate"); _ctx = stmts[0].Ctx; // Reset the errors. _errors = new List<ScriptError>(); _parseStk = new ParseStackManager(); // Use the visitor to walk the AST tree of statements/expressions var visitor = new AstVisitor((astnode1) => Validate(astnode1), (astnode2) =>OnNodeEnd(astnode2)); visitor.Visit(stmts); var end = DateTime.Now; // Now check for success. bool success = _errors.Count == 0; _results = new RunResult(start, end, success, _errors); _results.Errors = _errors; return _results; }