Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles $Revision: 1.7.0.10 $; site uiucuxc Path: utzoo!watmath!clyde!cbosgd!ihnp4!inuxc!pur-ee!uiucdcs!uiucuxc!hamilton From: hamilton@uiucuxc.CSO.UIUC.EDU Newsgroups: net.micro.amiga Subject: Re: more on Lattice working environment Message-ID: <148600030@uiucuxc> Date: Sun, 5-Jan-86 22:06:00 EST Article-I.D.: uiucuxc.148600030 Posted: Sun Jan 5 22:06:00 1986 Date-Received: Tue, 7-Jan-86 04:20:43 EST References: <157@yale.ARPA> Lines: 34 Nf-ID: #R:yale.ARPA:157:uiucuxc:148600030:000:1010 Nf-From: uiucuxc.CSO.UIUC.EDU!hamilton Jan 5 21:06:00 1986 >If anyone is interested in my quickly-hacked code trimmer, drop me a line. >It's an interesting exercise: removing comments from code is actually >somewhat nontrivial. i don't want to steal your thunder or anything, but i thought this might be amusing with respect to your 'nontrivial' comment. of course, it assumes you've got lex handy: %{ /* this Lex script generates a filter that removes comments from C sources. * to compile: * lex -t < {this text} > comments.c * cc -o comments comments.c -ll * to use: * comments < {C source} > {uncommented C source} */ %} %Start INSIDE %% "*/" { BEGIN 0; } "/*" { fprintf(stderr,"unbalanced /*!\n"); } . { } "/*" { BEGIN INSIDE; } "*/" { fprintf(stderr,"unbalanced */!\n"); } . { ECHO; } wayne hamilton U of Il and US Army Corps of Engineers CERL UUCP: {ihnp4,pur-ee,convex}!uiucdcs!uiucuxc!hamilton ARPA: hamilton@uiucuxc.cso.uiuc.edu CSNET: hamilton%uiucuxc@uiuc.csnet USMail: Box 476, Urbana, IL 61801 Phone: (217)333-8703