@@ -9,17 +9,18 @@ tree (PROD a, PROD c, OPT i)
99+-- a (OPT o)
1010+-- b (PROD c)
1111+-- c (OPT b)
12- +-- o (PROD m)
13- +-- m (PROD n)
12+ +-- o (PROD m, OPT i )
13+ +-- m (OPT n)
1414+-- n ()
1515+-- OPT i (PROD j)
1616+-- j ()
1717
1818Gathering the optional set from:
19- j: [i],
19+ j: [j, i],
2020a: [],
21- o: [m, n],
22- b: []
21+ o: [o, m, n],
22+ m: [o, m, n],
23+ b: [b],
2324*/
2425
2526const tree = new Node ( {
@@ -38,8 +39,8 @@ const tree = new Node({
3839 [ 'a' , [ ] , [ 'o' ] ] ,
3940 [ 'b' , [ 'c' ] , [ ] ] ,
4041 [ 'c' , [ ] , [ 'b' ] ] ,
41- [ 'o' , [ 'm' ] , [ ] ] ,
42- [ 'm' , [ 'n' ] , [ ] ] ,
42+ [ 'o' , [ 'm' ] , [ 'i' ] ] ,
43+ [ 'm' , [ ] , [ 'n' ] ] ,
4344 [ 'n' , [ ] , [ ] ] ,
4445 [ 'i' , [ 'j' ] , [ ] ] ,
4546 [ 'j' , [ ] , [ ] ] ,
@@ -83,11 +84,11 @@ t.equal(setO.has(nodeO), true, 'set o includes o')
8384t . equal ( setO . has ( nodeM ) , true , 'set o includes m' )
8485t . equal ( setO . has ( nodeN ) , true , 'set o includes n' )
8586
86- const setN = optionalSet ( nodeO )
87- t . equal ( setN . size , 3 , 'three nodes in n set' )
88- t . equal ( setN . has ( nodeO ) , true , 'set n includes o' )
89- t . equal ( setN . has ( nodeM ) , true , 'set n includes m' )
90- t . equal ( setN . has ( nodeN ) , true , 'set n includes n' )
87+ const setM = optionalSet ( nodeM )
88+ t . equal ( setM . size , 3 , 'three nodes in m set' )
89+ t . equal ( setM . has ( nodeO ) , true , 'set m includes o' )
90+ t . equal ( setM . has ( nodeM ) , true , 'set m includes m' )
91+ t . equal ( setM . has ( nodeN ) , true , 'set m includes n' )
9192
9293const setB = optionalSet ( nodeB )
9394t . equal ( setB . size , 1 , 'gathering from b is only b' )
0 commit comments