aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Bendersky <eliben@users.noreply.github.com>2017-01-13 05:16:54 -0800
committerGitHub <noreply@github.com>2017-01-13 05:16:54 -0800
commit7c4d5c4a400365f9e61a9aae14af6e128ab1e4dc (patch)
tree9b36b271aa7a8707a193359504bb30dc240c688e
parentf8e569dc6bd8abf9393230615b006650dce3cff5 (diff)
parent0a15d7dbc4b25a65c68de7038bf4289b5c8a7e12 (diff)
downloadpycparser-7c4d5c4a400365f9e61a9aae14af6e128ab1e4dc.tar.gz
Merge pull request #158 from manueljacob/int128
Add support for the __int128 type.
-rw-r--r--pycparser/c_lexer.py2
-rw-r--r--pycparser/c_parser.py1
-rwxr-xr-xtests/test_c_parser.py5
3 files changed, 7 insertions, 1 deletions
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 @@ class CLexer(object):
'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 @@ class CParser(PLYParser):
| _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 @@ class TestCParser_fundamentals(TestCParser_base):
],
['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',