Ejemplo n.º 1
0
        void ParseAttType(char ch, AttDef attdef)
        {
            if (ch == '%')
            {
                var e = ParseParameterEntity(WhiteSpace);
                PushEntity(_current.ResolvedUri, e);
                ParseAttType(_current.Lastchar, attdef);
                PopEntity(); // bugbug - are we at the end of the entity?
                return;
            }

            if (ch == '(')
            {
                attdef.SetEnumeratedType(ParseNameGroup(ch, false), AttributeType.ENUMERATION);
            }
            else
            {
                var token = ScanName(WhiteSpace);
                if (token.EqualsIgnoreCase("NOTATION"))
                {
                    ch = _current.SkipWhitespace();
                    if (ch != '(')
                    {
                        _current.Error("Expecting name group '(', but found '{0}'", ch);
                    }
                    attdef.SetEnumeratedType(ParseNameGroup(ch, true), AttributeType.NOTATION);
                }
                else
                {
                    attdef.SetType(token);
                }
            }
        }
Ejemplo n.º 2
0
        AttDef ParseAttDef()
        {
            var name = ScanName(WhiteSpace);

            name = name.ToUpperInvariant();
            var attdef = new AttDef(name);

            var ch = _current.SkipWhitespace();

            if (ch == '-')
            {
                ch = ParseDeclComments();
            }

            ParseAttType(ch, attdef);

            ch = _current.SkipWhitespace();
            if (ch == '-')
            {
                ch = ParseDeclComments();
            }

            ParseAttDefault(ch, attdef);

            ch = _current.SkipWhitespace();
            if (ch == '-')
            {
                ParseDeclComments();
            }

            return(attdef);
        }
Ejemplo n.º 3
0
        void ParseAttDefault(char ch, AttDef attdef)
        {
            if (ch == '%')
            {
                var e = ParseParameterEntity(WhiteSpace);
                PushEntity(_current.ResolvedUri, e);
                ParseAttDefault(_current.Lastchar, attdef);
                PopEntity(); // bugbug - are we at the end of the entity?
                return;
            }

            var hasdef = true;

            if (ch == '#')
            {
                _current.ReadChar();
                var token = _current.ScanToken(_sb, WhiteSpace, true);
                hasdef = attdef.SetPresence(token);
                ch     = _current.SkipWhitespace();
            }
            if (!hasdef)
            {
                return;
            }

            if (ch == '\'' || ch == '"')
            {
                var lit = _current.ScanLiteral(_sb, ch);
                attdef.Default = lit;
                _current.SkipWhitespace();
            }
            else
            {
                var name = _current.ScanToken(_sb, WhiteSpace, false);
                name           = name.ToUpperInvariant();
                attdef.Default = name; // bugbug - must be one of the enumerated names.
                _current.SkipWhitespace();
            }
        }