Re: Code beautifiers, anyone?

2006-08-26 Thread Matti J. Karki
On 8/26/06, James Long [EMAIL PROTECTED] wrote: inbuffer = re.sub('\n +', '\n', inbuffer) # Strip trailing whitespace This will strip spaces at the _beginning_ of line (leading spaces). Except, possibly, lines that begin at the first byte of the buffer, such as the first line of the file,

Re: Code beautifiers, anyone?

2006-08-25 Thread W. D.
At 17:00 8/24/2006, Matti J. Karki wrote: On 8/24/06, Kyrre Nygård [EMAIL PROTECTED] wrote: Perhaps you could share with us whatever scripts you've written? Totally forgot to include the actual intendation script. There should be a Python script attached to this mail. Please note, that the

Re: Code beautifiers, anyone?

2006-08-25 Thread Matti J. Karki
On 8/25/06, W. D. [EMAIL PROTECTED] wrote: At 17:00 8/24/2006, Matti J. Karki wrote: On 8/24/06, Kyrre Nygård [EMAIL PROTECTED] wrote: Perhaps you could share with us whatever scripts you've written? Totally forgot to include the actual intendation script. There should be a Python script

Re: Code beautifiers, anyone?

2006-08-25 Thread Kyrre Nygård
At 21:09 24.08.2006, Matti J. Karki wrote: Well, my scripts aren't magic. They are pretty simple. Here's few (not scripts, these are valid Vim regexps): Those are great regexps, Matti, thank you so much. They have been noteworthy recorded! Say, could I use these with Sed let's say in a Bash

Re: Code beautifiers, anyone?

2006-08-25 Thread Kyrre Nygård
At 06:01 25.08.2006, Matti J. Karki wrote: Yes. I know, that this is reinventing the wheel. Also, home-made scripts tend to be less reliable compared to dedicated tools. But I have to deal with C, C++, Java, Visual Basic and XML files and also some pretty obscure internal data files. With my

Re: Code beautifiers, anyone?

2006-08-25 Thread Kyrre Nygård
At 14:31 25.08.2006, Matti J. Karki wrote: No doubt :) There's no comments in the code, because usually my scripts are disposable. As I said, I do those case by case. The code should be quite clear for most parts, but the bunch of regexps at the beginning of the code do the following things:

Re: Code beautifiers, anyone?

2006-08-25 Thread Giorgos Keramidas
On 2006-08-25 15:24, Kyrre Nyg?rd [EMAIL PROTECTED] wrote: At 21:09 24.08.2006, Matti J. Karki wrote: Well, my scripts aren't magic. They are pretty simple. Here's few (not scripts, these are valid Vim regexps): Those are great regexps, Matti, thank you so much. They have been

Re: Code beautifiers, anyone?

2006-08-25 Thread Matti J. Karki
On 8/25/06, Kyrre Nygård [EMAIL PROTECTED] wrote: In your script, do these comments look alright then? (I simplified them a bit) inbuffer = re.sub('\) *?\n\{', ') {', inbuffer) # Move curly brackets to the end of lines inbuffer = re.sub('\) *?{', ') {', inbuffer) # Remove spaces between

Re: Code beautifiers, anyone?

2006-08-25 Thread Matti J. Karki
On 8/25/06, Giorgos Keramidas [EMAIL PROTECTED] wrote: On 2006-08-25 15:24, Kyrre Nyg?rd [EMAIL PROTECTED] wrote: At 21:09 24.08.2006, Matti J. Karki wrote: Well, my scripts aren't magic. They are pretty simple. Here's few (not scripts, these are valid Vim regexps): Those are great

Re: Code beautifiers, anyone?

2006-08-25 Thread Matti J. Karki
On 8/25/06, Kyrre Nygård [EMAIL PROTECTED] wrote: At 21:09 24.08.2006, Matti J. Karki wrote: Well, my scripts aren't magic. They are pretty simple. Here's few (not scripts, these are valid Vim regexps): Those are great regexps, Matti, thank you so much. They have been noteworthy recorded!

Re: Code beautifiers, anyone?

2006-08-25 Thread Kyrre Nygård
At 20:27 25.08.2006, Matti J. Karki wrote: A word of warning. Above, I mentioned that it's important to remember that my example will remove _all_ tabulator characters from text. This means that - for example - all lines with indentation inside the code comments will be messed up (remember,

Re: Code beautifiers, anyone?

2006-08-25 Thread James Long
Date: Fri, 25 Aug 2006 21:27:03 +0300 From: Matti J. Karki [EMAIL PROTECTED] Subject: Re: Code beautifiers, anyone? To: Kyrre Nyg?rd [EMAIL PROTECTED] Cc: W. D. [EMAIL PROTECTED], [EMAIL PROTECTED] Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=ISO-8859-1; format

Code beautifiers, anyone?

2006-08-24 Thread Kyrre Nygård
Hello people, I'm looking for the best ways to create a line of code beautification (reformatting) scripts -- one for C, one for Ruby, one for Bash and one for web development languages like XHTML, XML, CSS, PHP and Ajax. Whether as frontline warriors or household maids, they would ensure

Re: Code beautifiers, anyone?

2006-08-24 Thread Matti J. Karki
On 8/24/06, Kyrre Nygård [EMAIL PROTECTED] wrote: I'm looking for the best ways to create a line of code beautification (reformatting) scripts -- one for C, one for Ruby, one for Bash and one for web development languages like XHTML, XML, CSS, PHP and Ajax. Whether as frontline warriors or

Re: Code beautifiers, anyone?

2006-08-24 Thread Derek Ragona
For C code I use indent http://mysite.wanadoo-members.co.uk/indent/beautify.html -Derek At 07:58 AM 8/24/2006, Kyrre Nygård wrote: Hello people, I'm looking for the best ways to create a line of code beautification (reformatting) scripts -- one for C, one for Ruby, one for Bash and

Re: Code beautifiers, anyone?

2006-08-24 Thread David Kelly
On Thu, Aug 24, 2006 at 02:58:38PM +0200, Kyrre Nyg?rd wrote: Hello people, I'm looking for the best ways to create a line of code beautification (reformatting) scripts -- one for C, one for Ruby, one for Bash and one for web development languages like XHTML, XML, CSS, PHP and Ajax.

Re: Code beautifiers, anyone?

2006-08-24 Thread Kyrre Nygård
At 15:18 24.08.2006, Matti J. Karki wrote: Well, my suggestion to anyone asking this question is that the best thing IMHO is to learn some scripting language with good regular expression support. For example Tcl, Python or Perl. I have to deal with all sorts of source code and I have noticed

Re: Code beautifiers, anyone?

2006-08-24 Thread Matti J. Karki
On 8/24/06, Kyrre Nygård [EMAIL PROTECTED] wrote: Perhaps you could share with us whatever scripts you've written? Thanks! Well, my scripts aren't magic. They are pretty simple. Here's few (not scripts, these are valid Vim regexps): :%s/).*\n.*{/) {/g :%s/) *{/) {/g :%s/\t//g :%s/^

Re: Code beautifiers, anyone?

2006-08-24 Thread Matti J. Karki
On 8/24/06, Kyrre Nygård [EMAIL PROTECTED] wrote: Perhaps you could share with us whatever scripts you've written? Totally forgot to include the actual intendation script. There should be a Python script attached to this mail. Please note, that the script is not a silver bullet! It was

Re: Code beautifiers, anyone?

2006-08-24 Thread David Kelly
On Aug 24, 2006, at 5:00 PM, Matti J. Karki wrote: On 8/24/06, Kyrre Nygård [EMAIL PROTECTED] wrote: Perhaps you could share with us whatever scripts you've written? Totally forgot to include the actual intendation script. I'm just a bit confused about the fascination with scripts for

Re: Code beautifiers, anyone?

2006-08-24 Thread Matti J. Karki
On 8/25/06, David Kelly [EMAIL PROTECTED] wrote: On Aug 24, 2006, at 5:00 PM, Matti J. Karki wrote: On 8/24/06, Kyrre Nygård [EMAIL PROTECTED] wrote: Perhaps you could share with us whatever scripts you've written? Totally forgot to include the actual intendation script. I'm just a bit