| @@ 39-58 (lines=20) @@ | ||
| 36 | return new ValueObject($fields, $location); |
|
| 37 | } |
|
| 38 | ||
| 39 | private function parseList() |
|
| 40 | { |
|
| 41 | $location = $this->expect(Token::T_BRACKET_LEFT)->location; |
|
| 42 | $items = array(); |
|
| 43 | ||
| 44 | while (true) { |
|
| 45 | if ($this->scanner->eof()) { |
|
| 46 | throw $this->getParseError('Unclosed bracket of list'); |
|
| 47 | } |
|
| 48 | ||
| 49 | if ($this->accept(Token::T_BRACKET_RIGHT)) { |
|
| 50 | break; |
|
| 51 | } |
|
| 52 | ||
| 53 | $items[] = $this->parseValue(); |
|
| 54 | $this->accept(Token::T_COMMA); |
|
| 55 | } |
|
| 56 | ||
| 57 | return new ValueList($items, $location); |
|
| 58 | } |
|
| 59 | ||
| 60 | private function parseVariable() |
|
| 61 | { |
|
| @@ 216-235 (lines=20) @@ | ||
| 213 | throw $this->getParseError($message . " but instead found \"{$token->getName()}\" with value \"{$token->value}\""); |
|
| 214 | } |
|
| 215 | ||
| 216 | private function parseSelectionSet() |
|
| 217 | { |
|
| 218 | $location = $this->expect(Token::T_BRACE_LEFT)->location; |
|
| 219 | ||
| 220 | /** @var Selection[] $selections */ |
|
| 221 | $selections = array(); |
|
| 222 | while (true) { |
|
| 223 | if ($this->scanner->eof()) { |
|
| 224 | throw $this->getParseError('Unclosed brace of selection set'); |
|
| 225 | } |
|
| 226 | ||
| 227 | if ($this->accept(Token::T_BRACE_RIGHT)) { |
|
| 228 | break; |
|
| 229 | } |
|
| 230 | ||
| 231 | $selections[] = $this->parseSelection(); |
|
| 232 | } |
|
| 233 | ||
| 234 | return new SelectionSet($selections, $location); |
|
| 235 | } |
|
| 236 | ||
| 237 | private function parseTypeCondition() |
|
| 238 | { |
|
| @@ 90-105 (lines=16) @@ | ||
| 87 | throw $this->getParseError('Unclosed brace of object value'); |
|
| 88 | } |
|
| 89 | ||
| 90 | private function parseList() |
|
| 91 | { |
|
| 92 | $location = $this->expect(Token::T_BRACKET_LEFT)->location; |
|
| 93 | $items = array(); |
|
| 94 | while ($this->scanner->eof() === false) { |
|
| 95 | if ($this->accept(Token::T_BRACKET_RIGHT)) { |
|
| 96 | return new ValueList($items, $location); |
|
| 97 | } |
|
| 98 | ||
| 99 | $items[] = $this->parseValue(); |
|
| 100 | $this->accept(Token::T_COMMA); |
|
| 101 | } |
|
| 102 | ||
| 103 | throw $this->getParseError('Unclosed bracket of list'); |
|
| 104 | ||
| 105 | } |
|
| 106 | ||
| 107 | private function parseValue() |
|
| 108 | { |
|