summaryrefslogtreecommitdiff
path: root/pygments/unistring.py
diff options
context:
space:
mode:
authorTim Hatch <tim@timhatch.com>2012-08-27 00:30:35 -0700
committerTim Hatch <tim@timhatch.com>2012-08-27 00:30:35 -0700
commit08ad16c5ad5e80dfddd7ae81e368227e6bb6b989 (patch)
tree241ddb7a63077090db41462691995b459d3bc807 /pygments/unistring.py
parent33e67db7ac05825a5b873104d900958b8c55de06 (diff)
downloadpygments-08ad16c5ad5e80dfddd7ae81e368227e6bb6b989.tar.gz
Centralize regex metachar escaping, since the surrogate support breaks
one-parsed-char per unicode codepoint already.
Diffstat (limited to 'pygments/unistring.py')
-rw-r--r--pygments/unistring.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/pygments/unistring.py b/pygments/unistring.py
index 2b99f1f0..b6f53e89 100644
--- a/pygments/unistring.py
+++ b/pygments/unistring.py
@@ -114,8 +114,8 @@ if __name__ == '__main__':
# Hack to avoid combining this combining with the preceeding high
# surrogate, 0xdbff, when doing a repr.
c = u'\\' + c
- elif ord(c) in (0x2d, 0x5c):
- # Escape backslash itself and dash.
+ elif ord(c) in (0x2d, 0x5b, 0x5c, 0x5d):
+ # Escape regex metachars.
c = u'\\' + c
categories.setdefault(cat, []).append(c)