| @@ 175-199 (lines=25) @@ | ||
| 172 | return new Argument($nameToken->value, $value, $nameToken->location); |
|
| 173 | } |
|
| 174 | ||
| 175 | private function parseArgumentList() |
|
| 176 | { |
|
| 177 | $arguments = array(); |
|
| 178 | ||
| 179 | if ($this->is(Token::T_PAREN_LEFT) === false) { |
|
| 180 | return $arguments; |
|
| 181 | } |
|
| 182 | ||
| 183 | $this->expect(Token::T_PAREN_LEFT); |
|
| 184 | ||
| 185 | while (true) { |
|
| 186 | if ($this->scanner->eof()) { |
|
| 187 | throw $this->getParseError('Unclosed brace of argument list'); |
|
| 188 | } |
|
| 189 | ||
| 190 | if ($this->accept(Token::T_PAREN_RIGHT)) { |
|
| 191 | break; |
|
| 192 | } |
|
| 193 | ||
| 194 | $arguments[] = $this->parseArgument(); |
|
| 195 | $this->accept(Token::T_COMMA); |
|
| 196 | } |
|
| 197 | ||
| 198 | return $arguments; |
|
| 199 | } |
|
| 200 | ||
| 201 | private function parseField() |
|
| 202 | { |
|
| @@ 373-397 (lines=25) @@ | ||
| 370 | return new VariableDefinition($variable, $type, $defaultValue, $variable->location); |
|
| 371 | } |
|
| 372 | ||
| 373 | private function parseVariableDefinitionList() |
|
| 374 | { |
|
| 375 | $definitions = array(); |
|
| 376 | ||
| 377 | if ($this->is(Token::T_PAREN_LEFT) === false) { |
|
| 378 | return $definitions; |
|
| 379 | } |
|
| 380 | ||
| 381 | $this->expect(Token::T_PAREN_LEFT); |
|
| 382 | ||
| 383 | while (true) { |
|
| 384 | if ($this->scanner->eof()) { |
|
| 385 | throw $this->getParseError('Unclosed parenthesis of variable definition list'); |
|
| 386 | } |
|
| 387 | ||
| 388 | if ($this->accept(Token::T_PAREN_RIGHT)) { |
|
| 389 | break; |
|
| 390 | } |
|
| 391 | ||
| 392 | $definitions[] = $this->parseVariableDefinition(); |
|
| 393 | $this->accept(Token::T_COMMA); |
|
| 394 | } |
|
| 395 | ||
| 396 | return $definitions; |
|
| 397 | } |
|
| 398 | ||
| 399 | private function parseDefinition() |
|
| 400 | { |
|