Conditions | 4 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
21 | public function feedParserWithNodes(Parser $parser): void |
||
22 | { |
||
23 | $lexer = $parser->getLexer(); |
||
24 | |||
25 | $this->nodes[] = $parser->{$this->commonNodeMapping}(); |
||
26 | if (!isset($lexer->lookahead['type'])) { |
||
27 | throw new \RuntimeException('The parser\'s "lookahead" property is not populated with a type'); |
||
28 | } |
||
29 | |||
30 | $aheadType = $lexer->lookahead['type']; |
||
31 | |||
32 | while (Lexer::T_CLOSE_PARENTHESIS !== $aheadType) { |
||
33 | if (Lexer::T_COMMA === $aheadType) { |
||
34 | $parser->match(Lexer::T_COMMA); |
||
35 | $this->nodes[] = $parser->{$this->commonNodeMapping}(); |
||
36 | } |
||
37 | $aheadType = $lexer->lookahead['type']; |
||
38 | } |
||
51 |