]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
doc parse two lines for getting the context
authorAlfredo Deza <adeza@redhat.com>
Fri, 6 Oct 2017 12:57:01 +0000 (08:57 -0400)
committerAlfredo Deza <adeza@redhat.com>
Fri, 6 Oct 2017 13:10:26 +0000 (09:10 -0400)
So that signatures can get parsed when they are split like:

PG::RecoveryState::RepWaitBackfillReserved::react(
  const RemoteReservationCanceled &evt)

Signed-off-by: Alfredo Deza <adeza@redhat.com>
doc/scripts/gen_state_diagram.py

index 94c1f03eee5534d4628747effdd6b69ade4bc93a..a7399bb201c01849269347a7892bf0fbf8098db3 100755 (executable)
@@ -84,14 +84,22 @@ class StateMachineRenderer(object):
             )
 
     def read_input(self, input_lines):
+        previous_line = None
         for line in input_lines:
             self.get_state(line)
             self.get_event(line)
-            self.get_context(line)
-
-    def get_context(self, line):
-        match = re.search(r"(\w+::)*::(?P<tag>\w+)::\w+\(const (?P<event>\w+)",
-                          line)
+            # pass two lines at a time to get the context so that regexes can
+            # match on split signatures
+            self.get_context(line, previous_line)
+            previous_line = line
+
+    def get_context(self, line, previous_line):
+        match = re.search(r"(\w+::)*::(?P<tag>\w+)::\w+\(const (?P<event>\w+)", line)
+        if match is None and previous_line is not None:
+            # it is possible that we need to match on the previous line as well, so join
+            # them to make them one line and try and get this matching
+            joined_line = ' '.join([previous_line, line])
+            match = re.search(r"(\w+::)*::(?P<tag>\w+)::\w+\(\s*const (?P<event>\w+)", joined_line)
         if match is not None:
             self.context.append((match.group('tag'), self.context_depth, match.group('event')))
         if '{' in line: