get_arg_name: fixed continuation line processing bug
In addition to checking the indentation, check for the continuation
character ("\") to determine that a continuation line is being
processed.
Change-Id: Ieb21391674b19de9324e3a1c337db79b3e44f9fe
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/gen_print.py b/lib/gen_print.py
index 081e8f9..59eeea6 100755
--- a/lib/gen_print.py
+++ b/lib/gen_print.py
@@ -365,14 +365,15 @@
break
if start_line_ix != 0:
# Check to see whether the start line is a continuation of the prior
- # line?
- line_indent = get_line_indent(source_lines[start_line_ix - 1])
- if line_indent < start_indent:
+ # line.
+ prior_line = source_lines[start_line_ix - 1]
+ prior_line_stripped = re.sub(r"[ ]*\\([\r\n]$)", " \\1", prior_line)
+ prior_line_indent = get_line_indent(prior_line)
+ if prior_line != prior_line_stripped and\
+ prior_line_indent < start_indent:
start_line_ix -= 1
- # Remove the backslash (continuation char).
- source_lines[start_line_ix] = re.sub(r"[ ]*\\([\r\n]$)",
- " \\1",
- source_lines[start_line_ix])
+ # Remove the backslash (continuation char) from prior line.
+ source_lines[start_line_ix] = prior_line_stripped
# Join the start line through the end line into a composite line.
composite_line = ''.join(map(str.strip,