summaryrefslogtreecommitdiff
path: root/pygments/lexers/_luabuiltins.py
diff options
context:
space:
mode:
Diffstat (limited to 'pygments/lexers/_luabuiltins.py')
-rw-r--r--pygments/lexers/_luabuiltins.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/pygments/lexers/_luabuiltins.py b/pygments/lexers/_luabuiltins.py
index fcccd3f5..40037357 100644
--- a/pygments/lexers/_luabuiltins.py
+++ b/pygments/lexers/_luabuiltins.py
@@ -15,6 +15,7 @@
from __future__ import print_function
+
MODULES = {'basic': ['_G',
'_VERSION',
'assert',
@@ -144,7 +145,10 @@ MODULES = {'basic': ['_G',
if __name__ == '__main__':
import re
- import urllib
+ try:
+ from urllib import urlopen
+ except ImportError:
+ from urllib.request import urlopen
import pprint
# you can't generally find out what module a function belongs to if you
@@ -190,7 +194,7 @@ if __name__ == '__main__':
def get_newest_version():
- f = urllib.urlopen('http://www.lua.org/manual/')
+ f = urlopen('http://www.lua.org/manual/')
r = re.compile(r'^<A HREF="(\d\.\d)/">Lua \1</A>')
for line in f:
m = r.match(line)
@@ -198,7 +202,7 @@ if __name__ == '__main__':
return m.groups()[0]
def get_lua_functions(version):
- f = urllib.urlopen('http://www.lua.org/manual/%s/' % version)
+ f = urlopen('http://www.lua.org/manual/%s/' % version)
r = re.compile(r'^<A HREF="manual.html#pdf-(.+)">\1</A>')
functions = []
for line in f:
@@ -208,7 +212,7 @@ if __name__ == '__main__':
return functions
def get_function_module(name):
- for mod, cb in module_callbacks().iteritems():
+ for mod, cb in module_callbacks().items():
if cb(name):
return mod
if '.' in name: