Ejemplo n.º 1
0
        // Token: 0x06001893 RID: 6291 RVA: 0x000C4ABC File Offset: 0x000C2CBC
        private bool ParseKeywordRun()
        {
            if (1 != this.parseEnd - this.parseOffset)
            {
                byte b = this.parseBuffer[this.parseOffset + 1];
                char c = (char)b;
                int  num;
                if (c > '-')
                {
                    if (c <= '\\')
                    {
                        if (c == ':')
                        {
                            this.lastLeadByte = false;
                            this.run.InitializeKeyword(3, 0, 2, this.SkipIfNecessary(1), this.firstKeyword);
                            this.parseOffset += 2;
                            return(true);
                        }
                        if (c != '\\')
                        {
                            goto IL_CE;
                        }
                    }
                    else
                    {
                        if (c != '_')
                        {
                            switch (c)
                            {
                            case '{':
                            case '}':
                                goto IL_EA;

                            case '|':
                                this.lastLeadByte = false;
                                this.run.InitializeKeyword(2, 0, 2, this.SkipIfNecessary(1), this.firstKeyword);
                                this.parseOffset += 2;
                                return(true);

                            case '~':
                                num = 160;
                                goto IL_155;
                            }
                            goto IL_CE;
                        }
                        num = 8209;
                        goto IL_155;
                    }
IL_EA:
                    num = (int)b;
                    goto IL_EC;
                }
                if (c <= '\'')
                {
                    switch (c)
                    {
                    case '\t':
                        this.lastLeadByte = false;
                        this.run.InitializeKeyword(126, 0, 2, this.SkipIfNecessary(1), this.firstKeyword);
                        this.parseOffset += 2;
                        return(true);

                    case '\n':
                    case '\r':
                        this.lastLeadByte = false;
                        this.run.InitializeKeyword(68, 0, 2, this.SkipIfNecessary(1), this.firstKeyword);
                        this.parseOffset += 2;
                        return(true);

                    case '\v':
                    case '\f':
                        break;

                    default:
                        if (c == '\'')
                        {
                            this.EnsureCodePage();
                            if (this.parseEnd - this.parseOffset >= 4)
                            {
                                num = RtfSupport.Unescape(this.parseBuffer[this.parseOffset + 2], this.parseBuffer[this.parseOffset + 3]);
                                if (num > 255)
                                {
                                    if (this.lastLeadByte)
                                    {
                                        this.lastLeadByte = false;
                                        this.run.Initialize(RtfRunKind.Text, 1, 0, this.SkipIfNecessary(1), false);
                                        this.parseOffset++;
                                        return(true);
                                    }
                                    num = 63;
                                }
                                else
                                {
                                    if ((num == 13 || num == 10) && !this.lastLeadByte)
                                    {
                                        this.run.InitializeKeyword(68, 0, 4, this.SkipIfNecessary(1), this.firstKeyword);
                                        this.parseOffset += 4;
                                        return(true);
                                    }
                                    if (num == 0)
                                    {
                                        num = 32;
                                    }
                                    this.lastLeadByte = (!this.lastLeadByte && ParseSupport.IsLeadByte((byte)num, this.leadMask));
                                }
                                this.run.Initialize(RtfRunKind.Escape, 4, num, this.SkipIfNecessary(1), this.lastLeadByte);
                                this.parseOffset += 4;
                                return(true);
                            }
                            if (this.endOfFileVisible)
                            {
                                this.run.Initialize(RtfRunKind.Text, 1, 0, this.SkipIfNecessary(1), false);
                                this.parseOffset++;
                                this.lastLeadByte = false;
                                return(true);
                            }
                            return(false);
                        }
                        break;
                    }
                }
                else
                {
                    if (c == '*')
                    {
                        this.lastLeadByte = false;
                        this.run.InitializeKeyword(1, 0, 2, this.SkipIfNecessary(1), this.firstKeyword);
                        this.parseOffset += 2;
                        return(true);
                    }
                    if (c == '-')
                    {
                        num = 173;
                        goto IL_155;
                    }
                }
IL_CE:
                CharClass charClass = ParseSupport.GetCharClass(b);
                if (ParseSupport.AlphaCharacter(charClass))
                {
                    this.lastLeadByte = false;
                    return(this.ParseKeyword(b));
                }
                num = (int)b;
                if (num == 0)
                {
                    num = 32;
                }
IL_EC:
                this.EnsureCodePage();
                this.lastLeadByte = (!this.lastLeadByte && ParseSupport.IsLeadByte((byte)num, this.leadMask));
                this.run.Initialize(RtfRunKind.Escape, 2, num, this.SkipIfNecessary(1), this.lastLeadByte);
                this.parseOffset += 2;
                return(true);

IL_155:
                this.EnsureCodePage();
                this.lastLeadByte = false;
                this.run.Initialize(RtfRunKind.Unicode, 2, num, this.SkipIfNecessary(1), false);
                this.parseOffset += 2;
                return(true);
            }
            if (this.endOfFileVisible)
            {
                this.run.Initialize(RtfRunKind.Text, 1, 0, this.SkipIfNecessary(1), false);
                this.parseOffset++;
                return(true);
            }
            return(false);
        }