Пример #1
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++;
 }
Пример #2
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++;
                }
            }
Пример #3
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);
        }
Пример #4
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--;
         }
     }
 }
Пример #5
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;
            }
        }