|
|
|
|
|
|
|
|
|
|
|
is_simple(node)
check for the structure [a,[b,[c,[...[k,[symbol.atom,...]]...] This
is called a "simple node" |
|
|
|
|
is_supersimple(node)
checks for the structure [a,[b,[c,[...[k,[tid, ...]]...] where tid is
a token nid. |
|
|
|
|
|
|
|
projection(*args,
**kwargs)
The projection function takes a parse tree of an arbitrary langlet
and maps it onto a a Python parse tree. |
|
|
|
|
lift(node,
LANGLET_OFFSET)
Adds LANGLET_OFFSET to each node id N where n<LANGLET_OFFSET. |
|
|
|
|
get_node_name(langlet,
nid,
type='parse') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
node_cmp(tree,
node_id)
Compares first node of cst tree with node_id. |
|
|
|
|
check_node(node,
target_langlet,
strict=True)
Recursive validity check of a CST node against a grammar. |
|
|
|
|
to_text(node_id)
Returns textual representation of a node id regardless of the
langlet. |
|
|
|
|
prepare_source(source)
Formats an indented source string by stripping away
"leading" whitespaces. |
|
|
|
|
present_node(node,
mark=[],
stop=False,
indent=0,
short_form=False) |
|
|
|
|
pprint(node,
mark=[],
stop=True,
indent=0,
short_form=False) |
|
|
|
|
rule_error(langlet,
cst,
expected_nids,
keywords=set([]),
parts=10,
type='parse') |
|
|
|
|
node_replace(old,
new)
inplace replacement of old node by new new node. |
|
|
|
|
clone_node(node,
with_marker=True)
Creates an identical copy of node. |
|
|
|
|
left_shift(node)
inplace replacement of [k,[l,...]] by [l,...] |
|
|
|
|
replace_in(context,
nid,
in_nid,
node)
Replace all nodes N within i{context} where nid(N) = i{in_nid} by
i{node} when a node M with nid(M) = i{nid} can be found in N. |
|
|
|
|
|
|
|
unparen(node)
Unparenthesizes all subnodes of i{node} that are already atomic. |
|
|
|
|
new_name(name)
Creates a new identifier from a string by appending a random number. |
|
|
|
|
left_distribute(a_atom,
a_test,
func=None)
Suppose a_test is a predicate of the form `A == X or B > Y`. |
|
|
|
|
varargs2arglist(varargs)
This function is used to turn the arguments of a function defintion
into that of a function call. |
|
|
|
|
to_signature(varargs)
Creates a dictionary from a varargs node. |
|
|
|
|
concat_funcalls(funA,
funB)
Two function calls funA(argsA), funB(argsB) are merged to one call
funA(args).funB(argsB). |
|
|
|
|
|
|
|
atomize(node,
enforce=False)
A lot of substitutions involve either a test or an expr node as a
target. |
|
|
|
|
split_file_input(tree)
splits file_input node containing many stmts into several file_input
nodes containing one stmt |
|
|
|
|
split_expr(node)
splits an expr of the kind a.b(x).c(). |
|
|
|
|
| exprlist2testlist(_exprlist) |
|
|
|
|
| add_to_suite(_suite,
_stmt,
pos=-1) |
|
|
|
|
normalize(node)
Sometimes a function f is defined using a simple_stmt node wrapping
its SUITE. |
|
|
|
|
pushstmt(stmt1,
stmt2)
If stmt1 has following structure : |
|
|
|
|
remove_node(tree,
node,
level=10000,
exclude=[]) |
|
|
|
|
find_one_of(tree,
node_ids,
level=10000,
exclude=[])
Generalization of find_node. |
|
|
|
|
find_all(tree,
node_id,
level=10000,
exclude=[])
generator that finds all nodes with a certain node_id. |
|
|
|
|
find_all_gen(tree,
node_id,
level=10000,
exclude=[])
generator that finds all nodes with a certain node_id. |
|
|
|
|
find_all_of(tree,
node_ids=[],
level=10000,
exclude=[])
generator that finds all nodes with a certain node_id. |
|
|
|
|
find_all_of_gen(tree,
node_ids=[],
level=10000,
exclude=[])
generator that finds all nodes with a certain node_id. |
|
|
|
|
find_node_chain(tree,
nid,
level=10000,
exclude=[],
chain=[])
Find node and returns as node chain. |
|
|
|
|
find_all_chains_gen(tree,
node_id,
level=10000,
exclude=[],
chain=[])
generator that finds all nodes with a certain node_id. |
|
|
|
|
find_all_chains(tree,
node_id,
level=10000,
exclude=[],
chain=[])
generator that finds all nodes with a certain node_id. |
|
|
|
|
count_node(tree,
node_id,
level=10000,
exclude=[])
generator that finds all nodes with a certain node_id. |
|
|
|
|
|
|
|
| get_one_of(node,
node_ids) |
|
|
|
|
|
|
|
| get_all_of(node,
node_ids) |
|
|
|
|
|
|
|
power_merge(nodeA,
nodeB)
This function merges a pair of power nodes in the following way: |
|
|
|
|
|
|
|
|
|
|
find_node(tree,
node_id,
level=10000,
exclude=[])
finds one node with a certain node_id. |
|
|