Changes between Version 4 and Version 5 of ScriptableInterface


Ignore:
Timestamp:
Apr 19, 2012, 9:39:21 PM (13 years ago)
Author:
manualwiki
Comment:

expanded in ScriptableInterface

Legend:

Unmodified
Added
Removed
Modified
  • ScriptableInterface

    v4 v5  
    3838Here is the list of transformations that you can use via this interface: 
    3939 
    40 '''rename/2''' 
    41  
    42 Renames [[RefactoringSteps/RenameVariable|variable]], [[RefactoringSteps/RenameFunction|function]], [[RefactoringSteps/RenameRecord|record]], [[RefactoringSteps/RenameRecordField|record field]], [[RefactoringSteps/RenameMacro|macro]], [[RefactoringSteps/RenameHeader|header file]] or [[RefactoringSteps/RenameModule|module file]].  
    43 Example: 
    44  
    45 {{{ 
    46 #!erlang 
    47 ris:rename("mods[name=='mymod'].fun[name=='Colour']", "Color"). 
    48 }}} 
     40 
     41'''eliminate/1''' 
     42 
     43Eliminates the given variable(s). ([[RefactoringSteps/EliminateVariable|eliminate variable]]). 
     44 
     45 
     46'''extfun/2, extract/2''' 
     47 
     48This is the [[RefactoringSteps/ExtractFunction|extract function]] transformation. 
     49 
     50 
     51'''inline/1''' 
     52 
     53Inlines the given function(s), or macro(s). ([[RefactoringSteps/InlineFunction|inline function]], [[RefactoringSteps/InlineMacro|inline macro]]). 
     54 
    4955 
    5056'''move/2''' 
    5157 
    5258Moves the given [[RefactoringSteps/MoveFunction|function]], [[RefactoringSteps/MoveMacro|macro]], or [[RefactoringSteps/MoveRecord|record]] to another module. 
     59 
    5360Example: 
    5461{{{ 
     
    6269}}} 
    6370 
    64 '''extfun/2, extract/2''' 
    65  
    66  
    67  
    68  
    69  
    70  
     71 
     72'''rename/2''' 
     73 
     74Renames [[RefactoringSteps/RenameVariable|variable]], [[RefactoringSteps/RenameFunction|function]], [[RefactoringSteps/RenameRecord|record]], [[RefactoringSteps/RenameRecordField|record field]], [[RefactoringSteps/RenameMacro|macro]], [[RefactoringSteps/RenameHeader|header file]] or [[RefactoringSteps/RenameModule|module file]].  
     75 
     76Example: 
     77{{{ 
     78#!erlang 
     79ris:rename("mods[name=='mymod'].fun[name=='Colour']", "Color"). 
     80}}} 
     81 
     82 
     83 
     84 
     85 
     86{{{#!comment 
     87'''reorder/2''' 
     88 
     89Reorders the function parameters. ([[RefactoringSteps/ReorderParameters|reorder function paameters]]) 
     90 
     91Example: 
     92{{{ 
     93#!erlang 
     94ris:reorder("mod.fun[name==fun1,arity==3]", 
     95            [3,1,2]). 
     96}}} 
    7197 
    7298 
     
    91117In every modul, reorder every functions' parameters, whose name is fun1 and the arity is 3: 
    92118 
    93 {{{ 
    94 #!erlang 
    95 ris:reorder("mod.fun[name==fun1,arity==3]", 
    96             [3,1,2]). 
    97 }}} 
    98  
    99  
    100119 
    101120{{{ 
     
    111130 
    112131ris:inline("mod[name==china].fun[name==sum] 
    113                .expr[type/=pattern and index==1]"). 
     132              .expr[type/=pattern and index==1]"). 
     133}}} 
    114134}}} 
    115135 
     
    120140* '''intersect''': The following example takes the intersection of the files included by the two modules. 
    121141 
     142Example: 
    122143{{{ 
    123144ris:q({"mods[name==mod1].includes", intersect, 
     
    125146}}} 
    126147 
    127 * '''union''': The union set operation. \\ 
    128 * '''minus''': The substraction set operation. \\ 
     148* '''union''': The union set operation. (Example: same as above, just substitute 'intersect' with 'union') \\ 
     149* '''minus''': The substraction set operation. (Example: same as above, just substitute 'intersect' with 'minus') \\ 
     150* '''Sequence''': Queries can be sequenced to continue a query from where another has left off. This example first adds the module from file 'mymodule.erl'. The add call returns the entities loaded. A semantic query aggregate of a list works by executing the first query (or in this case, specifying a starting entity), and then running the next query in the chain (in this case getting the name of files included by the add call). 
     151 
     152Example: 
     153{{{ 
     154#!erlang 
     155ris:q([ris:add_byname("mymodule.erl"),".includes.name"]). 
     156}}} 
     157 
     158 
     159 
     160{{{#!comment 
    129161* '''range''': Ranges of expressions can be selected which denotes a list of continuous expressions between two syntactical siblings. An empty semantic query denotes the beginning or end of a block when used as the initial or final limit respectively. In this example, the expression range starts from the (first) match expression that contains "Var1" in the pattern side up to the end of the syntactical block. 
    130162 
     
    139171}}} 
    140172 
    141 * '''Sequence''': Queries can be sequenced to continue a query from where another has left off. This example first adds the module from file 'mymodule.erl'. The add call returns the entities loaded. A semantic query aggregate of a list works by executing the first query (or in this case, specifying a starting entity), and then running the next query in the chain (in this case getting the name of files included by the add call). 
    142  
    143 {{{ 
    144 #!erlang 
    145 ris:q([ris:add_byname("mymodule.erl"),".includes.name"]). 
    146 }}} 
    147  
    148173* '''Another sequence example''': The following example shows an example for composition. It first renames all functions whose name is 'duck' to 'quack'. It then appends the suffix '_quacker' to the name of all functions which call these quacks. The new name is automatically converted to an atom. 
    149  
    150174 
    151175{{{ 
     
    162186            end). 
    163187}}} 
     188}}} 
    164189 
    165190== Textual display ==