pycparser 2.21__tar.gz → 2.22__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.21 → pycparser-2.22}/CHANGES +4 -0
- {pycparser-2.21 → pycparser-2.22}/LICENSE +2 -2
- pycparser-2.22/MANIFEST.in +12 -0
- pycparser-2.22/PKG-INFO +28 -0
- {pycparser-2.21 → pycparser-2.22}/README.rst +3 -23
- {pycparser-2.21 → pycparser-2.22}/examples/c-to-c.py +0 -1
- {pycparser-2.21 → pycparser-2.22}/examples/c_json.py +0 -2
- pycparser-2.22/examples/construct_ast_from_scratch.py +53 -0
- {pycparser-2.21 → pycparser-2.22}/examples/dump_ast.py +0 -1
- {pycparser-2.21 → pycparser-2.22}/examples/explore_ast.py +0 -1
- {pycparser-2.21 → pycparser-2.22}/examples/func_calls.py +0 -2
- {pycparser-2.21 → pycparser-2.22}/examples/func_defs.py +0 -1
- {pycparser-2.21 → pycparser-2.22}/examples/func_defs_add_param.py +0 -2
- {pycparser-2.21 → pycparser-2.22}/examples/rewrite_ast.py +0 -1
- {pycparser-2.21 → pycparser-2.22}/examples/serialize_ast.py +4 -9
- {pycparser-2.21 → pycparser-2.22}/pycparser/__init__.py +6 -3
- {pycparser-2.21 → pycparser-2.22}/pycparser/_build_tables.py +3 -0
- {pycparser-2.21 → pycparser-2.22}/pycparser/c_lexer.py +1 -0
- {pycparser-2.21 → pycparser-2.22}/pycparser/c_parser.py +18 -4
- pycparser-2.22/pycparser/lextab.py +10 -0
- {pycparser-2.21 → pycparser-2.22}/pycparser/ply/lex.py +1 -1
- pycparser-2.22/pycparser/yacctab.py +369 -0
- pycparser-2.22/pycparser.egg-info/PKG-INFO +28 -0
- pycparser-2.22/pycparser.egg-info/SOURCES.txt +195 -0
- pycparser-2.22/pycparser.egg-info/dependency_links.txt +1 -0
- pycparser-2.22/pycparser.egg-info/top_level.txt +1 -0
- pycparser-2.22/setup.cfg +7 -0
- {pycparser-2.21 → pycparser-2.22}/setup.py +5 -9
- {pycparser-2.21 → pycparser-2.22}/tests/test_c_generator.py +8 -1
- {pycparser-2.21 → pycparser-2.22}/tests/test_c_lexer.py +14 -3
- {pycparser-2.21 → pycparser-2.22}/tests/test_c_parser.py +8 -1
- pycparser-2.22/tests/test_examples.py +24 -0
- {pycparser-2.21 → pycparser-2.22}/tests/test_util.py +4 -7
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/_fake_defines.h +2 -0
- pycparser-2.21/PKG-INFO +0 -27
- pycparser-2.21/pycparser/lextab.py +0 -10
- pycparser-2.21/pycparser/yacctab.py +0 -366
- pycparser-2.21/setup.cfg +0 -5
- pycparser-2.21/tests/test_examples.py +0 -34
- {pycparser-2.21 → pycparser-2.22}/examples/c_files/basic.c +0 -0
- {pycparser-2.21 → pycparser-2.22}/examples/c_files/funky.c +0 -0
- {pycparser-2.21 → pycparser-2.22}/examples/c_files/hash.c +0 -0
- {pycparser-2.21 → pycparser-2.22}/examples/c_files/memmgr.c +0 -0
- {pycparser-2.21 → pycparser-2.22}/examples/c_files/memmgr.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/examples/c_files/pragmas.c +0 -0
- {pycparser-2.21 → pycparser-2.22}/examples/c_files/year.c +0 -0
- {pycparser-2.21 → pycparser-2.22}/examples/cdecl.py +0 -0
- {pycparser-2.21 → pycparser-2.22}/examples/using_cpp_libc.py +0 -0
- {pycparser-2.21 → pycparser-2.22}/examples/using_gcc_E_libc.py +0 -0
- {pycparser-2.21 → pycparser-2.22}/pycparser/_ast_gen.py +0 -0
- {pycparser-2.21 → pycparser-2.22}/pycparser/_c_ast.cfg +0 -0
- {pycparser-2.21 → pycparser-2.22}/pycparser/ast_transforms.py +0 -0
- {pycparser-2.21 → pycparser-2.22}/pycparser/c_ast.py +0 -0
- {pycparser-2.21 → pycparser-2.22}/pycparser/c_generator.py +0 -0
- {pycparser-2.21 → pycparser-2.22}/pycparser/ply/__init__.py +0 -0
- {pycparser-2.21 → pycparser-2.22}/pycparser/ply/cpp.py +0 -0
- {pycparser-2.21 → pycparser-2.22}/pycparser/ply/ctokens.py +0 -0
- {pycparser-2.21 → pycparser-2.22}/pycparser/ply/yacc.py +0 -0
- {pycparser-2.21 → pycparser-2.22}/pycparser/ply/ygen.py +0 -0
- {pycparser-2.21 → pycparser-2.22}/pycparser/plyparser.py +0 -0
- {pycparser-2.21 → pycparser-2.22}/tests/__init__.py +0 -0
- {pycparser-2.21 → pycparser-2.22}/tests/c_files/c11.c +0 -0
- {pycparser-2.21 → pycparser-2.22}/tests/c_files/cppd_with_stdio_h.c +0 -0
- {pycparser-2.21 → pycparser-2.22}/tests/c_files/empty.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/tests/c_files/example_c_file.c +0 -0
- {pycparser-2.21 → pycparser-2.22}/tests/c_files/hdir/9/inc.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/tests/c_files/memmgr.c +0 -0
- {pycparser-2.21 → pycparser-2.22}/tests/c_files/memmgr.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/tests/c_files/memmgr_with_h.c +0 -0
- {pycparser-2.21 → pycparser-2.22}/tests/c_files/simplemain.c +0 -0
- {pycparser-2.21 → pycparser-2.22}/tests/c_files/year.c +0 -0
- {pycparser-2.21 → pycparser-2.22}/tests/test_c_ast.py +0 -0
- {pycparser-2.21 → pycparser-2.22}/tests/test_general.py +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/X11/Intrinsic.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/X11/Xlib.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/X11/_X11_fake_defines.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/X11/_X11_fake_typedefs.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/_ansi.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/_fake_typedefs.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/_syslist.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/aio.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/alloca.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/ar.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/argz.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/arpa/inet.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/asm-generic/int-ll64.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/assert.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/complex.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/cpio.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/ctype.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/dirent.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/dlfcn.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/emmintrin.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/endian.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/envz.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/errno.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/fastmath.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/fcntl.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/features.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/fenv.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/float.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/fmtmsg.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/fnmatch.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/ftw.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/getopt.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/glob.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/grp.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/iconv.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/ieeefp.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/immintrin.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/inttypes.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/iso646.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/langinfo.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/libgen.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/libintl.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/limits.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/linux/socket.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/linux/version.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/locale.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/malloc.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/math.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/mir_toolkit/client_types.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/monetary.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/mqueue.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/ndbm.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/net/if.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/netdb.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/netinet/in.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/netinet/tcp.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/newlib.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/nl_types.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/openssl/err.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/openssl/evp.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/openssl/hmac.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/openssl/ssl.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/openssl/x509v3.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/paths.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/poll.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/process.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/pthread.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/pwd.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/reent.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/regdef.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/regex.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/sched.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/search.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/semaphore.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/setjmp.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/signal.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/smmintrin.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/spawn.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/stdalign.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/stdarg.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/stdatomic.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/stdbool.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/stddef.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/stdint.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/stdio.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/stdlib.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/stdnoreturn.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/string.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/strings.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/stropts.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/sys/ioctl.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/sys/ipc.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/sys/mman.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/sys/msg.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/sys/poll.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/sys/resource.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/sys/select.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/sys/sem.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/sys/shm.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/sys/socket.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/sys/stat.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/sys/statvfs.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/sys/sysctl.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/sys/time.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/sys/times.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/sys/types.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/sys/uio.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/sys/un.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/sys/utsname.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/sys/wait.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/syslog.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/tar.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/termios.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/tgmath.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/threads.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/time.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/trace.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/ulimit.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/unctrl.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/unistd.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/utime.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/utmp.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/utmpx.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/wchar.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/wctype.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/wordexp.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/xcb/xcb.h +0 -0
- {pycparser-2.21 → pycparser-2.22}/utils/fake_libc_include/zlib.h +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
pycparser -- A C parser in Python
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2008-
|
|
3
|
+
Copyright (c) 2008-2022, Eli Bendersky
|
|
4
4
|
All rights reserved.
|
|
5
5
|
|
|
6
6
|
Redistribution and use in source and binary forms, with or without modification,
|
|
@@ -11,7 +11,7 @@ are permitted provided that the following conditions are met:
|
|
|
11
11
|
* Redistributions in binary form must reproduce the above copyright notice,
|
|
12
12
|
this list of conditions and the following disclaimer in the documentation
|
|
13
13
|
and/or other materials provided with the distribution.
|
|
14
|
-
* Neither the name of
|
|
14
|
+
* Neither the name of the copyright holder nor the names of its contributors may
|
|
15
15
|
be used to endorse or promote products derived from this software without
|
|
16
16
|
specific prior written permission.
|
|
17
17
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
recursive-include examples *.c *.h *.py
|
|
2
|
+
recursive-include tests *.c *.h *.py
|
|
3
|
+
recursive-include pycparser *.py *.cfg
|
|
4
|
+
recursive-include utils/fake_libc_include *.h
|
|
5
|
+
include README.*
|
|
6
|
+
include LICENSE
|
|
7
|
+
include CHANGES
|
|
8
|
+
include setup.*
|
|
9
|
+
exclude setup.pyc
|
|
10
|
+
|
|
11
|
+
recursive-exclude tests yacctab.* lextab.*
|
|
12
|
+
recursive-exclude examples yacctab.* lextab.*
|
pycparser-2.22/PKG-INFO
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: pycparser
|
|
3
|
+
Version: 2.22
|
|
4
|
+
Summary: C parser in Python
|
|
5
|
+
Home-page: https://github.com/eliben/pycparser
|
|
6
|
+
Author: Eli Bendersky
|
|
7
|
+
Author-email: eliben@gmail.com
|
|
8
|
+
Maintainer: Eli Bendersky
|
|
9
|
+
License: BSD-3-Clause
|
|
10
|
+
Platform: Cross Platform
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Requires-Python: >=3.8
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
pycparser is a complete parser of the C language, written in
|
|
24
|
+
pure Python using the PLY parsing library.
|
|
25
|
+
It parses C code into an AST and can serve as a front-end for
|
|
26
|
+
C compilers or analysis tools.
|
|
27
|
+
|
|
28
|
+
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
===============
|
|
2
|
-
pycparser v2.
|
|
2
|
+
pycparser v2.22
|
|
3
3
|
===============
|
|
4
4
|
|
|
5
5
|
|
|
@@ -83,9 +83,7 @@ Installing
|
|
|
83
83
|
Prerequisites
|
|
84
84
|
-------------
|
|
85
85
|
|
|
86
|
-
* **pycparser** was tested
|
|
87
|
-
Windows. It should work on any later version (in both the 2.x and 3.x lines)
|
|
88
|
-
as well.
|
|
86
|
+
* **pycparser** was tested with Python 3.8+ on Linux, macOS and Windows.
|
|
89
87
|
|
|
90
88
|
* **pycparser** has no external dependencies. The only non-stdlib library it
|
|
91
89
|
uses is PLY, which is bundled in ``pycparser/ply``. The current PLY version is
|
|
@@ -101,28 +99,10 @@ though.
|
|
|
101
99
|
Installation process
|
|
102
100
|
--------------------
|
|
103
101
|
|
|
104
|
-
|
|
105
|
-
package, you just have to execute the standard ``python setup.py install``. The
|
|
106
|
-
setup script will then place the ``pycparser`` module into ``site-packages`` in
|
|
107
|
-
your Python's installation library.
|
|
108
|
-
|
|
109
|
-
Alternatively, since **pycparser** is listed in the `Python Package Index
|
|
110
|
-
<https://pypi.org/project/pycparser/>`_ (PyPI), you can install it using your
|
|
111
|
-
favorite Python packaging/distribution tool, for example with::
|
|
102
|
+
The recommended way to install **pycparser** is with ``pip``::
|
|
112
103
|
|
|
113
104
|
> pip install pycparser
|
|
114
105
|
|
|
115
|
-
Known problems
|
|
116
|
-
--------------
|
|
117
|
-
|
|
118
|
-
* Some users who've installed a new version of **pycparser** over an existing
|
|
119
|
-
version ran into a problem using the newly installed library. This has to do
|
|
120
|
-
with parse tables staying around as ``.pyc`` files from the older version. If
|
|
121
|
-
you see unexplained errors from **pycparser** after an upgrade, remove it (by
|
|
122
|
-
deleting the ``pycparser`` directory in your Python's ``site-packages``, or
|
|
123
|
-
wherever you installed it) and install again.
|
|
124
|
-
|
|
125
|
-
|
|
126
106
|
Using
|
|
127
107
|
=====
|
|
128
108
|
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
# Eli Bendersky [https://eli.thegreenplace.net/]
|
|
8
8
|
# License: BSD
|
|
9
9
|
#------------------------------------------------------------------------------
|
|
10
|
-
from __future__ import print_function
|
|
11
10
|
import sys
|
|
12
11
|
|
|
13
12
|
# This is not required if you've installed pycparser into
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# -----------------------------------------------------------------
|
|
2
|
+
# pycparser: construct_ast_from_scratch.py
|
|
3
|
+
#
|
|
4
|
+
# Tiny example of writing an AST from scratch to C code.
|
|
5
|
+
#
|
|
6
|
+
# Andre Ribeiro [https://github.com/Andree37]
|
|
7
|
+
# License: BSD
|
|
8
|
+
# -----------------------------------------------------------------
|
|
9
|
+
import sys
|
|
10
|
+
|
|
11
|
+
# This is not required if you've installed pycparser into
|
|
12
|
+
# your site-packages/ with setup.py
|
|
13
|
+
sys.path.extend(['.', '..'])
|
|
14
|
+
|
|
15
|
+
from pycparser import c_ast, c_generator
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# target C code:
|
|
19
|
+
# int main() {
|
|
20
|
+
# return 0;
|
|
21
|
+
# }
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def empty_main_function_ast():
|
|
25
|
+
constant_zero = c_ast.Constant(type='int', value='0')
|
|
26
|
+
return_node = c_ast.Return(expr=constant_zero)
|
|
27
|
+
compound_node = c_ast.Compound(block_items=[return_node])
|
|
28
|
+
type_decl_node = c_ast.TypeDecl(declname='main', quals=[],
|
|
29
|
+
type=c_ast.IdentifierType(names=['int']),
|
|
30
|
+
align=[])
|
|
31
|
+
func_decl_node = c_ast.FuncDecl(args=c_ast.ParamList([]),
|
|
32
|
+
type=type_decl_node)
|
|
33
|
+
func_def_node = c_ast.Decl(name='main', quals=[], storage=[], funcspec=[],
|
|
34
|
+
type=func_decl_node, init=None,
|
|
35
|
+
bitsize=None, align=[])
|
|
36
|
+
main_func_node = c_ast.FuncDef(decl=func_def_node, param_decls=None,
|
|
37
|
+
body=compound_node)
|
|
38
|
+
|
|
39
|
+
return main_func_node
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def generate_c_code(my_ast):
|
|
43
|
+
generator = c_generator.CGenerator()
|
|
44
|
+
return generator.visit(my_ast)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
if __name__ == '__main__':
|
|
48
|
+
main_function_ast = empty_main_function_ast()
|
|
49
|
+
print("|----------------------------------------|")
|
|
50
|
+
main_function_ast.show(offset=2)
|
|
51
|
+
print("|----------------------------------------|")
|
|
52
|
+
main_c_code = generate_c_code(main_function_ast)
|
|
53
|
+
print("C code: \n%s" % main_c_code)
|
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
# Eli Bendersky [https://eli.thegreenplace.net/]
|
|
8
8
|
# License: BSD
|
|
9
9
|
#-----------------------------------------------------------------
|
|
10
|
-
from __future__ import print_function
|
|
11
|
-
import platform
|
|
12
10
|
import sys
|
|
13
11
|
|
|
14
12
|
# This is not required if you've installed pycparser into
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
# Eli Bendersky [https://eli.thegreenplace.net/]
|
|
8
8
|
# License: BSD
|
|
9
9
|
#-----------------------------------------------------------------
|
|
10
|
-
from __future__ import print_function
|
|
11
10
|
import pickle
|
|
12
11
|
import sys
|
|
13
12
|
|
|
@@ -24,16 +23,12 @@ void func(void)
|
|
|
24
23
|
if __name__ == '__main__':
|
|
25
24
|
parser = c_parser.CParser()
|
|
26
25
|
ast = parser.parse(text)
|
|
26
|
+
dump_filename = 'ast.pickle'
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
# The default version is 3 for python 3.x and 1 for python 2.7.
|
|
31
|
-
# You can always select the highest available protocol with the -1 argument.
|
|
32
|
-
|
|
33
|
-
with open('ast', 'wb') as f:
|
|
34
|
-
pickle.dump(ast, f, protocol=-1)
|
|
28
|
+
with open(dump_filename, 'wb') as f:
|
|
29
|
+
pickle.dump(ast, f, protocol=pickle.HIGHEST_PROTOCOL)
|
|
35
30
|
|
|
36
31
|
# Deserialize.
|
|
37
|
-
with open(
|
|
32
|
+
with open(dump_filename, 'rb') as f:
|
|
38
33
|
ast = pickle.load(f)
|
|
39
34
|
ast.show()
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
# License: BSD
|
|
9
9
|
#-----------------------------------------------------------------
|
|
10
10
|
__all__ = ['c_lexer', 'c_parser', 'c_ast']
|
|
11
|
-
__version__ = '2.
|
|
11
|
+
__version__ = '2.22'
|
|
12
12
|
|
|
13
13
|
import io
|
|
14
14
|
from subprocess import check_output
|
|
@@ -49,7 +49,7 @@ def preprocess_file(filename, cpp_path='cpp', cpp_args=''):
|
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
def parse_file(filename, use_cpp=False, cpp_path='cpp', cpp_args='',
|
|
52
|
-
parser=None):
|
|
52
|
+
parser=None, encoding=None):
|
|
53
53
|
""" Parse a C file using pycparser.
|
|
54
54
|
|
|
55
55
|
filename:
|
|
@@ -71,6 +71,9 @@ def parse_file(filename, use_cpp=False, cpp_path='cpp', cpp_args='',
|
|
|
71
71
|
r'-I../utils/fake_libc_include'
|
|
72
72
|
If several arguments are required, pass a list of strings.
|
|
73
73
|
|
|
74
|
+
encoding:
|
|
75
|
+
Encoding to use for the file to parse
|
|
76
|
+
|
|
74
77
|
parser:
|
|
75
78
|
Optional parser object to be used instead of the default CParser
|
|
76
79
|
|
|
@@ -82,7 +85,7 @@ def parse_file(filename, use_cpp=False, cpp_path='cpp', cpp_args='',
|
|
|
82
85
|
if use_cpp:
|
|
83
86
|
text = preprocess_file(filename, cpp_path, cpp_args)
|
|
84
87
|
else:
|
|
85
|
-
with io.open(filename) as f:
|
|
88
|
+
with io.open(filename, encoding=encoding) as f:
|
|
86
89
|
text = f.read()
|
|
87
90
|
|
|
88
91
|
if parser is None:
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
# Insert '.' and '..' as first entries to the search path for modules.
|
|
14
14
|
# Restricted environments like embeddable python do not include the
|
|
15
15
|
# current working directory on startup.
|
|
16
|
+
import importlib
|
|
16
17
|
import sys
|
|
17
18
|
sys.path[0:0] = ['.', '..']
|
|
18
19
|
|
|
@@ -32,6 +33,8 @@ c_parser.CParser(
|
|
|
32
33
|
|
|
33
34
|
# Load to compile into .pyc
|
|
34
35
|
#
|
|
36
|
+
importlib.invalidate_caches()
|
|
37
|
+
|
|
35
38
|
import lextab
|
|
36
39
|
import yacctab
|
|
37
40
|
import c_ast
|
|
@@ -571,15 +571,29 @@ class CParser(PLYParser):
|
|
|
571
571
|
self._parse_error('Directives not supported yet',
|
|
572
572
|
self._token_coord(p, 1))
|
|
573
573
|
|
|
574
|
+
# This encompasses two types of C99-compatible pragmas:
|
|
575
|
+
# - The #pragma directive:
|
|
576
|
+
# # pragma character_sequence
|
|
577
|
+
# - The _Pragma unary operator:
|
|
578
|
+
# _Pragma ( " string_literal " )
|
|
574
579
|
def p_pppragma_directive(self, p):
|
|
575
580
|
""" pppragma_directive : PPPRAGMA
|
|
576
581
|
| PPPRAGMA PPPRAGMASTR
|
|
582
|
+
| _PRAGMA LPAREN unified_string_literal RPAREN
|
|
577
583
|
"""
|
|
578
|
-
if len(p) ==
|
|
584
|
+
if len(p) == 5:
|
|
585
|
+
p[0] = c_ast.Pragma(p[3], self._token_coord(p, 2))
|
|
586
|
+
elif len(p) == 3:
|
|
579
587
|
p[0] = c_ast.Pragma(p[2], self._token_coord(p, 2))
|
|
580
588
|
else:
|
|
581
589
|
p[0] = c_ast.Pragma("", self._token_coord(p, 1))
|
|
582
590
|
|
|
591
|
+
def p_pppragma_directive_list(self, p):
|
|
592
|
+
""" pppragma_directive_list : pppragma_directive
|
|
593
|
+
| pppragma_directive_list pppragma_directive
|
|
594
|
+
"""
|
|
595
|
+
p[0] = [p[1]] if len(p) == 2 else p[1] + [p[2]]
|
|
596
|
+
|
|
583
597
|
# In function definitions, the declarator can be followed by
|
|
584
598
|
# a declaration list, for old "K&R style" function definitios.
|
|
585
599
|
def p_function_definition_1(self, p):
|
|
@@ -671,12 +685,12 @@ class CParser(PLYParser):
|
|
|
671
685
|
# sum += 1;
|
|
672
686
|
# }
|
|
673
687
|
def p_pragmacomp_or_statement(self, p):
|
|
674
|
-
""" pragmacomp_or_statement :
|
|
688
|
+
""" pragmacomp_or_statement : pppragma_directive_list statement
|
|
675
689
|
| statement
|
|
676
690
|
"""
|
|
677
|
-
if
|
|
691
|
+
if len(p) == 3:
|
|
678
692
|
p[0] = c_ast.Compound(
|
|
679
|
-
block_items=
|
|
693
|
+
block_items=p[1]+[p[2]],
|
|
680
694
|
coord=self._token_coord(p, 1))
|
|
681
695
|
else:
|
|
682
696
|
p[0] = 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_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-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))\')|(?P<t_U8CHAR_CONST>u8\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))\')|(?P<t_U16CHAR_CONST>u\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))\')|(?P<t_U32CHAR_CONST>U\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))\')|(?P<t_UNMATCHED_QUOTE>(\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))*\\n)|(\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))*$))|(?P<t_BAD_CHAR_CONST>(\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))[^\'\n]+\')|(\'\')|(\'([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-9])[^\'\\n]*\'))|(?P<t_WSTRING_LITERAL>L"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?P<t_U8STRING_LITERAL>u8"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?P<t_U16STRING_LITERAL>u"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?P<t_U32STRING_LITERAL>U"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?P<t_BAD_STRING_LITERAL>"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-9])([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?P<t_ID>[a-zA-Z_$][0-9a-zA-Z_$]*)|(?P<t_STRING_LITERAL>"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?P<t_ELLIPSIS>\\.\\.\\.)|(?P<t_LOR>\\|\\|)|(?P<t_PLUSPLUS>\\+\\+)|(?P<t_LSHIFTEQUAL><<=)|(?P<t_OREQUAL>\\|=)|(?P<t_PLUSEQUAL>\\+=)|(?P<t_RSHIFTEQUAL>>>=)|(?P<t_TIMESEQUAL>\\*=)|(?P<t_XOREQUAL>\\^=)|(?P<t_ANDEQUAL>&=)|(?P<t_ARROW>->)|(?P<t_CONDOP>\\?)|(?P<t_DIVEQUAL>/=)|(?P<t_EQ>==)|(?P<t_GE>>=)|(?P<t_LAND>&&)|(?P<t_LBRACKET>\\[)|(?P<t_LE><=)|(?P<t_LPAREN>\\()|(?P<t_LSHIFT><<)|(?P<t_MINUSEQUAL>-=)|(?P<t_MINUSMINUS>--)|(?P<t_MODEQUAL>%=)|(?P<t_NE>!=)|(?P<t_OR>\\|)|(?P<t_PERIOD>\\.)|(?P<t_PLUS>\\+)|(?P<t_RBRACKET>\\])|(?P<t_RPAREN>\\))|(?P<t_RSHIFT>>>)|(?P<t_TIMES>\\*)|(?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_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 = {}
|
|
@@ -179,7 +179,7 @@ class Lexer:
|
|
|
179
179
|
with open(filename, 'w') as tf:
|
|
180
180
|
tf.write('# %s.py. This file automatically created by PLY (version %s). Don\'t edit!\n' % (basetabmodule, __version__))
|
|
181
181
|
tf.write('_tabversion = %s\n' % repr(__tabversion__))
|
|
182
|
-
tf.write('_lextokens = set(%s)\n' % repr(tuple(self.lextokens)))
|
|
182
|
+
tf.write('_lextokens = set(%s)\n' % repr(tuple(sorted(self.lextokens))))
|
|
183
183
|
tf.write('_lexreflags = %s\n' % repr(self.lexreflags))
|
|
184
184
|
tf.write('_lexliterals = %s\n' % repr(self.lexliterals))
|
|
185
185
|
tf.write('_lexstateinfo = %s\n' % repr(self.lexstateinfo))
|