Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!sdd.hp.com!ucsd!ucbvax!laguna.metaphor.COM!alex From: alex@laguna.metaphor.COM (Bob Alexander) Newsgroups: comp.lang.icon Subject: Re: line splits & uncommenting Message-ID: <9009272237.AA02317@laguna.Metaphor.COM> Date: 27 Sep 90 22:37:22 GMT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: inet Organization: The Internet Lines: 32 Wow -- the problems and solutions are coming in faster than I can formulate a reply! Have to learn to type (and think) faster. Another possible solution to the split-string-literal problem is simply to make the variable that remembers the string literal delimiter persistant (static or global). Using as an example the version I previously posted, "delim" is the variable in question. The results could be very wierd if the input program contains certain syntax errors. procedure trimcomment(s1) # s2 # # Trim comments (and any trailing spaces) from Icon program text line "s1". # static delim local c s1 ? { while tab(upto('"\'\\#')) do { case c := move(1) of { "#": if /delim then return trim(&subject[1:&pos - 1],' \t') "\\": if \delim then {="^" ; move(1)} # in case he used "\^"" default: delim := if \delim then (if delim == c then &null) else c } } } return trim(s1,' \t') end -- Bob Alexander Metaphor Computer Systems (415) 961-3600 x751 alex@metaphor.com ====^=== Mountain View, CA ...{uunet}!{decwrl,apple}!metaphor!alex