function init($rules) { reset($rules); $this->root = key($rules); $builder = new LALR1Builder($rules); $builder->build(); $this->states = $builder->optimize(); reset($rules); }
function testLALRException() { $builder = new LALR1Builder(['A' => [[['A', 'a'], true], [['A', 'a'], true]]]); try { $builder->build(); $builder->optimize(); $this->fail(); } catch (LALR1Exception $e) { //$this->assertEquals(LALR1Exception::REDUCE_REDUCE_CONFLICT, $e->getCode()); } }