summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Add instructions on running _build_tablesEli Bendersky2021-08-281-1/+2
|
* c_parser: support parenthesized compounds (#423)Jordan Yates2021-07-072-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * c_parser: support parenthesized compounds Support parenthesized compound statements as described here: https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au> * test_c_parser: support additional initializers Add support to `expand_init` for additional `c_ast` types. If a type is not explicitly handled, return the type name instead of `None`. Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au> * test_c_parser: test parenthesized compounds Add parsing tests for various situations of parenthesized compound statements. The complete tree generated by the test string is: ``` FileAST: FuncDef: Decl: foo, [], [], [] FuncDecl: TypeDecl: foo, [] IdentifierType: ['void'] Compound: Decl: a, [], [], [] TypeDecl: a, [] IdentifierType: ['int'] Compound: Compound: Constant: int, 1 Compound: Constant: int, 1 Constant: int, 2 Decl: b, [], [], [] TypeDecl: b, [] IdentifierType: ['int'] Compound: Constant: int, 1 Decl: c, [], [], [] TypeDecl: c, [] IdentifierType: ['int'] Decl: d, [], [], [] TypeDecl: d, [] IdentifierType: ['int'] Compound: Decl: x, [], [], [] TypeDecl: x, [] IdentifierType: ['int'] Constant: int, 1 BinaryOp: + ID: x Constant: int, 2 Assignment: = ID: a Compound: Decl: x, [], [], [] TypeDecl: x, [] IdentifierType: ['int'] Constant: int, 1 BinaryOp: * Constant: int, 2 ID: x ``` Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
* Add example file for ast dumpingEli Bendersky2021-05-271-0/+15
|
* fixing limits in fake includes (#409)Burkhard2021-03-161-1/+9
|
* Extra line breaks when c_ast.If are chained (#401)Patricio Inzaghi2020-12-092-0/+18
|
* Simplify test execution (#400)Jon Dufresne2020-12-084-23/+2
| | | | | | | | | | | | Use the stdlib standard entry point for running tests through the command: python -m unittest discover Docs: https://docs.python.org/3/library/unittest.html#unittest-test-discovery This automatically looks for files with the test_ prefix and runs them as tests. This removes the need for the custom test entry point script, all_tests.py.
* Add testing and support for modern Pythons (#398)Jon Dufresne2020-12-082-1/+4
| | | Python 3.9 was released on October 5th, 2020.
* Remove tox.ini for nowEli Bendersky2020-12-081-6/+0
| | | | | | It's not currently required and adds all kinds of complexity for managing and keeping up to date. GitHub actions do this well for pending PRs. May reconsider and bring it back in the future.
* Delete Travis configuration (#399)Jon Dufresne2020-12-071-7/+0
| | | The project now uses GitHub actions and Travis does not run.
* Update LICENSE copyright yearEli Bendersky2020-11-021-1/+1
|
* Rename test and add lower-level testingEli Bendersky2020-10-051-1/+7
|
* Clean up commentsEli Bendersky2020-10-052-7/+2
|
* Added flattening of abundant parenthesis in CGenerator (#394)Julian2020-10-053-10/+78
|
* Remove confusing/stale reference in commentEli Bendersky2020-09-301-1/+1
|
* Add test for https://github.com/eliben/pycparser/issues/392Eli Bendersky2020-09-301-0/+10
| | | | [no fix yet]
* Remove AppVeyor integrationEli Bendersky2020-09-231-12/+0
| | | | We run Windows tests through GitHub actions now
* Update README.rstEli Bendersky2020-09-221-0/+2
|
* Update README.rstEli Bendersky2020-09-221-6/+2
|
* Rename workflow to pycparser-testsEli Bendersky2020-09-221-1/+1
|
* Add multi-OS setup for github actions (#391)Eli Bendersky2020-09-221-1/+3
| | | | | * Test change * Add OS
* Merge branch 'master' of github.com:eliben/pycparserEli Bendersky2020-09-221-2/+2
|\
| * Fix #349: convert to raw strings in lexer tests (#389)hodbn2020-08-181-2/+2
| |
* | Add initial github workflow file for actionsEli Bendersky2020-09-221-0/+26
|/
* Fix issues #378, #379, #385 (#387)Zecong Hu2020-07-184-12/+61
| | | | | | | | | | | | * Fix #385: generate code with nested sizeofs * Fix #378: replace assertion with check Only the assertion inside `_build_function_definition` is replaced. The assertion is not appropriate because there are possible inputs that would trigger the assertion, they're just grammatically incorrect. Thus, it is replaced with a check that raises `ParseError` on failure. * Fix #379: parse struct with nested enum
* Add example of modifying an AST and printing out modified codeEli Bendersky2020-04-151-0/+58
|
* Move code to __main__ blockEli Bendersky2020-04-151-9/+10
|
* Clean up whitespace in generated AST codeEli Bendersky2020-04-152-10/+10
|
* Move internal testing stuff from c-to-c example into utils/internalEli Bendersky2020-04-152-31/+28
|
* Replace define by typedef for typeEli Bendersky2020-03-111-1/+1
|
* Add some "types" to zlib.h (#368)Thomas Nilefalk2020-03-111-0/+31
|
* Update instructions to release. Release 2.20 was pushedrelease_v2.20Eli Bendersky2020-03-042-3/+3
|
* Merge branch 'master' of github.com:eliben/pycparserEli Bendersky2020-03-041-17/+8
|\
| * Update README.rstEli Bendersky2020-03-031-3/+0
| |
| * Move CI indicatorsEli Bendersky2020-03-031-15/+9
| |
* | Update version 2.19 --> 2.20Eli Bendersky2020-03-044-3/+17
|/
* Add travis testing for python 3.7 and 3.8 and remove workaroundEli Bendersky2020-03-031-8/+2
|
* Trim whitespaceEli Bendersky2020-03-031-12/+12
|
* Fix #363 incorrect AST when parsing offsetof (#364)Zecong Hu2020-03-032-2/+25
|
* Update README to mention non-installation of fake headersEli Bendersky2020-03-031-0/+3
| | | | | | Based on #358 by @WasabiFan Fixes #358
* Add unaligned versions of intel vector types (#357)Thom Wiggers2019-12-071-9/+18
|
* Recognize integer multicharacter constants like 'ABCD' (#350)yaroslav-o2019-09-253-5/+15
| | | | | | | | | | | | | Recognize integer multicharacter constants like 'ABCD' The feature I am adding is defined here - 5th case. https://en.cppreference.com/w/c/language/character_constant Also here: 6.4.4.4.10 of C99. Put simply, pycparser thought a statement like this is an error: int a = 'ABCD'; However it is not. It is likely possible to just modify char_const regular expression in c_lexer.py:240 to allow longer characters, but the way it is done in this PR - multicharacter constants are clearly separated. I am also limiting the length of multicharacter const integers to 4 characters - this matches VS compiler behavior (gcc allows any length with a warning) and lets pycparser NOT consider lengthy single-quoted strings as integers - these would be nonsensical anyway.
* Fix slow backtracking when parsing strings (no external deps) (#347)Tyson Andre2019-08-262-8/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix slow backtracking when parsing strings (no external deps) Fixes #61 This uses negative lookaheads to avoid ambiguity in how string should be parsed by the regex. - https://docs.python.org/2/library/re.html#regular-expression-syntax - Previously, if it didn't immediately succeed at parsing an escape sequence such as `\123`, it would have to try `\1`+`23`, `\12` + `3`, and `\123`, which multiplied the time taken by 3 per additional escape sequence. This solves that by only allowing `\123` - The same fix was added for hex escapes. Also fix a test that relied on the incorrect handling of regexes. The implementation documentation says that it intends to allow **decimal** escapes permissively. * WIP debug * Fix ambiguity caused by allowing #path directives Solve this by allowing "\x" when not followed by hex, in the regular string literal. In the previous commits, `\x12` could be parsed both as `\x`+`12` and `\x12`, which caused exponential options for backtracking. * Document changes to lexer, remove debug code * Optimize this for strings
* Move .gitattributes to project root dirEli Bendersky2019-08-262-0/+7
|
* Add .gitattributes file per https://github.com/github/linguist#overridesEli Bendersky2019-08-241-0/+2
| | | | | Label .ppout files as vendored so Github doesn't count them as pycparser's source
* Rename files to prevent Github from thinking this is a Pascal projectEli Bendersky2019-08-234-1/+1
|
* Move benchmarking stuff to its own dirEli Bendersky2019-08-235-2/+26050
|
* Enhance measurement scriptEli Bendersky2019-08-231-7/+28
|
* Add local .vimrcEli Bendersky2019-08-231-0/+8
|
* Add internal utility for benchmarking parsing timeEli Bendersky2019-08-231-0/+15
|
* Fix error transforming an empty switch (#346)Tyson Andre2019-08-212-1/+16
| | | | | | | | | | | | | * Fix error transforming an empty switch The parser would crash on that line for `switch(1) {}` because NoneType is not iterable. Fixes #345 * Add a test of empty switch statements * Address review comments