Hi,
Actually, it is not a bug in trim.
There are two problems in your code.
- The first problem is that "$" asParser negate plus" will consume whitespaces, too, and thus, there will be no whitespace left to trim afterwards.
- The second problem was the order of "trim" and "flatten". It should be "flatten trim". If you say "trim flatten", trim will indeed return the collection without whitespaces, but the position of the token still includes the whitespaces, and thus, because flatten simply flattens from the start to the end of the current position, you get the spaces back.
Try this:
stringToParse := 'class=" aClass "'.
valueParser := ($" asParser / #blank asParser ) negate plus.
parser := ('class="' asParser, valueParser flatten trim , $" asParser) ==> [:nodes | nodes second].
result := parser parse: stringToParse.
Cheers,
Doru
On 26 Nov 2010, at 07:20, Sean P. DeNigris wrote:
--
www.tudorgirba.com
"Every now and then stop and ask yourself if the war you're fighting is the right one."
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev