Program memory leaks
[nedit-bw.git] / indexNotInArray.diff
blobc37aaaa99c2da98f39512607facc70bdceb9e392
1 From: Tony Balinski <ajbj@free.fr>
2 Subject: Allow easy negative testing of array index inclusion
4 This patch provides the composite operator "! in" (for "not in"), which
5 can be used in array tests. This allows the current negative test
7 if (!(index in theArray)) ...
9 to be written
11 if (index !in theArray) ...
13 The Enhancements to NEdit macro parsing patch includes this small change.
15 ---
17 source/parse.y | 4 ++++
18 1 file changed, 4 insertions(+)
20 diff --quilt old/source/parse.y new/source/parse.y
21 --- old/source/parse.y
22 +++ new/source/parse.y
23 @@ -575,10 +575,14 @@ numexpr: NUMBER {
24 ADD_OP(OP_DECR); ADD_OP(OP_ASSIGN); ADD_SYM($1);
26 | numexpr IN numexpr {
27 ADD_OP(OP_IN_ARRAY);
29 + | numexpr NOT IN numexpr {
30 + ADD_OP(OP_IN_ARRAY);
31 + ADD_OP(OP_NOT);
32 + }
34 while: WHILE {
35 $$ = GetPC(); StartLoopAddrList();