Changes between Version 1 and Version 2 of SemanticQuery/Examples


Ignore:
Timestamp:
Apr 11, 2012, 1:11:32 PM (13 years ago)
Author:
manualwiki
Comment:

join basic and advanced queries, swap example queries and their explanation

Legend:

Unmodified
Added
Removed
Modified
  • SemanticQuery/Examples

    v1 v2  
    11= Query Examples = 
    22 
    3 == Basic queries == 
    4 In this language we can build difficult queries from lot of very simple queries. Here are some examples for simple ones: 
     3With our query language we can build either simple or more complex, compound quries. In the followings there are some useful and often used queries with different complexity. 
    54 
     5Returns a list of expressions which call the pointed function: 
    66{{{ 
    77@fun.refs 
    88}}} 
    9 Returns a list of expressions which call the pointed function. 
    109 
     10Returns all function calls from current module group by the module's own functions: 
    1111{{{ 
    1212@file.funs.calls 
    1313}}} 
    14 Returns all function calls from current module group by the module's own functions. 
    1514 
     15Returns all functions which have 3 arguments: 
    1616{{{ 
    1717@file.funs[arity==3] 
    1818}}} 
    19 Returns all functions which have 3 arguments. 
    2019 
    21 == Advanced queries == 
    22 Let's see some useful queries: 
    23  
     20Returns all functions which have a variable named "Expl". It useful when we want to know which functions use variables with same name: 
    2421{{{ 
    2522@file.funs.vars[name=="Expl"] 
    2623}}} 
    27 Returns all functions which have a variable named "Expl". It useful when we want to know which functions use variables with same name. 
    2824 
     25 
     26Returns all io:format calls (this query is very useful when you have finished your software, and you want to find all debug messages): 
    2927{{{ 
    3028mods[name=="io"].funs[name==format].refs 
    3129}}} 
    32 Returns all io:format calls, this query is very useful when you have finished your software, and you want to find all debug messages. 
    3330 
     31For example we stand in a variable, and run this query, we get information about the variable gets its value from where. This functionality uses [wiki:DataFlow data-flow analysis]. 
    3432{{{ 
    3533@expr.origin 
    3634}}} 
    37 For example we stand in a variable, and run this query, we get information about the variable gets its value from where. This functionality uses [wiki:DataFlow data-flow analysis]. 
    3835 
     36Returns information about the function gets its return value from where and how its calculated: 
    3937{{{ 
    4038@fun.refs.origin 
    4139}}} 
    42 Returns information about the function gets its return value from where and how its calculated. 
    4340 
    4441== Checking coding convensions ==