Example #1
0
        private AttDef ParseAttDef(char ch)
        {
            ch = this.m_current.SkipWhitespace();
            var name = ScanName(WhiteSpace);

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

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

            ParseAttType(ch, attdef);

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

            ParseAttDefault(ch, attdef);

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

            return(attdef);
        }
Example #2
0
        private void ParseAttDefault(char ch, AttDef attdef)
        {
            if (ch == '%')
            {
                var e = ParseParameterEntity(WhiteSpace);
                PushEntity(this.m_current.ResolvedUri, e);
                ParseAttDefault(this.m_current.Lastchar, attdef);
                PopEntity(); // bugbug - are we at the end of the entity?
                ch = this.m_current.Lastchar;
                return;
            }

            var hasdef = true;

            if (ch == '#')
            {
                this.m_current.ReadChar();
                var token = this.m_current.ScanToken(this.m_sb, WhiteSpace, true);
                hasdef = attdef.SetPresence(token);
                ch     = this.m_current.SkipWhitespace();
            }
            if (hasdef)
            {
                if (ch == '\'' || ch == '"')
                {
                    var lit = this.m_current.ScanLiteral(this.m_sb, ch);
                    attdef.Default = lit;
                    ch             = this.m_current.SkipWhitespace();
                }
                else
                {
                    var name = this.m_current.ScanToken(this.m_sb, WhiteSpace, false);
                    name           = name.ToUpperInvariant();
                    attdef.Default = name; // bugbug - must be one of the enumerated names.
                    ch             = this.m_current.SkipWhitespace();
                }
            }
        }
Example #3
0
        private void ParseAttType(char ch, AttDef attdef)
        {
            if (ch == '%')
            {
                var e = ParseParameterEntity(WhiteSpace);
                PushEntity(this.m_current.ResolvedUri, e);
                ParseAttType(this.m_current.Lastchar, attdef);
                PopEntity(); // bugbug - are we at the end of the entity?
                ch = this.m_current.Lastchar;
                return;
            }

            if (ch == '(')
            {
                //attdef.EnumValues = ParseNameGroup(ch, false);
                //attdef.Type = AttributeType.ENUMERATION;
                attdef.SetEnumeratedType(ParseNameGroup(ch, false), AttributeType.ENUMERATION);
            }
            else
            {
                var token = ScanName(WhiteSpace);
                if (string.Equals(token, "NOTATION", StringComparison.OrdinalIgnoreCase))
                {
                    ch = this.m_current.SkipWhitespace();
                    if (ch != '(')
                    {
                        this.m_current.Error("Expecting name group '(', but found '{0}'", ch);
                    }
                    //attdef.Type = AttributeType.NOTATION;
                    //attdef.EnumValues = ParseNameGroup(ch, true);
                    attdef.SetEnumeratedType(ParseNameGroup(ch, true), AttributeType.NOTATION);
                }
                else
                {
                    attdef.SetType(token);
                }
            }
        }
Example #4
0
        private void ParseAttDefault(char ch, AttDef attdef) {
            if (ch == '%') {
                var e = ParseParameterEntity(WhiteSpace);
                PushEntity(this.m_current.ResolvedUri, e);
                ParseAttDefault(this.m_current.Lastchar, attdef);
                PopEntity(); // bugbug - are we at the end of the entity?
                ch = this.m_current.Lastchar;
                return;
            }

            var hasdef = true;
            if (ch == '#') {
                this.m_current.ReadChar();
                var token = this.m_current.ScanToken(this.m_sb, WhiteSpace, true);
                hasdef = attdef.SetPresence(token);
                ch = this.m_current.SkipWhitespace();
            }
            if (hasdef) {
                if (ch == '\'' || ch == '"') {
                    var lit = this.m_current.ScanLiteral(this.m_sb, ch);
                    attdef.Default = lit;
                    ch = this.m_current.SkipWhitespace();
                } else {
                    var name = this.m_current.ScanToken(this.m_sb, WhiteSpace, false);
                    name = name.ToUpperInvariant();
                    attdef.Default = name; // bugbug - must be one of the enumerated names.
                    ch = this.m_current.SkipWhitespace();
                }
            }
        }
Example #5
0
        private void ParseAttType(char ch, AttDef attdef) {
            if (ch == '%') {
                var e = ParseParameterEntity(WhiteSpace);
                PushEntity(this.m_current.ResolvedUri, e);
                ParseAttType(this.m_current.Lastchar, attdef);
                PopEntity(); // bugbug - are we at the end of the entity?
                ch = this.m_current.Lastchar;
                return;
            }

            if (ch == '(') {
                //attdef.EnumValues = ParseNameGroup(ch, false);  
                //attdef.Type = AttributeType.ENUMERATION;
                attdef.SetEnumeratedType(ParseNameGroup(ch, false), AttributeType.ENUMERATION);
            } else {
                var token = ScanName(WhiteSpace);
                if (string.Equals(token, "NOTATION", StringComparison.OrdinalIgnoreCase)) {
                    ch = this.m_current.SkipWhitespace();
                    if (ch != '(') {
                        this.m_current.Error("Expecting name group '(', but found '{0}'", ch);
                    }
                    //attdef.Type = AttributeType.NOTATION;
                    //attdef.EnumValues = ParseNameGroup(ch, true);
                    attdef.SetEnumeratedType(ParseNameGroup(ch, true), AttributeType.NOTATION);
                } else {
                    attdef.SetType(token);
                }
            }
        }
Example #6
0
        private AttDef ParseAttDef(char ch) {
            ch = this.m_current.SkipWhitespace();
            var name = ScanName(WhiteSpace);
            name = name.ToUpperInvariant();
            var attdef = new AttDef(name);

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

            ParseAttType(ch, attdef);

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

            ParseAttDefault(ch, attdef);

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

            return attdef;
        }