Back to index

moin  1.9.0~rc2
Functions | Variables
MoinMoin.support.pygments.lexers._luabuiltins Namespace Reference

Functions

def module_callbacks
def get_newest_version
def get_lua_functions
def get_function_module
def regenerate
def run

Variables

dictionary MODULES

Function Documentation

Definition at line 215 of file _luabuiltins.py.

00215 
00216     def get_function_module(name):
00217         for mod, cb in module_callbacks().iteritems():
00218             if cb(name):
00219                 return mod
00220         if '.' in name:
00221             return name.split('.')[0]
00222         else:
00223             return 'basic'

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 205 of file _luabuiltins.py.

00205 
00206     def get_lua_functions(version):
00207         f = urllib.urlopen('http://www.lua.org/manual/%s/' % version)
00208         r = re.compile(r'^<A HREF="manual.html#pdf-(.+)">\1</A>')
00209         functions = []
00210         for line in f:
00211             m = r.match(line)
00212             if m is not None:
00213                 functions.append(m.groups()[0])
00214         return functions

Here is the caller graph for this function:

Definition at line 197 of file _luabuiltins.py.

00197 
00198     def get_newest_version():
00199         f = urllib.urlopen('http://www.lua.org/manual/')
00200         r = re.compile(r'^<A HREF="(\d\.\d)/">Lua \1</A>')
00201         for line in f:
00202             m = r.match(line)
00203             if m is not None:
00204                 return m.groups()[0]

Here is the caller graph for this function:

Definition at line 158 of file _luabuiltins.py.

00158 
00159     def module_callbacks():
00160         def is_in_coroutine_module(name):
00161             return name.startswith('coroutine.')
00162 
00163         def is_in_modules_module(name):
00164             if name in ['require', 'module'] or name.startswith('package'):
00165                 return True
00166             else:
00167                 return False
00168 
00169         def is_in_string_module(name):
00170             return name.startswith('string.')
00171 
00172         def is_in_table_module(name):
00173             return name.startswith('table.')
00174 
00175         def is_in_math_module(name):
00176             return name.startswith('math')
00177 
00178         def is_in_io_module(name):
00179             return name.startswith('io.') or name.startswith('file:')
00180 
00181         def is_in_os_module(name):
00182             return name.startswith('os.')
00183 
00184         def is_in_debug_module(name):
00185             return name.startswith('debug.')
00186 
00187         return {'coroutine': is_in_coroutine_module,
00188                 'modules': is_in_modules_module,
00189                 'string': is_in_string_module,
00190                 'table': is_in_table_module,
00191                 'math': is_in_math_module,
00192                 'io': is_in_io_module,
00193                 'os': is_in_os_module,
00194                 'debug': is_in_debug_module}
00195 
00196 

Here is the caller graph for this function:

Definition at line 224 of file _luabuiltins.py.

00224 
00225     def regenerate(filename, modules):
00226         f = open(filename)
00227         try:
00228             content = f.read()
00229         finally:
00230             f.close()
00231 
00232         header = content[:content.find('MODULES = {')]
00233         footer = content[content.find("if __name__ == '__main__':"):]
00234 
00235 
00236         f = open(filename, 'w')
00237         f.write(header)
00238         f.write('MODULES = %s\n\n' % pprint.pformat(modules))
00239         f.write(footer)
00240         f.close()

Here is the caller graph for this function:

Definition at line 241 of file _luabuiltins.py.

00241 
00242     def run():
00243         version = get_newest_version()
00244         print '> Downloading function index for Lua %s' % version
00245         functions = get_lua_functions(version)
00246         print '> %d functions found:' % len(functions)
00247 
00248         modules = {}
00249         for full_function_name in functions:
00250             print '>> %s' % full_function_name
00251             m = get_function_module(full_function_name)
00252             modules.setdefault(m, []).append(full_function_name)
00253 
00254         regenerate(__file__, modules)
00255 

Here is the call graph for this function:


Variable Documentation

Definition at line 16 of file _luabuiltins.py.