Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 897828d

Browse files
Use the already defined TypeFlags.HaveIter instead of redefining it
1 parent 1d33284 commit 897828d

28 files changed

+10522
-5
lines changed

.eggs/README.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
This directory contains eggs that were downloaded by setuptools to build, test, and run plug-ins.
2+
3+
This directory caches those eggs to prevent repeated downloads.
4+
5+
However, it is safe to delete this directory.
6+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Metadata-Version: 1.1
2+
Name: pycparser
3+
Version: 2.17
4+
Summary: C parser in Python
5+
Home-page: https://github.com/eliben/pycparser
6+
Author: Eli Bendersky
7+
Author-email: [email protected]
8+
License: BSD
9+
Description:
10+
pycparser is a complete parser of the C language, written in
11+
pure Python using the PLY parsing library.
12+
It parses C code into an AST and can serve as a front-end for
13+
C compilers or analysis tools.
14+
15+
Platform: Cross Platform
16+
Classifier: Programming Language :: Python :: 2
17+
Classifier: Programming Language :: Python :: 3
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
CHANGES
2+
LICENSE
3+
MANIFEST.in
4+
README.rst
5+
setup.cfg
6+
setup.py
7+
examples/c-to-c.py
8+
examples/cdecl.py
9+
examples/explore_ast.py
10+
examples/func_calls.py
11+
examples/func_defs.py
12+
examples/rewrite_ast.py
13+
examples/using_cpp_libc.py
14+
examples/using_gcc_E_libc.py
15+
examples/c_files/funky.c
16+
examples/c_files/hash.c
17+
examples/c_files/memmgr.c
18+
examples/c_files/memmgr.h
19+
examples/c_files/year.c
20+
pycparser/__init__.py
21+
pycparser/_ast_gen.py
22+
pycparser/_build_tables.py
23+
pycparser/_c_ast.cfg
24+
pycparser/ast_transforms.py
25+
pycparser/c_ast.py
26+
pycparser/c_generator.py
27+
pycparser/c_lexer.py
28+
pycparser/c_parser.py
29+
pycparser/lextab.py
30+
pycparser/plyparser.py
31+
pycparser/yacctab.py
32+
pycparser.egg-info/PKG-INFO
33+
pycparser.egg-info/SOURCES.txt
34+
pycparser.egg-info/dependency_links.txt
35+
pycparser.egg-info/top_level.txt
36+
pycparser/ply/__init__.py
37+
pycparser/ply/cpp.py
38+
pycparser/ply/ctokens.py
39+
pycparser/ply/lex.py
40+
pycparser/ply/yacc.py
41+
pycparser/ply/ygen.py
42+
tests/all_tests.py
43+
tests/test_c_ast.py
44+
tests/test_c_generator.py
45+
tests/test_c_lexer.py
46+
tests/test_c_parser.py
47+
tests/test_general.py
48+
tests/c_files/cppd_with_stdio_h.c
49+
tests/c_files/empty.h
50+
tests/c_files/example_c_file.c
51+
tests/c_files/memmgr.c
52+
tests/c_files/memmgr.h
53+
tests/c_files/memmgr_with_h.c
54+
tests/c_files/simplemain.c
55+
tests/c_files/year.c
56+
tests/c_files/hdir/9/inc.h
57+
utils/fake_libc_include/_ansi.h
58+
utils/fake_libc_include/_fake_defines.h
59+
utils/fake_libc_include/_fake_typedefs.h
60+
utils/fake_libc_include/_syslist.h
61+
utils/fake_libc_include/alloca.h
62+
utils/fake_libc_include/ar.h
63+
utils/fake_libc_include/argz.h
64+
utils/fake_libc_include/assert.h
65+
utils/fake_libc_include/complex.h
66+
utils/fake_libc_include/ctype.h
67+
utils/fake_libc_include/dirent.h
68+
utils/fake_libc_include/dlfcn.h
69+
utils/fake_libc_include/endian.h
70+
utils/fake_libc_include/envz.h
71+
utils/fake_libc_include/errno.h
72+
utils/fake_libc_include/fastmath.h
73+
utils/fake_libc_include/fcntl.h
74+
utils/fake_libc_include/features.h
75+
utils/fake_libc_include/fenv.h
76+
utils/fake_libc_include/float.h
77+
utils/fake_libc_include/getopt.h
78+
utils/fake_libc_include/grp.h
79+
utils/fake_libc_include/iconv.h
80+
utils/fake_libc_include/ieeefp.h
81+
utils/fake_libc_include/inttypes.h
82+
utils/fake_libc_include/iso646.h
83+
utils/fake_libc_include/langinfo.h
84+
utils/fake_libc_include/libgen.h
85+
utils/fake_libc_include/libintl.h
86+
utils/fake_libc_include/limits.h
87+
utils/fake_libc_include/locale.h
88+
utils/fake_libc_include/malloc.h
89+
utils/fake_libc_include/math.h
90+
utils/fake_libc_include/netdb.h
91+
utils/fake_libc_include/newlib.h
92+
utils/fake_libc_include/paths.h
93+
utils/fake_libc_include/process.h
94+
utils/fake_libc_include/pthread.h
95+
utils/fake_libc_include/pwd.h
96+
utils/fake_libc_include/reent.h
97+
utils/fake_libc_include/regdef.h
98+
utils/fake_libc_include/regex.h
99+
utils/fake_libc_include/sched.h
100+
utils/fake_libc_include/search.h
101+
utils/fake_libc_include/semaphore.h
102+
utils/fake_libc_include/setjmp.h
103+
utils/fake_libc_include/signal.h
104+
utils/fake_libc_include/stdarg.h
105+
utils/fake_libc_include/stdbool.h
106+
utils/fake_libc_include/stddef.h
107+
utils/fake_libc_include/stdint.h
108+
utils/fake_libc_include/stdio.h
109+
utils/fake_libc_include/stdlib.h
110+
utils/fake_libc_include/string.h
111+
utils/fake_libc_include/syslog.h
112+
utils/fake_libc_include/tar.h
113+
utils/fake_libc_include/termios.h
114+
utils/fake_libc_include/tgmath.h
115+
utils/fake_libc_include/time.h
116+
utils/fake_libc_include/unctrl.h
117+
utils/fake_libc_include/unistd.h
118+
utils/fake_libc_include/utime.h
119+
utils/fake_libc_include/utmp.h
120+
utils/fake_libc_include/wchar.h
121+
utils/fake_libc_include/wctype.h
122+
utils/fake_libc_include/zlib.h
123+
utils/fake_libc_include/arpa/inet.h
124+
utils/fake_libc_include/asm-generic/int-ll64.h
125+
utils/fake_libc_include/linux/socket.h
126+
utils/fake_libc_include/linux/version.h
127+
utils/fake_libc_include/netinet/in.h
128+
utils/fake_libc_include/netinet/tcp.h
129+
utils/fake_libc_include/openssl/err.h
130+
utils/fake_libc_include/openssl/evp.h
131+
utils/fake_libc_include/openssl/hmac.h
132+
utils/fake_libc_include/openssl/ssl.h
133+
utils/fake_libc_include/openssl/x509v3.h
134+
utils/fake_libc_include/sys/ioctl.h
135+
utils/fake_libc_include/sys/mman.h
136+
utils/fake_libc_include/sys/poll.h
137+
utils/fake_libc_include/sys/resource.h
138+
utils/fake_libc_include/sys/select.h
139+
utils/fake_libc_include/sys/socket.h
140+
utils/fake_libc_include/sys/stat.h
141+
utils/fake_libc_include/sys/sysctl.h
142+
utils/fake_libc_include/sys/time.h
143+
utils/fake_libc_include/sys/types.h
144+
utils/fake_libc_include/sys/uio.h
145+
utils/fake_libc_include/sys/un.h
146+
utils/fake_libc_include/sys/utsname.h
147+
utils/fake_libc_include/sys/wait.h
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pycparser
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
#-----------------------------------------------------------------
2+
# pycparser: __init__.py
3+
#
4+
# This package file exports some convenience functions for
5+
# interacting with pycparser
6+
#
7+
# Copyright (C) 2008-2016, Eli Bendersky
8+
# License: BSD
9+
#-----------------------------------------------------------------
10+
__all__ = ['c_lexer', 'c_parser', 'c_ast']
11+
__version__ = '2.17'
12+
13+
from subprocess import Popen, PIPE
14+
from .c_parser import CParser
15+
16+
17+
def preprocess_file(filename, cpp_path='cpp', cpp_args=''):
18+
""" Preprocess a file using cpp.
19+
20+
filename:
21+
Name of the file you want to preprocess.
22+
23+
cpp_path:
24+
cpp_args:
25+
Refer to the documentation of parse_file for the meaning of these
26+
arguments.
27+
28+
When successful, returns the preprocessed file's contents.
29+
Errors from cpp will be printed out.
30+
"""
31+
path_list = [cpp_path]
32+
if isinstance(cpp_args, list):
33+
path_list += cpp_args
34+
elif cpp_args != '':
35+
path_list += [cpp_args]
36+
path_list += [filename]
37+
38+
try:
39+
# Note the use of universal_newlines to treat all newlines
40+
# as \n for Python's purpose
41+
#
42+
pipe = Popen( path_list,
43+
stdout=PIPE,
44+
universal_newlines=True)
45+
text = pipe.communicate()[0]
46+
except OSError as e:
47+
raise RuntimeError("Unable to invoke 'cpp'. " +
48+
'Make sure its path was passed correctly\n' +
49+
('Original error: %s' % e))
50+
51+
return text
52+
53+
54+
def parse_file(filename, use_cpp=False, cpp_path='cpp', cpp_args='',
55+
parser=None):
56+
""" Parse a C file using pycparser.
57+
58+
filename:
59+
Name of the file you want to parse.
60+
61+
use_cpp:
62+
Set to True if you want to execute the C pre-processor
63+
on the file prior to parsing it.
64+
65+
cpp_path:
66+
If use_cpp is True, this is the path to 'cpp' on your
67+
system. If no path is provided, it attempts to just
68+
execute 'cpp', so it must be in your PATH.
69+
70+
cpp_args:
71+
If use_cpp is True, set this to the command line arguments strings
72+
to cpp. Be careful with quotes - it's best to pass a raw string
73+
(r'') here. For example:
74+
r'-I../utils/fake_libc_include'
75+
If several arguments are required, pass a list of strings.
76+
77+
parser:
78+
Optional parser object to be used instead of the default CParser
79+
80+
When successful, an AST is returned. ParseError can be
81+
thrown if the file doesn't parse successfully.
82+
83+
Errors from cpp will be printed out.
84+
"""
85+
if use_cpp:
86+
text = preprocess_file(filename, cpp_path, cpp_args)
87+
else:
88+
with open(filename, 'rU') as f:
89+
text = f.read()
90+
91+
if parser is None:
92+
parser = CParser()
93+
return parser.parse(text, filename)

0 commit comments

Comments
 (0)