コード例 #1
0
            public void Write(char[] buffer, int offset, int count)
            {
                int num = offset + count;

                while (offset < num)
                {
                    if (strIndex == 0)
                    {
                        if (ParseSupport.WhitespaceCharacter(ParseSupport.GetCharClass(buffer[offset])))
                        {
                            offset++;
                            continue;
                        }
                    }
                    else if (strIndex == str.Length)
                    {
                        if (ParseSupport.WhitespaceCharacter(ParseSupport.GetCharClass(buffer[offset])))
                        {
                            offset++;
                            continue;
                        }
                        definitelyNotEqual = true;
                        return;
                    }
                    if (ParseSupport.ToLowerCase(buffer[offset]) != str[strIndex])
                    {
                        definitelyNotEqual = true;
                        return;
                    }
                    offset++;
                    strIndex++;
                }
            }
コード例 #2
0
 public void Write(int ucs32Char)
 {
     if (LiteralLength(ucs32Char) != 1)
     {
         definitelyNotEqual = true;
         return;
     }
     if (strIndex == 0)
     {
         if (ParseSupport.WhitespaceCharacter(ParseSupport.GetCharClass((char)ucs32Char)))
         {
             return;
         }
     }
     else if (strIndex == str.Length)
     {
         if (ParseSupport.WhitespaceCharacter(ParseSupport.GetCharClass((char)ucs32Char)))
         {
             return;
         }
         definitelyNotEqual = true;
         return;
     }
     if (str[strIndex] != ParseSupport.ToLowerCase((char)ucs32Char))
     {
         definitelyNotEqual = true;
         return;
     }
     strIndex++;
 }
コード例 #3
0
        public unsafe static int CalculateLowerCase(char[] buffer, int offset, int length)
        {
            int num  = 5381;
            int num2 = num;

            CheckArgs(buffer, offset, length);
            fixed(char *ptr = buffer)
            {
                char *ptr2 = ptr + offset;

                while (length > 0)
                {
                    num = ((num << 5) + num ^ ParseSupport.ToLowerCase(*ptr2));
                    if (length == 1)
                    {
                        break;
                    }
                    num2    = ((num2 << 5) + num2 ^ ParseSupport.ToLowerCase(ptr2[1]));
                    ptr2   += 2;
                    length -= 2;
                }
            }

            return(num + num2 * 1566083941);
        }
コード例 #4
0
 internal static char LiteralLastChar(int literal)
 {
     if (literal <= 65535)
     {
         return((char)literal);
     }
     return(ParseSupport.LowSurrogateCharFromUcs4(literal));
 }
コード例 #5
0
 public void AdvanceLowerCase(char c)
 {
     if ((offset++ & 1) == 0)
     {
         hash1 = ((hash1 << 5) + hash1 ^ ParseSupport.ToLowerCase(c));
         return;
     }
     hash2 = ((hash2 << 5) + hash2 ^ ParseSupport.ToLowerCase(c));
 }
コード例 #6
0
        protected internal bool SkipLeadingWhitespace(LexicalUnit unit, ref FragmentPosition position)
        {
            int num = unit.head;

            if (num != -1)
            {
                int      num2           = unit.headOffset;
                RunEntry runEntry       = runList[num];
                uint     majorKind      = runEntry.MajorKind;
                int      runDeltaOffset = 0;
                int      i;
                do
                {
                    if (runEntry.Type == (RunType)3221225472u)
                    {
                        if (runEntry.Value > 65535)
                        {
                            break;
                        }
                        CharClass charClass = ParseSupport.GetCharClass((char)runEntry.Value);
                        if (!ParseSupport.WhitespaceCharacter(charClass))
                        {
                            break;
                        }
                    }
                    else if (runEntry.Type == (RunType)2147483648u)
                    {
                        for (i = num2; i < num2 + runEntry.Length; i++)
                        {
                            CharClass charClass = ParseSupport.GetCharClass(buffer[i]);
                            if (!ParseSupport.WhitespaceCharacter(charClass))
                            {
                                break;
                            }
                        }
                        if (i < num2 + runEntry.Length)
                        {
                            goto Block_7;
                        }
                    }
                    num2    += runEntry.Length;
                    runEntry = runList[++num];
                }while (runEntry.MajorKindPlusStartFlag == majorKind);
                goto IL_EF;
Block_7:
                runDeltaOffset = i - num2;
IL_EF:
                position.run            = num;
                position.runOffset      = num2;
                position.runDeltaOffset = runDeltaOffset;
                if (num == unit.head || runEntry.MajorKindPlusStartFlag == majorKind)
                {
                    return(true);
                }
            }
            return(false);
        }
コード例 #7
0
 public void Write(int ucs32Char)
 {
     if (LiteralLength(ucs32Char) != 1 || str[strIndex] != ParseSupport.ToLowerCase((char)ucs32Char))
     {
         strIndex = 0;
         return;
     }
     strIndex++;
     if (strIndex == str.Length)
     {
         found = true;
     }
 }
コード例 #8
0
 public void Write(int ucs32Literal, IFallback fallback)
 {
     if (ucs32Literal > 65535)
     {
         stringBuffer[0] = ParseSupport.HighSurrogateCharFromUcs4(ucs32Literal);
         stringBuffer[1] = ParseSupport.LowSurrogateCharFromUcs4(ucs32Literal);
     }
     else
     {
         stringBuffer[0] = (char)ucs32Literal;
     }
     Write(stringBuffer, 0, (ucs32Literal > 65535) ? 2 : 1, fallback);
 }
コード例 #9
0
        protected internal virtual bool CaseInsensitiveCompareRunEqual(int runOffset, string str, int strOffset)
        {
            int i = strOffset;

            while (i < str.Length)
            {
                if (ParseSupport.ToLowerCase(buffer[runOffset++]) != str[i++])
                {
                    return(false);
                }
            }
            return(true);
        }
コード例 #10
0
 public bool EqualsToLowerCaseStringIgnoreCase(string rightPart)
 {
     if (count != rightPart.Length)
     {
         return(false);
     }
     for (int i = 0; i < rightPart.Length; i++)
     {
         if (ParseSupport.ToLowerCase(buffer[offset + i]) != rightPart[i])
         {
             return(false);
         }
     }
     return(true);
 }
コード例 #11
0
 public void TrimWhitespace()
 {
     while (count != 0 && ParseSupport.WhitespaceCharacter(buffer[offset]))
     {
         offset++;
         count--;
     }
     if (count != 0)
     {
         int num = offset + count - 1;
         while (ParseSupport.WhitespaceCharacter(buffer[num--]))
         {
             count--;
         }
     }
 }
コード例 #12
0
        public void AdvanceLowerCase(int ucs32)
        {
            if (ucs32 < 65536)
            {
                AdvanceLowerCase((char)ucs32);
                return;
            }
            char c  = ParseSupport.LowSurrogateCharFromUcs4(ucs32);
            char c2 = ParseSupport.LowSurrogateCharFromUcs4(ucs32);

            if (((offset += 2) & 1) == 0)
            {
                hash1 = ((hash1 << 5) + hash1 ^ c);
                hash2 = ((hash2 << 5) + hash2 ^ c2);
                return;
            }
            hash2 = ((hash2 << 5) + hash2 ^ c);
            hash1 = ((hash1 << 5) + hash1 ^ c2);
        }
コード例 #13
0
            public void Write(char[] buffer, int offset, int count)
            {
                int num = offset + count;

                while (offset < num && strIndex < str.Length)
                {
                    if (ParseSupport.ToLowerCase(buffer[offset]) == str[strIndex])
                    {
                        strIndex++;
                    }
                    else
                    {
                        strIndex = 0;
                    }
                    offset++;
                }
                if (strIndex == str.Length)
                {
                    found = true;
                }
            }
コード例 #14
0
 public unsafe void AdvanceLowerCase(char *s, int len)
 {
     if ((offset & 1) != 0)
     {
         hash2 = ((hash2 << 5) + hash2 ^ ParseSupport.ToLowerCase(*s));
         s++;
         len--;
         offset++;
     }
     offset += len;
     while (len > 0)
     {
         hash1 = ((hash1 << 5) + hash1 ^ ParseSupport.ToLowerCase(*s));
         if (len == 1)
         {
             return;
         }
         hash2 = ((hash2 << 5) + hash2 ^ ParseSupport.ToLowerCase(s[1]));
         s    += 2;
         len  -= 2;
     }
 }
コード例 #15
0
 private void OutputLastWhitespace(char nextChar)
 {
     if (lineLength > 255 && autoNewLines)
     {
         if (lineLength > longestLineLength)
         {
             longestLineLength = lineLength;
         }
         lineLength = 0;
         if (ParseSupport.FarEastNonHanguelChar(nextChar))
         {
             output.Write(' ');
             lineLength++;
         }
     }
     else
     {
         output.Write(' ');
         lineLength++;
     }
     textLineLength++;
     lastWhitespace = false;
 }
コード例 #16
0
 public void Write(int ucs32Char)
 {
     if (ucs32Char > 65535)
     {
         int num = PrepareToBuffer(2);
         if (num > 0)
         {
             parseBuffer[maxTokenSize]     = ParseSupport.HighSurrogateCharFromUcs4(ucs32Char);
             parseBuffer[maxTokenSize + 1] = ParseSupport.LowSurrogateCharFromUcs4(ucs32Char);
             maxTokenSize += num;
             parseBuffer[maxTokenSize] = '\0';
             return;
         }
     }
     else
     {
         int num = PrepareToBuffer(1);
         if (num > 0)
         {
             parseBuffer[maxTokenSize++] = (char)ucs32Char;
             parseBuffer[maxTokenSize]   = '\0';
         }
     }
 }
コード例 #17
0
        protected internal void StripLeadingWhitespace(ref Fragment fragment)
        {
            int num = fragment.head;

            if (num != fragment.tail)
            {
                int num2 = fragment.headOffset;
                if (runList[num].Type < (RunType)2147483648u)
                {
                    SkipNonTextRuns(ref num, ref num2, fragment.tail);
                }
                if (num == fragment.tail)
                {
                    return;
                }
                int i;
                do
                {
                    if (runList[num].Type == (RunType)3221225472u)
                    {
                        if (runList[num].Value > 65535)
                        {
                            break;
                        }
                        CharClass charClass = ParseSupport.GetCharClass((char)runList[num].Value);
                        if (!ParseSupport.WhitespaceCharacter(charClass))
                        {
                            break;
                        }
                    }
                    else
                    {
                        for (i = num2; i < num2 + runList[num].Length; i++)
                        {
                            CharClass charClass = ParseSupport.GetCharClass(buffer[i]);
                            if (!ParseSupport.WhitespaceCharacter(charClass))
                            {
                                break;
                            }
                        }
                        if (i < num2 + runList[num].Length)
                        {
                            goto Block_8;
                        }
                    }
                    num2 += runList[num].Length;
                    num++;
                    if (num != fragment.tail && runList[num].Type < (RunType)2147483648u)
                    {
                        SkipNonTextRuns(ref num, ref num2, fragment.tail);
                    }
                }while (num != fragment.tail);
                goto IL_162;
Block_8:
                RunEntry[] expr_FA_cp_0 = runList;
                int        expr_FA_cp_1 = num;
                expr_FA_cp_0[expr_FA_cp_1].Length = expr_FA_cp_0[expr_FA_cp_1].Length - (i - num2);
                num2 = i;
IL_162:
                fragment.head       = num;
                fragment.headOffset = num2;
            }
        }