static TokenType NextToken()

in Source/Assets/AppCenterEditorExtensions/Editor/Scripts/AppCenterEditorSDK/SimpleJson.cs [951:1017]


        static TokenType NextToken(char[] json, ref int index)
        {
            EatWhitespace(json, ref index);
            if (index == json.Length)
                return TokenType.NONE;
            char c = json[index];
            index++;
            switch (c)
            {
                case '{':
                    return TokenType.CURLY_OPEN;
                case '}':
                    return TokenType.CURLY_CLOSE;
                case '[':
                    return TokenType.SQUARED_OPEN;
                case ']':
                    return TokenType.SQUARED_CLOSE;
                case ',':
                    return TokenType.COMMA;
                case '"':
                    return TokenType.STRING;
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                case '-':
                    return TokenType.NUMBER;
                case ':':
                    return TokenType.COLON;
            }
            index--;
            int remainingLength = json.Length - index;
            // false
            if (remainingLength >= 5)
            {
                if (json[index] == 'f' && json[index + 1] == 'a' && json[index + 2] == 'l' && json[index + 3] == 's' && json[index + 4] == 'e')
                {
                    index += 5;
                    return TokenType.FALSE;
                }
            }
            // true
            if (remainingLength >= 4)
            {
                if (json[index] == 't' && json[index + 1] == 'r' && json[index + 2] == 'u' && json[index + 3] == 'e')
                {
                    index += 4;
                    return TokenType.TRUE;
                }
            }
            // null
            if (remainingLength >= 4)
            {
                if (json[index] == 'n' && json[index + 1] == 'u' && json[index + 2] == 'l' && json[index + 3] == 'l')
                {
                    index += 4;
                    return TokenType.NULL;
                }
            }
            return TokenType.NONE;
        }