pycparser 2.22__tar.gz → 2.23__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pycparser-2.22/pycparser.egg-info → pycparser-2.23}/PKG-INFO +2 -2
- {pycparser-2.22 → pycparser-2.23}/README.rst +2 -2
- {pycparser-2.22 → pycparser-2.23}/examples/c_files/funky.c +0 -5
- {pycparser-2.22 → pycparser-2.23}/examples/c_files/hash.c +4 -4
- {pycparser-2.22 → pycparser-2.23}/examples/c_json.py +0 -1
- {pycparser-2.22 → pycparser-2.23}/examples/cdecl.py +0 -1
- {pycparser-2.22 → pycparser-2.23}/examples/explore_ast.py +0 -1
- {pycparser-2.22 → pycparser-2.23}/examples/using_cpp_libc.py +1 -3
- {pycparser-2.22 → pycparser-2.23}/examples/using_gcc_E_libc.py +0 -1
- {pycparser-2.22 → pycparser-2.23}/pycparser/__init__.py +1 -1
- {pycparser-2.22 → pycparser-2.23}/pycparser/c_generator.py +1 -1
- {pycparser-2.22 → pycparser-2.23}/pycparser/c_lexer.py +14 -0
- {pycparser-2.22 → pycparser-2.23}/pycparser/c_parser.py +30 -7
- pycparser-2.23/pycparser/lextab.py +10 -0
- pycparser-2.23/pycparser/yacctab.py +374 -0
- {pycparser-2.22 → pycparser-2.23/pycparser.egg-info}/PKG-INFO +2 -2
- {pycparser-2.22 → pycparser-2.23}/pycparser.egg-info/SOURCES.txt +0 -2
- {pycparser-2.22 → pycparser-2.23}/setup.py +2 -1
- {pycparser-2.22 → pycparser-2.23}/tests/test_c_generator.py +7 -0
- {pycparser-2.22 → pycparser-2.23}/tests/test_c_lexer.py +5 -1
- {pycparser-2.22 → pycparser-2.23}/tests/test_c_parser.py +81 -2
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/_fake_typedefs.h +14 -0
- pycparser-2.22/pycparser/lextab.py +0 -10
- pycparser-2.22/pycparser/yacctab.py +0 -369
- {pycparser-2.22 → pycparser-2.23}/CHANGES +0 -0
- {pycparser-2.22 → pycparser-2.23}/LICENSE +0 -0
- {pycparser-2.22 → pycparser-2.23}/MANIFEST.in +0 -0
- {pycparser-2.22 → pycparser-2.23}/examples/c-to-c.py +0 -0
- {pycparser-2.22 → pycparser-2.23}/examples/c_files/basic.c +0 -0
- {pycparser-2.22 → pycparser-2.23}/examples/c_files/memmgr.c +0 -0
- {pycparser-2.22 → pycparser-2.23}/examples/c_files/memmgr.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/examples/c_files/pragmas.c +0 -0
- {pycparser-2.22 → pycparser-2.23}/examples/c_files/year.c +0 -0
- {pycparser-2.22 → pycparser-2.23}/examples/construct_ast_from_scratch.py +0 -0
- {pycparser-2.22 → pycparser-2.23}/examples/dump_ast.py +0 -0
- {pycparser-2.22 → pycparser-2.23}/examples/func_calls.py +0 -0
- {pycparser-2.22 → pycparser-2.23}/examples/func_defs.py +0 -0
- {pycparser-2.22 → pycparser-2.23}/examples/func_defs_add_param.py +0 -0
- {pycparser-2.22 → pycparser-2.23}/examples/rewrite_ast.py +0 -0
- {pycparser-2.22 → pycparser-2.23}/examples/serialize_ast.py +0 -0
- {pycparser-2.22 → pycparser-2.23}/pycparser/_ast_gen.py +0 -0
- {pycparser-2.22 → pycparser-2.23}/pycparser/_build_tables.py +0 -0
- {pycparser-2.22 → pycparser-2.23}/pycparser/_c_ast.cfg +0 -0
- {pycparser-2.22 → pycparser-2.23}/pycparser/ast_transforms.py +0 -0
- {pycparser-2.22 → pycparser-2.23}/pycparser/c_ast.py +0 -0
- {pycparser-2.22 → pycparser-2.23}/pycparser/ply/__init__.py +0 -0
- {pycparser-2.22 → pycparser-2.23}/pycparser/ply/cpp.py +0 -0
- {pycparser-2.22 → pycparser-2.23}/pycparser/ply/ctokens.py +0 -0
- {pycparser-2.22 → pycparser-2.23}/pycparser/ply/lex.py +0 -0
- {pycparser-2.22 → pycparser-2.23}/pycparser/ply/yacc.py +0 -0
- {pycparser-2.22 → pycparser-2.23}/pycparser/ply/ygen.py +0 -0
- {pycparser-2.22 → pycparser-2.23}/pycparser/plyparser.py +0 -0
- {pycparser-2.22 → pycparser-2.23}/pycparser.egg-info/dependency_links.txt +0 -0
- {pycparser-2.22 → pycparser-2.23}/pycparser.egg-info/top_level.txt +0 -0
- {pycparser-2.22 → pycparser-2.23}/setup.cfg +0 -0
- {pycparser-2.22 → pycparser-2.23}/tests/__init__.py +0 -0
- {pycparser-2.22 → pycparser-2.23}/tests/c_files/c11.c +0 -0
- {pycparser-2.22 → pycparser-2.23}/tests/c_files/cppd_with_stdio_h.c +0 -0
- {pycparser-2.22 → pycparser-2.23}/tests/c_files/empty.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/tests/c_files/example_c_file.c +0 -0
- {pycparser-2.22 → pycparser-2.23}/tests/c_files/hdir/9/inc.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/tests/c_files/memmgr.c +0 -0
- {pycparser-2.22 → pycparser-2.23}/tests/c_files/memmgr.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/tests/c_files/memmgr_with_h.c +0 -0
- {pycparser-2.22 → pycparser-2.23}/tests/c_files/simplemain.c +0 -0
- {pycparser-2.22 → pycparser-2.23}/tests/c_files/year.c +0 -0
- {pycparser-2.22 → pycparser-2.23}/tests/test_c_ast.py +0 -0
- {pycparser-2.22 → pycparser-2.23}/tests/test_examples.py +0 -0
- {pycparser-2.22 → pycparser-2.23}/tests/test_general.py +0 -0
- {pycparser-2.22 → pycparser-2.23}/tests/test_util.py +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/X11/Intrinsic.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/X11/Xlib.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/X11/_X11_fake_defines.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/X11/_X11_fake_typedefs.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/_ansi.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/_fake_defines.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/_syslist.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/aio.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/alloca.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/ar.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/argz.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/arpa/inet.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/asm-generic/int-ll64.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/assert.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/complex.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/cpio.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/ctype.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/dirent.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/dlfcn.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/emmintrin.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/endian.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/envz.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/errno.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/fastmath.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/fcntl.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/features.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/fenv.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/float.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/fmtmsg.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/fnmatch.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/ftw.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/getopt.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/glob.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/grp.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/iconv.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/ieeefp.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/immintrin.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/inttypes.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/iso646.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/langinfo.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/libgen.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/libintl.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/limits.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/linux/socket.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/linux/version.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/locale.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/malloc.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/math.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/mir_toolkit/client_types.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/monetary.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/mqueue.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/ndbm.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/net/if.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/netdb.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/netinet/in.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/netinet/tcp.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/newlib.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/nl_types.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/openssl/err.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/openssl/evp.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/openssl/hmac.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/openssl/ssl.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/openssl/x509v3.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/paths.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/poll.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/process.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/pthread.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/pwd.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/reent.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/regdef.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/regex.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/sched.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/search.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/semaphore.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/setjmp.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/signal.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/smmintrin.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/spawn.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/stdalign.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/stdarg.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/stdatomic.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/stdbool.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/stddef.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/stdint.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/stdio.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/stdlib.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/stdnoreturn.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/string.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/strings.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/stropts.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/sys/ioctl.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/sys/ipc.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/sys/mman.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/sys/msg.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/sys/poll.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/sys/resource.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/sys/select.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/sys/sem.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/sys/shm.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/sys/socket.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/sys/stat.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/sys/statvfs.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/sys/sysctl.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/sys/time.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/sys/times.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/sys/types.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/sys/uio.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/sys/un.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/sys/utsname.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/sys/wait.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/syslog.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/tar.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/termios.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/tgmath.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/threads.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/time.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/trace.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/ulimit.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/unctrl.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/unistd.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/utime.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/utmp.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/utmpx.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/wchar.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/wctype.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/wordexp.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/xcb/xcb.h +0 -0
- {pycparser-2.22 → pycparser-2.23}/utils/fake_libc_include/zlib.h +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pycparser
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.23
|
|
4
4
|
Summary: C parser in Python
|
|
5
5
|
Home-page: https://github.com/eliben/pycparser
|
|
6
6
|
Author: Eli Bendersky
|
|
@@ -16,6 +16,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
20
|
Requires-Python: >=3.8
|
|
20
21
|
License-File: LICENSE
|
|
21
22
|
|
|
@@ -25,4 +26,3 @@ License-File: LICENSE
|
|
|
25
26
|
It parses C code into an AST and can serve as a front-end for
|
|
26
27
|
C compilers or analysis tools.
|
|
27
28
|
|
|
28
|
-
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
===============
|
|
2
|
-
pycparser v2.
|
|
2
|
+
pycparser v2.23
|
|
3
3
|
===============
|
|
4
4
|
|
|
5
5
|
|
|
@@ -110,7 +110,7 @@ Interaction with the C preprocessor
|
|
|
110
110
|
-----------------------------------
|
|
111
111
|
|
|
112
112
|
In order to be compilable, C code must be preprocessed by the C preprocessor -
|
|
113
|
-
``cpp``. ``cpp`` handles preprocessing directives like ``#include`` and
|
|
113
|
+
``cpp``. A compatible ``cpp`` handles preprocessing directives like ``#include`` and
|
|
114
114
|
``#define``, removes comments, and performs other minor tasks that prepare the C
|
|
115
115
|
code for compilation.
|
|
116
116
|
|
|
@@ -24,7 +24,7 @@ typedef struct tagHash
|
|
|
24
24
|
{
|
|
25
25
|
unsigned int table_size;
|
|
26
26
|
|
|
27
|
-
Node** heads;
|
|
27
|
+
Node** heads;
|
|
28
28
|
|
|
29
29
|
} Hash;
|
|
30
30
|
|
|
@@ -137,7 +137,7 @@ ReturnCode HashRemove(Hash* hash, const char* key)
|
|
|
137
137
|
|
|
138
138
|
return SUCCESS;
|
|
139
139
|
}
|
|
140
|
-
|
|
140
|
+
|
|
141
141
|
temp2 = temp1;
|
|
142
142
|
temp1 = temp1->next;
|
|
143
143
|
}
|
|
@@ -187,10 +187,10 @@ void HashDestroy(Hash* hash)
|
|
|
187
187
|
free(temp->entry);
|
|
188
188
|
|
|
189
189
|
temp = temp->next;
|
|
190
|
-
|
|
190
|
+
|
|
191
191
|
free(temp2);
|
|
192
192
|
}
|
|
193
|
-
}
|
|
193
|
+
}
|
|
194
194
|
|
|
195
195
|
free(hash->heads);
|
|
196
196
|
hash->heads = NULL;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
#-----------------------------------------------------------------
|
|
2
2
|
# pycparser: using_cpp_libc.py
|
|
3
3
|
#
|
|
4
|
-
# Shows how to use
|
|
5
|
-
# the 'real' cpp if you're on Linux/Unix) and "fake" libc includes
|
|
4
|
+
# Shows how to use 'cpp' (the C pre-processor binary) and "fake" libc includes
|
|
6
5
|
# to parse a file that includes standard C headers.
|
|
7
6
|
#
|
|
8
7
|
# Eli Bendersky [https://eli.thegreenplace.net/]
|
|
@@ -12,7 +11,6 @@ import sys
|
|
|
12
11
|
|
|
13
12
|
# This is not required if you've installed pycparser into
|
|
14
13
|
# your site-packages/ with setup.py
|
|
15
|
-
#
|
|
16
14
|
sys.path.extend(['.', '..'])
|
|
17
15
|
|
|
18
16
|
from pycparser import parse_file
|
|
@@ -133,7 +133,7 @@ class CGenerator(object):
|
|
|
133
133
|
def _visit_expr(self, n):
|
|
134
134
|
if isinstance(n, c_ast.InitList):
|
|
135
135
|
return '{' + self.visit(n) + '}'
|
|
136
|
-
elif isinstance(n, c_ast.ExprList):
|
|
136
|
+
elif isinstance(n, (c_ast.ExprList, c_ast.Compound)):
|
|
137
137
|
return '(' + self.visit(n) + ')'
|
|
138
138
|
else:
|
|
139
139
|
return self.visit(n)
|
|
@@ -209,6 +209,10 @@ class CLexer(object):
|
|
|
209
209
|
|
|
210
210
|
bad_octal_constant = '0[0-7]*[89]'
|
|
211
211
|
|
|
212
|
+
# comments are not supported
|
|
213
|
+
unsupported_c_style_comment = r'\/\*'
|
|
214
|
+
unsupported_cxx_style_comment = r'\/\/'
|
|
215
|
+
|
|
212
216
|
# character constants (K&R2: A.2.5.2)
|
|
213
217
|
# Note: a-zA-Z and '.-~^_!=&;,' are allowed as escape chars to support #line
|
|
214
218
|
# directives with Windows paths as filenames (..\..\dir\file)
|
|
@@ -475,6 +479,16 @@ class CLexer(object):
|
|
|
475
479
|
msg = "Invalid octal constant"
|
|
476
480
|
self._error(msg, t)
|
|
477
481
|
|
|
482
|
+
@TOKEN(unsupported_c_style_comment)
|
|
483
|
+
def t_UNSUPPORTED_C_STYLE_COMMENT(self, t):
|
|
484
|
+
msg = "Comments are not supported, see https://github.com/eliben/pycparser#3using."
|
|
485
|
+
self._error(msg, t)
|
|
486
|
+
|
|
487
|
+
@TOKEN(unsupported_cxx_style_comment)
|
|
488
|
+
def t_UNSUPPORTED_CXX_STYLE_COMMENT(self, t):
|
|
489
|
+
msg = "Comments are not supported, see https://github.com/eliben/pycparser#3using."
|
|
490
|
+
self._error(msg, t)
|
|
491
|
+
|
|
478
492
|
@TOKEN(octal_constant)
|
|
479
493
|
def t_INT_CONST_OCT(self, t):
|
|
480
494
|
return t
|
|
@@ -1530,6 +1530,20 @@ class CParser(PLYParser):
|
|
|
1530
1530
|
type=c_ast.TypeDecl(None, None, None, None),
|
|
1531
1531
|
coord=self._token_coord(p, 1))
|
|
1532
1532
|
|
|
1533
|
+
def p_direct_abstract_declarator_8(self, p):
|
|
1534
|
+
""" direct_abstract_declarator : LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET
|
|
1535
|
+
| LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET
|
|
1536
|
+
"""
|
|
1537
|
+
listed_quals = [item if isinstance(item, list) else [item]
|
|
1538
|
+
for item in [p[2],p[3]]]
|
|
1539
|
+
quals = [qual for sublist in listed_quals for qual in sublist
|
|
1540
|
+
if qual is not None]
|
|
1541
|
+
p[0] = c_ast.ArrayDecl(
|
|
1542
|
+
type=c_ast.TypeDecl(None, None, None, None),
|
|
1543
|
+
dim=p[4],
|
|
1544
|
+
dim_quals=quals,
|
|
1545
|
+
coord=self._token_coord(p, 1))
|
|
1546
|
+
|
|
1533
1547
|
# declaration is a list, statement isn't. To make it consistent, block_item
|
|
1534
1548
|
# will always be a list
|
|
1535
1549
|
#
|
|
@@ -1566,6 +1580,18 @@ class CParser(PLYParser):
|
|
|
1566
1580
|
""" labeled_statement : DEFAULT COLON pragmacomp_or_statement """
|
|
1567
1581
|
p[0] = c_ast.Default([p[3]], self._token_coord(p, 1))
|
|
1568
1582
|
|
|
1583
|
+
def p_labeled_statement_4(self, p):
|
|
1584
|
+
""" labeled_statement : ID COLON """
|
|
1585
|
+
p[0] = c_ast.Label(p[1], c_ast.EmptyStatement(self._token_coord(p, 1)), self._token_coord(p, 1))
|
|
1586
|
+
|
|
1587
|
+
def p_labeled_statement_5(self, p):
|
|
1588
|
+
""" labeled_statement : CASE constant_expression COLON """
|
|
1589
|
+
p[0] = c_ast.Case(p[2], [c_ast.EmptyStatement(self._token_coord(p, 2))], self._token_coord(p, 1))
|
|
1590
|
+
|
|
1591
|
+
def p_labeled_statement_6(self, p):
|
|
1592
|
+
""" labeled_statement : DEFAULT COLON """
|
|
1593
|
+
p[0] = c_ast.Default([c_ast.EmptyStatement(self._token_coord(p, 1))], self._token_coord(p, 1))
|
|
1594
|
+
|
|
1569
1595
|
def p_selection_statement_1(self, p):
|
|
1570
1596
|
""" selection_statement : IF LPAREN expression RPAREN pragmacomp_or_statement """
|
|
1571
1597
|
p[0] = c_ast.If(p[3], p[5], None, self._token_coord(p, 1))
|
|
@@ -1865,15 +1891,12 @@ class CParser(PLYParser):
|
|
|
1865
1891
|
""" constant : FLOAT_CONST
|
|
1866
1892
|
| HEX_FLOAT_CONST
|
|
1867
1893
|
"""
|
|
1868
|
-
if
|
|
1894
|
+
if p[1][-1] in ('f', 'F'):
|
|
1869
1895
|
t = 'float'
|
|
1896
|
+
elif p[1][-1] in ('l', 'L'):
|
|
1897
|
+
t = 'long double'
|
|
1870
1898
|
else:
|
|
1871
|
-
|
|
1872
|
-
t = 'float'
|
|
1873
|
-
elif p[1][-1] in ('l', 'L'):
|
|
1874
|
-
t = 'long double'
|
|
1875
|
-
else:
|
|
1876
|
-
t = 'double'
|
|
1899
|
+
t = 'double'
|
|
1877
1900
|
|
|
1878
1901
|
p[0] = c_ast.Constant(
|
|
1879
1902
|
t, p[1], self._token_coord(p, 1))
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# lextab.py. This file automatically created by PLY (version 3.10). Don't edit!
|
|
2
|
+
_tabversion = '3.10'
|
|
3
|
+
_lextokens = set(('AND', 'ANDEQUAL', 'ARROW', 'AUTO', 'BREAK', 'CASE', 'CHAR', 'CHAR_CONST', 'COLON', 'COMMA', 'CONDOP', 'CONST', 'CONTINUE', 'DEFAULT', 'DIVEQUAL', 'DIVIDE', 'DO', 'DOUBLE', 'ELLIPSIS', 'ELSE', 'ENUM', 'EQ', 'EQUALS', 'EXTERN', 'FLOAT', 'FLOAT_CONST', 'FOR', 'GE', 'GOTO', 'GT', 'HEX_FLOAT_CONST', 'ID', 'IF', 'INLINE', 'INT', 'INT_CONST_BIN', 'INT_CONST_CHAR', 'INT_CONST_DEC', 'INT_CONST_HEX', 'INT_CONST_OCT', 'LAND', 'LBRACE', 'LBRACKET', 'LE', 'LNOT', 'LONG', 'LOR', 'LPAREN', 'LSHIFT', 'LSHIFTEQUAL', 'LT', 'MINUS', 'MINUSEQUAL', 'MINUSMINUS', 'MOD', 'MODEQUAL', 'NE', 'NOT', 'OFFSETOF', 'OR', 'OREQUAL', 'PERIOD', 'PLUS', 'PLUSEQUAL', 'PLUSPLUS', 'PPHASH', 'PPPRAGMA', 'PPPRAGMASTR', 'RBRACE', 'RBRACKET', 'REGISTER', 'RESTRICT', 'RETURN', 'RPAREN', 'RSHIFT', 'RSHIFTEQUAL', 'SEMI', 'SHORT', 'SIGNED', 'SIZEOF', 'STATIC', 'STRING_LITERAL', 'STRUCT', 'SWITCH', 'TIMES', 'TIMESEQUAL', 'TYPEDEF', 'TYPEID', 'U16CHAR_CONST', 'U16STRING_LITERAL', 'U32CHAR_CONST', 'U32STRING_LITERAL', 'U8CHAR_CONST', 'U8STRING_LITERAL', 'UNION', 'UNSIGNED', 'VOID', 'VOLATILE', 'WCHAR_CONST', 'WHILE', 'WSTRING_LITERAL', 'XOR', 'XOREQUAL', '_ALIGNAS', '_ALIGNOF', '_ATOMIC', '_BOOL', '_COMPLEX', '_NORETURN', '_PRAGMA', '_STATIC_ASSERT', '_THREAD_LOCAL', '__INT128'))
|
|
4
|
+
_lexreflags = 64
|
|
5
|
+
_lexliterals = ''
|
|
6
|
+
_lexstateinfo = {'INITIAL': 'inclusive', 'ppline': 'exclusive', 'pppragma': 'exclusive'}
|
|
7
|
+
_lexstatere = {'INITIAL': [('(?P<t_PPHASH>[ \\t]*\\#)|(?P<t_NEWLINE>\\n+)|(?P<t_LBRACE>\\{)|(?P<t_RBRACE>\\})|(?P<t_FLOAT_CONST>((((([0-9]*\\.[0-9]+)|([0-9]+\\.))([eE][-+]?[0-9]+)?)|([0-9]+([eE][-+]?[0-9]+)))[FfLl]?))|(?P<t_HEX_FLOAT_CONST>(0[xX]([0-9a-fA-F]+|((([0-9a-fA-F]+)?\\.[0-9a-fA-F]+)|([0-9a-fA-F]+\\.)))([pP][+-]?[0-9]+)[FfLl]?))|(?P<t_INT_CONST_HEX>0[xX][0-9a-fA-F]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P<t_INT_CONST_BIN>0[bB][01]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P<t_BAD_CONST_OCT>0[0-7]*[89])|(?P<t_UNSUPPORTED_C_STYLE_COMMENT>\\/\\*)|(?P<t_UNSUPPORTED_CXX_STYLE_COMMENT>\\/\\/)|(?P<t_INT_CONST_OCT>0[0-7]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P<t_INT_CONST_DEC>(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P<t_INT_CONST_CHAR>\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F])))){2,4}\')|(?P<t_CHAR_CONST>\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))\')|(?P<t_WCHAR_CONST>L\'([^\'\\\\\\n]|(\\\\(([a-wyzA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*)|(?P<t_XOR>\\^)|(?P<t_AND>&)|(?P<t_COLON>:)|(?P<t_COMMA>,)|(?P<t_DIVIDE>/)|(?P<t_EQUALS>=)|(?P<t_GT>>)|(?P<t_LNOT>!)|(?P<t_LT><)|(?P<t_MINUS>-)|(?P<t_MOD>%)|(?P<t_NOT>~)|(?P<t_SEMI>;)', [None, ('t_PPHASH', 'PPHASH'), ('t_NEWLINE', 'NEWLINE'), ('t_LBRACE', 'LBRACE'), ('t_RBRACE', 'RBRACE'), ('t_FLOAT_CONST', 'FLOAT_CONST'), None, None, None, None, None, None, None, None, None, ('t_HEX_FLOAT_CONST', 'HEX_FLOAT_CONST'), None, None, None, None, None, None, None, ('t_INT_CONST_HEX', 'INT_CONST_HEX'), None, None, None, None, None, None, None, ('t_INT_CONST_BIN', 'INT_CONST_BIN'), None, None, None, None, None, None, None, ('t_BAD_CONST_OCT', 'BAD_CONST_OCT'), ('t_UNSUPPORTED_C_STYLE_COMMENT', 'UNSUPPORTED_C_STYLE_COMMENT'), ('t_UNSUPPORTED_CXX_STYLE_COMMENT', 'UNSUPPORTED_CXX_STYLE_COMMENT'), ('t_INT_CONST_OCT', 'INT_CONST_OCT'), None, None, None, None, None, None, None, ('t_INT_CONST_DEC', 'INT_CONST_DEC'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_INT_CONST_CHAR', 'INT_CONST_CHAR'), None, None, None, None, None, None, ('t_CHAR_CONST', 'CHAR_CONST'), None, None, None, None, None, None, ('t_WCHAR_CONST', 'WCHAR_CONST'), None, None, None, None, None, None, ('t_U8CHAR_CONST', 'U8CHAR_CONST'), None, None, None, None, None, None, ('t_U16CHAR_CONST', 'U16CHAR_CONST'), None, None, None, None, None, None, ('t_U32CHAR_CONST', 'U32CHAR_CONST'), None, None, None, None, None, None, ('t_UNMATCHED_QUOTE', 'UNMATCHED_QUOTE'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_BAD_CHAR_CONST', 'BAD_CHAR_CONST'), None, None, None, None, None, None, None, None, None, None, ('t_WSTRING_LITERAL', 'WSTRING_LITERAL'), None, None, ('t_U8STRING_LITERAL', 'U8STRING_LITERAL'), None, None, ('t_U16STRING_LITERAL', 'U16STRING_LITERAL'), None, None, ('t_U32STRING_LITERAL', 'U32STRING_LITERAL'), None, None, ('t_BAD_STRING_LITERAL', 'BAD_STRING_LITERAL'), None, None, None, None, None, ('t_ID', 'ID'), (None, 'STRING_LITERAL'), None, None, (None, 'ELLIPSIS'), (None, 'LOR'), (None, 'PLUSPLUS'), (None, 'LSHIFTEQUAL'), (None, 'OREQUAL'), (None, 'PLUSEQUAL'), (None, 'RSHIFTEQUAL'), (None, 'TIMESEQUAL'), (None, 'XOREQUAL'), (None, 'ANDEQUAL'), (None, 'ARROW'), (None, 'CONDOP'), (None, 'DIVEQUAL'), (None, 'EQ'), (None, 'GE'), (None, 'LAND'), (None, 'LBRACKET'), (None, 'LE'), (None, 'LPAREN'), (None, 'LSHIFT'), (None, 'MINUSEQUAL'), (None, 'MINUSMINUS'), (None, 'MODEQUAL'), (None, 'NE'), (None, 'OR'), (None, 'PERIOD'), (None, 'PLUS'), (None, 'RBRACKET'), (None, 'RPAREN'), (None, 'RSHIFT'), (None, 'TIMES'), (None, 'XOR'), (None, 'AND'), (None, 'COLON'), (None, 'COMMA'), (None, 'DIVIDE'), (None, 'EQUALS'), (None, 'GT'), (None, 'LNOT'), (None, 'LT'), (None, 'MINUS'), (None, 'MOD'), (None, 'NOT'), (None, 'SEMI')])], 'ppline': [('(?P<t_ppline_FILENAME>"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?P<t_ppline_LINE_NUMBER>(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P<t_ppline_NEWLINE>\\n)|(?P<t_ppline_PPLINE>line)', [None, ('t_ppline_FILENAME', 'FILENAME'), None, None, ('t_ppline_LINE_NUMBER', 'LINE_NUMBER'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ppline_NEWLINE', 'NEWLINE'), ('t_ppline_PPLINE', 'PPLINE')])], 'pppragma': [('(?P<t_pppragma_NEWLINE>\\n)|(?P<t_pppragma_PPPRAGMA>pragma)|(?P<t_pppragma_STR>.+)', [None, ('t_pppragma_NEWLINE', 'NEWLINE'), ('t_pppragma_PPPRAGMA', 'PPPRAGMA'), ('t_pppragma_STR', 'STR')])]}
|
|
8
|
+
_lexstateignore = {'INITIAL': ' \t', 'ppline': ' \t', 'pppragma': ' \t'}
|
|
9
|
+
_lexstateerrorf = {'INITIAL': 't_error', 'ppline': 't_ppline_error', 'pppragma': 't_pppragma_error'}
|
|
10
|
+
_lexstateeoff = {}
|