示例#1
0
        /// <summary>
        /// Ported from journal_t::read_textual(parse_context_stack_t& context_stack)
        /// </summary>
        public int ReadTextual(ParseContextStack contextStack)
        {
            var trace = Logger.Current.TraceContext(TimerName.ParsingTotal, 1)?.Message("Total time spent parsing text:").Start(); // TRACE_START

            TextualParser instance = new TextualParser(contextStack, contextStack.GetCurrent(), null, CheckingStyle == JournalCheckingStyleEnum.CHECK_PERMISSIVE);

            instance.ApplyStack.PushFront("account", contextStack.GetCurrent().Master);
            instance.Parse();

            trace?.Stop(); // TRACE_STOP

            // Apply any deferred postings at this time
            Master.ApplyDeferredPosts();

            // These tracers were started in textual.cc
            Logger.Current.TraceContext(TimerName.XactText, 1)?.Finish();   // TRACE_FINISH
            Logger.Current.TraceContext(TimerName.XactDetails, 1)?.Finish();
            Logger.Current.TraceContext(TimerName.XactPosts, 1)?.Finish();
            Logger.Current.TraceContext(TimerName.Xacts, 1)?.Finish();
            Logger.Current.TraceContext(TimerName.InstanceParse, 1)?.Finish();  // report per-instance timers
            Logger.Current.TraceContext(TimerName.ParsingTotal, 1)?.Finish();

            if (contextStack.GetCurrent().Errors > 0)
            {
                throw new CountError(contextStack.GetCurrent().Errors);
            }

            return(contextStack.GetCurrent().Count);
        }
示例#2
0
        public int ReadTextual(ParseContextStack contextStack)
        {
            TextualParser instance = new TextualParser(contextStack, contextStack.GetCurrent(), null, CheckingStyle == JournalCheckingStyleEnum.CHECK_PERMISSIVE);

            instance.ApplyStack.PushFront("account", contextStack.GetCurrent().Master);
            instance.Parse();

            // Apply any deferred postings at this time
            Master.ApplyDeferredPosts();

            if (contextStack.GetCurrent().Errors > 0)
            {
                throw new CountError(contextStack.GetCurrent().Errors);
            }

            return(contextStack.GetCurrent().Count);
        }