From 24226fc1d0ee263b5eaa0d8a0e7b99d195045330 Mon Sep 17 00:00:00 2001 From: Dustin Spicuzza Date: Thu, 20 Nov 2025 11:03:27 -0500 Subject: [PATCH] Remove nullptr_t as a special token - Doesn't break any of the tests? Probably was just a CppHeaderParser hack - Fixes #130 --- cxxheaderparser/lexer.py | 1 - tests/test_fn.py | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/cxxheaderparser/lexer.py b/cxxheaderparser/lexer.py index 04834c4..c93a35f 100644 --- a/cxxheaderparser/lexer.py +++ b/cxxheaderparser/lexer.py @@ -117,7 +117,6 @@ class PlyLexer: "new", "noexcept", "nullptr", - "nullptr_t", # not a keyword, but makes things easier "operator", "private", "protected", diff --git a/tests/test_fn.py b/tests/test_fn.py index 09f2e34..c13f97d 100644 --- a/tests/test_fn.py +++ b/tests/test_fn.py @@ -1428,3 +1428,36 @@ def test_deleted_function() -> None: ] ) ) + + +def test_nullptr_t() -> None: + content = """ + void f(std::nullptr_t) {} + """ + data = parse_string(content, cleandoc=True) + + assert data == ParsedData( + namespace=NamespaceScope( + functions=[ + Function( + return_type=Type( + typename=PQName(segments=[FundamentalSpecifier(name="void")]) + ), + name=PQName(segments=[NameSpecifier(name="f")]), + parameters=[ + Parameter( + type=Type( + typename=PQName( + segments=[ + NameSpecifier(name="std"), + FundamentalSpecifier(name="nullptr_t"), + ] + ) + ) + ) + ], + has_body=True, + ) + ] + ) + )