Re: A Puzzle in Eu -- what would you do?
- Posted by Jason Gade <jaygade at yahoo.com> Aug 05, 2005
- 521 views
Bernie Ryan wrote: > > > sequence ctr ctr = {1} > > while 1 do > ctr &= match("--",line[ctr[$]..$]) > if ctr[$] = 0 then exit endif > end while > > ctr now equals a list of all the locations of the "--" in the line. > so from there you can figure out where the real comment is. > > Hit the keys too fast > > Bernie > > My files in archive: > w32engin.ew mixedlib.e eu_engin.e win32eru.exw > > Can be downloaded here: > <a > href="http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan">http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan</a> > Bernie, your code went into an infinite loop for me. Try this slightly more complicated version below:
sequence line, ctr integer here line = "there are no -- comments -- in this thing -- here" ctr = {0} while 1 do here = match("--", line[ctr[$]+1..$]) if here = 0 then exit end if ctr &= here + ctr[$] end while ? ctr
With your code it gets stuck in an infinite loop with ctr = {1,14,1,14,1,14...} ================================================================ "Actually, I'm sitting on my butt staring at a computer screen." - Tom Tomorrow j.