Playtomic.JSON.ParseArray C# (CSharp) Method

ParseArray() protected method

protected ParseArray ( char json, int &index ) : ArrayList
json char
index int
return System.Collections.ArrayList
        protected ArrayList ParseArray(char[] json, ref int index)
        {
            ArrayList array = new ArrayList();

            // [
            NextToken(json, ref index);

            bool done = false;
            while (!done) {
                int token = LookAhead(json, index);
                if (token == JSON.TOKEN_NONE) {
                    return null;
                } else if (token == JSON.TOKEN_COMMA) {
                    NextToken(json, ref index);
                } else if (token == JSON.TOKEN_SQUARED_CLOSE) {
                    NextToken(json, ref index);
                    break;
                } else {
                    bool success = true;
                    object value = ParseValue(json, ref index, ref success);
                    if (!success) {
                        return null;
                    }

                    array.Add(value);
                }
            }

            return array;
        }