-
Notifications
You must be signed in to change notification settings - Fork 0
/
BRKREM.lss
64 lines (58 loc) · 1.93 KB
/
BRKREM.lss
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
<h1>BRKREM - BREAK(S) or REM</h1>
[[BRKREM(S)]] returns a pattern that will behave like BREAK(S)
if that pattern would succeed and will match the remainder of the
subject otherwise.
<h2>Uses</h2>
<a href="SDIFF.html">SDIFF</a><br>
<<INCLUDES>>=
-INCLUDE 'SDIFF.INC'
@
<<BRKREM>>=
-PUBLIC BRKREM()
*
DEFINE('BRKREM(S)CS') :(BRKREM_END)
*
BRKREM BRKREM = IDENT(S) REM :S(RETURN)
CS = SDIFF(&ALPHABET, S)
IDENT(CS) :S(RETURN)
BRKREM = RPOS(0) | SPAN(CS) RPOS(0) | BREAK(S)
:(RETURN)
*
BRKREM_END
@
<<unit_test>>=
#!/usr/bin/bash
exec "snobol4" "-b" "$0" "$@"
-INCLUDE 'BRKREM.INC'
&CODE = 1
&CODE = 0
END
@
<<>>=
-MODULE BRKREM
<<INCLUDES>>
-IN72
-STITL BRKREM
-EJECT
*
************************************************************************
* *
* *
* ###### ###### # # ###### ####### # # *
* # # # # # # # # # ## ## *
* # # # # # # # # # # # # # *
* ###### ###### ### ###### ##### # # # *
* # # # # # # # # # # # *
* # # # # # # # # # # # *
* ###### # # # # # # ####### # # *
* *
* BRKREM BREAK(S) OR REM *
* *
************************************************************************
*
* BRKREM.lss
*
<<BRKREM>>
*
* CE: .MSNOBOL4;
@