[pypy-svn] r57862 - in pypy/branch/oo-jit/dotviewer: . test
arigo at codespeak.net
arigo at codespeak.net
Fri Sep 5 17:32:00 CEST 2008
Author: arigo
Date: Fri Sep 5 17:31:59 2008
New Revision: 57862
Modified:
pypy/branch/oo-jit/dotviewer/graphparse.py
pypy/branch/oo-jit/dotviewer/test/test_graphparse.py
Log:
Tweak the regexp.
Modified: pypy/branch/oo-jit/dotviewer/graphparse.py
==============================================================================
--- pypy/branch/oo-jit/dotviewer/graphparse.py (original)
+++ pypy/branch/oo-jit/dotviewer/graphparse.py Fri Sep 5 17:31:59 2008
@@ -5,9 +5,9 @@
import os, sys, re
import msgstruct
-# a "nonword" is a separator between words. A sequence of '\' and a letter
-# is considered as a separator too.
-re_nonword = re.compile(r'((?:[^0-9a-zA-Z_.\\]|\\[a-z])+)')
+# a "nonword" is a separator between words. A sequence of '\' followed by
+# any character is considered as a single separator too.
+re_nonword = re.compile(r'((?:[^0-9a-zA-Z_.\\]|\\.)+)')
re_plain = re.compile(r'graph [-0-9.]+ [-0-9.]+ [-0-9.]+$', re.MULTILINE)
re_digraph = re.compile(r'\b(graph|digraph)\b', re.IGNORECASE)
Modified: pypy/branch/oo-jit/dotviewer/test/test_graphparse.py
==============================================================================
--- pypy/branch/oo-jit/dotviewer/test/test_graphparse.py (original)
+++ pypy/branch/oo-jit/dotviewer/test/test_graphparse.py Fri Sep 5 17:31:59 2008
@@ -5,3 +5,5 @@
def test_re_nonword():
words = [s for s in re_nonword.split('abc() def2 \\lghi jkl\\l') if s]
assert words == ['abc', '() ', 'def2', ' \\l', 'ghi', ' ', 'jkl', '\\l']
+ words = [s for s in re_nonword.split('abc\\\\def') if s]
+ assert words == ['abc', '\\\\', 'def']
More information about the Pypy-commit
mailing list