aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Bendersky <eliben@gmail.com>2017-11-22 05:57:49 -0800
committerEli Bendersky <eliben@gmail.com>2017-11-22 05:57:49 -0800
commit17efc7c306e1d1bbcaabc8fd57a312a52f1bf105 (patch)
tree4ffd60fd7597810bececbda40339c2c6351c19ef
parentec2331889b3a283dfbd09bc76fc7e117d0644ec0 (diff)
downloadplatform_external_python_pycparser-17efc7c306e1d1bbcaabc8fd57a312a52f1bf105.tar.gz
platform_external_python_pycparser-17efc7c306e1d1bbcaabc8fd57a312a52f1bf105.tar.bz2
platform_external_python_pycparser-17efc7c306e1d1bbcaabc8fd57a312a52f1bf105.zip
Minor cleanups
- Removed unnecessary whitespace - Removed old & stale 'if __main__' sections in some of the library files
-rw-r--r--pycparser/_ast_gen.py13
-rw-r--r--pycparser/c_generator.py6
-rw-r--r--pycparser/c_lexer.py1
-rw-r--r--pycparser/c_parser.py19
4 files changed, 5 insertions, 34 deletions
diff --git a/pycparser/_ast_gen.py b/pycparser/_ast_gen.py
index aacc700..526d1ec 100644
--- a/pycparser/_ast_gen.py
+++ b/pycparser/_ast_gen.py
@@ -150,14 +150,12 @@ class NodeCfg(object):
# Empty generator
src += (
' return\n' +
- ' yield\n'
- )
+ ' yield\n')
else:
# Empty generator
src += (
' return\n' +
- ' yield\n'
- )
+ ' yield\n')
return src
@@ -309,10 +307,3 @@ class NodeVisitor(object):
self.visit(c)
'''
-
-
-if __name__ == "__main__":
- import sys
- ast_gen = ASTCodeGenerator('_c_ast.cfg')
- ast_gen.generate(open('c_ast.py', 'w'))
-
diff --git a/pycparser/c_generator.py b/pycparser/c_generator.py
index a7ee5e6..8001739 100644
--- a/pycparser/c_generator.py
+++ b/pycparser/c_generator.py
@@ -39,7 +39,7 @@ class CGenerator(object):
def visit_ID(self, n):
return n.name
-
+
def visit_Pragma(self, n):
ret = '#pragma'
if n.string:
@@ -416,5 +416,5 @@ class CGenerator(object):
""" Returns True for nodes that are "simple" - i.e. nodes that always
have higher precedence than operators.
"""
- return isinstance(n,( c_ast.Constant, c_ast.ID, c_ast.ArrayRef,
- c_ast.StructRef, c_ast.FuncCall))
+ return isinstance(n, (c_ast.Constant, c_ast.ID, c_ast.ArrayRef,
+ c_ast.StructRef, c_ast.FuncCall))
diff --git a/pycparser/c_lexer.py b/pycparser/c_lexer.py
index d9941c1..944cbb8 100644
--- a/pycparser/c_lexer.py
+++ b/pycparser/c_lexer.py
@@ -482,4 +482,3 @@ class CLexer(object):
def t_error(self, t):
msg = 'Illegal character %s' % repr(t.value[0])
self._error(msg, t)
-
diff --git a/pycparser/c_parser.py b/pycparser/c_parser.py
index fe3b082..f01f67f 100644
--- a/pycparser/c_parser.py
+++ b/pycparser/c_parser.py
@@ -1766,22 +1766,3 @@ class CParser(PLYParser):
column=self.clex.find_tok_column(p)))
else:
self._parse_error('At end of input', self.clex.filename)
-
-
-#------------------------------------------------------------------------------
-if __name__ == "__main__":
- import pprint
- import time, sys
-
- #t1 = time.time()
- #parser = CParser(lex_optimize=True, yacc_debug=True, yacc_optimize=False)
- #sys.write(time.time() - t1)
-
- #buf = '''
- #int (*k)(int);
- #'''
-
- ## set debuglevel to 2 for debugging
- #t = parser.parse(buf, 'x.c', debuglevel=0)
- #t.show(showcoord=True)
-