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