| @@ 129-153 (lines=25) @@ | ||
| 126 | return new Argument($nameToken->value, $value, $nameToken->location); |
|
| 127 | } |
|
| 128 | ||
| 129 | private function parseArgumentList() |
|
| 130 | { |
|
| 131 | $arguments = array(); |
|
| 132 | ||
| 133 | if ($this->is(Token::T_PAREN_LEFT) === false) { |
|
| 134 | return $arguments; |
|
| 135 | } |
|
| 136 | ||
| 137 | $this->expect(Token::T_PAREN_LEFT); |
|
| 138 | ||
| 139 | while (true) { |
|
| 140 | if ($this->scanner->eof()) { |
|
| 141 | throw $this->getParseError('Unclosed brace of argument list'); |
|
| 142 | } |
|
| 143 | ||
| 144 | if ($this->accept(Token::T_PAREN_RIGHT)) { |
|
| 145 | break; |
|
| 146 | } |
|
| 147 | ||
| 148 | $arguments[] = $this->parseArgument(); |
|
| 149 | $this->accept(Token::T_COMMA); |
|
| 150 | } |
|
| 151 | ||
| 152 | return $arguments; |
|
| 153 | } |
|
| 154 | ||
| 155 | private function parseField() |
|
| 156 | { |
|
| @@ 327-351 (lines=25) @@ | ||
| 324 | return new VariableDefinition($variable, $type, $defaultValue, $variable->location); |
|
| 325 | } |
|
| 326 | ||
| 327 | private function parseVariableDefinitionList() |
|
| 328 | { |
|
| 329 | $definitions = array(); |
|
| 330 | ||
| 331 | if ($this->is(Token::T_PAREN_LEFT) === false) { |
|
| 332 | return $definitions; |
|
| 333 | } |
|
| 334 | ||
| 335 | $this->expect(Token::T_PAREN_LEFT); |
|
| 336 | ||
| 337 | while (true) { |
|
| 338 | if ($this->scanner->eof()) { |
|
| 339 | throw $this->getParseError('Unclosed parenthesis of variable definition list'); |
|
| 340 | } |
|
| 341 | ||
| 342 | if ($this->accept(Token::T_PAREN_RIGHT)) { |
|
| 343 | break; |
|
| 344 | } |
|
| 345 | ||
| 346 | $definitions[] = $this->parseVariableDefinition(); |
|
| 347 | $this->accept(Token::T_COMMA); |
|
| 348 | } |
|
| 349 | ||
| 350 | return $definitions; |
|
| 351 | } |
|
| 352 | ||
| 353 | private function parseDefinition() |
|
| 354 | { |
|