• Home
  • Raw
  • Download

Lines Matching +full:preserve +full:- +full:comments

4 that (optionally) takes care of stripping comments, ignoring blank
11 """Provides a file-like object that takes care of all the things you
13 line-by-line syntax: strip comments (as long as "#" is your
22 implementing line-at-a-time lookahead.
38 strip from "#" to end-of-line, as well as any whitespace
39 leading up to the "#" -- unless it is escaped by a backslash
46 skip lines that are empty *after* stripping comments and
51 if a backslash is the last non-newline character on a line
52 after stripping comments and whitespace, join the following line
65 None for end-of-file: an empty string might just be a blank line (or
66 an all-whitespace line), if 'rstrip_ws' is true but 'skip_blanks' is
80 (a string) and 'file' (a file-like object) must be supplied.
86 # set values for all options -- either from client option hash
133 outmsg.append("lines %d-%d: " % tuple(line))
146 whole range, eg. "lines 3-5". If 'line' supplied, it overrides
159 line(s) just read. Returns None on end-of-file, since the empty
163 # one. (We don't actually buffer read-ahead data -- lines only
167 line = self.linebuf[-1]
168 del self.linebuf[-1]
183 # is not preceded by "\", then it starts a comment --
190 if pos == -1: # no "#" -- no comments
193 # It's definitely a comment -- either "#" is the first
195 elif pos == 0 or line[pos-1] != "\\":
196 # Have to preserve the trailing newline, because it's
197 # the job of a later step (rstrip_ws) to remove it --
198 # and if rstrip_ws is false, we'd better preserve it!
202 eol = (line[-1] == '\n') and '\n' or ''
206 # *now*, before we try to join it to 'buildup_line' --
222 "end-of-file")
261 if line[-1] == '\\':
262 buildup_line = line[:-1]
265 if line[-2:] == '\\\n':
266 buildup_line = line[0:-2] + '\n'
285 a parser with line-at-a-time lookahead."""