pycparser 3.11__tar.gz → 3.12__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.
Files changed (191) hide show
  1. {pycparser-3.11 → pycparser-3.12}/MANIFEST.in +1 -1
  2. pycparser-3.12/OLDER_CHANGES +288 -0
  3. {pycparser-3.11/pycparser.egg-info → pycparser-3.12}/PKG-INFO +48 -6
  4. {pycparser-3.11 → pycparser-3.12}/README.rst +46 -3
  5. {pycparser-3.11 → pycparser-3.12}/pycparser/__init__.py +1 -1
  6. {pycparser-3.11 → pycparser-3.12}/pycparser/_ast_gen.py +37 -11
  7. {pycparser-3.11 → pycparser-3.12}/pycparser/_c_ast.cfg +74 -20
  8. {pycparser-3.11 → pycparser-3.12}/pycparser/ast_transforms.py +17 -0
  9. {pycparser-3.11 → pycparser-3.12}/pycparser/c_ast.py +322 -31
  10. {pycparser-3.11 → pycparser-3.12}/pycparser/c_generator.py +316 -60
  11. {pycparser-3.11 → pycparser-3.12}/pycparser/c_lexer.py +185 -45
  12. {pycparser-3.11 → pycparser-3.12}/pycparser/c_parser.py +723 -428
  13. {pycparser-3.11 → pycparser-3.12/pycparser.egg-info}/PKG-INFO +48 -6
  14. {pycparser-3.11 → pycparser-3.12}/pycparser.egg-info/SOURCES.txt +2 -0
  15. {pycparser-3.11 → pycparser-3.12}/pyproject.toml +3 -4
  16. pycparser-3.12/tests/test_c23_attributes.py +440 -0
  17. {pycparser-3.11 → pycparser-3.12}/tests/test_c_ast.py +0 -10
  18. pycparser-3.12/tests/test_c_generator.py +1710 -0
  19. {pycparser-3.11 → pycparser-3.12}/tests/test_c_lexer.py +246 -47
  20. {pycparser-3.11 → pycparser-3.12}/tests/test_c_parser.py +2500 -14
  21. {pycparser-3.11 → pycparser-3.12}/tests/test_general.py +44 -1
  22. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/_fake_defines.h +1 -1
  23. pycparser-3.11/tests/test_c_generator.py +0 -809
  24. {pycparser-3.11 → pycparser-3.12}/LICENSE +0 -0
  25. {pycparser-3.11 → pycparser-3.12}/examples/c-to-c.py +0 -0
  26. {pycparser-3.11 → pycparser-3.12}/examples/c_files/basic.c +0 -0
  27. {pycparser-3.11 → pycparser-3.12}/examples/c_files/funky.c +0 -0
  28. {pycparser-3.11 → pycparser-3.12}/examples/c_files/hash.c +0 -0
  29. {pycparser-3.11 → pycparser-3.12}/examples/c_files/memmgr.c +0 -0
  30. {pycparser-3.11 → pycparser-3.12}/examples/c_files/memmgr.h +0 -0
  31. {pycparser-3.11 → pycparser-3.12}/examples/c_files/pragmas.c +0 -0
  32. {pycparser-3.11 → pycparser-3.12}/examples/c_files/year.c +0 -0
  33. {pycparser-3.11 → pycparser-3.12}/examples/c_json.py +0 -0
  34. {pycparser-3.11 → pycparser-3.12}/examples/cdecl.py +0 -0
  35. {pycparser-3.11 → pycparser-3.12}/examples/construct_ast_from_scratch.py +0 -0
  36. {pycparser-3.11 → pycparser-3.12}/examples/dump_ast.py +0 -0
  37. {pycparser-3.11 → pycparser-3.12}/examples/explore_ast.py +0 -0
  38. {pycparser-3.11 → pycparser-3.12}/examples/func_calls.py +0 -0
  39. {pycparser-3.11 → pycparser-3.12}/examples/func_defs.py +0 -0
  40. {pycparser-3.11 → pycparser-3.12}/examples/func_defs_add_param.py +0 -0
  41. {pycparser-3.11 → pycparser-3.12}/examples/rewrite_ast.py +0 -0
  42. {pycparser-3.11 → pycparser-3.12}/examples/serialize_ast.py +0 -0
  43. {pycparser-3.11 → pycparser-3.12}/examples/typed_usage.py +0 -0
  44. {pycparser-3.11 → pycparser-3.12}/examples/using_cpp_libc.py +0 -0
  45. {pycparser-3.11 → pycparser-3.12}/examples/using_gcc_E_libc.py +0 -0
  46. {pycparser-3.11 → pycparser-3.12}/pycparser.egg-info/dependency_links.txt +0 -0
  47. {pycparser-3.11 → pycparser-3.12}/pycparser.egg-info/top_level.txt +0 -0
  48. {pycparser-3.11 → pycparser-3.12}/setup.cfg +0 -0
  49. {pycparser-3.11 → pycparser-3.12}/setup.py +0 -0
  50. {pycparser-3.11 → pycparser-3.12}/tests/__init__.py +0 -0
  51. {pycparser-3.11 → pycparser-3.12}/tests/c_files/c11.c +0 -0
  52. {pycparser-3.11 → pycparser-3.12}/tests/c_files/cppd_with_stdio_h.c +0 -0
  53. {pycparser-3.11 → pycparser-3.12}/tests/c_files/empty.h +0 -0
  54. {pycparser-3.11 → pycparser-3.12}/tests/c_files/example_c_file.c +0 -0
  55. {pycparser-3.11 → pycparser-3.12}/tests/c_files/hdir/9/inc.h +0 -0
  56. {pycparser-3.11 → pycparser-3.12}/tests/c_files/memmgr.c +0 -0
  57. {pycparser-3.11 → pycparser-3.12}/tests/c_files/memmgr.h +0 -0
  58. {pycparser-3.11 → pycparser-3.12}/tests/c_files/memmgr_with_h.c +0 -0
  59. {pycparser-3.11 → pycparser-3.12}/tests/c_files/simplemain.c +0 -0
  60. {pycparser-3.11 → pycparser-3.12}/tests/c_files/year.c +0 -0
  61. {pycparser-3.11 → pycparser-3.12}/tests/test_examples.py +0 -0
  62. {pycparser-3.11 → pycparser-3.12}/tests/test_util.py +0 -0
  63. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/X11/Intrinsic.h +0 -0
  64. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/X11/Xlib.h +0 -0
  65. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/X11/_X11_fake_defines.h +0 -0
  66. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/X11/_X11_fake_typedefs.h +0 -0
  67. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/_ansi.h +0 -0
  68. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/_fake_typedefs.h +0 -0
  69. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/_syslist.h +0 -0
  70. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/aio.h +0 -0
  71. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/alloca.h +0 -0
  72. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/ar.h +0 -0
  73. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/argz.h +0 -0
  74. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/arpa/inet.h +0 -0
  75. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/asm-generic/int-ll64.h +0 -0
  76. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/assert.h +0 -0
  77. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/complex.h +0 -0
  78. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/cpio.h +0 -0
  79. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/ctype.h +0 -0
  80. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/dirent.h +0 -0
  81. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/dlfcn.h +0 -0
  82. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/emmintrin.h +0 -0
  83. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/endian.h +0 -0
  84. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/envz.h +0 -0
  85. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/errno.h +0 -0
  86. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/fastmath.h +0 -0
  87. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/fcntl.h +0 -0
  88. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/features.h +0 -0
  89. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/fenv.h +0 -0
  90. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/float.h +0 -0
  91. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/fmtmsg.h +0 -0
  92. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/fnmatch.h +0 -0
  93. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/ftw.h +0 -0
  94. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/getopt.h +0 -0
  95. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/glob.h +0 -0
  96. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/grp.h +0 -0
  97. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/iconv.h +0 -0
  98. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/ieeefp.h +0 -0
  99. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/immintrin.h +0 -0
  100. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/inttypes.h +0 -0
  101. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/iso646.h +0 -0
  102. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/langinfo.h +0 -0
  103. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/libgen.h +0 -0
  104. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/libintl.h +0 -0
  105. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/limits.h +0 -0
  106. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/linux/socket.h +0 -0
  107. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/linux/version.h +0 -0
  108. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/locale.h +0 -0
  109. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/malloc.h +0 -0
  110. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/math.h +0 -0
  111. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/mir_toolkit/client_types.h +0 -0
  112. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/monetary.h +0 -0
  113. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/mqueue.h +0 -0
  114. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/ndbm.h +0 -0
  115. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/net/if.h +0 -0
  116. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/netdb.h +0 -0
  117. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/netinet/in.h +0 -0
  118. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/netinet/tcp.h +0 -0
  119. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/newlib.h +0 -0
  120. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/nl_types.h +0 -0
  121. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/openssl/err.h +0 -0
  122. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/openssl/evp.h +0 -0
  123. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/openssl/hmac.h +0 -0
  124. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/openssl/ssl.h +0 -0
  125. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/openssl/x509v3.h +0 -0
  126. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/paths.h +0 -0
  127. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/poll.h +0 -0
  128. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/process.h +0 -0
  129. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/pthread.h +0 -0
  130. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/pwd.h +0 -0
  131. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/reent.h +0 -0
  132. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/regdef.h +0 -0
  133. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/regex.h +0 -0
  134. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/sched.h +0 -0
  135. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/search.h +0 -0
  136. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/semaphore.h +0 -0
  137. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/setjmp.h +0 -0
  138. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/signal.h +0 -0
  139. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/smmintrin.h +0 -0
  140. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/spawn.h +0 -0
  141. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/stdalign.h +0 -0
  142. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/stdarg.h +0 -0
  143. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/stdatomic.h +0 -0
  144. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/stdbool.h +0 -0
  145. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/stddef.h +0 -0
  146. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/stdint.h +0 -0
  147. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/stdio.h +0 -0
  148. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/stdlib.h +0 -0
  149. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/stdnoreturn.h +0 -0
  150. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/string.h +0 -0
  151. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/strings.h +0 -0
  152. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/stropts.h +0 -0
  153. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/sys/ioctl.h +0 -0
  154. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/sys/ipc.h +0 -0
  155. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/sys/mman.h +0 -0
  156. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/sys/msg.h +0 -0
  157. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/sys/poll.h +0 -0
  158. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/sys/resource.h +0 -0
  159. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/sys/select.h +0 -0
  160. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/sys/sem.h +0 -0
  161. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/sys/shm.h +0 -0
  162. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/sys/socket.h +0 -0
  163. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/sys/stat.h +0 -0
  164. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/sys/statvfs.h +0 -0
  165. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/sys/sysctl.h +0 -0
  166. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/sys/time.h +0 -0
  167. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/sys/times.h +0 -0
  168. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/sys/types.h +0 -0
  169. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/sys/uio.h +0 -0
  170. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/sys/un.h +0 -0
  171. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/sys/utsname.h +0 -0
  172. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/sys/wait.h +0 -0
  173. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/syslog.h +0 -0
  174. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/tar.h +0 -0
  175. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/termios.h +0 -0
  176. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/tgmath.h +0 -0
  177. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/threads.h +0 -0
  178. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/time.h +0 -0
  179. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/trace.h +0 -0
  180. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/uchar.h +0 -0
  181. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/ulimit.h +0 -0
  182. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/unctrl.h +0 -0
  183. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/unistd.h +0 -0
  184. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/utime.h +0 -0
  185. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/utmp.h +0 -0
  186. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/utmpx.h +0 -0
  187. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/wchar.h +0 -0
  188. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/wctype.h +0 -0
  189. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/wordexp.h +0 -0
  190. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/xcb/xcb.h +0 -0
  191. {pycparser-3.11 → pycparser-3.12}/utils/fake_libc_include/zlib.h +0 -0
@@ -4,5 +4,5 @@ recursive-include pycparser *.py *.cfg
4
4
  recursive-include utils/fake_libc_include *.h
5
5
  include README.*
6
6
  include LICENSE
7
- include CHANGES
7
+ include OLDER_CHANGES
8
8
  include setup.*
@@ -0,0 +1,288 @@
1
+ + Starting with version 2.22, please use the GitHub UI
2
+ at https://github.com/eliben/pycparser/tags
3
+ to compare tags in order to find out what changed.
4
+
5
+ + Version 2.21 (2021.11.06)
6
+
7
+ - Much improved support for C11 (multiple PRs)
8
+ - Support for parehthesized compount statements (#423)
9
+ - Support for modern Python versions (3.9 and 3.10)
10
+ - Fix support for structs with nested enums (#387)
11
+ - Multiple small bug fixes
12
+
13
+ + Version 2.20 (2020.03.04)
14
+
15
+ - #61: Fix slow backtracking when parsing strings.
16
+ - #99: Parser for FuncDecl incorrectly sets declname attribute on return type.
17
+ - #310: Fix crash when file starts with a semicolon.
18
+ - #313: Fix array type generation.
19
+ - #314: Fix failed parsing of unnamed function parameters with array dim
20
+ qualifiers.
21
+ - #315: Fix pointer type generation.
22
+ - #324: Fixes for u/l constant integer suffix.
23
+ - #346: Fix error transforming an empty switch.
24
+ - #350: Recognize integer multicharacter constants like 'ABCD'.
25
+ - #363: Fix incorrect AST when parsing offsetof.
26
+
27
+ + Version 2.19 (2018.09.19)
28
+
29
+ - PR #277: Fix parsing of floating point literals
30
+ - PR #254: Add support for parsing empty structs
31
+ - PR #240: Fix enum formatting in generated C code (also #216)
32
+ - PR #222: Add support for #pragma in struct declarations
33
+ - There are reports that this release doesn't work with Python 2.6 (#281).
34
+ Please note that the minimal supported version is 2.7; the required versions
35
+ are listed in the README file.
36
+
37
+ + Version 2.18 (2017.07.04)
38
+
39
+ - PR #161 & #184: Update bundled PLY version to 3.10
40
+ - PR #158: Add support for the __int128 type.
41
+ - PR #169: Handle more tricky TYPEID in declarators.
42
+ - PR #178: Add columns to the coord of each node
43
+
44
+ + Version 2.17 (2016.10.29)
45
+
46
+ - Again functionality identical to 2.15 and 2.16; the difference is that the
47
+ tarball now contains Python files with properly set permissions.
48
+
49
+ + Version 2.16 (2016.10.18)
50
+
51
+ - Functionally identical to 2.15, but fixes a packaging problem that caused
52
+ failed installation (_build_tables wasn't rerun in the pycparser/ dir).
53
+
54
+ + Version 2.15 (2016.10.18)
55
+
56
+ - PR #121: Update bundled PLY version to 3.8
57
+ - Issue #117: Fix parsing of extra semi-colons inside structure declarations.
58
+ - PR #109: Update c_generator to add {} around nested named initializers.
59
+ - PR #101: Added support for parsing pragmas into the AST.
60
+ - Additional fake headers and typedefs, manifest fixes (#97, #106, #111).
61
+ - Testing with Python 3.5 instead of 3.3 now (3.4 and 3.5 are the 3.x versions
62
+ tested).
63
+ - PR #145: More complete support for offsetof()
64
+ - Issue #116: Fix line numbers recorded for empty and compound statements.
65
+ - Minor performance improvement to the invalid string literal regex.
66
+
67
+ + Version 2.14 (2015.06.09)
68
+
69
+ - Added CParser parameter to specify output directory for generated parsing
70
+ tables (#84).
71
+ - Removed lcc's cpp and its license from the distribution. Using lcc's cpp
72
+ is no longer recommended, now that Clang has binary builds available for
73
+ Windows.
74
+
75
+ + Version 2.13 (2015.05.12)
76
+
77
+ - Added support for offsetof() the way gcc implements it (special builtin
78
+ that takes a type as an argument).
79
+ - Added faked va_* macros (these are expected to come from stdarg.h)
80
+ - Added a bunch more fake headers and typedefs to support parsing C projects
81
+ like Git and SQLite without modifications to pycparser.
82
+ - Added support for empty initializer lists (#79).
83
+
84
+ + Version 2.12 (2015.04.21)
85
+
86
+ - This is a fix release for 2.11; the memory optimization with __slots__ on
87
+ Coord and AST nodes didn't take weakrefs into account, which broke cffi and
88
+ its many dependents (issue #76). Fixed by adding __weakref__ to __slots__.
89
+
90
+ + Version 2.11 (2015.04.21)
91
+
92
+ - Add support for C99 6.5.3.7 p7 - qualifiers within array dimensions in
93
+ function declarations. Started with issue #21 (reported with initial patch
94
+ by Robin Martinjak).
95
+ - Issue #27: bug in handling of unified wstring literals.
96
+ - Issue #28: fix coord reporting for 'for' loops.
97
+ - Added ``examples/using_gcc_E_libc.py`` to demonstrate how ``gcc -E`` can
98
+ be used instead of ``cpp`` for preprocessing.
99
+ - Pull request #64: support keywords like const, volatile, restrict and static
100
+ in dimensions in array declarations.
101
+ - Reduce memory usage of AST nodes (issue #72).
102
+ - Parsing order of nested pointer declarations fixed (issue #68).
103
+
104
+ + Version 2.10 (2013.08.03)
105
+
106
+ - A number of improvements in the handling of typedef-name ambiguities,
107
+ contributed by Sye van der Veen in GitHub issue #1:
108
+
109
+ * Allow shadowing of types by identifiers in inner scopes.
110
+ * Allow struct field names to reside in a separate namespace and have
111
+ the same names as types.
112
+ * Allow duplicate typedefs in some cases to mimic real compiler behavior.
113
+
114
+ - c_generator error for ExprList in expression context.
115
+ - Assume default int type for functions whose argument or return types were
116
+ not specified.
117
+ - Relax the lexer a bit w.r.t. some integer suffixes and $ in identifier names
118
+ (which is supported by some other compilers).
119
+
120
+ + Version 2.09.1 (2012.12.29)
121
+
122
+ - No actual functionality changes.
123
+ - The source distribution was re-packaged to contain the pre-generated Lex and
124
+ Yacc tables of PLY.
125
+
126
+ + Version 2.09 (2012.12.27)
127
+
128
+ - The pycparser project has moved to Bitbucket. For this version, issue
129
+ numbers still refer to the old Googlecode project, unless stated otherwise.
130
+ Starting with the next version all issue numbers will refer to the new
131
+ Bitbucket project.
132
+ - pycparser now carries its PLY dependency along. The pycparser/ply directory
133
+ contains the source of PLY for the currently supported version. This makes
134
+ distribution and testing easier.
135
+ - Issue #79: fix generation of new switch/case AST nodes.
136
+ - Issue #83: fix parsing and C generation to distinguish between initializer
137
+ lists in declarations and initializing variables with parenthesized
138
+ comma-separated expressions.
139
+ - Issue #84: fix C generation for some statements.
140
+ - Issues #86 and #87: improve location reporting for parse errors.
141
+ - Issue #89: fix C generation for K&R-style function definitions.
142
+
143
+ + Version 2.08 (2012.08.10)
144
+
145
+ - Issue 73: initial support for #pragma directives. Consume them without
146
+ errors and ignore (no tokens are returned). Line numbers are preserved.
147
+ - Issue 68: more correct handling of source files without any actual content.
148
+ - Issue 69: running all tests will now set appropriate return code.
149
+ - Better error reporting in case where multiple type specifiers are provided.
150
+ Also fixes Issue 60.
151
+ - Issue 63: line endings cleanup for consistent LF ending.
152
+ - Issues 64 & 65: added some more headers and typedefs to fake includes.
153
+ - Refactoring the cpp invocation in parse_file into a separate function, which
154
+ can also be used as a utility.
155
+ - Issue 74: some Windows include paths were handled incorrectly.
156
+
157
+ + Version 2.07 (2012.06.16)
158
+
159
+ - Issue 54: added an optional parser argument to parse_file
160
+ - Issue 59: added some more fake headers for C99
161
+ - Issue 62: correct coord for Ellipsis nodes
162
+ - Issue 57: support for C99 hexadecimal float constants
163
+ - Made running tests that call on 'cpp' a bit more robust.
164
+
165
+ + Version 2.06 (2012.02.04)
166
+
167
+ - Issue 48: gracefully handle parsing of empty files
168
+ - Issues 49 & 50: handle more escaped chars in paths to #line - "..\..\test.h".
169
+ - Support for C99 _Complex type.
170
+ - CGenerator moves from examples/ to pycparser/ as a first-class citizen, and
171
+ added some fixes to it. examples/c-to-c.py still stays as a convenience
172
+ wrapper.
173
+ - Fix problem with parsing a file in which the first statement is just a
174
+ semicolon.
175
+ - Improved the AST created for switch statements, making it closer to the
176
+ semantic meaning than to the grammar.
177
+
178
+ + Version 2.05 (2011.10.16)
179
+
180
+ - Added support for the C99 ``_Bool`` type and ``stdbool.h`` header file
181
+ - Expanded ``examples/explore_ast.py`` with more details on working with the
182
+ AST
183
+ - Relaxed the rules on parsing unnamed struct members (helps parse ``windows.h``)
184
+ - Bug fixes:
185
+
186
+ * Fixed spacing issue for some type declarations
187
+ * Issue 47: display empty statements (lone ';') correctly after parsing
188
+
189
+ + Version 2.04 (2011.05.21)
190
+
191
+ - License changed from LGPL to BSD
192
+ - Bug fixes:
193
+
194
+ * Issue 31: constraining the scope of typedef definitions
195
+ * Issues 33, 35: fixes for the c-to-c.py example
196
+
197
+ - Added C99 integer types to fake headers
198
+ - Added unit tests for the c-to-c.py example
199
+
200
+ + Version 2.03 (2011.03.06)
201
+
202
+ - Bug fixes:
203
+
204
+ * Issue 17: empty file-level declarations
205
+ * Issue 18: empty statements and declarations in functions
206
+ * Issue 19: anonymous structs & union fields
207
+ * Issue 23: fix coordinates of Cast nodes
208
+
209
+ - New example added (``examples/c-to-c.py``) for translating ASTs generated
210
+ by ``pycparser`` back into C code.
211
+ - ``pycparser`` is now on PyPI (Python Package Index)
212
+ - Created `FAQ <http://code.google.com/p/pycparser/wiki/FAQ>`_ on
213
+ the ``pycparser`` project page
214
+ - Removed support for Python 2.5. ``pycparser`` supports Python 2
215
+ from 2.6 and on, and Python 3.
216
+
217
+ + Version 2.02 (2010.12.10)
218
+
219
+ * The name of a ``NamedInitializer`` node was turned into a sequence of nodes
220
+ instead of an attribute, to make it discoverable by the AST node visitor.
221
+ * Documentation updates
222
+
223
+ + Version 2.01 (04.12.2010)
224
+
225
+ * Removed dependency on YAML. Parsing of the AST node configuration file
226
+ is done with a simple parser.
227
+ * Fixed issue 12: installation problems
228
+
229
+ + Version 2.00 (2010.10.31)
230
+
231
+ * Support for C99 (read
232
+ `this wiki page <http://code.google.com/p/pycparser/wiki/C99support>`_
233
+ for more information).
234
+
235
+ + Version 1.08 (2010.10.09)
236
+
237
+ * Bug fixes:
238
+
239
+ + Correct handling of ``do{} ... while`` statements in some cases
240
+ + Issues 6 & 7: Concatenation of string literals
241
+ + Issue 9: Support for unnamed bitfields in structs
242
+
243
+ + Version 1.07 (2010.05.18)
244
+
245
+ * Python 3.1 compatibility: ``pycparser`` was modified to run
246
+ on Python 3.1 as well as 2.6
247
+
248
+ + Version 1.06 (2010.04.10)
249
+
250
+ * Bug fixes:
251
+
252
+ + coord not propagated to FuncCall nodes
253
+ + lexing of the ^= token (XOREQUALS)
254
+ + parsing failed on some abstract declarator rules
255
+
256
+ * Linux compatibility: fixed end-of-line and ``cpp`` path issues to allow
257
+ all tests and examples run on Linux
258
+
259
+ + Version 1.05 (2009.10.16)
260
+
261
+ * Fixed the ``parse_file`` auxiliary function to handle multiple arguments to
262
+ ``cpp`` correctly
263
+
264
+ + Version 1.04 (2009.05.22)
265
+
266
+ * Added the ``fake_libc_include`` directory to allow parsing of C code that
267
+ uses standard C library include files without dependency on a real C
268
+ library.
269
+ * Tested with Python 2.6 and PLY 3.2
270
+
271
+ + Version 1.03 (2009.01.31)
272
+
273
+ * Accept enumeration lists with a comma after the last item (C99 feature).
274
+
275
+ + Version 1.02 (2009.01.16)
276
+
277
+ * Fixed problem of parsing struct/enum/union names that were named similarly
278
+ to previously defined ``typedef`` types.
279
+
280
+ + Version 1.01 (2009.01.09)
281
+
282
+ * Fixed subprocess invocation in the helper function parse_file - now
283
+ it's more portable
284
+
285
+ + Version 1.0 (2008.11.15)
286
+
287
+ * Initial release
288
+ * Support for ANSI C89
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pycparser
3
- Version: 3.11
3
+ Version: 3.12
4
4
  Summary: C parser in Python
5
5
  Author-email: Eli Bendersky <eliben@gmail.com>
6
6
  Maintainer-email: Eli Bendersky <eliben@gmail.com>
@@ -8,13 +8,12 @@ License-Expression: BSD-3-Clause
8
8
  Project-URL: Homepage, https://github.com/eliben/pycparser
9
9
  Classifier: Development Status :: 5 - Production/Stable
10
10
  Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.10
12
11
  Classifier: Programming Language :: Python :: 3.11
13
12
  Classifier: Programming Language :: Python :: 3.12
14
13
  Classifier: Programming Language :: Python :: 3.13
15
14
  Classifier: Programming Language :: Python :: 3.14
16
15
  Classifier: Programming Language :: Python :: 3.15
17
- Requires-Python: >=3.10
16
+ Requires-Python: >=3.11
18
17
  Description-Content-Type: text/x-rst
19
18
  License-File: LICENSE
20
19
  Dynamic: license-file
@@ -70,9 +69,12 @@ simple to install and deploy.
70
69
  Which version of C does pycparser support?
71
70
  ------------------------------------------
72
71
 
73
- **pycparser** aims to support the full C99 language (according to the standard
74
- ISO/IEC 9899). Some features from C11 are also supported, and patches to support
75
- more are welcome.
72
+ **pycparser** aims to support the full C11 language, including earlier
73
+ revisions like C99.
74
+
75
+ C23 support is conditional on a ``dialect="c23"`` setting, since this revision
76
+ introduces new keywords like ``bool`` that would conflict with existing C code
77
+ if not handled properly.
76
78
 
77
79
  **pycparser** supports very few GCC extensions, but it's fairly easy to set
78
80
  things up so that it parses code with a lot of GCC-isms successfully. See the
@@ -170,6 +172,20 @@ that most realistic C code samples would require running the C preprocessor
170
172
  before passing the code to **pycparser**; see the previous sections for more
171
173
  details.
172
174
 
175
+ For example, to parse C23 source with a preprocessor that supports ``-std=c23``::
176
+
177
+ from pycparser import CParser, parse_file
178
+
179
+ ast = parse_file(
180
+ "example.c",
181
+ use_cpp=True,
182
+ cpp_args=["-std=c23"],
183
+ parser=CParser(dialect="c23"),
184
+ )
185
+
186
+ The parser's dialect does not configure the external preprocessor; select its
187
+ language mode separately through ``cpp_args``.
188
+
173
189
  .. |examples| replace:: ``examples``
174
190
  .. _examples: examples
175
191
 
@@ -181,6 +197,32 @@ The public interface of **pycparser** is well documented with comments in
181
197
  ``pycparser/c_parser.py``. For a detailed overview of the various AST nodes
182
198
  created by the parser, see ``pycparser/_c_ast.cfg``.
183
199
 
200
+ The root node is a ``FileAST``, whose ``ext`` attribute is a list of top-level
201
+ declarations and function definitions. Explore nodes through their named fields,
202
+ and use ``show()`` on a subtree to inspect just that part of the AST::
203
+
204
+ from pycparser import CParser
205
+
206
+ ast = CParser().parse("int x; int f(void) { return x; }")
207
+ print(len(ast.ext)) # 2
208
+ func = ast.ext[1]
209
+ func.body.show()
210
+
211
+ For generic exploration, call ``children()`` to get a tuple of ``(field_name,
212
+ child_node)`` pairs for the immediate children. The tuple supports length and
213
+ indexing directly::
214
+
215
+ children = func.children()
216
+ print(len(children)) # 2: decl and body
217
+ name, child = children[0]
218
+ print(name) # decl
219
+ child.show()
220
+
221
+ Iterating over a node directly (``for child in node``) yields just the child
222
+ nodes, without their names. For a guided walkthrough, see
223
+ `examples/explore_ast.py <examples/explore_ast.py>`_; for recursive traversal,
224
+ see the ``NodeVisitor`` example in `examples/func_defs.py <examples/func_defs.py>`_.
225
+
184
226
  There's also a `FAQ available here <https://github.com/eliben/pycparser/wiki/FAQ>`_.
185
227
  In any case, you can always drop me an `email <eliben@gmail.com>`_ for help.
186
228
 
@@ -49,9 +49,12 @@ simple to install and deploy.
49
49
  Which version of C does pycparser support?
50
50
  ------------------------------------------
51
51
 
52
- **pycparser** aims to support the full C99 language (according to the standard
53
- ISO/IEC 9899). Some features from C11 are also supported, and patches to support
54
- more are welcome.
52
+ **pycparser** aims to support the full C11 language, including earlier
53
+ revisions like C99.
54
+
55
+ C23 support is conditional on a ``dialect="c23"`` setting, since this revision
56
+ introduces new keywords like ``bool`` that would conflict with existing C code
57
+ if not handled properly.
55
58
 
56
59
  **pycparser** supports very few GCC extensions, but it's fairly easy to set
57
60
  things up so that it parses code with a lot of GCC-isms successfully. See the
@@ -149,6 +152,20 @@ that most realistic C code samples would require running the C preprocessor
149
152
  before passing the code to **pycparser**; see the previous sections for more
150
153
  details.
151
154
 
155
+ For example, to parse C23 source with a preprocessor that supports ``-std=c23``::
156
+
157
+ from pycparser import CParser, parse_file
158
+
159
+ ast = parse_file(
160
+ "example.c",
161
+ use_cpp=True,
162
+ cpp_args=["-std=c23"],
163
+ parser=CParser(dialect="c23"),
164
+ )
165
+
166
+ The parser's dialect does not configure the external preprocessor; select its
167
+ language mode separately through ``cpp_args``.
168
+
152
169
  .. |examples| replace:: ``examples``
153
170
  .. _examples: examples
154
171
 
@@ -160,6 +177,32 @@ The public interface of **pycparser** is well documented with comments in
160
177
  ``pycparser/c_parser.py``. For a detailed overview of the various AST nodes
161
178
  created by the parser, see ``pycparser/_c_ast.cfg``.
162
179
 
180
+ The root node is a ``FileAST``, whose ``ext`` attribute is a list of top-level
181
+ declarations and function definitions. Explore nodes through their named fields,
182
+ and use ``show()`` on a subtree to inspect just that part of the AST::
183
+
184
+ from pycparser import CParser
185
+
186
+ ast = CParser().parse("int x; int f(void) { return x; }")
187
+ print(len(ast.ext)) # 2
188
+ func = ast.ext[1]
189
+ func.body.show()
190
+
191
+ For generic exploration, call ``children()`` to get a tuple of ``(field_name,
192
+ child_node)`` pairs for the immediate children. The tuple supports length and
193
+ indexing directly::
194
+
195
+ children = func.children()
196
+ print(len(children)) # 2: decl and body
197
+ name, child = children[0]
198
+ print(name) # decl
199
+ child.show()
200
+
201
+ Iterating over a node directly (``for child in node``) yields just the child
202
+ nodes, without their names. For a guided walkthrough, see
203
+ `examples/explore_ast.py <examples/explore_ast.py>`_; for recursive traversal,
204
+ see the ``NodeVisitor`` example in `examples/func_defs.py <examples/func_defs.py>`_.
205
+
163
206
  There's also a `FAQ available here <https://github.com/eliben/pycparser/wiki/FAQ>`_.
164
207
  In any case, you can always drop me an `email <eliben@gmail.com>`_ for help.
165
208
 
@@ -8,7 +8,7 @@
8
8
  # License: BSD
9
9
  # -----------------------------------------------------------------
10
10
  __all__ = ["c_ast", "c_lexer", "c_parser"]
11
- __version__ = "3.11"
11
+ __version__ = "3.12"
12
12
 
13
13
  from subprocess import check_output
14
14
 
@@ -50,7 +50,8 @@ class ASTCodeGenerator:
50
50
  continue
51
51
  colon_i = line.find(":")
52
52
  lbracket_i = line.find("[")
53
- rbracket_i = line.find("]")
53
+ # A field's default may contain []; find the outer closing bracket.
54
+ rbracket_i = line.rfind("]")
54
55
  if colon_i < 1 or lbracket_i <= colon_i or rbracket_i <= lbracket_i:
55
56
  raise RuntimeError(f"Invalid line in {filename}:\n{line}\n")
56
57
 
@@ -74,11 +75,23 @@ class NodeCfg:
74
75
  self.attr = []
75
76
  self.child = []
76
77
  self.seq_child = []
78
+ self.defaults = {}
77
79
 
78
80
  for entry in contents:
81
+ entry, has_default, default = entry.partition("=")
82
+ entry = entry.strip()
79
83
  clean_entry = entry.rstrip("*")
80
84
  self.all_entries.append(clean_entry)
81
85
 
86
+ if has_default:
87
+ default = default.strip()
88
+ if default not in ("None", "[]"):
89
+ raise RuntimeError(
90
+ f"Unsupported default {default!r} for {name}.{clean_entry}; "
91
+ "expected None or []"
92
+ )
93
+ self.defaults[clean_entry] = default
94
+
82
95
  if entry.endswith("**"):
83
96
  self.seq_child.append(clean_entry)
84
97
  elif entry.endswith("*"):
@@ -96,22 +109,30 @@ class NodeCfg:
96
109
  def _gen_init(self):
97
110
  src = f"class {self.name}(Node):\n"
98
111
 
99
- if self.all_entries:
100
- args = ", ".join(self.all_entries)
101
- slots = ", ".join(f"'{e}'" for e in self.all_entries)
102
- slots += ", 'coord', '__weakref__'"
103
- arglist = f"(self, {args}, coord=None)"
104
- else:
105
- slots = "'coord', '__weakref__'"
106
- arglist = "(self, coord=None)"
112
+ args = ["self"]
113
+ args.extend(name for name in self.all_entries if name not in self.defaults)
114
+ args.append("coord=None")
115
+ # Defaulted fields are keyword-only so adding one doesn't shift coord
116
+ # in existing positional calls. Both supported defaults use None here;
117
+ # list defaults are initialized separately for each instance below.
118
+ if self.defaults:
119
+ args.append("*")
120
+ args.extend(f"{name}=None" for name in self.defaults)
121
+ arglist = f"({', '.join(args)})"
107
122
 
108
123
  # Keep coord and __weakref__ last: Node.__repr__ relies on their
109
124
  # positions when iterating over the node's fields.
125
+ slots = ", ".join(
126
+ repr(name) for name in self.all_entries + ["coord", "__weakref__"]
127
+ )
110
128
  src += f" __slots__ = ({slots})\n"
111
129
  src += f" def __init__{arglist}:\n"
112
130
 
113
131
  for name in self.all_entries + ["coord"]:
114
- src += f" self.{name} = {name}\n"
132
+ if self.defaults.get(name) == "[]":
133
+ src += f" self.{name} = [] if {name} is None else {name}\n"
134
+ else:
135
+ src += f" self.{name} = {name}\n"
115
136
 
116
137
  return src
117
138
 
@@ -220,7 +241,12 @@ class Node:
220
241
  return result
221
242
 
222
243
  def children(self):
223
- """ A sequence of all children that are Nodes
244
+ """Return a tuple of (name, child) pairs for immediate child nodes.
245
+
246
+ Names identify the field and, for list fields, the index, such as
247
+ "type" or "ext[0]". Optional children that are None are omitted.
248
+ The returned tuple supports len() and indexing. Iterating over the
249
+ node itself yields just the child nodes, without their names.
224
250
  """
225
251
 
226
252
  def show(