HasErrors() 공개 메소드

public HasErrors ( ) : bool
리턴 bool
 public override void BuildAst(LanguageData language, ParseTree parseTree) {
   var opHandler = new OperatorHandler(language.Grammar.CaseSensitive);
   Util.Check(!parseTree.HasErrors(), "ParseTree has errors, cannot build AST.");
   var astContext = new InterpreterAstContext(language, opHandler);
   var astBuilder = new AstBuilder(astContext);
   astBuilder.BuildAst(parseTree);
 }
예제 #2
0
 public void Validate(ParseTree parseTree)
 {
     if (parseTree.HasErrors() && parseTree.ParserMessages.Count > 0)
     {
         var message = parseTree.ParserMessages[0];
         var error = message.Message + " at " + message.Location.ToUiString();
         throw new Exception(error);
     }
 }
예제 #3
0
        public void TryParse(string source)
        {
            //ClearParserOutput();
            if (_parser == null || !_parser.Language.CanParse()) return;
            _parseTree = null;
            GC.Collect(); //to avoid disruption of perf times with occasional collections
            //_parser.Context.TracingEnabled = chkParserTrace.Checked;

            try
            {
                _parseTree = _parser.Parse(source);
                if (_parseTree.HasErrors() == false)
                {
                    UpdateOutlineWindow();
                    statusBarControl.State = new LPSolverState("Done.", EnumEditorStates.Normal);
                }
                //else
                //{
                //    throw new Exception("Could not Parse the Model. Please Check Error List");
                //}
            }
            catch (Exception exp)
            {
                statusBarControl.State = new LPSolverState("Parser Error - " + exp.Message, EnumEditorStates.Error);
            }
            finally
            {
                _parseTree = _parser.Context.CurrentParseTree;
                ShowCompilerErrors();
            }
        }
예제 #4
0
 public static void CheckParseErrors(ParseTree parseTree)
 {
     if (parseTree.HasErrors())
     throw new Exception("Unexpected parse error(s): " + string.Join("\n", parseTree.ParserMessages));
 }
예제 #5
0
파일: Kasteps.cs 프로젝트: kb10uy/Kb10uy
 /// <summary>
 /// スクリプトを解析し、処理ができるようにします。
 /// 通常、この関数はスクリプトを読み込んだ時点で自動的に実行されます。
 /// </summary>
 public void Parse()
 {
     RawTree = Parser.Parse(RawString);
     if (RawTree.HasErrors())
     {
         var exm = "Kastepsスクリプトにエラーがありました。" + Environment.NewLine;
         foreach (var m in RawTree.ParserMessages)
         {
             exm += String.Format("{0} @[{1},{2}]: {3}", m.Level, m.Location.Line, m.Location.Column, m.Message);
         }
         throw new InvalidDataException(exm);
     }
 }
예제 #6
0
 public bool HasErrors()
 {
     return(parseTree.HasErrors());
 }