コード例 #1
0
        // Token: 0x06003F3F RID: 16191 RVA: 0x00121274 File Offset: 0x0011F474
        private XamlToRtfError ParseXTokStartElement(XamlToRtfParser.XamlToken xamlToken, ref string name)
        {
            XamlToRtfError xamlToRtfError = this._xamlAttributes.Init(xamlToken.Text);

            if (xamlToRtfError == XamlToRtfError.None)
            {
                xamlToRtfError = this._xamlAttributes.GetTag(ref name);
                if (xamlToRtfError == XamlToRtfError.None)
                {
                    xamlToRtfError = this._xamlContent.StartElement(string.Empty, name, name, this._xamlAttributes);
                    if (xamlToRtfError == XamlToRtfError.None)
                    {
                        if (this._xamlAttributes.IsEmpty)
                        {
                            xamlToRtfError = this._xamlContent.EndElement(string.Empty, name, name);
                        }
                        else
                        {
                            xamlToRtfError = (XamlToRtfError)this._xamlTagStack.Push(name);
                        }
                    }
                }
            }
            return(xamlToRtfError);
        }
コード例 #2
0
        // Token: 0x06003F3D RID: 16189 RVA: 0x0012114C File Offset: 0x0011F34C
        internal XamlToRtfError Parse()
        {
            if (this._xamlContent == null || this._xamlError == null)
            {
                return(XamlToRtfError.Unknown);
            }
            XamlToRtfParser.XamlToken xamlToken = new XamlToRtfParser.XamlToken();
            string         empty = string.Empty;
            XamlToRtfError xamlToRtfError;

            for (xamlToRtfError = this._xamlContent.StartDocument(); xamlToRtfError == XamlToRtfError.None; xamlToRtfError = XamlToRtfError.Unknown)
            {
                xamlToRtfError = this._xamlLexer.Next(xamlToken);
                if (xamlToRtfError != XamlToRtfError.None || xamlToken.TokenType == XamlTokenType.XTokEOF)
                {
                    break;
                }
                switch (xamlToken.TokenType)
                {
                case XamlTokenType.XTokInvalid:
                    xamlToRtfError = XamlToRtfError.Unknown;
                    continue;

                case XamlTokenType.XTokCharacters:
                    xamlToRtfError = this._xamlContent.Characters(xamlToken.Text);
                    continue;

                case XamlTokenType.XTokEntity:
                    xamlToRtfError = this._xamlContent.SkippedEntity(xamlToken.Text);
                    continue;

                case XamlTokenType.XTokStartElement:
                    xamlToRtfError = this.ParseXTokStartElement(xamlToken, ref empty);
                    continue;

                case XamlTokenType.XTokEndElement:
                    xamlToRtfError = this.ParseXTokEndElement(xamlToken, ref empty);
                    continue;

                case XamlTokenType.XTokCData:
                case XamlTokenType.XTokPI:
                case XamlTokenType.XTokComment:
                    continue;

                case XamlTokenType.XTokWS:
                    xamlToRtfError = this._xamlContent.IgnorableWhitespace(xamlToken.Text);
                    continue;
                }
            }
            if (xamlToRtfError == XamlToRtfError.None && this._xamlTagStack.Count != 0)
            {
                xamlToRtfError = XamlToRtfError.Unknown;
            }
            if (xamlToRtfError == XamlToRtfError.None)
            {
                xamlToRtfError = this._xamlContent.EndDocument();
            }
            return(xamlToRtfError);
        }
コード例 #3
0
        // Token: 0x06003F40 RID: 16192 RVA: 0x001212F8 File Offset: 0x0011F4F8
        private XamlToRtfError ParseXTokEndElement(XamlToRtfParser.XamlToken xamlToken, ref string name)
        {
            XamlToRtfError xamlToRtfError = this._xamlAttributes.Init(xamlToken.Text);

            if (xamlToRtfError == XamlToRtfError.None)
            {
                xamlToRtfError = this._xamlAttributes.GetTag(ref name);
                if (xamlToRtfError == XamlToRtfError.None && this._xamlTagStack.IsMatchTop(name))
                {
                    this._xamlTagStack.Pop();
                    xamlToRtfError = this._xamlContent.EndElement(string.Empty, name, name);
                }
            }
            return(xamlToRtfError);
        }
コード例 #4
0
            // Token: 0x06008627 RID: 34343 RVA: 0x0024BEB8 File Offset: 0x0024A0B8
            private void NextLessThanToken(XamlToRtfParser.XamlToken token)
            {
                this._xamlIndex++;
                if (!this.IsCharsAvailable(1))
                {
                    token.TokenType = XamlTokenType.XTokInvalid;
                    return;
                }
                token.TokenType = XamlTokenType.XTokInvalid;
                char c = this._xaml[this._xamlIndex];

                if (c <= '/')
                {
                    if (c == '!')
                    {
                        this._xamlIndex++;
                        while (this.IsCharsAvailable(3))
                        {
                            if (this._xaml[this._xamlIndex] == '-' && this._xaml[this._xamlIndex + 1] == '-' && this._xaml[this._xamlIndex + 2] == '>')
                            {
                                this._xamlIndex += 3;
                                token.TokenType  = XamlTokenType.XTokComment;
                                return;
                            }
                            this._xamlIndex++;
                        }
                        return;
                    }
                    if (c == '/')
                    {
                        this._xamlIndex++;
                        while (this.IsCharsAvailable(1))
                        {
                            if (this._xaml[this._xamlIndex] == '>')
                            {
                                this._xamlIndex++;
                                token.TokenType = XamlTokenType.XTokEndElement;
                                return;
                            }
                            this._xamlIndex++;
                        }
                        return;
                    }
                }
                else
                {
                    if (c == '>')
                    {
                        this._xamlIndex++;
                        token.TokenType = XamlTokenType.XTokInvalid;
                        return;
                    }
                    if (c == '?')
                    {
                        this._xamlIndex++;
                        while (this.IsCharsAvailable(2))
                        {
                            if (this._xaml[this._xamlIndex] == '?' && this._xaml[this._xamlIndex + 1] == '>')
                            {
                                this._xamlIndex += 2;
                                token.TokenType  = XamlTokenType.XTokPI;
                                return;
                            }
                            this._xamlIndex++;
                        }
                        return;
                    }
                }
                char c2 = '\0';

                while (this.IsCharsAvailable(1))
                {
                    if (c2 != '\0')
                    {
                        if (this._xaml[this._xamlIndex] == c2)
                        {
                            c2 = '\0';
                        }
                    }
                    else if (this._xaml[this._xamlIndex] == '"' || this._xaml[this._xamlIndex] == '\'')
                    {
                        c2 = this._xaml[this._xamlIndex];
                    }
                    else if (this._xaml[this._xamlIndex] == '>')
                    {
                        this._xamlIndex++;
                        token.TokenType = XamlTokenType.XTokStartElement;
                        return;
                    }
                    this._xamlIndex++;
                }
            }
コード例 #5
0
            // Token: 0x06008624 RID: 34340 RVA: 0x0024BCCC File Offset: 0x00249ECC
            internal XamlToRtfError Next(XamlToRtfParser.XamlToken token)
            {
                XamlToRtfError result    = XamlToRtfError.None;
                int            xamlIndex = this._xamlIndex;

                if (this._xamlIndex < this._xaml.Length)
                {
                    char c = this._xaml[this._xamlIndex];
                    if (c <= ' ')
                    {
                        switch (c)
                        {
                        case '\t':
                        case '\n':
                        case '\r':
                            break;

                        case '\v':
                        case '\f':
                            goto IL_124;

                        default:
                            if (c != ' ')
                            {
                                goto IL_124;
                            }
                            break;
                        }
                        token.TokenType = XamlTokenType.XTokWS;
                        this._xamlIndex++;
                        while (this.IsCharsAvailable(1))
                        {
                            if (!this.IsSpace(this._xaml[this._xamlIndex]))
                            {
                                break;
                            }
                            this._xamlIndex++;
                        }
                        goto IL_17C;
                    }
                    if (c == '&')
                    {
                        token.TokenType = XamlTokenType.XTokInvalid;
                        this._xamlIndex++;
                        while (this.IsCharsAvailable(1))
                        {
                            if (this._xaml[this._xamlIndex] == ';')
                            {
                                this._xamlIndex++;
                                token.TokenType = XamlTokenType.XTokEntity;
                                break;
                            }
                            this._xamlIndex++;
                        }
                        goto IL_17C;
                    }
                    if (c == '<')
                    {
                        this.NextLessThanToken(token);
                        goto IL_17C;
                    }
IL_124:
                    token.TokenType = XamlTokenType.XTokCharacters;
                    this._xamlIndex++;
                    while (this.IsCharsAvailable(1) && this._xaml[this._xamlIndex] != '&' && this._xaml[this._xamlIndex] != '<')
                    {
                        this._xamlIndex++;
                    }
                }
IL_17C:
                token.Text = this._xaml.Substring(xamlIndex, this._xamlIndex - xamlIndex);
                if (token.Text.Length == 0)
                {
                    token.TokenType = XamlTokenType.XTokEOF;
                }
                return(result);
            }