eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'ParseTreeRewriter':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: ParseTreeRewriter


Inheritance:

   Object
   |
   +--RBProgramNodeVisitor
      |
      +--ParseTreeSearcher
         |
         +--ParseTreeRewriter
            |
            +--ParseTreeSourceRewriter

Package:
stx:goodies/refactoryBrowser/parser
Category:
Refactory-ParseTree Matching
Version:
rev: 1.35 date: 2018/04/16 11:26:08
user: cg
file: ParseTreeRewriter.st directory: goodies/refactoryBrowser/parser
module: stx stc-classLibrary: parser

Description:


ParseTreeRewriter walks over and transforms its BRProgramNode (tree). If the tree is modified, then answer is set to true, and the modified tree can be retrieved by the #tree method.

Instance Variables:
	tree    <BRProgramNode> the parse tree we're transforming


Class protocol:

accessing
o  replace: code with: newCode in: aParseTree

o  replace: code with: newCode in: aParseTree onInterval: anInterval

o  replaceStatements: code with: newCode in: aParseTree onInterval: anInterval

instance creation
o  classVariable: aVarName getter: getMethod setter: setMethod

o  new
A small hack to use ParseTreeSourceRewriter if all refactorings. should not harm...
usage example(s):
        ParseTreeRewriter new.
        UserPreferences current at: #useParseTreeSourceRewriterForAllRewrites put: false.
        UserPreferences current at: #useParseTreeSourceRewriterForAllRewrites put: true

o  removeTemporaryNamed: aName

o  rename: varName to: newVarName

o  rename: varName to: newVarName handler: aBlock
Rename varName to newVarName, evaluating aBlock if there is a
temporary variable with the same name as newVarName. This
does not change temporary variables with varName.

o  replace: code with: newCode method: aBoolean

o  replaceLiteral: literal with: newLiteral
duplicate code.

o  valueHolderForVariable: aVarName holderMethod: aSelector

o  variable: aVarName getter: getMethod setter: setMethod

o  variable: aVarName getter: getMethod setter: setMethod receiver: aString

private
o  replaceLiteral: literal with: newLiteral inToken: literalToken
if literalToken's value is literal, replace it by newLiteral and return true.
otherwise, return false


Instance protocol:

accessing
o  executeTree: aParseTree
(comment from inherited method)
Save our current context, in case someone is performing another search inside a match.

o  forgetReplacements
Nothing to do here, to be polymorph with ParseTreeSourceRewriter

o  replacements
Nothing returned here, to be polymorph with ParseTreeSourceRewriter

o  tree

converting
o  asSearcher

obsolete
o  buildMethodParseTreeRuleFor: aReplaceCondition

o  buildParseTreeRuleFor: aReplaceCondition

private
o  foundMatch

o  lookForMoreMatchesInContext: oldContext

queries
o  isRewritingOriginalSource

replacing
o  replace: searchString with: replaceString

o  replace: searchString with: replaceString keepComments: keepComments
if keepComments is true, comments in the replaceString will be handled

o  replace: searchString with: replaceString thenDo: actionOnReplacedNode

o  replace: searchString with: replaceString when: aBlock

o  replace: searchString withValueFrom: replaceBlock

o  replace: searchString withValueFrom: replaceBlock when: conditionBlock

o  replaceArgument: searchString with: replaceString

o  replaceArgument: searchString with: replaceString when: aBlock

o  replaceArgument: searchString withValueFrom: replaceBlock

o  replaceArgument: searchString withValueFrom: replaceBlock when: conditionBlock

o  replaceLiteral: literal with: newLiteral

o  replaceMethod: searchString with: replaceString

o  replaceMethod: searchString with: replaceString when: aBlock

o  replaceMethod: searchString withValueFrom: replaceBlock

o  replaceMethod: searchString withValueFrom: replaceBlock when: conditionBlock

o  replaceTree: searchTree withTree: replaceTree

o  replaceTree: searchTree withTree: replaceTree when: aBlock

o  replaceVariable: variable with: newVariable
Transcript showCR:'replacing variable ',variable,' by ',newVariable.

visiting
o  visitArguments: aNodeCollection

visitor-double dispatching
o  acceptAssignmentNode: anAssignmentNode

o  acceptBlockNode: aBlockNode

o  acceptCascadeNode: aCascadeNode

o  acceptMessageNode: aMessageNode

o  acceptMethodNode: aMethodNode

o  acceptOptimizedNode: anOptimizedNode

o  acceptReturnNode: aReturnNode

o  acceptSequenceNode: aSequenceNode



ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Wed, 12 Dec 2018 22:27:21 GMT