Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!apple!csl!fernwood!uunet!mcsun!unido!ira.uka.de!rusmv1!texinfo1 From: texinfo1@rusmv1.rus.uni-stuttgart.de (Rainer Schoepf) Newsgroups: comp.text.tex Subject: Re: TeX guru help needed Keywords: \loop \par Message-ID: <1991Jun25.203859.6701@rusmv1.rus.uni-stuttgart.de> Date: 25 Jun 91 20:38:59 GMT References: Distribution: comp Organization: Comp.Center (RUS), U of Stuttgart, FRG Lines: 47 In article pfeiffer@cix.cict.fr (Daniel Pfeiffer) writes: >I want to read and parse every line in a file that contains no >empty lines: > > \openin\@std \bookname.sind > \loop > \read\@std to\@theline > \ifx\@theline\par\encorefalse\fi > \ifencore > \expandafter\@parse\@theline > \ifx\@theword\@theoldword > \ifx\@thepage\@theoldpage\else, \@thepage\fi > \else > \relax\endgraf\@theword\@dots\@thepage > \let\@theoldword=\@theword > \fi > \let\@theoldpage=\@thepage > \repeat > >I read from a file whose lines are all uniform, and recognized by \@parse. >When I get to the end of the file the value of \@theline is \par. So I >figured I'd test for the end with \ifx\@theline\par. Problem is that >\loop tries to read everything upto \repeat but falls flat on it's face >when it sees the \par. How do I make \par symbolic rather than a paragraph >separator. I've tried \let\@par=\par but then the test \ifx\@theline\@par >fails. Putting an \outer before \loop doesn't change anything. > >How do I correct this??? Alternate solutions to parsing every line >in a file are also welcome! > > +---------------+ > | * * * | > | * * | Beware - polyglot esperantist > | * * | > | * * | > | * * * | > +---------------+ > | > | Daniel Pfeiffer > | Tolosa (Toulouse), Midi-Pyrenees, Europe > | > | How about testing for end-of-file with the \ifeof primitive? Rainer Sch"opf