• Home
  • Raw
  • Download

Lines Matching +full:check +full:- +full:whitespace

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
16 leading and/or trailing whitespace. All of these are optional
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
41 strip leading whitespace from each line before returning it
43 strip trailing whitespace (including line terminator!) from
47 whitespace. (If both lstrip_ws and rstrip_ws are false,
48 then some lines may consist of solely whitespace: these will
51 if a backslash is the last non-newline character on a line
52 after stripping comments and whitespace, join the following line
57 strip leading whitespace from lines that are joined to their
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
94 # sanity check 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 --
184 # strip the comment, strip whitespace before it, and
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] != "\\":
197 # the job of a later step (rstrip_ws) to remove it --
202 eol = (line[-1] == '\n') and '\n' or ''
205 # If all that's left is whitespace, then skip line
206 # *now*, before we try to join it to 'buildup_line' --
222 "end-of-file")
246 # strip whitespace however the client wants (leading and
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."""