bug-indent
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-indent] C++ ability for indent .. code patch and question.


From: Preston A. Elder
Subject: [Bug-indent] C++ ability for indent .. code patch and question.
Date: Sat, 12 Jan 2002 02:39:10 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.4) Gecko/20010923

Hi,

I use indent on C++ code, works fine, however, as stated in the docs, I end up with the template problem of:
a< b< c>>;

I found the fix was to modify lexi.c, and insert the following code at line 1020 (ie. the detection code for the lexical token of '<', '>' and '!'):
            if (token - cur_line)
                if (token[-1] == ' ' || token[-1] == TAB)
                    parser_state_tos->want_blank = true;

This should force the parser to maintain a space before a <, > or ! character if there was one there already. I cannot see any ill effect from this code, and the only changes I've noticed in my code (after doing comparisons between a standard indent, and the one modified with the above code), is that the template problem is fixed. This was tested on rather complex code, in a file that is 426kb.

If you can think of any reason why this is NOT a good idea, I'm all ears. The only thing I dont like about this, is I've had to use the cur_line veriable outside the io.c file (which is the only place it is used currently), but I dont know how else to check if the token string is starting at the beginning of the line or not (last thing we want is to do blow our boundaries!).

BTW - I love the program, and it works well, and has alot of cool options -- for all my (and others) formatting needs. Good job :)

--
PreZ
Development Head
Magick IRC Services

Magick IRC Services, power to the PEOPLE!
Product Site: http://www.magick.tm
Project Site: http://www.sourceforge.net/projects/magick




reply via email to

[Prev in Thread] Current Thread [Next in Thread]