Lines Matching refs:line
11 # It doesn't attempt to deal with line continuations, etc.
12 # so you may want to "join line" on your def statements
36 "Whether we generate simple, single-line quotes for single line comments."
42 "Have we read our first non-comment line yet?"
44 def output_line(self, line=None):
45 if line:
46 self.output_lines.append(line)
50 def output_normal_line(self, line):
51 # flush any comment lines we had stored and output this line.
53 self.output_line(line)
60 for line in self.comment_lines:
61 self.output_line(line)
64 for line in self.trailing_empty_lines:
65 self.output_line(line)
73 for line in self.trailing_empty_lines:
74 self.output_line(line)
79 def extract(line):
80 match = COMMENT_RE.match(line)
87 lines = [extract(line) for line in self.comment_lines]
97 # Add single- or multi-line-string quote
108 for line in lines:
109 if line:
110 self.output_line(indent + line)
118 def queue_comment_line(self, line):
122 self.comment_lines.append(line)
124 def handle_empty_line(self, line):
125 """Handle an empty line.
132 self.trailing_empty_lines.append(line)
134 self.output_normal_line(line)
143 def process_line(self, line_num, line):
144 line = line.rstrip()
145 comment_match = COMMENT_RE.match(line)
146 def_match = CONVERTIBLE_DEF_RE.match(line)
148 # First check if this is a comment line.
151 self.queue_comment_line(line)
153 self.output_line(line)
155 # If not a comment line, then by definition we're done with the comment header.
157 if not line.strip():
158 self.handle_empty_line(line)
165 self.output_line(line)
168 # Can't make a docstring for this line:
169 self.output_normal_line(line)
176 for line in self.output_lines:
177 fp.write(line)