From 670ed87d70aabf08038307cb15f18602d7871c7d Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Fri, 27 Dec 2019 06:11:54 +0300 Subject: [PATCH] started work on XOR(..)... Signed-off-by: Alex A. Naanou --- diff.js | 20 ++++++++++++++++++++ format.js | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/diff.js b/diff.js index 84d5cff..c1b9c02 100644 --- a/diff.js +++ b/diff.js @@ -599,6 +599,26 @@ object.Constructor('OR', Object.assign(Object.create(Pattern.prototype), { }, })) +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// XXX XOR +var XOR = +module.XOR = +object.Constructor('XOR', Object.assign(Object.create(Pattern.prototype), { + __cmp__: function(obj, cmp, context){ + /* XXX + for(var m of this.members){ + if(cmp(m, obj, context)){ + return true + } + } + return false + //*/ + }, + __init__: function(...members){ + this.members = members + }, +})) + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Will compare as true if all of the .members compare as true... var AND = diff --git a/format.js b/format.js index 1118c7c..6fbeaaf 100644 --- a/format.js +++ b/format.js @@ -14,7 +14,7 @@ var diff = require('./diff') var { ANY, NULL, BOOL, B, NUMBER, N, STRING, S, ARRAY, L, FUNCTION, F, - OR, AND, NOT, + OR, XOR, AND, NOT, AT, OF, IN, VAR, LIKE, TEST, // non-pattern values...