Parses the current token as a list of Enums.
@param <T>
@param parser
@param clazz
@return List of {@link Enum}s
@throws IOException
@throws JsonFormatException
@author vvakame
977008
public static <T extends Enum<T>>List<T> parserEnumList(JsonPullParser parser, Class<T> clazz)
			throws IOException, JsonFormatException {

		State eventType = parser.getEventType();
		if (eventType == State.VALUE_NULL) {
			return null;
		}
		if (eventType != State.START_ARRAY) {
			throw new IllegalStateException("not started brace!");
		}
		List<T> list = new ArrayList<T>();
		while (parser.lookAhead() != State.END_ARRAY) {
			eventType = parser.getEventType();
			if (eventType == State.VALUE_NULL) {
				list.add(null);
			} else if (eventType == State.VALUE_STRING) {
				T obj = Enum.valueOf(clazz, parser.getValueString());
				list.add(obj);
			} else {
				throw new IllegalStateException("unexpected state. expected=VALUE_STRING, but get="
						+ eventType.toString());
			}
		}
		parser.getEventType();
		return list;
	}
1227666
public static function parse(Parser $parser, TokensList $list, array $options = [])
    {
        $ret = new self();

        $offset = false;

        for (; $list->idx < $list->count; ++$list->idx) {
            /**
             * Token parsed at this moment.
             *
             * @var Token
             */
            $token = $list->tokens[$list->idx];

            // End of statement.
            if ($token->type === Token::TYPE_DELIMITER) {
                break;
            }

            // Skipping whitespaces and comments.
            if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) {
                continue;
            }

            if (($token->type === Token::TYPE_KEYWORD) && ($token->flags & Token::FLAG_KEYWORD_RESERVED)) {
                break;
            }

            if ($token->type === Token::TYPE_KEYWORD && $token->keyword === 'OFFSET') {
                if ($offset) {
                    $parser->error('An offset was expected.', $token);
                }
                $offset = true;
                continue;
            }

            if (($token->type === Token::TYPE_OPERATOR) && ($token->value === ',')) {
                $ret->offset = $ret->rowCount;
                $ret->rowCount = 0;
                continue;
            }

            if ($offset) {
                $ret->offset = $token->value;
                $offset = false;
            } else {
                $ret->rowCount = $token->value;
            }
        }

        if ($offset) {
            $parser->error(
                'An offset was expected.',
                $list->tokens[$list->idx - 1]
            );
        }

        --$list->idx;

        return $ret;
    }
937905
static Parser<Token[]> tokens(final Parser<? extends Collection<Token>> parser) {
    return parser.map(list -> list.toArray(new Token[list.size()]));
  }
720872
public static JsonWebSignature parse(JsonFactory jsonFactory, String tokenString)
      throws IOException {
    return parser(jsonFactory).parse(tokenString);
  }
241397
static List<Object> parseList(AbstractContext context, JsonParser parser, List<Object> list, boolean skipRead) {
		try {
			if (!skipRead) {
				parser.nextToken();
			}

			if (parser.currentToken() != JsonToken.START_ARRAY) {
				throw (new KriptonRuntimeException("Invalid input format"));
			}

			skipRead = false;

			JsonToken token;
			do {
				if (skipRead) {
					token = parser.getCurrentToken();
				} else {
					token = parser.nextToken();
					skipRead = true;
				}
				switch (token) {
				case VALUE_FALSE:
				case VALUE_TRUE:
				case VALUE_NUMBER_FLOAT:
				case VALUE_NUMBER_INT:
				case VALUE_STRING:
					list.add(parser.getText());
					break;
				case VALUE_NULL:
					list.add(null);
					break;
				case VALUE_EMBEDDED_OBJECT:
					// parse submap
					list.add(parseMap(context, parser, new LinkedHashMap<String, Object>(), true));
					break;
				case START_ARRAY:
					list.add(parseList(context, parser, list, true));
					break;
				default:
					break;
				}
			} while (parser.nextToken() != JsonToken.END_ARRAY);
			return list;
		} catch (IOException e) {
			e.printStackTrace();
			throw (new KriptonRuntimeException(e));
		}
	}
900454
private Resource parseResource() throws IOException {
        //current token is ready consumed by parseResources
        if (jsonParser.getCurrentToken() != JsonToken.START_OBJECT) {
            throw new JsonParseException("Not a Resource object", jsonParser.getCurrentLocation());
        }

        Resource resource = new Resource();

        while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
            String key = jsonParser.getCurrentName();

            switch (key) {
            default:
                resource.add(key, parseDefaultValue(key));
                break;
            }
        }

        return resource;
    }
252368
public <T> T parse(String input, Class<T> clazz) {
		try {
			if (String.class.equals(clazz)) {
				return (T) input;
			}

			StringParser<T> parser = getParser(clazz, input);
			if (parser == null) {
				throw new ParserException(String.format("Cannot parse to %s : %s", clazz.getName(), input));
			}

			return parser.parse(input);
		}
		catch (NumberFormatException e) {
			throw new ParserException(e.getMessage());
		}
	}
581197
public List<T> parseList(InputStream is) throws IOException {
        JsonParser jsonParser = LoganSquare.JSON_FACTORY.createParser(is);
        jsonParser.nextToken();
        return parseList(jsonParser);
    }
1166847
public List<Object> parseArray() throws IOException {
		Type t = lexer.readNextToken();
		if (t != Type.START_ARRAY) {
			throw new IOException("Unexpected token: " + t);
		}
		
		return parseArrayInternal();
	}
388553
def parse_type(parser):
    # type: (Parser) -> Union[NamedType, NonNullType, ListType]
    """"""
    start = parser.token.start
    if skip(parser, TokenKind.BRACKET_L):
        ast_type = parse_type(parser)
        expect(parser, TokenKind.BRACKET_R)
        ast_type = ast.ListType(type=ast_type, loc=loc(parser, start))  # type: ignore

    else:
        ast_type = parse_named_type(parser)

    if skip(parser, TokenKind.BANG):
        return ast.NonNullType(type=ast_type, loc=loc(parser, start))

    return ast_type
320969
static ClassRefTypeSignature parse(final Parser parser, final String definingClassName) throws ParseException {
        if (parser.peek() == 'L') {
            parser.next();
            if (!TypeUtils.getIdentifierToken(parser, /* separator = */ '/', /* separatorReplace = */ '.')) {
                throw new ParseException(parser, "Could not parse identifier token");
            }
            final String className = parser.currToken();
            final List<TypeArgument> typeArguments = TypeArgument.parseList(parser, definingClassName);
            List<String> suffixes;
            List<List<TypeArgument>> suffixTypeArguments;
            if (parser.peek() == '.') {
                suffixes = new ArrayList<>();
                suffixTypeArguments = new ArrayList<>();
                while (parser.peek() == '.') {
                    parser.expect('.');
                    if (!TypeUtils.getIdentifierToken(parser, /* separator = */ '/',
                            /* separatorReplace = */ '.')) {
                        throw new ParseException(parser, "Could not parse identifier token");
                    }
                    suffixes.add(parser.currToken());
                    suffixTypeArguments.add(TypeArgument.parseList(parser, definingClassName));
                }
            } else {
                suffixes = Collections.emptyList();
                suffixTypeArguments = Collections.emptyList();
            }
            parser.expect(';');
            return new ClassRefTypeSignature(className, typeArguments, suffixes, suffixTypeArguments);
        } else {
            return null;
        }
    }
388221
protected List<String> parseNameList( DdlTokenStream tokens ) throws ParsingException {
        List<String> names = new LinkedList<String>();

        while (true) {
            names.add(parseName(tokens));

            if (!tokens.canConsume(COMMA)) {
                break;
            }
        }

        return names;
    }
596781
public <T extends Serializable> T parse(String input, Class<T> clazz) {
		try {
			return parseInput(input, clazz);
		} catch (InvocationTargetException | InstantiationException | IllegalAccessException | NoSuchMethodException | NumberFormatException | ParserException e) {
			throw new ParserException(e.getMessage());
		}
	}
617333
public <E extends Enum<E>> List<E> getTypeList(Class<E> clz, E[] typeList) {
        if (typeList.length > 0) {
            return new ArrayList<>(Arrays.asList(typeList));
        } else {
            return new ArrayList<>(EnumSet.allOf(clz));
        }
    }
825429
public static function parse(Parser $parser, TokensList $list, array $options = [])
    {
        $ret = [];

        $expr = new self();

        /**
         * The state of the parser.
         *
         * Below are the states of the parser.
         *
         *      0 -----------------------[ JOIN ]----------------------> 1
         *
         *      1 -----------------------[ expr ]----------------------> 2
         *
         *      2 ------------------------[ ON ]-----------------------> 3
         *      2 -----------------------[ USING ]---------------------> 4
         *
         *      3 --------------------[ conditions ]-------------------> 0
         *
         *      4 ----------------------[ columns ]--------------------> 0
         *
         * @var int
         */
        $state = 0;

        // By design, the parser will parse first token after the keyword.
        // In this case, the keyword must be analyzed too, in order to determine
        // the type of this join.
        if ($list->idx > 0) {
            --$list->idx;
        }

        for (; $list->idx < $list->count; ++$list->idx) {
            /**
             * Token parsed at this moment.
             *
             * @var Token
             */
            $token = $list->tokens[$list->idx];

            // End of statement.
            if ($token->type === Token::TYPE_DELIMITER) {
                break;
            }

            // Skipping whitespaces and comments.
            if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) {
                continue;
            }

            if ($state === 0) {
                if (($token->type === Token::TYPE_KEYWORD)
                    && ! empty(static::$JOINS[$token->keyword])
                ) {
                    $expr->type = static::$JOINS[$token->keyword];
                    $state = 1;
                } else {
                    break;
                }
            } elseif ($state === 1) {
                $expr->expr = Expression::parse($parser, $list, ['field' => 'table']);
                $state = 2;
            } elseif ($state === 2) {
                if ($token->type === Token::TYPE_KEYWORD) {
                    switch ($token->keyword) {
                        case 'ON':
                            $state = 3;
                            break;
                        case 'USING':
                            $state = 4;
                            break;
                        default:
                            if (! empty(static::$JOINS[$token->keyword])
                            ) {
                                $ret[] = $expr;
                                $expr = new self();
                                $expr->type = static::$JOINS[$token->keyword];
                                $state = 1;
                            } else {
                                /* Next clause is starting */
                                break 2;
                            }
                            break;
                    }
                }
            } elseif ($state === 3) {
                $expr->on = Condition::parse($parser, $list);
                $ret[] = $expr;
                $expr = new self();
                $state = 0;
            } elseif ($state === 4) {
                $expr->using = ArrayObj::parse($parser, $list);
                $ret[] = $expr;
                $expr = new self();
                $state = 0;
            }
        }

        if (! empty($expr->type)) {
            $ret[] = $expr;
        }

        --$list->idx;

        return $ret;
    }
749973
public static function parse(Parser $parser, TokensList $list, array $options = [])
    {
        $ret = new self();

        /**
         * The state of the parser.
         *
         * Below are the states of the parser.
         *
         *      0 ----------------------[ table ]---------------------> 1
         *
         *      1 ---------------------[ columns ]--------------------> 2
         *
         *      2 ---------------------[ options ]--------------------> (END)
         *
         * @var int
         */
        $state = 0;

        for (; $list->idx < $list->count; ++$list->idx) {
            /**
             * Token parsed at this moment.
             *
             * @var Token
             */
            $token = $list->tokens[$list->idx];

            // End of statement.
            if ($token->type === Token::TYPE_DELIMITER) {
                break;
            }

            // Skipping whitespaces and comments.
            if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) {
                continue;
            }

            if ($state === 0) {
                $ret->table = Expression::parse(
                    $parser,
                    $list,
                    [
                        'parseField' => 'table',
                        'breakOnAlias' => true,
                    ]
                );
                $state = 1;
            } elseif ($state === 1) {
                $ret->columns = ArrayObj::parse($parser, $list)->values;
                $state = 2;
            } elseif ($state === 2) {
                $ret->options = OptionsArray::parse($parser, $list, static::$REFERENCES_OPTIONS);
                ++$list->idx;
                break;
            }
        }

        --$list->idx;

        return $ret;
    }
189754
public <T extends Enum<T>> List<T> getEnumList(final String param, final Class<T> clazz) {
    return this.getList(param, new StringToEnum<>(clazz), new AlwaysValid<T>(), "enumeration");
  }