summaryrefslogtreecommitdiff
path: root/pygments/util.py
diff options
context:
space:
mode:
authorTim Hatch <tim@timhatch.com>2014-10-03 23:35:29 -0700
committerTim Hatch <tim@timhatch.com>2014-10-03 23:35:29 -0700
commit583750890b845f4f8537eee5feb1f77c957dda38 (patch)
treecc15232583b5f9552fba99722c6e8f9a227004ef /pygments/util.py
parentdffb41a91d5e948228dabb98c9707d50624c1bd8 (diff)
downloadpygments-583750890b845f4f8537eee5feb1f77c957dda38.tar.gz
Move specialcasing of words() to any subclass of Future
The idea here is that plugins might want to provide some other optimization we haven't dreamed up yet, and to do so this way means they don't need to change with RegexLexerMeta (and it will be easier to support in regexlint).
Diffstat (limited to 'pygments/util.py')
-rw-r--r--pygments/util.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/pygments/util.py b/pygments/util.py
index 3a1c0947..6f0c4148 100644
--- a/pygments/util.py
+++ b/pygments/util.py
@@ -276,6 +276,18 @@ def format_lines(var_name, seq, raw=False, indent_level=0):
lines.append(base_indent + ')')
return '\n'.join(lines)
+
+class Future(object):
+ """
+ Generic class to defer some work.
+
+ Handled specially in RegexLexerMeta, to support regex string construction at
+ first use.
+ """
+ def get(self):
+ raise NotImplementedError
+
+
# Python 2/3 compatibility
if sys.version_info < (3, 0):