aboutsummaryrefslogtreecommitdiff
path: root/pycparser/c_parser.py
AgeCommit message (Collapse)Author
2020-03-03Fix #363 incorrect AST when parsing offsetof (#364)Zecong Hu
2019-09-25Recognize integer multicharacter constants like 'ABCD' (#350)yaroslav-o
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.
2019-06-01Fix issue #314: Failed parsing unnamed function parameters with array dim ↵Saullo Carvalho Castelo Branco
qualifiers (#327) Fixes #314
2019-05-09Followup on #326 - simplify building up type stringEli Bendersky
2019-05-09Fix issue #324: u/l constant integer suffix (#326)Kevin
2019-03-06Fix crash when file starts with a semicolon (#310)Simon Lindholm
2018-08-31Correct Parsing of Floating Point Literals, issue #253 (#277)Robbert Harms
* Corrects the type attribute of a constant node when parsing doubles. This sets the type attribute to either 'float', 'long double' or 'double' depending on if 'f|F', 'l|L' or '' is specified at the end of the constant definition. * Add tests for previous changes.
2018-06-26Use https:// for all project links where available (#267)Jon Dufresne
2018-04-27Add support for empty struct (#66) (#254)ldore
2018-03-03Fix #235: Pragma displacing real statements (#236)dbluhm
* Fix #235: Pragma displacing real statements
2017-11-22Minor cleanupsEli Bendersky
- Removed unnecessary whitespace - Removed old & stale 'if __main__' sections in some of the library files
2017-11-22Add support for #pragma in struct_declaration (Issue #221). (#222)ldore
2017-03-10Add column support in c_parser (#178)serpilliere
2017-02-22Fix parsing TYPEIDs in declarators (#169)Nate Bogdanowicz
* Remove `init_declarator_list` workarounds * Remove `struct_declaration` workaround * Remove `declarator` pointer workaround * Add `@parameterized` decorator for parser rules * Rename `declarator` productions to `id_declarator` in preparation of adding `typeid_declarator` * Use `id_declarator` in function definitions * Add `typeid_declarator` and allow it as a `declarator` * Create separate production for `type_specifier_no_typeid` * Allow specifiers to be appended (useful for left-recursive lists) * Change `specifier_qualifier_list` to be left-recursive and require at least one `type specifier` * Change `declaration_specifiers` to require one `type_specifier` and disallow `typeid`s once we've seen a `type_specifier` * Allow `decl_body` to omit a `type_specifier` if `init_declarator` doesn't start with a TYPEID * Add `typeid_noparen_declarator` for use in `parameter_declaration`s * Add test for multi-declarator declaration using a typedef name * Move test into a more appropriate function and add another test * Expand UnaryOp in `expand_init()` * Add test for redefining name in the middle of a declaration * Added info on the `append` parameter. * Move rule template processing to a class constructor * Auto-remove template methods and remove leading underscores * Use xxx/yyy instead of XXX/YYY for better readability * Add more documentation of the templating functions * Add test for correct handling of ambiguity in parameter declarations * Don't test incremental generation of declarators yet
2017-02-02Revert "Add argument to CParser.__init__ for overriding the yacc start ↵Eli Bendersky
symbol. (#159)" This reverts commit 44137334bac69df72c6378fa84931006179d8bdf.
2017-02-02Remove Copyright from every source fileEli Bendersky
Replace it by website link; copyright appears in the LICENSE file already, which is sufficient
2017-01-31A bit of internal cleanupEli Bendersky
2017-01-15Add argument to CParser.__init__ for overriding the yacc start symbol. (#159)Manuel Jacob
* Add argument to CParser.__init__ for overriding the yacc start symbol. * Add a test for the new 'start' argument of CParser.__init__. * Add documentation for the new 'start' argument of CParser.__init__.
2017-01-12Add support for the __int128 type.Manuel Jacob
This type is not part of the core C99 or C11 standards, but is mentioned in both documents under "Common extensions".
2016-10-11Issue #116: Fix coord assignment to compound statementsEli Bendersky
2016-10-11Issue #116: Fix line number assignment to EmptyStatementEli Bendersky
2016-09-09Fix eliben/pycparser#87 : offsetof() support is incompleteksero
2016-08-16report filename if error is "at end of input"Julian Hammer
2016-07-25Allow user to decide which lexer the parser uses.Erik Soma
2016-03-19Fix parsing of extra semi-colons inside structure declarations.Eli Bendersky
Fixes #117
2015-12-15fixed #107 "No coord for Prgama Node"Julian Hammer
2015-10-20Add support for #pragmaJulian Hammer
Preprocessor pragmas and their arguments are tokenized (as PPPRAGMA and PPPRAGMASTR) and included in the AST as a pppragma directive with the argument as value. If no argument was given the string will be empty. Unit test of the lexer, parser and generator have been modified and added accordingly. The previous behavior, that #pragma lines would be ignored, is henceforth obsolete.
2015-06-09Added taboutputdir parameter to control outputdir for tab filesShai Berger
2015-05-10Various cosmetic updates to documentationEli Bendersky
2015-05-10Adding support for empty initializer lists.Eli Bendersky
The idea comes from #79 but the implementation is somewhat different.
2015-05-09Adding support for offsetof()Eli Bendersky
2015-04-20Fix parsing order of nested PtrDeclsEli Bendersky
Closes #68
2015-04-20Fix parsing of array declsEli Bendersky
After qualifiers were added, some problems seeped in assigning dimensions properly.
2015-04-20Allow binary constants (e.g.: 0b01010)Konstanty Bialkowski
- Add lexer and parser tests.
2015-04-18Decrease memory usage of pycparser by using __slots__ in AST nodes.Eli Bendersky
In general, there's no need to dynamically adjust the attributes of AST nodes. So __slots__ seems suitable. This reduces the memory usage of the test case reported in issue #72 from 21MB to 17.5MB and should reduce the amount of space consumed by AST nodes in general.
2015-01-11Align array dimension grammar with the C standard.necase
The pycparser grammar for direct-declarators diverged with the C standard, which permits const, volatile, restrict, and static to be modifiers in the array dimension. The relevant grammar can be found in section 6.7.5. The old p_direct_declarator_3 was split into two rules, and the remaining p_direct_declarator rules were renumbered, preserving precedence. So p_direct_declarator_3 now matches array declarations with optional type qualifiers or assignment expressions; p_direct_declarator_4 matches declarations with the static keyword; p_direct_declarator_5 matches the variable-length array declarations; and p_direct_declarator_6 matches declarations with parentheses.
2014-03-15Fix issue #27: handle unified wstring literals properlyEli Bendersky
2014-03-15Fix issue #28: coord for 'for' loopsEli Bendersky
2014-01-25Fuller support for qualifiers in array dimensions.Eli Bendersky
Added a field to the ArrayDecl node and modified tests
2014-01-25Add support for arr[const 10] in function declarations too;Eli Bendersky
and move tests around.
2014-01-22allow "static" in array parameters (GH issue #21)Robin Martinjak
2013-07-24Fix sys.path inclusion order in _build_tables.py (GH issue #12),Eli Bendersky
and some comment fixes.
2013-07-13Remember last_token in the lexer, instead of using tokenfuncEli Bendersky
2013-07-13Cosmetic changes & commentsEli Bendersky
2013-07-11Support typedef names redeclared to identifiers in inner scopesSye van der Veen
2013-06-12Some cleanupsEli Bendersky
2013-06-12Cleanup after pull request #2Eli Bendersky
2013-06-10Functions that don't have explicit return types are assumed to return intSye van der Veen
2013-01-16Fix comment and trim trailing whitespaceEli Bendersky
2012-12-25Issue #83: Distinguish initializer lists from expression listsEli Bendersky