JB and I were discuting about changing the SHParser by PetitParser, maybe your problem is a good excuse to do it :°
Ben 2011/2/26 Edouard Poor <[email protected]> > I was trying to write the most compact source code to HTML/CSS I could come > up with: > > parser := SHParserST80 new. > > code := OrderedCollection sourceCodeAt: #sort:. > ranges := parser rangesIn: code classOrMetaClass: OrderedCollection > workspace: nil environment: nil. > > dict := Dictionary with: 1->#whitespace. > ranges do: [ :range | dict add: range start -> range type; add: range end + > 1 -> #whitespace ]. > spans := dict associations sorted overlappingPairsCollect: [ :a :b | > '<span class="', a value, '">', (code copyFrom: a key to: b key - 1), > '</span>' ]. > > but SHParserST80's use of #- and #'$' might mess things up a little. What > do you think about replacing those two symbols with textual versions (like > #minus #characterPrefix)? > > I'm kind of serious - Shout's two non-textual type names seem ugly. > > Cheers, > Edouard. >
