Age | Commit message (Collapse) | Author |
|
|
|
Based on #358 by @WasabiFan
Fixes #358
|
|
|
|
qt-qpr1-dev-plus-aosp-without-vendor@5915889 into stage-aosp-master am: 6bf3c94558
am: 62a6e52515 -s ours
am skip reason: subject contains skip directive
Change-Id: I98dc15debec7844b7b6550010980765e336b21d7
|
|
stage-aosp-master
am: 6bf3c94558
Change-Id: I29115739b2839b7865a75ca935ef3c846d1f7ef4
|
|
stage-aosp-master
Bug: 142003500
Change-Id: I5d2934eed774d0ffe2cc9a7c1773961340aca526
|
|
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
|
|
|
|
Label .ppout files as vendored so Github doesn't count them as pycparser's
source
|
|
|
|
|
|
|
|
|
|
|
|
* 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
|
|
|
|
|
|
af3e1e9790 am: 8b0f52e4cb
am: 12b20d0787
Change-Id: If41dde5355542f8b63f1e363b54484bac0b25a59
|
|
af3e1e9790
am: 8b0f52e4cb
Change-Id: I5883921ef44f56a0463fad538d23443b69ab4a0f
|
|
am: af3e1e9790
Change-Id: I39486cb47d082f709dc0f3308406639f2e1298ad
|
|
am: 0746c13d37
Change-Id: I871cfe38c67672b9dd4ae694c2eebc18180e4ed7
|
|
am: 290613ceed
Change-Id: I599c897eff1421493751d71ccfba0fc537408ee1
|
|
Bug: 124250384
Test: atest
Change-Id: I7135bac19aec185cb07e74d05eb64f93c1b26d02
|
|
|
|
return type (#329)
|
|
qualifiers (#327)
Fixes #314
|
|
am: ec6c09ea7b
am: e044741af8
Change-Id: I5713231903617d1a1e1c1f477c8d078a067f3ba1
|
|
am: ec6c09ea7b
Change-Id: I9a69535d2d8a1629db45ecba980aa80d9e1a99cf
|
|
am: 9041297f75
Change-Id: I41ef71c9e466888a237a946f13d4cbc793a40e11
|
|
am: 7f94b85334
Change-Id: I5a1201ca2543ef884ac1d48f8023b6f6269ab44c
|
|
This way tools/external_updater can check updates for this library.
Test: None
Change-Id: Ieb2493ca41ffeac0fd6e99e75f64d87393bf3d51
|
|
|
|
|
|
|
|
am: 0b4e910397
Change-Id: I453cf9aee8e842342b133b86da3f91fad406b0ed
|
|
am: 43ffef5500
Change-Id: Ifa9b8b8f1187a75e8fec943d4275c20454dc4761
|
|
am: 2e2b43f3cc
Change-Id: I1d8f0a6e3dd635aca613fcd6177478ccf74b89c9
|
|
Restricted environments like embeddable python do not include the
current working directory on startup.
|
|
* Add visit_PtrDecl to generate ptr types correctly
Also removed code duplication from visit_ArrayDecl and visit_TypeDecl by calling _generate_type instead, without emitting the declname.
Added tests for ptr type generation
* Truncate lines longer than 80 characters
per https://github.com/eliben/pycparser/pull/315/files#r269553083
|
|
Merge commit 'caa4c11ebb99ed5cf854dc6342b5352d5ff52686' into import
Bug: 122778810
Test: None
Change-Id: Idd3ca2e0360d396d70f078b3fdf93fcee1f652f9
|
|
* Fix array type generation (#312)
Also added dim_quals handling to _generate_type
Exmaple:
>>> ast = parser.parse('int g(const int a[const 20]){}')
>>> gen.visit(ast.ext[0].decl.type.args.params[0])
'const int a[const 20]'
>>> gen.visit(ast.ext[0].decl.type.args.params[0].type)
'int[const 20]'
* Added TypeDecl generation. Added tests
|
|
|
|
|
|
|
|
|
|
|
|
Fixes #308
|
|
|
|
function. (#295)"
This reverts commit 1083b55c64d6235b00f40070e452b9b2605b23da.
encoding is not portable across the list of supported Python versions
See #296
|