• Home
  • Raw
  • Download

Lines Matching +full:expand +full:- +full:brackets

5 # programs.  When called as "pindent -c", it takes a valid Python
6 # program as input and outputs a version augmented with block-closing
7 # comments. When called as "pindent -d", it assumes its input is a
8 # Python program with block-closing comments and outputs a commentless
9 # version. When called as "pindent -r" it assumes its input is a
10 # Python program with block-closing comments but with its indentation
13 # A "block-closing comment" is a comment of the form '# end <keyword>'
16 # be repeated in the block-closing comment as well. Here is an
17 # example of a program fully augmented with block-closing comments:
23 # b = b-1
24 # if b > a: a = a-1
32 # block-closing comment; the same is true for other compound
33 # statements (e.g. try...except). Also note that "short-form" blocks
36 # that indentation is not significant when interpreting block-closing
40 # they yield an identical result). Running first "pindent -c" and
41 # then "pindent -r" on a valid Python program produces a program that
43 # be different). Running "pindent -e" on that output produces a
47 # -s stepsize: set the indentation step size (default 8)
48 # -t tabsize : set the number of spaces a tab character is worth (default 8)
49 # -e : expand TABs into spaces
54 # - comments ending in a backslash will be mistaken for continued lines
55 # - continuations using backslash are always left unchanged
56 # - continuations inside parentheses are not extra indented by -r
57 # but must be indented for -c to work correctly (this breaks
59 # - continued lines inside triple-quoted strings are totally garbled
62 # - On input, a block may also be closed with an "end statement" --
63 # this is a block-closing comment without the '#' sign.
66 # - check syntax based on transitions in 'next' table
67 # - better error reporting
68 # - better error recovery
69 # - check identifier after class/def
72 # - Don't get fooled by comments ending in backslash
73 # - reindent continuation lines indicated by backslash
74 # - handle continuation lines inside parentheses/braces/brackets
75 # - handle triple quoted strings spanning lines
76 # - realign comments
77 # - optionally do much more thorough reformatting, a la C indent
110 r'^(?:\s|\\\n)*(?P<kw>[a-z]+)'
111 r'((?:\s|\\\n)+(?P<id>[a-zA-Z_]\w*))?'
114 r'^(?:\s|\\\n)*#?\s*end\s+(?P<kw>[a-z]+)'
115 r'(\s+(?P<id>[a-zA-Z_]\w*))?'
144 while line[-2:] == '\\\n':
190 self.putline(line, len(stack)-1)
191 kwa, kwb = stack[-1]
192 stack[-1] = kwa, kw
227 if begin_counter - end_counter < 0:
229 elif begin_counter - end_counter > 0:
327 # - xxx_filter(input, output): read and write file objects
328 # - xxx_string(s): take and return string object
329 # - xxx_file(filename): process file in place, return true iff changed
435 usage: pindent (-c|-d|-r) [-s stepsize] [-t tabsize] [-e] [file] ...
436 -c : complete a correctly indented program (add #end directives)
437 -d : delete #end directives
438 -r : reformat a completed program (use #end directives)
439 -s stepsize: indentation step (default %(STEPSIZE)d)
440 -t tabsize : the worth in spaces of a tab (default %(TABSIZE)d)
441 -e : expand TABs into spaces (default OFF)
443 If no files are specified or a single - is given,
448 sys.stderr.write('Error: You can not specify both '+op1+' and -'+op2[0]+' at the same time\n')
467 if o == '-c':
471 elif o == '-d':
475 elif o == '-r':
479 elif o == '-s':
481 elif o == '-t':
483 elif o == '-e':
489 'You must specify -c(omplete), -d(elete) or -r(eformat)\n')
493 if not args or args == ['-']: