Here follows an answer in C:
(best viewed with "tabstop=4" in ~/.vimrc)

you can simply add some more char's (e.g: '/')
to be ignored as whitespace: just add them
to the head of the 'case' list, e.g.   "case '/':"  
without futher additions and recompile: "cc <file.c>

-----------------------------------------------------------
This program is to be called up as a filter, e.g:

        a.out < textfile        > lexical_file
or
        cat textfile | a.out > lexical_file
or
        cat textfile | a.out            # output goes to the screen
-----------------------------------------------------------




#include        <stdio.h>

#define CR      '\r'                            //CarriageReturn
#define LF      '\n'                            //LineFeed
#define TAB     '\t'                            //Tabulator

#define YES     1
#define NO      0

int             ch;                                             //text
char    newline;                                //mark LineFeed condition


main () {
        newline = YES;                          //NO Linefeed before text

        while ((ch = getchar()) != EOF) {       //read text
                switch (ch) {
                case CR:
                case TAB:
                case LF:        if (newline == NO) {
                                                putchar(LF);
                                                newline = YES;
                                        }
                                        break;

                default:        putchar(ch);
                                        newline = NO;
                }
        }
}


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to