| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
* Support _Pragma, a C99 alternative to #pragma
See https://gcc.gnu.org/onlinedocs/cpp/Pragmas.html
* Test cases for _Pragma
* Add explanatory comment for _PRAGMA and PPPRAGMA
|
|
|
|
|
| |
* Fix typos
* Revert changes in vendor module
|
|
|
|
|
|
|
|
|
| |
* Fix PEP8 [E101](https://github.com/PyCQA/pycodestyle/blob/2.8.0/docs/intro.rst#error-codes)
* Fix PEP8 [E711](https://github.com/PyCQA/pycodestyle/blob/2.8.0/docs/intro.rst#error-codes)
* Fix E999 (python2)
* Fix PEP8 [F401](https://flake8.pycqa.org/en/4.0.1/user/error-codes.html)
|
|
|
|
|
|
|
| |
* Implement u8, u, and U strings from C11
* Also add u8, u, and U chars from C11 and C23
Co-authored-by: vit9696 <vit9696@users.noreply.github.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Implement _Alignas and _Alignof support with tests
* Improve testing and avoid unnecessary alignas for typedef
* Add more tests
* Drop legacy artifact
* Remove extra _add_declaration_specifier call
* Drop custom equality comparators for now
Co-authored-by: vit9696 <vit9696@users.noreply.github.com>
|
|
|
|
|
|
|
| |
This adds initial implementation for the _Atomic keyword in C11, only focusing
on the use as qualifier (spec section 6.7.3)
Based on #431 by vit9696. Updates #430
|
|
|
|
|
|
|
|
|
|
| |
* Introduce partial C11 support
Implemented _Noreturn, _Static_assert, _Thread_local. Also fixed
tests with preprocessor on macOS.
* Add more tests
Co-authored-by: vit9696 <vit9696@users.noreply.github.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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)
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
|
| |
|
|
|
|
|
| |
- Removed unnecessary whitespace
- Removed old & stale 'if __main__' sections in some of the library files
|
|
|
| |
https://docs.python.org/3/whatsnew/3.6.html#deprecated-python-behavior
|
|
|
|
| |
Replace it by website link; copyright appears in the LICENSE file already, which is sufficient
|
|
|
|
|
| |
This type is not part of the core C99 or C11 standards, but is mentioned
in both documents under "Common extensions".
|
|
|
|
|
| |
By making the first * non-greedy, performance is ~10-15% better; it still
demonstrates pahological backtracking slowness (issue #61).
|
|
|
|
|
| |
The test shows that on a simple lexer level the issue doesn't manifest. It does,
however, manifest if parsing a file.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
| |
- Add lexer and parser tests.
|
|
|
|
| |
'=' added to pppragma_ignore.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|\
| |
| | |
Dollar signs in identifiers
|
| | |
|
|/ |
|
| |
|
|
|
|
| |
columns.
|
|
|
|
| |
distribution and with tests.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
(such as 'int' or typedef_name) by always keeping them in an IdentifierType
node. This allows to correctly report some errors, which fixes issue 60.
Also cleanup some whitespace & formatting issues, and replace deprecated
unittest methods for python3.
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
directives with Windows paths like "..\..\test"
+ added tests
|
|
|
|
| |
- adding tests for _Bool & stdbool
|
|
|
|
|
| |
Also added stdbool.h to fake_libc_includes, and its defines and typedefs
to _fake_defines.h and _fake_typedefs.h.
|
| |
|
|
|
|
| |
This means only Python 2.6 and later is supported in 2.x
|
| |
|
| |
|
|
|