-
Notifications
You must be signed in to change notification settings - Fork 0
/
highlight.sno
executable file
·28 lines (22 loc) · 762 Bytes
/
highlight.sno
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
#!/usr/local/bin/snobol4 -b
&anchor = 1
* flush OUTPUT immediately
output(.output, 6, "W")
loop line = input :f(end)
line ".HIGHLIGHT " rem . language :s(pipe)
output = line :(loop)
* empty line to fixup line numbering
pipe output = "."
* FIXME: hack to strip the last byte (linefeed) since source-highlight
* is picky about newlines at the end of the file (will print another lineprefix)
output(.pipe, 100,,
+ "| head -c -1 | source-highlight --outlang-def groff.outlang -s " language)
pipe_l line = input
line ".HIGHLIGHT" :s(close)
pipe = line :(pipe_l)
close endfile(100)
* empty line to fixup line numbering
* FIXME: the linefeed is necessary because source-highlight did not terminate
* the last line
output = char(10) "." :(loop)
end