Add support for the __int128 type.
This type is not part of the core C99 or C11 standards, but is mentioned
in both documents under "Common extensions".
diff --git a/pycparser/c_lexer.py b/pycparser/c_lexer.py
index c7443b8..1a15c67 100644
--- a/pycparser/c_lexer.py
+++ b/pycparser/c_lexer.py
@@ -106,7 +106,7 @@
'REGISTER', 'OFFSETOF',
'RESTRICT', 'RETURN', 'SHORT', 'SIGNED', 'SIZEOF', 'STATIC', 'STRUCT',
'SWITCH', 'TYPEDEF', 'UNION', 'UNSIGNED', 'VOID',
- 'VOLATILE', 'WHILE',
+ 'VOLATILE', 'WHILE', '__INT128',
)
keyword_map = {}
diff --git a/pycparser/c_parser.py b/pycparser/c_parser.py
index dc13962..0856dc2 100644
--- a/pycparser/c_parser.py
+++ b/pycparser/c_parser.py
@@ -737,6 +737,7 @@
| _COMPLEX
| SIGNED
| UNSIGNED
+ | __INT128
"""
p[0] = c_ast.IdentifierType([p[1]], coord=self._coord(p.lineno(1)))
diff --git a/tests/test_c_parser.py b/tests/test_c_parser.py
index e32c49d..2bd43d1 100755
--- a/tests/test_c_parser.py
+++ b/tests/test_c_parser.py
@@ -285,6 +285,11 @@
],
['TypeDecl', ['IdentifierType', ['int']]]]])
+ def test_int128(self):
+ self.assertEqual(self.get_decl('__int128 a;'),
+ ['Decl', 'a', ['TypeDecl', ['IdentifierType', ['__int128']]]])
+
+
def test_nested_decls(self): # the fun begins
self.assertEqual(self.get_decl('char** ar2D;'),
['Decl', 'ar2D',