示例#1
0
 public void AddParse(string key, CsGlobalNamespace globals)
 {
     var parse = new Parse(0, "test.cs", 0, 0, globals, new Token[0], new Token[0]);
     lock (m_mutex)
     {
         m_parses[key] = parse;
     }
 }
        private void DoProcessParse(Parse parse)
        {
            var decs = new List<Declaration>();

            CsGlobalNamespace globals = parse.Globals;
            if (globals != null)
            {
                DoGetDeclarations(globals, string.Empty, decs);
                DoGetDirectives(globals.Preprocess, decs);

                decs.Sort((lhs, rhs) => lhs.Extent.location.CompareTo(rhs.Extent.location));

                var data = new Declarations(parse.Key, parse.Edit, decs.ToArray());
                Broadcaster.Invoke("computed declarations", data);
            }
        }
示例#3
0
        private void DoParseMatch(Parse parse, List<StyleRun> runs)
        {
            if (parse.ErrorLength > 0)
                runs.Add(new StyleRun(parse.ErrorIndex, parse.ErrorLength, "ParseError"));

            if (parse.Globals != null)
                DoMatchScope(parse.Globals, runs);
        }
示例#4
0
 private void DoQueueJob(Parse parse)
 {
     lock (m_mutex)
     {
         Log.WriteLine(TraceLevel.Verbose, "Styler", "queuing parse {0} for edit {1}", System.IO.Path.GetFileName(parse.Key), parse.Edit);
         m_parses.Add(parse);
         Monitor.Pulse(m_mutex);
     }
 }
示例#5
0
        private void DoComputeRuns(Parse parse)
        {
            var runs = new List<StyleRun>();
            DoParseMatch(parse, runs);
            Log.WriteLine(TraceLevel.Verbose, "Styler", "computed runs for parse {0} edit {1}", System.IO.Path.GetFileName(parse.Key), parse.Edit);

            lock (m_mutex)
            {
                Styles styles;
                if (!m_styles.TryGetValue(parse.Key, out styles))
                {
                    styles = new Styles();
                    m_styles.Add(parse.Key, styles);
                }
                styles.ParsedStyles = new StyleRuns(m_boss, parse.Key, parse.Edit, runs.ToArray());

                DoTryBroadcast(parse.Key);
            }
        }