Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bionet!ig!arizona!rupley From: rupley@arizona.edu (John Rupley) Newsgroups: comp.lang.c Subject: Re: Scrunch blank lines Summary: yet another Lex version Message-ID: <10031@megaron.arizona.edu> Date: 1 Apr 89 01:57:42 GMT References: <7150@siemens.UUCP> <9900010@bradley> <4896@cbnews.ATT.COM> <10029@megaron.arizona.edu> Distribution: na Organization: U of Arizona CS Dept, Tucson Lines: 17 In article <620@gonzo.UUCP> daveb@gonzo.UUCP (Dave Brower) writes: >So, I offer this week's challenge: Smallest program that will take >"blank line" style cpp output on stdin and send to stdout a scrunched >version with appropriate #line directives. Yet another Lex version: ------------------------------------------------------------------------ char f[80]; int x; %% #.+\n {sscanf(yytext,"#%d%s",&yylineno,f); x++;} .+\n {if(x)printf("# %d %s\n",yylineno-1,f); ECHO; x=0;} \n x++; ------------------------------------------------------------------------ John Rupley rupley!local@megaron.arizona.edu