Exemple #1
0
        private void State_InName( )
        {
            if ((base.IsAtEndOfInput || Sample_StringParserBase.IsWhitespaceChar(base.CurrentChar)) || (base.CurrentChar == '['))
            {
                this._token = GenericTypeNameScannerToken.NAME;
                this._state = State.START;
            }
            else
            {
                switch (base.CurrentChar)
                {
                case '(':
                    this._pushedBackSymbol = GenericTypeNameScannerToken.OPEN;
                    this._token            = GenericTypeNameScannerToken.NAME;
                    this._state            = State.START;
                    break;

                case ')':
                    this._pushedBackSymbol = GenericTypeNameScannerToken.CLOSE;
                    this._token            = GenericTypeNameScannerToken.NAME;
                    this._state            = State.START;
                    break;

                case ',':
                    this._pushedBackSymbol = GenericTypeNameScannerToken.COMMA;
                    this._token            = GenericTypeNameScannerToken.NAME;
                    this._state            = State.START;
                    break;

                case ':':
                    this._pushedBackSymbol = GenericTypeNameScannerToken.COLON;
                    this._token            = GenericTypeNameScannerToken.NAME;
                    this._state            = State.START;
                    break;

                default:
                    if (XamlName.IsValidQualifiedNameCharPlus(base.CurrentChar, CustomeGenericTypeNamePartDelimeter))
                    {
                        this.AddToMultiCharToken();
                    }
                    else
                    {
                        this._token = GenericTypeNameScannerToken.ERROR;
                    }
                    break;
                }
                this._lastChar = base.CurrentChar;
                base.Advance();
            }
        }
Exemple #2
0
        internal static int ParseSubscriptSegment(string subscript, ref int pos)
        {
            bool flag = false;
            int  num  = 1;

            do
            {
                switch (subscript[pos])
                {
                case '[':
                    if (!flag)
                    {
                        flag = true;
                        break;
                    }
                    return(0);

                case ']':
                    if (flag)
                    {
                        pos++;
                        return(num);
                    }
                    return(0);

                case ',':
                    if (!flag)
                    {
                        return(0);
                    }
                    num++;
                    break;

                default:
                    if (!Sample_StringParserBase.IsWhitespaceChar(subscript[pos]))
                    {
                        return(0);
                    }
                    break;
                }
                pos++;
            }while(pos < subscript.Length);
            return(0);
        }
Exemple #3
0
        private void State_InSubscript( )
        {
            if (base.IsAtEndOfInput)
            {
                this._token = GenericTypeNameScannerToken.ERROR;
                this._state = State.START;
            }
            else
            {
                switch (base.CurrentChar)
                {
                case ',':
                    this.AddToMultiCharToken();
                    break;

                case ']':
                    this.AddToMultiCharToken();
                    this._token = GenericTypeNameScannerToken.SUBSCRIPT;
                    this._state = State.START;
                    break;

                default:
                    if (Sample_StringParserBase.IsWhitespaceChar(base.CurrentChar))
                    {
                        this.AddToMultiCharToken();
                    }
                    else
                    {
                        this._token = GenericTypeNameScannerToken.ERROR;
                    }
                    break;
                }
                this._lastChar = base.CurrentChar;
                base.Advance();
            }
        }