| @@ 175-199 (lines=25) @@ | ||
| 172 | return new Argument($name, $value); |
|
| 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 | { |
|
| @@ 380-404 (lines=25) @@ | ||
| 377 | return new VariableDefinition($variable, $type, $defaultValue); |
|
| 378 | } |
|
| 379 | ||
| 380 | private function parseVariableDefinitionList() |
|
| 381 | { |
|
| 382 | $definitions = array(); |
|
| 383 | ||
| 384 | if ($this->is(Token::T_PAREN_LEFT) === false) { |
|
| 385 | return $definitions; |
|
| 386 | } |
|
| 387 | ||
| 388 | $this->expect(Token::T_PAREN_LEFT); |
|
| 389 | ||
| 390 | while (true) { |
|
| 391 | if ($this->scanner->eof()) { |
|
| 392 | throw $this->getParseError('Unclosed parenthesis of variable definition list'); |
|
| 393 | } |
|
| 394 | ||
| 395 | if ($this->accept(Token::T_PAREN_RIGHT)) { |
|
| 396 | break; |
|
| 397 | } |
|
| 398 | ||
| 399 | $definitions[] = $this->parseVariableDefinition(); |
|
| 400 | $this->accept(Token::T_COMMA); |
|
| 401 | } |
|
| 402 | ||
| 403 | return $definitions; |
|
| 404 | } |
|
| 405 | ||
| 406 | private function parseDefinition() |
|
| 407 | { |
|