diff --git a/CppHeaderParser/CppHeaderParser.py b/CppHeaderParser/CppHeaderParser.py index a13ad2e..a07ad6e 100644 --- a/CppHeaderParser/CppHeaderParser.py +++ b/CppHeaderParser/CppHeaderParser.py @@ -1350,7 +1350,8 @@ def resolve_enum_values(self, values): # Remove single quotes from single quoted chars (unless part of some expression if len(a) == 3 and a[0] == "'" and a[2] == "'": a = v["value"] = a[1] - if a.lower().startswith("0x"): + a = i = ord(a) + elif a.lower().startswith("0x"): try: i = a = int(a, 16) except: diff --git a/test/TestSampleClass.h b/test/TestSampleClass.h index 439635c..45efef7 100644 --- a/test/TestSampleClass.h +++ b/test/TestSampleClass.h @@ -73,6 +73,8 @@ namespace Alpha Z_B = 0x2B, Z_C = 'j', Z_D, + Z_E = '9', + Z_F = 9, } Zebra; }; diff --git a/test/test_CppHeaderParser.py b/test/test_CppHeaderParser.py index 46eaaeb..d91edca 100644 --- a/test/test_CppHeaderParser.py +++ b/test/test_CppHeaderParser.py @@ -418,6 +418,8 @@ def test_values(self): {"name": "Z_B", "raw_value": "0x2B", "value": 43}, {"name": "Z_C", "raw_value": "j", "value": 106}, {"name": "Z_D", "value": 107}, + {"name": "Z_E", "raw_value": "9", "value": 57}, + {"name": "Z_F", "value": 9}, ], )
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: