/** * @param bool $isConst * * @return \Fubhy\GraphQL\Language\Node\ValueInterface * * @throws \Exception */ protected function parseValue($isConst) { $start = $this->token->getStart(); $token = $this->token; switch ($this->token->getType()) { case Token::BRACKET_L_TYPE: return $this->parseArray($isConst); case Token::BRACE_L_TYPE: return $this->parseObject($isConst); case Token::INT_TYPE: $this->advance(); return new IntValue($token->getValue(), $this->location($start)); case Token::FLOAT_TYPE: $this->advance(); return new FloatValue($token->getValue(), $this->location($start)); case Token::STRING_TYPE: $this->advance(); return new StringValue($token->getValue(), $this->location($start)); case Token::NAME_TYPE: $this->advance(); switch ($value = $token->getValue()) { case 'true': case 'false': return new BooleanValue($value === 'true', $this->location($start)); } return new EnumValue($value, $this->location($start)); case Token::DOLLAR_TYPE: if (!$isConst) { return $this->parseVariable(); } break; } throw $this->unexpected(); }