Parse() public method

public Parse ( ) : void
return void
Example #1
0
        public ParseTree Parse(string sourceText, string fileName)
        {
            if (Context.Status != ParserStatus.AcceptedPartial)
            {
                Reset();
            }
            Context.SourceStream.SetText(sourceText, 0, Context.Status == ParserStatus.AcceptedPartial);
            Context.CurrentParseTree = new ParseTree(sourceText, fileName);
            Context.Status           = ParserStatus.Parsing;
            int start = Environment.TickCount;

            CoreParser.Parse();
            Context.CurrentParseTree.ParseTime = Environment.TickCount - start;
            UpdateParseTreeStatus();
            return(Context.CurrentParseTree);
        }
Example #2
0
        public ParseTree Parse(string sourceText, string fileName)
        {
            if (Context.Status != ParserStatus.AcceptedPartial)
            {
                Reset();
            }
            var createAst         = Language.Grammar.LanguageFlags.IsSet(LanguageFlags.CreateAst);
            var keepLineNumbering = Context.Status == ParserStatus.AcceptedPartial;

            Context.SourceStream.SetText(sourceText, 0, keepLineNumbering);
            Context.CurrentParseTree = new ParseTree(sourceText, fileName);
            Context.Status           = ParserStatus.Parsing;
            var sw = new Stopwatch();

            sw.Start();
            CoreParser.Parse();
            sw.Stop();
            Context.CurrentParseTree.ParseTimeMilliseconds = sw.ElapsedMilliseconds;
            UpdateParseTreeStatus();
            return(Context.CurrentParseTree);
        }