RosettaCodeData/Task/Strip-block-comments/Icon/strip-block-comments-2.icon
2023-07-01 13:44:08 -04: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