Without looking at RB code, this is how I would handle it: 1) Reify Smalltalk tokens, and create a SpaceToken (can include various separators character and comments) the tokens just include a copy of corresponding source text. 2) Scanner creates a linked list of tokens including SpaceTokens 3) Parser parses the stream of tokens and build an AST that retain pointers to the links (firstLink and lastLink) The advantage of storing links rather than position is that we can add/remove links easily without recomputing positions 4) refactoring operates on AST and replaces links content, eventually if it add or remove links, then some special care of intersticial SpaceToken has to happen. 5) printing refactored source code is printing the tokens verbatim (that is just nextPutAll: their contents)
Nicolas 2009/11/22 Lukas Renggli <[email protected]>: >> at one point gwenael changed the parser to handle comments but apparently >> the code could not be loaded and >> it was never integrated. I imagine that now it is too divergent. > > The code never worked for me. It broke most parts of the Refactoring Engine. > > The new code is a fresh port from John's repository. There existing > port was a total mess, partly broken, partly incomplete, very > inefficient and polluted with code from other projects. > > Lukas > > -- > Lukas Renggli > http://www.lukas-renggli.ch > > _______________________________________________ > Pharo-project mailing list > [email protected] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
