[pypy-svn] r57861 - in pypy/branch/oo-jit/dotviewer: . test

arigo at codespeak.net arigo at codespeak.net
Fri Sep 5 17:29:46 CEST 2008


Author: arigo
Date: Fri Sep  5 17:29:42 2008
New Revision: 57861

Added:
   pypy/branch/oo-jit/dotviewer/test/test_graphparse.py   (contents, props changed)
Modified:
   pypy/branch/oo-jit/dotviewer/graphparse.py
Log:
A fix in the graph viewer.  A link did not work (the word remained
non-red) if that word only appeared at the beginning of the lines of a
multiline node.



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:29:42 2008
@@ -5,7 +5,9 @@
 import os, sys, re
 import msgstruct
 
-re_nonword = re.compile(r'([^0-9a-zA-Z_.]+)')
+# 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])+)')
 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)
 

Added: pypy/branch/oo-jit/dotviewer/test/test_graphparse.py
==============================================================================
--- (empty file)
+++ pypy/branch/oo-jit/dotviewer/test/test_graphparse.py	Fri Sep  5 17:29:42 2008
@@ -0,0 +1,7 @@
+from dotviewer.graphparse import *
+
+# XXX mostly empty
+
+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']



More information about the Pypy-commit mailing list