-
Notifications
You must be signed in to change notification settings - Fork 8
/
lpmatch().txt
72 lines (57 loc) · 1.34 KB
/
lpmatch().txt
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
LIST PMATCH
--
USAGE: lpmatch(<list>[, <delim>[, <error type>]])
<list>: A list of player names or dbrefs to check
<delim>: Input delimiter used. If ", check for names in double-quotes
<error type>:
a[llow]: (default)
Pass non-matched <name> as #-1 <name> in order.
Output: list|of|dbrefs
d[eny]: Return #-1 NOT FOUND|list|of|entries that|were not|players.
--
e: possible error
p: pmatch() results
--
&f_lpmatch Global Function Object=
[setq( e,
case( 1,
cor( not( strlen( %0 )), strlen( %3 )),
#-1 FUNCTION (LPMATCH) EXPECTS BETWEEN 1 AND 3 ARGUMENTS,
strmatch( %1, @@ ), #-1 NO ZERO WIDTH DELIMITERS,
gte( strlen( %1 ), 5 ), #-1 DELIMITER TOO LONG,
not( match( |allow|deny, %2*, | )), #-1 ERROR TYPE NOT FOUND,
@@ delim is ":
strmatch( %1, " ),
squish(
trim(
iter( %0,
if( mod( inum( 0 ), 2 ),
iter( %i0,
if( setr( p, pmatch( %i0 )), %qp, #-1 %i0 ),
, |
),
if( setr( p, pmatch( %i0 )), %qp, #-1 %i0 )
),
", |
),
b, |
),
|
),
@@ delim is anything else
iter( %0,
if( setr( p, pmatch( trim( %i0 )) ), %qp, #-1 [trim( %i0 )] ),
%1, |
)
)
)]
[switch( 1,
not( t( %qe )),
%qe,
cand(
strmatch( %qe, *#-1* ),
strmatch( %2, d* )
),
#-1 NOT FOUND|[iter( graball( %qe, #-1 *, | ), rest( %i0 ), |, | )],
%qe
)]