keywords.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 #
00003 # Copyright 2007 Neal Norwitz
00004 # Portions Copyright 2007 Google Inc.
00005 #
00006 # Licensed under the Apache License, Version 2.0 (the "License");
00007 # you may not use this file except in compliance with the License.
00008 # You may obtain a copy of the License at
00009 #
00010 #      http://www.apache.org/licenses/LICENSE-2.0
00011 #
00012 # Unless required by applicable law or agreed to in writing, software
00013 # distributed under the License is distributed on an "AS IS" BASIS,
00014 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015 # See the License for the specific language governing permissions and
00016 # limitations under the License.
00017 
00018 """C++ keywords and helper utilities for determining keywords."""
00019 
00020 __author__ = 'nnorwitz@google.com (Neal Norwitz)'
00021 
00022 
00023 try:
00024     # Python 3.x
00025     import builtins
00026 except ImportError:
00027     # Python 2.x
00028     import __builtin__ as builtins
00029 
00030 
00031 if not hasattr(builtins, 'set'):
00032     # Nominal support for Python 2.3.
00033     from sets import Set as set
00034 
00035 
00036 TYPES = set('bool char int long short double float void wchar_t unsigned signed'.split())
00037 TYPE_MODIFIERS = set('auto register const inline extern static virtual volatile mutable'.split())
00038 ACCESS = set('public protected private friend'.split())
00039 
00040 CASTS = set('static_cast const_cast dynamic_cast reinterpret_cast'.split())
00041 
00042 OTHERS = set('true false asm class namespace using explicit this operator sizeof'.split())
00043 OTHER_TYPES = set('new delete typedef struct union enum typeid typename template'.split())
00044 
00045 CONTROL = set('case switch default if else return goto'.split())
00046 EXCEPTION = set('try catch throw'.split())
00047 LOOP = set('while do for break continue'.split())
00048 
00049 ALL = TYPES | TYPE_MODIFIERS | ACCESS | CASTS | OTHERS | OTHER_TYPES | CONTROL | EXCEPTION | LOOP
00050 
00051 
00052 def IsKeyword(token):
00053     return token in ALL
00054 
00055 def IsBuiltinType(token):
00056     if token in ('virtual', 'inline'):
00057         # These only apply to methods, they can't be types by themselves.
00058         return False
00059     return token in TYPES or token in TYPE_MODIFIERS


ros_opcua_impl_freeopcua
Author(s): Denis Štogl
autogenerated on Sat Jun 8 2019 18:24:56