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...