blob: e4cde3574933abe2514d40b350d466db6b1ba8d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
############################################################################
#
# File: istrip.icn
#
# Subject: Program to strip comments from Icon program
#
# Author: Ralph E. Griswold
#
# Date: March 29, 1992
#
############################################################################
#
# This file is in the public domain.
#
############################################################################
#
# This program strips comments out of an Icon program. It also removes
# empty lines and leading whitespace (see stripcom.icn).
#
############################################################################
#
# Links: stripcom
#
############################################################################
link stripcom
procedure main()
local line, nextline
while line := read() do {
while line[-1] == "_" do { # handle continued literal
nextline := read() | stop("*** unclosed continued literal")
nextline ?:= {
tab(many(' \t')) # remove leading whitespace
tab(0)
}
line := line[1:-1] || nextline
}
write(stripcom(line))
}
end
|