diff options
author | Even <eventh@gmail.com> | 2011-09-18 15:14:08 +0200 |
---|---|---|
committer | Even <eventh@gmail.com> | 2011-09-18 15:14:08 +0200 |
commit | f08560d1392ff7b12a0829b933dc6db3bbddcfe4 (patch) | |
tree | 8c5d671987c16386a45349ecc07561efd633a770 /pycparser | |
parent | 1ff510dfeaa2958282604a1ace97a352b51286d2 (diff) | |
download | pycparser-f08560d1392ff7b12a0829b933dc6db3bbddcfe4.tar.gz |
Added support for C99 _Bool type.
Also added stdbool.h to fake_libc_includes, and its defines and typedefs
to _fake_defines.h and _fake_typedefs.h.
Diffstat (limited to 'pycparser')
-rw-r--r-- | pycparser/c_lexer.py | 10 | ||||
-rw-r--r-- | pycparser/c_parser.py | 1 |
2 files changed, 8 insertions, 3 deletions
diff --git a/pycparser/c_lexer.py b/pycparser/c_lexer.py index 90b2730..0679aad 100644 --- a/pycparser/c_lexer.py +++ b/pycparser/c_lexer.py @@ -91,11 +91,11 @@ class CLexer(object): ## Reserved keywords ## keywords = ( - 'AUTO', 'BREAK', 'CASE', 'CHAR', 'CONST', 'CONTINUE', - 'DEFAULT', 'DO', 'DOUBLE', 'ELSE', 'ENUM', 'EXTERN', + 'AUTO', '_BOOL', 'BREAK', 'CASE', 'CHAR', 'CONST', 'CONTINUE', + 'DEFAULT', 'DO', 'DOUBLE', 'ELSE', 'ENUM', 'EXTERN', 'FLOAT', 'FOR', 'GOTO', 'IF', 'INLINE', 'INT', 'LONG', 'REGISTER', 'RESTRICT', 'RETURN', 'SHORT', 'SIGNED', 'SIZEOF', 'STATIC', 'STRUCT', - 'SWITCH', 'TYPEDEF', 'UNION', 'UNSIGNED', 'VOID', + 'SWITCH', 'TYPEDEF', 'UNION', 'UNSIGNED', 'VOID', 'VOLATILE', 'WHILE', ) @@ -103,6 +103,10 @@ class CLexer(object): for r in keywords: keyword_map[r.lower()] = r + # Hack as the C99 boolean type is not all lowercase! + keyword_map['_Bool'] = keyword_map['_bool'] + del keyword_map['_bool'] + ## ## All the tokens recognized by the lexer ## diff --git a/pycparser/c_parser.py b/pycparser/c_parser.py index 2bfd29b..9687a66 100644 --- a/pycparser/c_parser.py +++ b/pycparser/c_parser.py @@ -565,6 +565,7 @@ class CParser(PLYParser): def p_type_specifier_1(self, p): """ type_specifier : VOID + | _BOOL | CHAR | SHORT | INT |