示例#1
0
        void attrib(out BoneSoft.CSS.Attribute atb)
        {
            atb       = new BoneSoft.CSS.Attribute();
            atb.Value = "";
            string quote = null;
            string ident = null;

            Expect(35);
            while (la.kind == 4)
            {
                Get();
            }
            identity(out ident);
            atb.Operand = ident;
            while (la.kind == 4)
            {
                Get();
            }
            if (StartOf(14))
            {
                switch (la.kind)
                {
                case 36: {
                    Get();
                    atb.Operator = AttributeOperator.Equals;
                    break;
                }

                case 37: {
                    Get();
                    atb.Operator = AttributeOperator.InList;
                    break;
                }

                case 38: {
                    Get();
                    atb.Operator = AttributeOperator.Hyphenated;
                    break;
                }

                case 39: {
                    Get();
                    atb.Operator = AttributeOperator.EndsWith;
                    break;
                }

                case 40: {
                    Get();
                    atb.Operator = AttributeOperator.BeginsWith;
                    break;
                }

                case 41: {
                    Get();
                    atb.Operator = AttributeOperator.Contains;
                    break;
                }
                }
                while (la.kind == 4)
                {
                    Get();
                }
                if (StartOf(3))
                {
                    if (la.kind == 24)
                    {
                        Get();
                        atb.Value += "-";
                    }
                    identity(out ident);
                    atb.Value += ident;
                }
                else if (la.kind == 7 || la.kind == 8)
                {
                    QuotedString(out quote);
                    atb.Value = quote;
                }
                else
                {
                    SynErr(56);
                }
                while (la.kind == 4)
                {
                    Get();
                }
            }
            Expect(42);
        }
示例#2
0
        void attrib(out BoneSoft.CSS.Attribute atb)
        {
            atb = new BoneSoft.CSS.Attribute();
            atb.Value = "";
            string quote = null;
            string ident = null;

            Expect(35);
            while (la.kind == 4) {
                Get();
            }
            identity(out ident);
            atb.Operand = ident;
            while (la.kind == 4) {
                Get();
            }
            if (StartOf(14)) {
                switch (la.kind) {
                    case 36: {
                            Get();
                            atb.Operator = AttributeOperator.Equals;
                            break;
                        }
                    case 37: {
                            Get();
                            atb.Operator = AttributeOperator.InList;
                            break;
                        }
                    case 38: {
                            Get();
                            atb.Operator = AttributeOperator.Hyphenated;
                            break;
                        }
                    case 39: {
                            Get();
                            atb.Operator = AttributeOperator.EndsWith;
                            break;
                        }
                    case 40: {
                            Get();
                            atb.Operator = AttributeOperator.BeginsWith;
                            break;
                        }
                    case 41: {
                            Get();
                            atb.Operator = AttributeOperator.Contains;
                            break;
                        }
                }
                while (la.kind == 4) {
                    Get();
                }
                if (StartOf(3)) {
                    if (la.kind == 24) {
                        Get();
                        atb.Value += "-";
                    }
                    identity(out ident);
                    atb.Value += ident;
                } else if (la.kind == 7 || la.kind == 8) {
                    QuotedString(out quote);
                    atb.Value = quote;
                } else SynErr(55);
                while (la.kind == 4) {
                    Get();
                }
            }
            Expect(42);
        }
示例#3
0
        void simpleselector(out SimpleSelector ss)
        {
            ss             = new SimpleSelector();
            ss.ElementName = "";
            string psd = null;

            BoneSoft.CSS.Attribute atb    = null;
            SimpleSelector         parent = ss;
            string ident = null;

            if (StartOf(3))
            {
                if (la.kind == 24)
                {
                    Get();
                    ss.ElementName += "-";
                }
                identity(out ident);
                ss.ElementName += ident;
            }
            else if (la.kind == 32)
            {
                Get();
                ss.ElementName = "*";
            }
            else if (StartOf(13))
            {
                if (la.kind == 33)
                {
                    Get();
                    if (la.kind == 24)
                    {
                        Get();
                        ss.ID = "-";
                    }
                    identity(out ident);
                    if (ss.ID == null)
                    {
                        ss.ID = ident;
                    }
                    else
                    {
                        ss.ID += ident;
                    }
                }
                else if (la.kind == 34)
                {
                    Get();
                    ss.Class = "";
                    if (la.kind == 24)
                    {
                        Get();
                        ss.Class += "-";
                    }
                    identity(out ident);
                    ss.Class += ident;
                }
                else if (la.kind == 35)
                {
                    attrib(out atb);
                    ss.Attribute = atb;
                }
                else
                {
                    pseudo(out psd);
                    ss.Pseudo = psd;
                }
            }
            else
            {
                SynErr(55);
            }
            while (StartOf(13))
            {
                SimpleSelector child = new SimpleSelector();
                if (la.kind == 33)
                {
                    Get();
                    if (la.kind == 24)
                    {
                        Get();
                        child.ID = "-";
                    }
                    identity(out ident);
                    if (child.ID == null)
                    {
                        child.ID = ident;
                    }
                    else
                    {
                        child.ID += "-";
                    }
                }
                else if (la.kind == 34)
                {
                    Get();
                    child.Class = "";
                    if (la.kind == 24)
                    {
                        Get();
                        child.Class += "-";
                    }
                    identity(out ident);
                    child.Class += ident;
                }
                else if (la.kind == 35)
                {
                    attrib(out atb);
                    child.Attribute = atb;
                }
                else
                {
                    pseudo(out psd);
                    child.Pseudo = psd;
                }
                parent.Child = child;
                parent       = child;
            }
        }