Exemple #1
0
        public List <CssElement> Parse()
        {
            var elements = new List <CssElement>();

            while (!Eof())
            {
                string elementName = ParseElementName();

                if (string.IsNullOrEmpty(elementName))
                {
                    break;
                }

                var element = new CssElement(elementName);

                var name  = ParseAttributeName();
                var value = ParseAttributeValue();

                while (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(value))
                {
                    element.Add(name, value);

                    EatWhiteSpace();

                    if (GetCurrentChar() == '}')
                    {
                        m_idx++;
                        break;
                    }

                    name  = ParseAttributeName();
                    value = ParseAttributeValue();
                }

                elements.Add(element);
            }

            return(elements);
        }
Exemple #2
0
 public void Add(CssElement element)
 {
     Elements.Add(element);
 }