142 'table.remove', |
142 'table.remove', |
143 'table.sort']} |
143 'table.sort']} |
144 |
144 |
145 if __name__ == '__main__': |
145 if __name__ == '__main__': |
146 import re |
146 import re |
147 import urllib.request, urllib.parse, urllib.error |
147 try: # Py3 |
|
148 import urllib.request as request |
|
149 except (ImportError): |
|
150 import urllib2 as request # __IGNORE_WARNING__ |
|
151 |
148 import pprint |
152 import pprint |
149 |
153 |
150 # you can't generally find out what module a function belongs to if you |
154 # you can't generally find out what module a function belongs to if you |
151 # have only its name. Because of this, here are some callback functions |
155 # have only its name. Because of this, here are some callback functions |
152 # that recognize if a gioven function belongs to a specific module |
156 # that recognize if a gioven function belongs to a specific module |
188 'debug': is_in_debug_module} |
192 'debug': is_in_debug_module} |
189 |
193 |
190 |
194 |
191 |
195 |
192 def get_newest_version(): |
196 def get_newest_version(): |
193 f = urllib.request.urlopen('http://www.lua.org/manual/') |
197 f = request.urlopen('http://www.lua.org/manual/') |
194 r = re.compile(r'^<A HREF="(\d\.\d)/">Lua \1</A>') |
198 r = re.compile(r'^<A HREF="(\d\.\d)/">Lua \1</A>') |
195 for line in f: |
199 for line in f: |
196 m = r.match(line) |
200 m = r.match(line) |
197 if m is not None: |
201 if m is not None: |
198 return m.groups()[0] |
202 return m.groups()[0] |
199 |
203 |
200 def get_lua_functions(version): |
204 def get_lua_functions(version): |
201 f = urllib.request.urlopen('http://www.lua.org/manual/%s/' % version) |
205 f = request.urlopen('http://www.lua.org/manual/%s/' % version) |
202 r = re.compile(r'^<A HREF="manual.html#pdf-(.+)">\1</A>') |
206 r = re.compile(r'^<A HREF="manual.html#pdf-(.+)">\1</A>') |
203 functions = [] |
207 functions = [] |
204 for line in f: |
208 for line in f: |
205 m = r.match(line) |
209 m = r.match(line) |
206 if m is not None: |
210 if m is not None: |