ok(eq_set([array_keys($rt->_lookahead($ra->__path[0]))], ['a', 'f', 'r']), '_lookahead reamused/refused/amused/fused/used'); $ra->reset()->add('reran')->add('ran')->_reduce(); ok(eq_set([array_keys($rt->_lookahead($ra->__path[0]))], ['r']), '_lookahead reran/ran'); $ra->reset()->add('cruised')->add('bruised')->add('hosed')->add('gazed')->add('used')->_reduce(); ok(eq_set([array_keys($rt->_lookahead($ra->__path[0]))], ['b', 'c', 'g', 'h', 'u']), '_lookahead cruised/bruised/hosed/gazed/used'); //} is($rt->_dump([1, 0, NULL]), '[1 0 *]', 'dump undef'); is($rt->_dump([1, 0, ' ']), "[1 0 ' ']", 'dump space'); is($rt->_dump(['a' => ['a', 'b'], 'b' => ['b']]), '{a=>[a b] b=>[b]}', 'dump node'); is($rt->_dump(['a', chr(7), 'b']), '[a \\x07 b]', 'dump pretty'); //保留 //is( $r->insert(' ')->insert(' ')->dump(), // '[\\x07 {\\x05=>[\\x05] \\x06=>[\\x06]}]', 'dump pretty node' //); is($rt->_dump(['a', chr(7), 'b']), '[a \\x07 b]', 'dump pretty'); is($rt->_combine('?=', ['c', 'a', 'b']), '(?=[abc])', '_combine c a b'); is($rt->_combine('?=', ['c', 'ab', 'de']), '(?=ab|de|c)', '_combine c ab de'); is($rt->_combine('?=', ['in', 'og']), '(?=in|og)', '_combine in og'); is($rt->_combine('?=', ['in', 'og', 'j', 'k', 'l']), '(?=[jkl]|in|og)', '_combine in og j k l'); is($rt->_combine('?=', ['in', 'og', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']), '(?=\\d|in|og)', '_combine in og 0 1 ... 9'); is_deeply($rt->_unrev_path([['x1' => ['x1', 'z\\d'], '' => 0]], $context), [['z\\d' => ['z\\d', 'x1'], '' => 0]], 'node(* metachar)'); is_deeply($rt->_unrev_path([['x' => ['x', '\\d'], '' => 0]], $context), [['\\d' => ['\\d', 'x'], '' => 0]], 'node(* metachar) 2'); is_deeply($rt->_unrev_path([['ab', 'cd', 'ef'], ['x1' => ['x1', 'y2', 'z\\d'], 'mx' => [['mx', 'us', 'ca']]]], $context), [['z\\d' => ['z\\d', 'y2', 'x1'], 'ca' => [['ca', 'us', 'mx']]], ['ef', 'cd', 'ab']], 'path(node)'); //{ // my $r = $r; is_deeply($r->lexstr('ab'), ['a', 'b'], "lexstr('ab')"); is_deeply($r->lexstr('a\\,b'), ['a', ',', 'b'], "lexstr('a\\,b')"); //} //eval { // my $ra = $r; // $ra->Default_Lexer( qr/\d+/ );