Beispiel #1
0
        internal void GetRegularToken(out TokenType tokenType, out int tokenValue, DateTimeFormatInfo dtfi)
        {
            tokenValue = 0;
            if (this.Index >= this.len)
            {
                tokenType = TokenType.EndOfString;
            }
            else
            {
                tokenType = TokenType.UnknownToken;
                while (!DateTimeParse.IsDigit(this.m_current))
                {
                    if (char.IsWhiteSpace(this.m_current))
                    {
label_18:
                        int num    = this.Index + 1;
                        this.Index = num;
                        if (num < this.len)
                        {
                            this.m_current = this.Value[this.Index];
                            if (char.IsWhiteSpace(this.m_current))
                            {
                                goto label_18;
                            }
                        }
                        else
                        {
                            tokenType = TokenType.EndOfString;
                            return;
                        }
                    }
                    else
                    {
                        dtfi.Tokenize(TokenType.RegularTokenMask, out tokenType, out tokenValue, ref this);
                        return;
                    }
                }
                tokenValue = (int)this.m_current - 48;
                int num1 = this.Index;
                while (true)
                {
                    int num2 = this.Index + 1;
                    this.Index = num2;
                    if (num2 < this.len)
                    {
                        this.m_current = this.Value[this.Index];
                        int num3 = (int)this.m_current - 48;
                        if (num3 >= 0 && num3 <= 9)
                        {
                            // ISSUE: explicit reference operation
                            // ISSUE: variable of a reference type
                            int& local = @tokenValue;
                            // ISSUE: explicit reference operation
                            int num4 = ^ local * 10 + num3;
Beispiel #2
0
 internal TokenType GetSeparatorToken(DateTimeFormatInfo dtfi, out int indexBeforeSeparator, out char charBeforeSeparator)
 {
     indexBeforeSeparator = this.Index;
     charBeforeSeparator  = this.m_current;
     if (!this.SkipWhiteSpaceCurrent())
     {
         return(TokenType.SEP_End);
     }
     if (!DateTimeParse.IsDigit(this.m_current))
     {
         TokenType type;
         int       num;
         if (!dtfi.Tokenize(TokenType.SeparatorTokenMask, out type, out num, ref this))
         {
             type = TokenType.SEP_Space;
         }
         return(type);
     }
     return(TokenType.SEP_Space);
 }
 [System.Security.SecurityCritical]  // auto-generated
 internal TokenType GetSeparatorToken(DateTimeFormatInfo dtfi, out int indexBeforeSeparator, out char charBeforeSeparator) {
     indexBeforeSeparator = Index;
     charBeforeSeparator = m_current;
     TokenType tokenType;
     if (!SkipWhiteSpaceCurrent()) {
         // Reach the end of the string.
         return (TokenType.SEP_End);
     }
     if (!DateTimeParse.IsDigit(m_current)) {
         // Not a digit.  Tokenize it.
         int tokenValue;
         bool found = dtfi.Tokenize(TokenType.SeparatorTokenMask, out tokenType, out tokenValue, ref this);
         if (!found) {
             tokenType = TokenType.SEP_Space;
         }
     } else {
         // Do nothing here.  If we see a number, it will not be a separator. There is no need wasting time trying to find the
         // separator token.
         tokenType = TokenType.SEP_Space;
     }
     return (tokenType);
 }
        [System.Security.SecurityCritical]  // auto-generated
        internal void GetRegularToken(out TokenType tokenType, out int tokenValue, DateTimeFormatInfo dtfi) {
            tokenValue = 0;
            if (Index >= len) {
                tokenType = TokenType.EndOfString;
                return;
            }

            tokenType = TokenType.UnknownToken;

Start:
            if (DateTimeParse.IsDigit(m_current)) {
                // This is a digit.
                tokenValue = m_current - '0';
                int value;
                int start = Index;

                //
                // Collect other digits.
                //
                while (++Index < len)
                {
                    m_current = Value[Index];
                    value = m_current - '0';
                    if (value >= 0 && value <= 9) {
                        tokenValue = tokenValue * 10 + value;
                    } else {
                        break;
                    }
                }
                if (Index - start > DateTimeParse.MaxDateTimeNumberDigits) {
                    tokenType = TokenType.NumberToken;
                    tokenValue = -1;
                } else if (Index - start < 3) {
                    tokenType = TokenType.NumberToken;
                } else {
                    // If there are more than 3 digits, assume that it's a year value.
                    tokenType = TokenType.YearNumberToken;
                }
                if (m_checkDigitToken)
                {
                    int save = Index;
                    char saveCh = m_current;
                    // Re-scan using the staring Index to see if this is a token.
                    Index = start;  // To include the first digit.
                    m_current = Value[Index];
                    TokenType tempType;
                    int tempValue;
                    // This DTFI has tokens starting with digits.
                    // E.g. mn-MN has month name like "\x0031\x00a0\x0434\x04af\x0433\x044d\x044d\x0440\x00a0\x0441\x0430\x0440"
                    if (dtfi.Tokenize(TokenType.RegularTokenMask, out tempType, out tempValue, ref this))
                    {
                        tokenType = tempType;
                        tokenValue = tempValue;
                        // This is a token, so the Index has been advanced propertly in DTFI.Tokenizer().
                    } else
                    {
                        // Use the number token value.
                        // Restore the index.
                        Index = save;
                        m_current = saveCh;
                    }
                    
                } 
                
            } else if (Char.IsWhiteSpace( m_current)) {
                // Just skip to the next character.
                while (++Index < len) {
                    m_current = Value[Index];
                    if (!(Char.IsWhiteSpace(m_current))) {
                        goto Start;
                    }
                }
                // We have reached the end of string.
                tokenType = TokenType.EndOfString;
            } else {
                dtfi.Tokenize(TokenType.RegularTokenMask, out tokenType, out tokenValue, ref this);
            }
        }
        internal void GetRegularToken(out TokenType tokenType, out int tokenValue, DateTimeFormatInfo dtfi)
        {
            tokenValue = 0;
            if (this.Index >= this.len)
            {
                tokenType = TokenType.EndOfString;
                return;
            }
            tokenType = TokenType.UnknownToken;
IL_19:
            while (!DateTimeParse.IsDigit(this.m_current))
            {
                if (char.IsWhiteSpace(this.m_current))
                {
                    for (;;)
                    {
                        int num = this.Index + 1;
                        this.Index = num;
                        if (num >= this.len)
                        {
                            break;
                        }
                        this.m_current = this.Value[this.Index];
                        if (!char.IsWhiteSpace(this.m_current))
                        {
                            goto IL_19;
                        }
                    }
                    tokenType = TokenType.EndOfString;
                    return;
                }
                dtfi.Tokenize(TokenType.RegularTokenMask, out tokenType, out tokenValue, ref this);
                return;
            }
            tokenValue = (int)(this.m_current - '0');
            int index = this.Index;

            for (;;)
            {
                int num = this.Index + 1;
                this.Index = num;
                if (num >= this.len)
                {
                    break;
                }
                this.m_current = this.Value[this.Index];
                int num2 = (int)(this.m_current - '0');
                if (num2 < 0 || num2 > 9)
                {
                    break;
                }
                tokenValue = tokenValue * 10 + num2;
            }
            if (this.Index - index > 8)
            {
                tokenType  = TokenType.NumberToken;
                tokenValue = -1;
            }
            else if (this.Index - index < 3)
            {
                tokenType = TokenType.NumberToken;
            }
            else
            {
                tokenType = TokenType.YearNumberToken;
            }
            if (!this.m_checkDigitToken)
            {
                return;
            }
            int  index2  = this.Index;
            char current = this.m_current;

            this.Index     = index;
            this.m_current = this.Value[this.Index];
            TokenType tokenType2;
            int       num3;

            if (dtfi.Tokenize(TokenType.RegularTokenMask, out tokenType2, out num3, ref this))
            {
                tokenType  = tokenType2;
                tokenValue = num3;
                return;
            }
            this.Index     = index2;
            this.m_current = current;
        }
Beispiel #6
0
        internal void GetRegularToken(out TokenType tokenType, out int tokenValue, DateTimeFormatInfo dtfi)
        {
            tokenValue = 0;
            if (this.Index >= this.len)
            {
                tokenType = TokenType.EndOfString;
                return;
            }
            tokenType = TokenType.UnknownToken;
Label_0019:
            if (!DateTimeParse.IsDigit(this.m_current))
            {
                if (char.IsWhiteSpace(this.m_current))
                {
                    while (++this.Index < this.len)
                    {
                        this.m_current = this.Value[this.Index];
                        if (!char.IsWhiteSpace(this.m_current))
                        {
                            goto Label_0019;
                        }
                    }
                    tokenType = TokenType.EndOfString;
                    return;
                }
                dtfi.Tokenize(TokenType.RegularTokenMask, out tokenType, out tokenValue, ref this);
            }
            else
            {
                tokenValue = this.m_current - '0';
                int index = this.Index;
                while (++this.Index < this.len)
                {
                    this.m_current = this.Value[this.Index];
                    int num = this.m_current - '0';
                    if ((num < 0) || (num > 9))
                    {
                        break;
                    }
                    tokenValue = (tokenValue * 10) + num;
                }
                if ((this.Index - index) > 8)
                {
                    tokenType  = TokenType.NumberToken;
                    tokenValue = -1;
                }
                else if ((this.Index - index) < 3)
                {
                    tokenType = TokenType.NumberToken;
                }
                else
                {
                    tokenType = TokenType.YearNumberToken;
                }
                if (this.m_checkDigitToken)
                {
                    TokenType type;
                    int       num4;
                    int       num3    = this.Index;
                    char      current = this.m_current;
                    this.Index     = index;
                    this.m_current = this.Value[this.Index];
                    if (dtfi.Tokenize(TokenType.RegularTokenMask, out type, out num4, ref this))
                    {
                        tokenType  = type;
                        tokenValue = num4;
                        return;
                    }
                    this.Index     = num3;
                    this.m_current = current;
                }
            }
        }