Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #62975

Re: Searching online "indent"

From Etienne <e.e.f.prudhomme@gmail.com>
Newsgroups comp.lang.c
Subject Re: Searching online "indent"
Date 2015-06-04 14:22 -0400
Organization A noiseless patient Spider
Message-ID <20150604142255.274b17a0ff4a4f3e7ad765c5@gmail.com> (permalink)
References <indent-20150604033951@ram.dialup.fu-berlin.de> <47ee2508-4b6a-427b-8406-af6e4048d97d@googlegroups.com>

Show all headers | View raw


On Thu, 4 Jun 2015 10:01:33 -0700 (PDT)
David Kleinecke <dkleinecke@gmail.com> wrote:

> The lines all run together problem is solved by replacing each ';' 
> by ";\n" and fixing up the places where this goes wring. That's a
> simple "replace all" in any editor.

   Correct me if I'm wrong, but  it needs something more than search &
replace if you've  got no indentation of blocks. You'll  need at least
regex  because it's  impossible  to say  if something  is  in a  block
without conditions.

   Search & replace could be good to change the indentation style, but
it can't say if those lines:

  |if(condition) {
  |    char foo[] = "bar";
  |    int  lenght = strlen(foo);
  |    int  i;
  |    for(i=0; i<length; i++) {
->|    instruction;
->|    instruction;
->|}
  |}

are inside a block.

   By the way,  why someone would format their code  in only one line?

-- 
Etienne

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Searching online "indent" David Kleinecke <dkleinecke@gmail.com> - 2015-06-04 10:01 -0700
  Re: Searching online "indent" Etienne <e.e.f.prudhomme@gmail.com> - 2015-06-04 14:22 -0400
    Re: Searching online "indent" "Bill Cunningham" <nospam@nspam.invalid> - 2015-06-05 20:59 -0400
      Re: Searching online "indent" Keith Thompson <kst-u@mib.org> - 2015-06-05 20:41 -0700

csiph-web