From dd41f7dde1d8d68439351495ceef0ccc439bfe6a Mon Sep 17 00:00:00 2001 From: Courtney Cavin Date: Mon, 8 Feb 2021 22:32:05 -0800 Subject: [PATCH] Properly handle tokenization of templated types Fixes an issue where T> would result in a final token of '>>' instead of '>'. --- pybindgen/typehandlers/ctypeparser/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pybindgen/typehandlers/ctypeparser/__init__.py b/pybindgen/typehandlers/ctypeparser/__init__.py index e54fc7a..c46931b 100644 --- a/pybindgen/typehandlers/ctypeparser/__init__.py +++ b/pybindgen/typehandlers/ctypeparser/__init__.py @@ -133,6 +133,10 @@ def _parse_type_recursive(tokens): if token.name.startswith('::'): token.name = token.name[2:] if token.token_type == tokenizer.SYNTAX: + if token.name in [ '>>' ]: + tokens.insert(0, tokenizer.Token(tokenizer.SYNTAX, token.name[0], None, None)) + tokens.insert(0, tokenizer.Token(tokenizer.SYNTAX, token.name[0], None, None)) + continue if token.name in [',', '>', ')']: ctype.reorder_modifiers() return ctype, token