summaryrefslogtreecommitdiff
path: root/pygments/lexers
diff options
context:
space:
mode:
Diffstat (limited to 'pygments/lexers')
-rw-r--r--pygments/lexers/__init__.py4
-rw-r--r--pygments/lexers/_phpbuiltins.py22
-rw-r--r--pygments/lexers/other.py4
-rw-r--r--pygments/lexers/special.py5
-rw-r--r--pygments/lexers/templates.py3
-rw-r--r--pygments/lexers/web.py4
6 files changed, 19 insertions, 23 deletions
diff --git a/pygments/lexers/__init__.py b/pygments/lexers/__init__.py
index 96e68a28..d4f5bd90 100644
--- a/pygments/lexers/__init__.py
+++ b/pygments/lexers/__init__.py
@@ -61,13 +61,13 @@ def get_lexer_for_filename(_fn, **options):
fn = basename(_fn)
for modname, name, _, filenames, _ in LEXERS.itervalues():
for filename in filenames:
- if fnmatch.fnmatch(_fn, filename):
+ if fnmatch.fnmatch(fn, filename):
if name not in _lexer_cache:
_load_lexers(modname)
return _lexer_cache[name](**options)
for cls in find_plugin_lexers():
for filename in cls.filenames:
- if fnmatch.fnmatch(_fn, filename):
+ if fnmatch.fnmatch(fn, filename):
return cls(**options)
raise ValueError('no lexer for filename %r found' % _fn)
diff --git a/pygments/lexers/_phpbuiltins.py b/pygments/lexers/_phpbuiltins.py
index 17522a8b..626bc99b 100644
--- a/pygments/lexers/_phpbuiltins.py
+++ b/pygments/lexers/_phpbuiltins.py
@@ -3327,16 +3327,14 @@ MODULES = {'.NET': ['dotnet_load'],
if __name__ == '__main__':
import pprint
- import sys
- import os
import re
import urllib
_function_re = re.compile('<B\s+CLASS="function"\s*>(.*?)\(\)</B\s*>(?uism)')
def get_php_functions():
- f = urllib.urlopen('http://de.php.net/manual/en/index.functions.php')
- data = f.read()
- f.close()
+ uf = urllib.urlopen('http://de.php.net/manual/en/index.functions.php')
+ data = uf.read()
+ uf.close()
results = set()
for match in _function_re.finditer(data):
fn = match.group(1)
@@ -3347,15 +3345,15 @@ if __name__ == '__main__':
results.sort()
return results
- def get_function_module(function_name):
- fn = function_name.replace('_', '-')
- f = urllib.urlopen('http://de.php.net/manual/en/function.%s.php' % fn)
+ def get_function_module(func_name):
+ fn = func_name.replace('_', '-')
+ uf = urllib.urlopen('http://de.php.net/manual/en/function.%s.php' % fn)
regex = re.compile('<li class="header up">'
'<a href="ref\..*?\.php">([a-zA-Z0-9\s]+)</a></li>')
- for line in f:
- m = regex.search(line)
- if m is not None:
- return m.group(1)
+ for line in uf:
+ match = regex.search(line)
+ if match:
+ return match.group(1)
print '>> Downloading Function Index'
functions = get_php_functions()
diff --git a/pygments/lexers/other.py b/pygments/lexers/other.py
index 8fee48ef..01822fc5 100644
--- a/pygments/lexers/other.py
+++ b/pygments/lexers/other.py
@@ -11,8 +11,8 @@
import re
-from pygments.lexer import Lexer, RegexLexer, include
-from pygments.token import Token, Error, \
+from pygments.lexer import RegexLexer, include
+from pygments.token import Error, \
Text, Comment, Operator, Keyword, Name, String, Number
diff --git a/pygments/lexers/special.py b/pygments/lexers/special.py
index 34e8d88e..e0d26e8c 100644
--- a/pygments/lexers/special.py
+++ b/pygments/lexers/special.py
@@ -12,9 +12,8 @@
import re
import cStringIO
-from pygments.lexer import Lexer, RegexLexer
-from pygments.token import Token, Error, \
- Text, Comment, Operator, Keyword, Name, String, Number
+from pygments.lexer import Lexer
+from pygments.token import Token, Error, Text
__all__ = ['TextLexer', 'RawTokenLexer']
diff --git a/pygments/lexers/templates.py b/pygments/lexers/templates.py
index 641675b9..21956e47 100644
--- a/pygments/lexers/templates.py
+++ b/pygments/lexers/templates.py
@@ -18,8 +18,7 @@ except NameError:
from pygments.lexers.web import \
PhpLexer, HtmlLexer, XmlLexer, JavascriptLexer, CssLexer
from pygments.lexers.agile import PythonLexer
-from pygments.lexer import \
- Lexer, DelegatingLexer, RegexLexer, do_insertions, bygroups, \
+from pygments.lexer import Lexer, DelegatingLexer, RegexLexer, bygroups, \
include, using
from pygments.token import Error, \
Text, Comment, Operator, Keyword, Name, String, Number, Other
diff --git a/pygments/lexers/web.py b/pygments/lexers/web.py
index 8e7f3e01..1328b4ff 100644
--- a/pygments/lexers/web.py
+++ b/pygments/lexers/web.py
@@ -15,7 +15,7 @@ try:
except NameError:
from sets import Set as set
-from pygments.lexer import Lexer, RegexLexer, do_insertions, bygroups, using
+from pygments.lexer import Lexer, RegexLexer, bygroups, using
from pygments.token import \
Text, Comment, Operator, Keyword, Name, String, Number, Other
from pygments.util import get_bool_opt, get_list_opt, looks_like_xml, \
@@ -290,7 +290,7 @@ class PhpLexer(RegexLexer):
for key, value in MODULES.iteritems():
if key not in self.disabledmodules:
self._functions.update(value)
- Lexer.__init__(self, **options)
+ RegexLexer.__init__(self, **options)
def get_tokens_unprocessed(self, text):
stack = ['root']