public function inside_another_rule() { $tokens = new Tokenized('f(1, 2);'); $rule = new Sequence([new Token(T_STRING), new Token('('), $this->fixture, new Token(')'), new Token(';')], function ($values) { return [$values[0] => $values[2]]; }); $this->assertEquals(['f' => ['1', '2']], $rule->consume([], $tokens, [])->backing()); }
public function inside_another_rule() { $tokens = new Tokenized('set{a : b};'); $rule = new Sequence([new Token(T_STRING), new Token('{'), $this->fixture, new Token('}'), new Token(';')], function ($values) { return [$values[0] => $values[2]]; }); $this->assertEquals(['set' => ['a' => 'b']], $rule->consume([], $tokens, [])->backing()); }