home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / msdos / txtutl / lex_yacc.arc / STRIP.L < prev    next >
Encoding:
Text File  |  1989-05-28  |  461 b   |  19 lines

  1.  
  2.   { A sample Lex program that strips whitespace from stdin and writes result
  3.     to stdout; when running the program you can use DOS I/O redirection, e.g.
  4.       strip <input-file >output-file }
  5.  
  6.   uses LexLib;
  7.  
  8. %%
  9.  
  10. ^[ \t]*\n        ;        { ignore empty lines }
  11. [ \t]+$            ;        { ignore trailing whitespace }
  12. [ \t]+            write(yyout, ' ');
  13.                           { replace remaining whitespace by single blank }
  14. %%
  15.  
  16. begin
  17.   if yylex=0 then { done }
  18. end.
  19.