Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rutgers!ucsd!ucbvax!laguna.metaphor.COM!alex From: alex@laguna.metaphor.COM (Bob Alexander) Newsgroups: comp.lang.icon Subject: Stripping comments Message-ID: <9009262033.AA01364@laguna.Metaphor.COM> Date: 26 Sep 90 20:33:19 GMT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: inet Organization: The Internet Lines: 26 Here's a routine I just whipped up. I tested it some but don't have complete confidence in it. Comments? (pun intended) procedure trimcomment(s1) # s2 local c,delim s1 ? { while tab(upto('"\'\\#')) do { case c := move(1) of { !"\"'": { delim := if \delim then { if delim == c then &null } else c } "\\": if \delim then ="^" & move(1) # in case he used "\^'" "#": if /delim then return trim(&subject[1:&pos - 1]) } } } return trim(s1) end -- Bob Alexander Metaphor Computer Systems (415) 961-3600 x751 alex@metaphor.com ====^=== Mountain View, CA ...{uunet}!{decwrl,apple}!metaphor!alex