RosettaCodeData/Task/Strip-block-comments/Icon/strip-block-comments-2.icon
Ingy döt Net 68f8f3e56b all tasks
2013-04-11 01:07:29 -07:00

14 lines
446 B
Text

procedure main()
every writes(stripBlockComment(!&input,"/*","*/"))
end
procedure stripBlockComment(s,s2,s3)
static inC # non-null when inside comment
(s||"\n") ? while not pos(0) do {
if /inC then
if inC := 1(tab(find(s2))\1, move(*s2)) then suspend inC
else return tab(0)
else if (tab(find(s3))\1,move(*s3)) then inC := &null
else fail
}
end