Exemplo n.º 1
0
 /// <summary>
 /// Internal use
 /// </summary>
 /// <param name="mlines">The mlines.</param>
 /// <param name="filename">The filename.</param>
 /// <param name="cb">The cb.</param>
 /// <returns></returns>
 internal int Parse(DoubleLinkedList <TokenLine> mlines, string filename, IParserCallback cb)
 {
     lock (this)
     {
         this.cb = cb;
         return(Parse(new ParseTokenEnumerator(mlines, filename, this)));
     }
 }
Exemplo n.º 2
0
        internal void Preprocess(DoubleLinkedList <TokenLine> lines, string filename, IParserCallback cb, ArrayList pairings, params string[] defined)
        {
            this.pairings = new ArrayList();
            isdisabled    = false;

            condstack.Clear();
            regionstack.Clear();
            defines.Clear();
            foreach (string d in defined)
            {
                if (d != null)
                {
                    defines.Add(d, d);
                }
            }
            this.cb = cb;
            Preprocess(new PreprocessorTokenEnumerator(lines, filename, this));

            Set pp = new Set(pairings) & new Set(this.pairings);

            foreach (Pairing p in this.pairings)
            {
                if (pp.Contains(p))
                {
                    // we have to replace it here, else references wont point correctly
                    Pairing old = pp.Replace(p) as Pairing;
                    p.hidden = old.hidden;
                }
                else
                {
                    pp.Add(p);
                }
            }

            pairings.Clear();
            pairings.AddRange(pp);
            pairings.Sort();

            while (regionstack.Count > 0)
            {
                Region c = (Region)regionstack.Pop();
                c.start.Error = true;
                cb.Invoke(c.start);
                ServiceHost.Error.OutputErrors(new ActionResult("Region " + c.text + " not terminated", c.start));
            }

            while (condstack.Count > 0)
            {
                Conditional c = (Conditional)condstack.Pop();
                c.start.Error = true;
                cb.Invoke(c.start);
                ServiceHost.Error.OutputErrors(new ActionResult("Conditional " + c.text + " not terminated", c.start));
            }

            this.pairings.Clear();
            this.pairings = null;
        }