Esempio n. 1
0
        public void Write(int ucs32Char)
        {
            int count;

            if (ucs32Char > 0xFFFF)
            {
                count = this.PrepareToBuffer(2);
                if (count > 0)
                {
                    this.parseBuffer[this.maxTokenSize]     = ParseSupport.HighSurrogateCharFromUcs4(ucs32Char);
                    this.parseBuffer[this.maxTokenSize + 1] = ParseSupport.LowSurrogateCharFromUcs4(ucs32Char);
                    this.maxTokenSize += count;
                    this.parseBuffer[this.maxTokenSize] = '\0';
                }
            }
            else
            {
                count = this.PrepareToBuffer(1);
                if (count > 0)
                {
                    this.parseBuffer[this.maxTokenSize++] = (char)ucs32Char;
                    this.parseBuffer[this.maxTokenSize]   = '\0';
                }
            }
        }
Esempio n. 2
0
 // Token: 0x060011E2 RID: 4578 RVA: 0x0007EE4C File Offset: 0x0007D04C
 public void Advance(int ucs32)
 {
     if (ucs32 >= 65536)
     {
         char c  = ParseSupport.LowSurrogateCharFromUcs4(ucs32);
         char c2 = ParseSupport.LowSurrogateCharFromUcs4(ucs32);
         if (((this.offset += 2) & 1) == 0)
         {
             this.hash1 = ((this.hash1 << 5) + this.hash1 ^ (int)c);
             this.hash2 = ((this.hash2 << 5) + this.hash2 ^ (int)c2);
             return;
         }
         this.hash2 = ((this.hash2 << 5) + this.hash2 ^ (int)c);
         this.hash1 = ((this.hash1 << 5) + this.hash1 ^ (int)c2);
         return;
     }
     else
     {
         if ((this.offset++ & 1) == 0)
         {
             this.hash1 = ((this.hash1 << 5) + this.hash1 ^ ucs32);
             return;
         }
         this.hash2 = ((this.hash2 << 5) + this.hash2 ^ ucs32);
         return;
     }
 }
Esempio n. 3
0
        //public unsafe void Advance(char* s, int len)
        //{
        //    if (0 != (offset & 1))
        //    {
        //        hash2 = ((hash2 << 5) + hash2) ^ s[0];
        //        s++;
        //        len--;
        //        offset++;
        //    }

        //    offset += len;

        //    while (len > 0)
        //    {
        //        hash1 = ((hash1 << 5) + hash1) ^ s[0];
        //        if (len == 1)
        //            break;
        //        hash2 = ((hash2 << 5) + hash2) ^ s[1];
        //        s += 2;
        //        len -= 2;
        //    }
        //}

        //public unsafe void AdvanceLowerCase(char* s, int len)
        //{
        //    if (0 != (offset & 1))
        //    {
        //        hash2 = ((hash2 << 5) + hash2) ^ ParseSupport.ToLowerCase(s[0]);
        //        s++;
        //        len--;
        //        offset++;
        //    }

        //    offset += len;

        //    while (len > 0)
        //    {
        //        hash1 = ((hash1 << 5) + hash1) ^ ParseSupport.ToLowerCase(s[0]);
        //        if (len == 1)
        //            break;
        //        hash2 = ((hash2 << 5) + hash2) ^ ParseSupport.ToLowerCase(s[1]);
        //        s += 2;
        //        len -= 2;
        //    }
        //}

        public void Advance(int ucs32)
        {
            // Unicode 32bit literal.

            if (ucs32 >= 0x10000)
            {
                var c1 = ParseSupport.LowSurrogateCharFromUcs4(ucs32);
                var c2 = ParseSupport.LowSurrogateCharFromUcs4(ucs32);
                if (0 == ((offset += 2) & 1))
                {
                    hash1 = ((hash1 << 5) + hash1) ^ c1;
                    hash2 = ((hash2 << 5) + hash2) ^ c2;
                }
                else
                {
                    hash2 = ((hash2 << 5) + hash2) ^ c1;
                    hash1 = ((hash1 << 5) + hash1) ^ c2;
                }
            }
            else
            {
                if (0 == (offset++ & 1))
                {
                    hash1 = ((hash1 << 5) + hash1) ^ (int)ucs32;
                }
                else
                {
                    hash2 = ((hash2 << 5) + hash2) ^ (int)ucs32;
                }
            }
        }
Esempio n. 4
0
        public void Write(int ucs32Literal, IFallback fallback)
        {
            int count = 1;

            if (ucs32Literal > 65535)
            {
                if (fallback != null && fallback is HtmlWriter)
                {
                    uint num  = (uint)ucs32Literal;
                    int  num2 = (num < 10U) ? 1 : ((num < 100U) ? 2 : ((num < 1000U) ? 3 : ((num < 10000U) ? 4 : ((num < 100000U) ? 5 : ((num < 1000000U) ? 6 : 7)))));
                    int  num3 = 2 + num2;
                    this.stringBuffer[0]    = '&';
                    this.stringBuffer[1]    = '#';
                    this.stringBuffer[num3] = ';';
                    while (num != 0U)
                    {
                        uint num4 = num % 10U;
                        this.stringBuffer[--num3] = (char)(num4 + 48U);
                        num /= 10U;
                    }
                    count = 3 + num2;
                    this.Write(this.stringBuffer, 0, count, null);
                    return;
                }
                this.stringBuffer[0] = ParseSupport.HighSurrogateCharFromUcs4(ucs32Literal);
                this.stringBuffer[1] = ParseSupport.LowSurrogateCharFromUcs4(ucs32Literal);
                count = 2;
            }
            else
            {
                this.stringBuffer[0] = (char)ucs32Literal;
            }
            this.Write(this.stringBuffer, 0, count, fallback);
        }
Esempio n. 5
0
        public void Write(int ucs32Literal, IFallback fallback)
        {
            if (ucs32Literal > 0xFFFF)
            {
                stringBuffer[0] = ParseSupport.HighSurrogateCharFromUcs4(ucs32Literal);
                stringBuffer[1] = ParseSupport.LowSurrogateCharFromUcs4(ucs32Literal);
            }
            else
            {
                stringBuffer[0] = (char)ucs32Literal;
            }

            Write(stringBuffer, 0, ucs32Literal > 0xFFFF ? 2 : 1, fallback);
        }
Esempio n. 6
0
        // Token: 0x060011E3 RID: 4579 RVA: 0x0007EF2C File Offset: 0x0007D12C
        public void AdvanceLowerCase(int ucs32)
        {
            if (ucs32 < 65536)
            {
                this.AdvanceLowerCase((char)ucs32);
                return;
            }
            char c  = ParseSupport.LowSurrogateCharFromUcs4(ucs32);
            char c2 = ParseSupport.LowSurrogateCharFromUcs4(ucs32);

            if (((this.offset += 2) & 1) == 0)
            {
                this.hash1 = ((this.hash1 << 5) + this.hash1 ^ (int)c);
                this.hash2 = ((this.hash2 << 5) + this.hash2 ^ (int)c2);
                return;
            }
            this.hash2 = ((this.hash2 << 5) + this.hash2 ^ (int)c);
            this.hash1 = ((this.hash1 << 5) + this.hash1 ^ (int)c2);
        }
Esempio n. 7
0
 public void AdvanceLowerCase(int ucs32)
 {
     if (ucs32 >= 0x10000)
     {
         var c1 = ParseSupport.LowSurrogateCharFromUcs4(ucs32);
         var c2 = ParseSupport.LowSurrogateCharFromUcs4(ucs32);
         if (0 == ((offset += 2) & 1))
         {
             hash1 = ((hash1 << 5) + hash1) ^ c1;
             hash2 = ((hash2 << 5) + hash2) ^ c2;
         }
         else
         {
             hash2 = ((hash2 << 5) + hash2) ^ c1;
             hash1 = ((hash1 << 5) + hash1) ^ c2;
         }
     }
     else
     {
         AdvanceLowerCase((char)ucs32);
     }
 }
Esempio n. 8
0
 public void AdvanceLowerCase(int ucs32)
 {
     if (ucs32 >= 0x10000)
     {
         char c1 = ParseSupport.LowSurrogateCharFromUcs4(ucs32);
         char c2 = ParseSupport.LowSurrogateCharFromUcs4(ucs32);
         if (0 == ((this.offset += 2) & 1))
         {
             this.hash1 = ((this.hash1 << 5) + this.hash1) ^ c1;
             this.hash2 = ((this.hash2 << 5) + this.hash2) ^ c2;
         }
         else
         {
             this.hash2 = ((this.hash2 << 5) + this.hash2) ^ c1;
             this.hash1 = ((this.hash1 << 5) + this.hash1) ^ c2;
         }
     }
     else
     {
         this.AdvanceLowerCase((char)ucs32);
     }
 }
Esempio n. 9
0
 // Token: 0x06001014 RID: 4116 RVA: 0x000761C0 File Offset: 0x000743C0
 public void Write(int ucs32Char)
 {
     if (ucs32Char > 65535)
     {
         int num = this.PrepareToBuffer(2);
         if (num > 0)
         {
             this.parseBuffer[this.maxTokenSize]     = ParseSupport.HighSurrogateCharFromUcs4(ucs32Char);
             this.parseBuffer[this.maxTokenSize + 1] = ParseSupport.LowSurrogateCharFromUcs4(ucs32Char);
             this.maxTokenSize += num;
             this.parseBuffer[this.maxTokenSize] = '\0';
             return;
         }
     }
     else
     {
         int num = this.PrepareToBuffer(1);
         if (num > 0)
         {
             this.parseBuffer[this.maxTokenSize++] = (char)ucs32Char;
             this.parseBuffer[this.maxTokenSize]   = '\0';
         }
     }
 }
Esempio n. 10
0
 internal static char LiteralLastChar(int literal)
 {
     return((literal > 0xFFFF) ? ParseSupport.LowSurrogateCharFromUcs4(literal) : (char)literal);
 }