Beispiel #1
0
        void selector(out Selector sel)
        {
            sel = new Selector();
            SimpleSelector ss = null;
            Combinator? cb = null;

            simpleselector(out ss);
            sel.SimpleSelectors.Add(ss);
            while (StartOf(11))
            {
                if (la.kind == 28 || la.kind == 29 || la.kind == 30)
                {
                    if (la.kind == 28)
                    {
                        Get();
                        cb = Combinator.PrecededImmediatelyBy;
                    }
                    else if (la.kind == 29)
                    {
                        Get();
                        cb = Combinator.ChildOf;
                    }
                    else
                    {
                        Get();
                        cb = Combinator.PrecededBy;
                    }
                }
                simpleselector(out ss);
                if (cb.HasValue) { ss.Combinator = cb.Value; }
                sel.SimpleSelectors.Add(ss);

                cb = null;
            }
        }
Beispiel #2
0
        static string Render(Selector sel)
        {
            StringBuilder txt = new StringBuilder();

            bool first = true;
            foreach (SimpleSelector ss in sel.SimpleSelectors)
            {
                if (first) { first = false; } else { txt.Append(" "); }
                txt.AppendFormat("<span class=\"simpleSelector\">{0}</span>", Render(ss));
            }

            return txt.ToString();
        }