#flatten does not transform your result, but returns a copy of the
consumed range from the input collection. Check the method comment of
#flatten, the class comment of PPFlattenParser, and the tests.
Try with something along:
word := #word asParser plus flatten ==> [ :s | s capitalized ].
space := #space asParser ==> [ :s | nil ].
parser := (word separatedBy: space) ==> [ :s | s reject: [ :each |
each isNil ] ].
start := parser foldLeft: [ :a :b | a , b ]
Lukas
--
Lukas Renggli
www.lukas-renggli.ch