Ejemplo n.º 1
0
        private static void OnParsingFinished(object sender, CommonInterfaces.ParsingFinishedArgs args)
        {
            string lang = args.Lang;

            if (!parsedSppf.ContainsKey(lang))
            {
                parsedSppf.Add(lang, 0);
            }
            else
            {
                parsedSppf[lang]++;
            }

            Action action =
                () =>
            {
                var isEnd = false;
                while (!isEnd)
                {
                    Tuple <ITreeNode, bool> res = YcProcessor.GetNextTree(lang, parsedSppf[lang]);
                    ExistingTreeNodes.AddTree(res.Item1);
                    isEnd = res.Item2;
                }
            };

            using (TaskBarrier fibers = Process.DaemonProcess.CreateFibers())
            {
                fibers.EnqueueJob(action);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Do highlighting some tokens chunk.
        /// </summary>
        /// <param name="sender">Now always null</param>
        /// <param name="args"></param>
        private static void OnLexingFinished(object sender, CommonInterfaces.LexingFinishedArgs <ITreeNode> args)
        {
            IHighlightingConsumer consumer = Process.Consumer;
            var processor = new TreeNodeProcessor(consumer, Process.CSharpFile);

            string xmlPath = YcProcessor.XmlPath(args.Lang);

            ColorHelper.ParseFile(xmlPath, args.Lang);

            Action action =
                () => args.Tokens.ForEach(node => processor.ProcessAfterInterior(node));

            using (TaskBarrier fibers = Process.DaemonProcess.CreateFibers())
            {
                fibers.EnqueueJob(action);
            }

            Process.DoHighlighting(new DaemonStageResult(consumer.Highlightings));
        }