cxxheaderparser 1.3.2__tar.gz → 1.3.4__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.
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/PKG-INFO +1 -1
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/cxxheaderparser/lexer.py +2 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/cxxheaderparser/parser.py +23 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/cxxheaderparser/types.py +6 -1
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/cxxheaderparser/version.py +1 -1
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/cxxheaderparser.egg-info/PKG-INFO +1 -1
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/tests/test_abv_template.py +74 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/tests/test_fn.py +55 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/tests/test_template.py +105 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/LICENSE.txt +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/README.md +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/cxxheaderparser/__init__.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/cxxheaderparser/__main__.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/cxxheaderparser/_ply/__init__.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/cxxheaderparser/_ply/lex.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/cxxheaderparser/dump.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/cxxheaderparser/errors.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/cxxheaderparser/gentest.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/cxxheaderparser/options.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/cxxheaderparser/parserstate.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/cxxheaderparser/preprocessor.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/cxxheaderparser/py.typed +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/cxxheaderparser/simple.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/cxxheaderparser/tokfmt.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/cxxheaderparser/visitor.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/cxxheaderparser.egg-info/SOURCES.txt +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/cxxheaderparser.egg-info/dependency_links.txt +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/cxxheaderparser.egg-info/requires.txt +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/cxxheaderparser.egg-info/top_level.txt +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/setup.cfg +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/setup.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/tests/test_attributes.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/tests/test_class.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/tests/test_class_base.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/tests/test_concepts.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/tests/test_doxygen.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/tests/test_enum.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/tests/test_friends.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/tests/test_misc.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/tests/test_namespaces.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/tests/test_numeric_literals.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/tests/test_operators.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/tests/test_preprocessor.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/tests/test_skip.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/tests/test_tokfmt.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/tests/test_typedef.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/tests/test_typefmt.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/tests/test_union.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/tests/test_using.py +0 -0
- {cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/tests/test_var.py +0 -0
|
@@ -718,6 +718,17 @@ class CxxParser:
|
|
|
718
718
|
if dtype:
|
|
719
719
|
args.append(TemplateArgument(dtype, param_pack))
|
|
720
720
|
else:
|
|
721
|
+
# special case for sizeof...(thing)
|
|
722
|
+
if (
|
|
723
|
+
param_pack
|
|
724
|
+
and len(val.tokens) == 1
|
|
725
|
+
and val.tokens[0].value == "sizeof"
|
|
726
|
+
):
|
|
727
|
+
val.tokens.append(Token("...", "ELLIPSIS"))
|
|
728
|
+
tok = self._next_token_must_be("(")
|
|
729
|
+
raw_toks = self._consume_balanced_tokens(tok)
|
|
730
|
+
val.tokens.extend(Token(tok.value, tok.type) for tok in raw_toks)
|
|
731
|
+
|
|
721
732
|
args.append(TemplateArgument(val, param_pack))
|
|
722
733
|
|
|
723
734
|
tok = self._next_token_must_be(",", ">")
|
|
@@ -2371,6 +2382,8 @@ class CxxParser:
|
|
|
2371
2382
|
volatile = True
|
|
2372
2383
|
elif tok_type in _attribute_start:
|
|
2373
2384
|
self._consume_attribute(tok)
|
|
2385
|
+
elif tok_type in ("__inline", "__forceinline"):
|
|
2386
|
+
both["inline"] = tok
|
|
2374
2387
|
else:
|
|
2375
2388
|
break
|
|
2376
2389
|
|
|
@@ -2622,6 +2635,16 @@ class CxxParser:
|
|
|
2622
2635
|
):
|
|
2623
2636
|
return
|
|
2624
2637
|
|
|
2638
|
+
# Check for an abbreviated template return type, promote it
|
|
2639
|
+
if not is_typedef and parsed_type is not None and self.lex.token_if_val("auto"):
|
|
2640
|
+
abv_ret_tmpl = TemplateNonTypeParam(type=parsed_type, param_idx=-1)
|
|
2641
|
+
if template is None:
|
|
2642
|
+
template = TemplateDecl(params=[abv_ret_tmpl])
|
|
2643
|
+
elif isinstance(template, TemplateDecl):
|
|
2644
|
+
template.params.append(abv_ret_tmpl)
|
|
2645
|
+
else:
|
|
2646
|
+
template[-1].params.append(abv_ret_tmpl)
|
|
2647
|
+
|
|
2625
2648
|
var_ok = True
|
|
2626
2649
|
|
|
2627
2650
|
if is_typedef:
|
|
@@ -458,13 +458,18 @@ class TemplateNonTypeParam:
|
|
|
458
458
|
// abbreviated template parameters are converted to this and param_idx is set
|
|
459
459
|
void fn(C auto p)
|
|
460
460
|
~~~~~~
|
|
461
|
+
|
|
462
|
+
// abbreviated template parameters that are return types have param_idx = -1
|
|
463
|
+
C auto fn()
|
|
464
|
+
~~~~~~
|
|
461
465
|
"""
|
|
462
466
|
|
|
463
467
|
type: DecoratedType
|
|
464
468
|
name: typing.Optional[str] = None
|
|
465
469
|
default: typing.Optional[Value] = None
|
|
466
470
|
|
|
467
|
-
#: If this was promoted, the parameter index that this corresponds with
|
|
471
|
+
#: If this was promoted, the parameter index that this corresponds with. Return
|
|
472
|
+
#: types are set to -1
|
|
468
473
|
param_idx: typing.Optional[int] = None
|
|
469
474
|
|
|
470
475
|
#: Contains a ``...``
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# Autogenerated by setup.py
|
|
2
|
-
__version__ = '1.3.
|
|
2
|
+
__version__ = '1.3.4'
|
|
@@ -351,3 +351,77 @@ def test_abv_template_f5() -> None:
|
|
|
351
351
|
]
|
|
352
352
|
)
|
|
353
353
|
)
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
def test_returned_abv_template() -> None:
|
|
357
|
+
content = """
|
|
358
|
+
constexpr std::signed_integral auto FloorDiv(std::signed_integral auto x,
|
|
359
|
+
std::signed_integral auto y);
|
|
360
|
+
"""
|
|
361
|
+
data = parse_string(content, cleandoc=True)
|
|
362
|
+
|
|
363
|
+
assert data == ParsedData(
|
|
364
|
+
namespace=NamespaceScope(
|
|
365
|
+
functions=[
|
|
366
|
+
Function(
|
|
367
|
+
return_type=Type(
|
|
368
|
+
typename=PQName(
|
|
369
|
+
segments=[
|
|
370
|
+
NameSpecifier(name="std"),
|
|
371
|
+
NameSpecifier(name="signed_integral"),
|
|
372
|
+
]
|
|
373
|
+
)
|
|
374
|
+
),
|
|
375
|
+
name=PQName(segments=[NameSpecifier(name="FloorDiv")]),
|
|
376
|
+
parameters=[
|
|
377
|
+
Parameter(
|
|
378
|
+
type=Type(typename=PQName(segments=[AutoSpecifier()])),
|
|
379
|
+
name="x",
|
|
380
|
+
),
|
|
381
|
+
Parameter(
|
|
382
|
+
type=Type(typename=PQName(segments=[AutoSpecifier()])),
|
|
383
|
+
name="y",
|
|
384
|
+
),
|
|
385
|
+
],
|
|
386
|
+
constexpr=True,
|
|
387
|
+
template=TemplateDecl(
|
|
388
|
+
params=[
|
|
389
|
+
TemplateNonTypeParam(
|
|
390
|
+
type=Type(
|
|
391
|
+
typename=PQName(
|
|
392
|
+
segments=[
|
|
393
|
+
NameSpecifier(name="std"),
|
|
394
|
+
NameSpecifier(name="signed_integral"),
|
|
395
|
+
]
|
|
396
|
+
)
|
|
397
|
+
),
|
|
398
|
+
param_idx=-1,
|
|
399
|
+
),
|
|
400
|
+
TemplateNonTypeParam(
|
|
401
|
+
type=Type(
|
|
402
|
+
typename=PQName(
|
|
403
|
+
segments=[
|
|
404
|
+
NameSpecifier(name="std"),
|
|
405
|
+
NameSpecifier(name="signed_integral"),
|
|
406
|
+
]
|
|
407
|
+
)
|
|
408
|
+
),
|
|
409
|
+
param_idx=0,
|
|
410
|
+
),
|
|
411
|
+
TemplateNonTypeParam(
|
|
412
|
+
type=Type(
|
|
413
|
+
typename=PQName(
|
|
414
|
+
segments=[
|
|
415
|
+
NameSpecifier(name="std"),
|
|
416
|
+
NameSpecifier(name="signed_integral"),
|
|
417
|
+
]
|
|
418
|
+
)
|
|
419
|
+
),
|
|
420
|
+
param_idx=1,
|
|
421
|
+
),
|
|
422
|
+
]
|
|
423
|
+
),
|
|
424
|
+
)
|
|
425
|
+
]
|
|
426
|
+
)
|
|
427
|
+
)
|
|
@@ -1258,3 +1258,58 @@ def test_method_trailing_return_with_body() -> None:
|
|
|
1258
1258
|
]
|
|
1259
1259
|
)
|
|
1260
1260
|
)
|
|
1261
|
+
|
|
1262
|
+
|
|
1263
|
+
def test_msvc_inline() -> None:
|
|
1264
|
+
content = """
|
|
1265
|
+
__inline double fn1() {}
|
|
1266
|
+
__forceinline double fn2() {}
|
|
1267
|
+
static __inline double fn3() {}
|
|
1268
|
+
static __forceinline double fn4() {}
|
|
1269
|
+
"""
|
|
1270
|
+
data = parse_string(content, cleandoc=True)
|
|
1271
|
+
|
|
1272
|
+
assert data == ParsedData(
|
|
1273
|
+
namespace=NamespaceScope(
|
|
1274
|
+
functions=[
|
|
1275
|
+
Function(
|
|
1276
|
+
return_type=Type(
|
|
1277
|
+
typename=PQName(segments=[FundamentalSpecifier(name="double")])
|
|
1278
|
+
),
|
|
1279
|
+
name=PQName(segments=[NameSpecifier(name="fn1")]),
|
|
1280
|
+
parameters=[],
|
|
1281
|
+
inline=True,
|
|
1282
|
+
has_body=True,
|
|
1283
|
+
),
|
|
1284
|
+
Function(
|
|
1285
|
+
return_type=Type(
|
|
1286
|
+
typename=PQName(segments=[FundamentalSpecifier(name="double")])
|
|
1287
|
+
),
|
|
1288
|
+
name=PQName(segments=[NameSpecifier(name="fn2")]),
|
|
1289
|
+
parameters=[],
|
|
1290
|
+
inline=True,
|
|
1291
|
+
has_body=True,
|
|
1292
|
+
),
|
|
1293
|
+
Function(
|
|
1294
|
+
return_type=Type(
|
|
1295
|
+
typename=PQName(segments=[FundamentalSpecifier(name="double")])
|
|
1296
|
+
),
|
|
1297
|
+
name=PQName(segments=[NameSpecifier(name="fn3")]),
|
|
1298
|
+
parameters=[],
|
|
1299
|
+
static=True,
|
|
1300
|
+
inline=True,
|
|
1301
|
+
has_body=True,
|
|
1302
|
+
),
|
|
1303
|
+
Function(
|
|
1304
|
+
return_type=Type(
|
|
1305
|
+
typename=PQName(segments=[FundamentalSpecifier(name="double")])
|
|
1306
|
+
),
|
|
1307
|
+
name=PQName(segments=[NameSpecifier(name="fn4")]),
|
|
1308
|
+
parameters=[],
|
|
1309
|
+
static=True,
|
|
1310
|
+
inline=True,
|
|
1311
|
+
has_body=True,
|
|
1312
|
+
),
|
|
1313
|
+
]
|
|
1314
|
+
)
|
|
1315
|
+
)
|
|
@@ -2247,3 +2247,108 @@ def test_template_deduction_guide() -> None:
|
|
|
2247
2247
|
]
|
|
2248
2248
|
)
|
|
2249
2249
|
)
|
|
2250
|
+
|
|
2251
|
+
|
|
2252
|
+
def test_sizeof_pack() -> None:
|
|
2253
|
+
content = """
|
|
2254
|
+
template <std::same_as<int>... OutputIndices>
|
|
2255
|
+
LinearSystem<States, Inputs, sizeof...(OutputIndices)> Slice(OutputIndices... outputIndices);
|
|
2256
|
+
"""
|
|
2257
|
+
data = parse_string(content, cleandoc=True)
|
|
2258
|
+
|
|
2259
|
+
assert data == ParsedData(
|
|
2260
|
+
namespace=NamespaceScope(
|
|
2261
|
+
functions=[
|
|
2262
|
+
Function(
|
|
2263
|
+
return_type=Type(
|
|
2264
|
+
typename=PQName(
|
|
2265
|
+
segments=[
|
|
2266
|
+
NameSpecifier(
|
|
2267
|
+
name="LinearSystem",
|
|
2268
|
+
specialization=TemplateSpecialization(
|
|
2269
|
+
args=[
|
|
2270
|
+
TemplateArgument(
|
|
2271
|
+
arg=Type(
|
|
2272
|
+
typename=PQName(
|
|
2273
|
+
segments=[
|
|
2274
|
+
NameSpecifier(name="States")
|
|
2275
|
+
]
|
|
2276
|
+
)
|
|
2277
|
+
)
|
|
2278
|
+
),
|
|
2279
|
+
TemplateArgument(
|
|
2280
|
+
arg=Type(
|
|
2281
|
+
typename=PQName(
|
|
2282
|
+
segments=[
|
|
2283
|
+
NameSpecifier(name="Inputs")
|
|
2284
|
+
]
|
|
2285
|
+
)
|
|
2286
|
+
)
|
|
2287
|
+
),
|
|
2288
|
+
TemplateArgument(
|
|
2289
|
+
arg=Value(
|
|
2290
|
+
tokens=[
|
|
2291
|
+
Token(value="sizeof"),
|
|
2292
|
+
Token(value="..."),
|
|
2293
|
+
Token(value="("),
|
|
2294
|
+
Token(value="OutputIndices"),
|
|
2295
|
+
Token(value=")"),
|
|
2296
|
+
]
|
|
2297
|
+
),
|
|
2298
|
+
param_pack=True,
|
|
2299
|
+
),
|
|
2300
|
+
]
|
|
2301
|
+
),
|
|
2302
|
+
)
|
|
2303
|
+
]
|
|
2304
|
+
)
|
|
2305
|
+
),
|
|
2306
|
+
name=PQName(segments=[NameSpecifier(name="Slice")]),
|
|
2307
|
+
parameters=[
|
|
2308
|
+
Parameter(
|
|
2309
|
+
type=Type(
|
|
2310
|
+
typename=PQName(
|
|
2311
|
+
segments=[NameSpecifier(name="OutputIndices")]
|
|
2312
|
+
)
|
|
2313
|
+
),
|
|
2314
|
+
name="outputIndices",
|
|
2315
|
+
param_pack=True,
|
|
2316
|
+
)
|
|
2317
|
+
],
|
|
2318
|
+
template=TemplateDecl(
|
|
2319
|
+
params=[
|
|
2320
|
+
TemplateNonTypeParam(
|
|
2321
|
+
type=Type(
|
|
2322
|
+
typename=PQName(
|
|
2323
|
+
segments=[
|
|
2324
|
+
NameSpecifier(name="std"),
|
|
2325
|
+
NameSpecifier(
|
|
2326
|
+
name="same_as",
|
|
2327
|
+
specialization=TemplateSpecialization(
|
|
2328
|
+
args=[
|
|
2329
|
+
TemplateArgument(
|
|
2330
|
+
arg=Type(
|
|
2331
|
+
typename=PQName(
|
|
2332
|
+
segments=[
|
|
2333
|
+
FundamentalSpecifier(
|
|
2334
|
+
name="int"
|
|
2335
|
+
)
|
|
2336
|
+
]
|
|
2337
|
+
)
|
|
2338
|
+
)
|
|
2339
|
+
)
|
|
2340
|
+
]
|
|
2341
|
+
),
|
|
2342
|
+
),
|
|
2343
|
+
]
|
|
2344
|
+
)
|
|
2345
|
+
),
|
|
2346
|
+
name="OutputIndices",
|
|
2347
|
+
param_pack=True,
|
|
2348
|
+
)
|
|
2349
|
+
]
|
|
2350
|
+
),
|
|
2351
|
+
)
|
|
2352
|
+
]
|
|
2353
|
+
)
|
|
2354
|
+
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cxxheaderparser-1.3.2 → cxxheaderparser-1.3.4}/cxxheaderparser.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|