OXIESEC PANEL
- Current Dir:
/
/
usr
/
lib
/
python2.7
/
compiler
Server IP: 10.0.0.4
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
07/15/2022 06:13:41 AM
rwxr-xr-x
📄
__init__.py
1023 bytes
07/01/2022 03:56:32 PM
rw-r--r--
📄
__init__.pyc
1.26 KB
07/15/2022 06:13:40 AM
rw-r--r--
📄
ast.py
36.63 KB
07/01/2022 03:56:32 PM
rw-r--r--
📄
ast.pyc
69.67 KB
07/15/2022 06:13:40 AM
rw-r--r--
📄
consts.py
468 bytes
07/01/2022 03:56:32 PM
rw-r--r--
📄
consts.pyc
735 bytes
07/15/2022 06:13:40 AM
rw-r--r--
📄
future.py
1.85 KB
07/01/2022 03:56:32 PM
rw-r--r--
📄
future.pyc
2.87 KB
07/15/2022 06:13:40 AM
rw-r--r--
📄
misc.py
1.75 KB
07/01/2022 03:56:32 PM
rw-r--r--
📄
misc.pyc
3.61 KB
07/15/2022 06:13:40 AM
rw-r--r--
📄
pyassem.py
23.7 KB
07/01/2022 03:56:32 PM
rw-r--r--
📄
pyassem.pyc
25.19 KB
07/15/2022 06:13:40 AM
rw-r--r--
📄
pycodegen.py
46.69 KB
07/01/2022 03:56:32 PM
rw-r--r--
📄
pycodegen.pyc
54.85 KB
07/15/2022 06:13:40 AM
rw-r--r--
📄
symbols.py
14.15 KB
07/01/2022 03:56:32 PM
rw-r--r--
📄
symbols.pyc
17.15 KB
07/15/2022 06:13:40 AM
rw-r--r--
📄
syntax.py
1.41 KB
07/01/2022 03:56:32 PM
rw-r--r--
📄
syntax.pyc
1.83 KB
07/15/2022 06:13:40 AM
rw-r--r--
📄
transformer.py
51.87 KB
07/01/2022 03:56:32 PM
rw-r--r--
📄
transformer.pyc
46.28 KB
07/15/2022 06:13:40 AM
rw-r--r--
📄
visitor.py
3.8 KB
07/01/2022 03:56:32 PM
rw-r--r--
📄
visitor.pyc
4.07 KB
07/15/2022 06:13:40 AM
rw-r--r--
Editing: syntax.py
Close
"""Check for errs in the AST. The Python parser does not catch all syntax errors. Others, like assignments with invalid targets, are caught in the code generation phase. The compiler package catches some errors in the transformer module. But it seems clearer to write checkers that use the AST to detect errors. """ from compiler import ast, walk def check(tree, multi=None): v = SyntaxErrorChecker(multi) walk(tree, v) return v.errors class SyntaxErrorChecker: """A visitor to find syntax errors in the AST.""" def __init__(self, multi=None): """Create new visitor object. If optional argument multi is not None, then print messages for each error rather than raising a SyntaxError for the first. """ self.multi = multi self.errors = 0 def error(self, node, msg): self.errors = self.errors + 1 if self.multi is not None: print "%s:%s: %s" % (node.filename, node.lineno, msg) else: raise SyntaxError, "%s (%s:%s)" % (msg, node.filename, node.lineno) def visitAssign(self, node): # the transformer module handles many of these pass ## for target in node.nodes: ## if isinstance(target, ast.AssList): ## if target.lineno is None: ## target.lineno = node.lineno ## self.error(target, "can't assign to list comprehension")