-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathisse.sno
executable file
·79 lines (67 loc) · 2.16 KB
/
isse.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#! /usr/local/bin/snobol4 -b
* ISSE - Incredibly (Simple|Stupid) Snobol4 Editor
* Author: Rafal M. Sulejman
*
* Standard (no readline)
*
* Usage:
* {startline}[,{endline}]{command_letter}
*
* Commands
* a - appends one line after selected line
* c - changes selected line
* d - deletes selected line
* i - inserts one line before selected line
* l - lists (showing tabs and EOLs) the selected range
* n - shows selected range with line numbers
* p - shows selected range
* q - quit (without saving)
* w - write (save changes)
*
cmds = "acdilnpqw"
nums = "0123456789$%."
cmdp = ( span(nums) | "" ) . ln.start
+ ( "," | "")
+ ( span(nums) | "" ) . ln.end
+ any(cmds) . cmd
ln.last = 0
fn = host(0)
t = table()
opene input('infile',1,,fn)
rdfil curline = infile :f(all)
ln.last = ln.last + 1
t<ln.last> = curline :(rdfil)
all output = ln.last
rd.cmd cmdln = input
cmdln "." = ln.cur
cmdln "$" = ln.last
cmdln "%" = 1 "," ln.last
cmdln cmdp :f(rd.cmd)
ln.cur = 0 + ln.start :($('cmd.' cmd))
cmd.c terminal = t<ln.cur>
t<ln.cur> = input :(rd.cmd)
cmd.d ln.end = ln.last
ln.last = ln.last - 1
loop.d t<ln.cur> = t<ln.cur + 1> :(incr)
cmd.a ln.cur = ln.cur + 1
cmd.i ln.last = ln.last + 1
ln.tmp = ln.last
loop.i t<ln.tmp> = t<ln.tmp - 1>
ln.tmp = gt(ln.tmp,ln.cur) ln.tmp - 1 :s(loop.i)
t<ln.cur> = input :(rd.cmd)
cmd.l
loop.l ln.out = t<ln.cur>
tabs.l ln.out char(9) = "^I" :s(tabs.l)
ln.out rpos(0) = "$"
output = ln.out :(incr)
cmd.n
loop.n output = ln.cur char(9) t<ln.cur> :(incr)
cmd.p
loop.p output = t<ln.cur> :(incr)
cmd.w output('outfile',2,,fn)
ln.cur = 1
ln.end = ln.last
loop.w outfile = t<ln.cur> :(incr)
incr ln.cur = gt(ln.end,ln.cur) ln.cur + 1 :s($('loop.' cmd))f(rd.cmd)
cmd.q
end