[patch 03/11] "key not in array"

Bert Wesarg wesarg at informatik.uni-halle.de
Sat Jan 27 16:15:32 CET 2007


This patch is from Tony Balinski and i like it.

    [INACTIVE] Allow easy negative testing of array index inclusion

    This patch provides the composite operator "! in" (for "not in"), which
    can be used in array tests. This allows the current negative test
	    if (!(index in theArray)) ...
    to be written
	    if (index !in theArray) ...

    The Enhancements to NEdit macro parsing patch includes this small change.

---

 source/parse.y |    4 ++++
 1 files changed, 4 insertions(+)

diff --quilt old/source/parse.y new/source/parse.y
--- old/source/parse.y
+++ new/source/parse.y
@@ -404,10 +404,14 @@ numexpr:    NUMBER {
                 ADD_OP(OP_DECR); ADD_OP(OP_ASSIGN); ADD_SYM($1);
             }
             | numexpr IN numexpr {
                 ADD_OP(OP_IN_ARRAY);
             }
+            | numexpr NOT IN numexpr {
+                ADD_OP(OP_IN_ARRAY);
+                ADD_OP(OP_NOT);
+            }
             ;
 while:  WHILE {
             $$ = GetPC(); StartLoopAddrList();
         }
         ;

-- 



More information about the Develop mailing list