mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Move static analysis documentation of the names for nodes_to_execute.
This commit is contained in:
106
docs/docs/static_analsysis.rst
Normal file
106
docs/docs/static_analsysis.rst
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
|
||||||
|
This file is the start of the documentation of how static analysis works.
|
||||||
|
|
||||||
|
Below is a list of parser names that are used within nodes_to_execute.
|
||||||
|
|
||||||
|
------------ cared for:
|
||||||
|
global_stmt
|
||||||
|
exec_stmt # no priority
|
||||||
|
assert_stmt
|
||||||
|
if_stmt
|
||||||
|
while_stmt
|
||||||
|
for_stmt
|
||||||
|
try_stmt
|
||||||
|
(except_clause)
|
||||||
|
with_stmt
|
||||||
|
(with_item)
|
||||||
|
(with_var)
|
||||||
|
print_stmt
|
||||||
|
del_stmt
|
||||||
|
return_stmt
|
||||||
|
raise_stmt
|
||||||
|
yield_expr
|
||||||
|
file_input
|
||||||
|
funcdef
|
||||||
|
param
|
||||||
|
old_lambdef
|
||||||
|
lambdef
|
||||||
|
import_name
|
||||||
|
import_from
|
||||||
|
(import_as_name)
|
||||||
|
(dotted_as_name)
|
||||||
|
(import_as_names)
|
||||||
|
(dotted_as_names)
|
||||||
|
(dotted_name)
|
||||||
|
classdef
|
||||||
|
comp_for
|
||||||
|
(comp_if) ?
|
||||||
|
decorator
|
||||||
|
|
||||||
|
----------- add basic
|
||||||
|
test
|
||||||
|
or_test
|
||||||
|
and_test
|
||||||
|
not_test
|
||||||
|
expr
|
||||||
|
xor_expr
|
||||||
|
and_expr
|
||||||
|
shift_expr
|
||||||
|
arith_expr
|
||||||
|
term
|
||||||
|
factor
|
||||||
|
power
|
||||||
|
atom
|
||||||
|
comparison
|
||||||
|
expr_stmt
|
||||||
|
testlist
|
||||||
|
testlist1
|
||||||
|
testlist_safe
|
||||||
|
|
||||||
|
----------- special care:
|
||||||
|
# mostly depends on how we handle the other ones.
|
||||||
|
testlist_star_expr # should probably just work with expr_stmt
|
||||||
|
star_expr
|
||||||
|
exprlist # just ignore? then names are just resolved. Strange anyway, bc expr is not really allowed in the list, typically.
|
||||||
|
|
||||||
|
----------- ignore:
|
||||||
|
suite
|
||||||
|
subscriptlist
|
||||||
|
subscript
|
||||||
|
simple_stmt
|
||||||
|
?? sliceop # can probably just be added.
|
||||||
|
testlist_comp # prob ignore and care about it with atom.
|
||||||
|
dictorsetmaker
|
||||||
|
trailer
|
||||||
|
decorators
|
||||||
|
decorated
|
||||||
|
# always execute function arguments? -> no problem with stars.
|
||||||
|
# Also arglist and argument are different in different grammars.
|
||||||
|
arglist
|
||||||
|
argument
|
||||||
|
|
||||||
|
|
||||||
|
----------- remove:
|
||||||
|
tname # only exists in current Jedi parser. REMOVE!
|
||||||
|
tfpdef # python 2: tuple assignment; python 3: annotation
|
||||||
|
vfpdef # reduced in python 3 and therefore not existing.
|
||||||
|
tfplist # not in 3
|
||||||
|
vfplist # not in 3
|
||||||
|
|
||||||
|
--------- not existing with parser reductions.
|
||||||
|
small_stmt
|
||||||
|
import_stmt
|
||||||
|
flow_stmt
|
||||||
|
compound_stmt
|
||||||
|
stmt
|
||||||
|
pass_stmt
|
||||||
|
break_stmt
|
||||||
|
continue_stmt
|
||||||
|
comp_op
|
||||||
|
augassign
|
||||||
|
old_test
|
||||||
|
typedargslist # afaik becomes [param]
|
||||||
|
varargslist # dito
|
||||||
|
vname
|
||||||
|
comp_iter
|
||||||
|
test_nocond
|
||||||
@@ -215,114 +215,6 @@ def get_executable_nodes(module):
|
|||||||
Returns the nodes used in a module. All these nodes should be
|
Returns the nodes used in a module. All these nodes should be
|
||||||
evaluated to check for potential exceptions.
|
evaluated to check for potential exceptions.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
"""
|
|
||||||
functions
|
|
||||||
to ignore:
|
|
||||||
|
|
||||||
------------ cared for:
|
|
||||||
global_stmt
|
|
||||||
exec_stmt # no priority
|
|
||||||
assert_stmt
|
|
||||||
if_stmt
|
|
||||||
while_stmt
|
|
||||||
for_stmt
|
|
||||||
try_stmt
|
|
||||||
(except_clause)
|
|
||||||
with_stmt
|
|
||||||
(with_item)
|
|
||||||
(with_var)
|
|
||||||
print_stmt
|
|
||||||
del_stmt
|
|
||||||
return_stmt
|
|
||||||
raise_stmt
|
|
||||||
yield_expr
|
|
||||||
file_input
|
|
||||||
funcdef
|
|
||||||
param
|
|
||||||
old_lambdef
|
|
||||||
lambdef
|
|
||||||
import_name
|
|
||||||
import_from
|
|
||||||
(import_as_name)
|
|
||||||
(dotted_as_name)
|
|
||||||
(import_as_names)
|
|
||||||
(dotted_as_names)
|
|
||||||
(dotted_name)
|
|
||||||
classdef
|
|
||||||
comp_for
|
|
||||||
(comp_if) ?
|
|
||||||
decorator
|
|
||||||
|
|
||||||
----------- add basic
|
|
||||||
test
|
|
||||||
or_test
|
|
||||||
and_test
|
|
||||||
not_test
|
|
||||||
expr
|
|
||||||
xor_expr
|
|
||||||
and_expr
|
|
||||||
shift_expr
|
|
||||||
arith_expr
|
|
||||||
term
|
|
||||||
factor
|
|
||||||
power
|
|
||||||
atom
|
|
||||||
comparison
|
|
||||||
expr_stmt
|
|
||||||
testlist
|
|
||||||
testlist1
|
|
||||||
testlist_safe
|
|
||||||
|
|
||||||
----------- special care:
|
|
||||||
# mostly depends on how we handle the other ones.
|
|
||||||
testlist_star_expr # should probably just work with expr_stmt
|
|
||||||
star_expr
|
|
||||||
exprlist # just ignore? then names are just resolved. Strange anyway, bc expr is not really allowed in the list, typically.
|
|
||||||
|
|
||||||
----------- ignore:
|
|
||||||
suite
|
|
||||||
subscriptlist
|
|
||||||
subscript
|
|
||||||
simple_stmt
|
|
||||||
?? sliceop # can probably just be added.
|
|
||||||
testlist_comp # prob ignore and care about it with atom.
|
|
||||||
dictorsetmaker
|
|
||||||
trailer
|
|
||||||
decorators
|
|
||||||
decorated
|
|
||||||
# always execute function arguments? -> no problem with stars.
|
|
||||||
# Also arglist and argument are different in different grammars.
|
|
||||||
arglist
|
|
||||||
argument
|
|
||||||
|
|
||||||
|
|
||||||
----------- remove:
|
|
||||||
tname # only exists in current Jedi parser. REMOVE!
|
|
||||||
tfpdef # python 2: tuple assignment; python 3: annotation
|
|
||||||
vfpdef # reduced in python 3 and therefore not existing.
|
|
||||||
tfplist # not in 3
|
|
||||||
vfplist # not in 3
|
|
||||||
|
|
||||||
--------- not existing with parser reductions.
|
|
||||||
small_stmt
|
|
||||||
import_stmt
|
|
||||||
flow_stmt
|
|
||||||
compound_stmt
|
|
||||||
stmt
|
|
||||||
pass_stmt
|
|
||||||
break_stmt
|
|
||||||
continue_stmt
|
|
||||||
comp_op
|
|
||||||
augassign
|
|
||||||
old_test
|
|
||||||
typedargslist # afaik becomes [param]
|
|
||||||
varargslist # dito
|
|
||||||
vname
|
|
||||||
comp_iter
|
|
||||||
test_nocond
|
|
||||||
|
|
||||||
"""
|
|
||||||
def check_children(node):
|
def check_children(node):
|
||||||
try:
|
try:
|
||||||
children = node.children
|
children = node.children
|
||||||
|
|||||||
Reference in New Issue
Block a user