ThirdParty/Pygments/pygments/lexers/_phpbuiltins.py

branch
Py2 comp.
changeset 2669
11a6696ff868
parent 2525
8b507a9a2d40
child 3145
a9de05d4a22f
equal deleted inserted replaced
2607:e5115553185a 2669:11a6696ff868
3711 import os 3711 import os
3712 import pprint 3712 import pprint
3713 import re 3713 import re
3714 import shutil 3714 import shutil
3715 import tarfile 3715 import tarfile
3716 import urllib.request, urllib.parse, urllib.error 3716 try: # Py3
3717 import urllib.request as request
3718 except (ImportError):
3719 import urllib2 as request # __IGNORE_WARNING__
3717 3720
3718 PHP_MANUAL_URL = 'http://us3.php.net/distributions/manual/php_manual_en.tar.gz' 3721 PHP_MANUAL_URL = 'http://us3.php.net/distributions/manual/php_manual_en.tar.gz'
3719 PHP_MANUAL_DIR = './php-chunked-xhtml/' 3722 PHP_MANUAL_DIR = './php-chunked-xhtml/'
3720 PHP_REFERENCE_GLOB = 'ref.*' 3723 PHP_REFERENCE_GLOB = 'ref.*'
3721 PHP_FUNCTION_RE = '<a href="function\..*?\.html">(.*?)</a>' 3724 PHP_FUNCTION_RE = '<a href="function\..*?\.html">(.*?)</a>'
3752 3755
3753 break 3756 break
3754 return modules 3757 return modules
3755 3758
3756 def get_php_references(): 3759 def get_php_references():
3757 download = urllib.request.urlretrieve(PHP_MANUAL_URL) 3760 download = request.urlretrieve(PHP_MANUAL_URL)
3758 tar = tarfile.open(download[0]) 3761 tar = tarfile.open(download[0])
3759 tar.extractall() 3762 tar.extractall()
3760 tar.close() 3763 tar.close()
3761 for file in glob.glob("%s%s" % (PHP_MANUAL_DIR, PHP_REFERENCE_GLOB)): 3764 for file in glob.glob("%s%s" % (PHP_MANUAL_DIR, PHP_REFERENCE_GLOB)):
3762 yield file 3765 yield file

eric ide

mercurial