From d88179a0b3e08fade2bcf599c8d5c9f7878434e4 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Wed, 26 Sep 2018 03:35:10 +0300 Subject: [PATCH] notes and cleanup... Signed-off-by: Alex A. Naanou --- format.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/format.js b/format.js index 4ef894c..ca8e09b 100644 --- a/format.js +++ b/format.js @@ -17,7 +17,7 @@ var { OR, AND, NOT, AT, OF, IN, VAR, LIKE, TEST, - + // non-pattern values... EMPTY, NONE, } = diff @@ -25,7 +25,8 @@ var { /*********************************************************************/ // helpers... -// OPT(key, value) -> true if key matches value or does not exist... +// OPT(key, value) +// -> true if key matches value or does not exist... var OPT = function(key, value){ return OR( NOT(AT(key)), @@ -35,6 +36,9 @@ var OPT = function(key, value){ /*********************************************************************/ // +// NOTE: this file is organized bottoms-up, with the most general +// (top-level) patterns at the bottom. +// // XXX need better mismatch checking -- ideally stating the exact spot // where we did not match and the path of fails it created... // @@ -157,13 +161,17 @@ module.OPTIONS = AND( OPT('no_length', B), OPT('cmp', F) ) + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - var DIFF_OBJECT = module.DIFF_OBJECT = AND( // format metadata... AT('format', diff.FORMAT_NAME), - //AT('version', S(/\d+\.\d+\.\d+/)), - AT('version', diff.FORMAT_VERSION), + AT('version', AND( + // version format... + S(/\d+\.\d+\.\d+[ab]?/), + // explicit version value... + diff.FORMAT_VERSION)), // instance metadata... AT('options', OPTIONS),