Merge pull request #118 from gareins/master

Refreshing reserved keywords
This commit is contained in:
Lev Walkin 2017-03-26 05:08:58 -07:00 committed by GitHub
commit e0a303922e
1 changed files with 20 additions and 16 deletions

View File

@ -5,24 +5,28 @@
#include <asn1fix_export.h> /* other exportable stuff from libasn1fix */
/*
* Checks that the given string is not a reserved C/C++ keyword.
* ISO/IEC 9899:1999 (C99), A.1.2
* Checks that the given string is not a reserved C/C++ keyword [1],[2].
* _* keywords not included, since asn1 identifiers cannot begin with hyphen [3]
* [1] ISO/IEC 9899:2011 (C11), 6.4.1
* [2] ISO/IEC 14882:2014 (C++14), 2.12
* [3] ISO/IEC 8824-1:2003 (asn1) 11.3
*/
static char *res_kwd[] = {
"auto", "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", "volatile", "while",
"_Bool", "_Complex", "_Imaginary",
/* C++ */
"class", "explicit", "bool", "mutable",
"template", "typeid", "typename", "and", "and_eq",
"or", "or_eq", "xor", "xor_eq", "not", "not_eq",
"bitor", "compl", "bitand",
"const_cast", "dynamic_cast", "reinterpret_cast",
"static_cast", "true", "false", "namespace", "using",
"throw", "try", "catch"
/* C */
"auto", "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", "volatile", "while",
/* C++ */
"alignas", "alignof", "and", "and_eq", "asm", "bitand", "bitor", "bool",
"catch", "char16_t", "char32_t", "class", "compl", "const_cast",
"constexpr", "decltype", "delete", "delete", "dynamic_cast",
"explicit", "export", "false", "friend", "mutable", "namespace", "new",
"noexcept", "not", "not_eq", "nullptr", "operator", "or", "or_eq",
"private", "protected", "public", "reinterpret_cast", "static_assert",
"static_cast", "template", "this", "thread_local", "throw", "true", "try",
"typeid", "typename", "using", "virtual", "wchar_t", "xor", "xor_eq"
};
static int
reserved_keyword(const char *str) {