6
if isinstance(tok, (list, tuple)):
7
tok = '(%s)' % r'\s*'.join(tok)
9
return r'\s*'.join(tokens)
17
enum = join('enum', colon)
20
struct = join(typedef, 'struct')
22
basic_type = r'(?:void|int|char\s*\*{1,3})'
23
struct_type = r'MPI_(?:Status)'
24
integral_type = r'MPI_(?:Aint|Offset)'
25
opaque_type = r'MPI_(?:Datatype|Request|Op|Info|Group|Errhandler|Comm|Win|File)'
26
any_mpi_type = r'(?:%s|%s|%s)' % (struct_type, integral_type, opaque_type)
28
upper_name = r'MPI_[A-Z0-9_]+'
29
camel_name = r'MPI_[A-Z][a-z0-9_]+'
30
usrfun_name = camel_name + r'_(?:function|fn)'
33
ret_type = r'void|int|double'
36
canylong = join(r'long', r'(?:long)?')
37
canyptr = join(r'\w+', pointer+'?')
39
annotation = r'\#\:\='
40
defval = r'(?:%s)?' % join (annotation, [r'\(?[A-Za-z0-9_\+\-\(\)\*]+\)?'])
42
STRUCT_TYPE = join( struct, [struct_type] , colon, eol)
43
INTEGRAL_TYPE = join( typedef, canylong, [integral_type], eol)
44
OPAQUE_TYPE = join( typedef, canyptr, [opaque_type], eol)
45
FUNCTION_TYPE = join( typedef, [ret_type], [camel_name],
46
lparen, [arg_list], rparen,
49
ENUM_VALUE = join( enum, [upper_name], defval, eol)
50
HANDLE_VALUE = join( [opaque_type], [upper_name], defval, eol)
51
BASICP_VALUE = join( [basic_type, pointer], [upper_name], defval , eol)
52
STRUCTP_VALUE = join( [struct_type, pointer], [upper_name], defval , eol)
53
FUNCTP_VALUE = join( [usrfun_name, pointer], [upper_name], defval , eol)
54
FUNCTION_PROTO = join([ret_type], [camel_name],
55
lparen, [arg_list], rparen,
58
fint_type = r'MPI_Fint'
59
c2f_name = r'MPI_[A-Z][a-z_]+_c2f'
60
f2c_name = r'MPI_[A-Z][a-z_]+_f2c'
62
FINT_TYPE = join( typedef, canylong, [fint_type], eol)
63
FINTP_VALUE = join( [fint_type, pointer], [upper_name], defval , eol)
64
FUNCTION_C2F = join([fint_type], [c2f_name],
65
lparen, [opaque_type], rparen,
67
FUNCTION_F2C = join([opaque_type], [f2c_name],
68
lparen, [fint_type], rparen,
74
all = [key for key in dict(glb) if key.isupper()]
75
for key in all: glb[key] = re.compile(glb[key])