Start distinguishing AST from grammar tree

This commit is contained in:
rocky
2018-02-22 11:17:09 -05:00
parent a1b2a91d88
commit 09efb24a3e
10 changed files with 71 additions and 53 deletions

View File

@@ -16,7 +16,7 @@ read_global_ops = frozenset(('STORE_GLOBAL', 'DELETE_GLOBAL'))
# FIXME: this and find_globals could be paramaterized with one of the
# above global ops
def find_all_globals(node, globs):
"""Search AST node to find variable names that are global."""
"""Search Syntax Tree node to find variable names that are global."""
for n in node:
if isinstance(n, AST):
globs = find_all_globals(n, globs)
@@ -25,7 +25,7 @@ def find_all_globals(node, globs):
return globs
def find_globals(node, globs):
"""search AST node to find variable names that need a 'global' added."""
"""search grammar-tree node to find variable names that need a 'global' added."""
for n in node:
if isinstance(n, AST):
globs = find_globals(n, globs)