[Pharo-project] ParseTreeRewrite Limitations
Camille/o were trying to fix a bug in the CriticsRules and found a strange limitation of the ParseTreeRewriter Given: Result: ------ ------- | a b | | a b | self halt. self bar. self bar. However this is not possible to specify directly: RBParseTreeRewriter new replace: '`@object halt' with: ''. As the parsed ' ' string will result in a SequenceNode, thus forcing the original message node ('self halt') to be a sequence node. So instead of looking for 'self halt' it will look for || self halt. and thus it tries to explicitly match the temporary. The result is, that we cannot remove 'self halt' with a rewrite rule if the method/block contains temporaries :/. Has anybody encountered this, or knows how to directly replace a message node with an "empty node"? best c&c
Camillo Bruni-3 wrote
Camille/o were trying to fix a bug in the CriticsRules and found a strange limitation of the ParseTreeRewriter
Given: Result: ------ ------- | a b | | a b | self halt. self bar. self bar.
However this is not possible to specify directly:
RBParseTreeRewriter new replace: '`@object halt' with: ''.
As the parsed ' ' string will result in a SequenceNode, thus forcing the original message node ('self halt') to be a sequence node.
So instead of looking for 'self halt' it will look for || self halt. and thus it tries to explicitly match the temporary.
The result is, that we cannot remove 'self halt' with a rewrite rule if the method/block contains temporaries :/.
Has anybody encountered this, or knows how to directly replace a message node with an "empty node"?
best c&c
You have to edit the higher level node. So find the node with the halt as a child and do you edits there. -- View this message in context: http://forum.world.st/ParseTreeRewrite-Limitations-tp4680439p4680486.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
participants (2)
-
Camillo Bruni -
Paul DeBruicker