ternary operator extension
[nedit-bw.git] / indexNotInArray.diff
blobd8cfa75f0d97c8ff9551af7523596b1d3f0b8c79
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 | 5 +++++
18 1 file changed, 5 insertions(+)
20 diff --quilt old/source/parse.y new/source/parse.y
21 --- old/source/parse.y
22 +++ new/source/parse.y
23 @@ -587,7 +587,12 @@ numexpr: NUMBER {
24 | numexpr IN numexpr {
25 ADD_OP(OP_IN_ARRAY);
27 + | numexpr NOT IN numexpr {
28 + ADD_OP(OP_IN_ARRAY);
29 + ADD_OP(OP_NOT);
30 + }
33 while: WHILE {
34 $$ = GetPC(); StartLoopAddrList();