alex@laguna.metaphor.COM (Bob Alexander) (09/27/90)
I *knew* I should let this routine age for a couple of days before posting it! It couldn't handle "abc\"def". First bug fix (with a bit of vertical compactification, and other misc changes): procedure trimcomment(s1) # s2 # # Trim comments (and any trailing spaces) from Icon program text line. # local c,delim 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