From 6adc57e84222b4b03a3df70ec00b56f3405bd878 Mon Sep 17 00:00:00 2001 From: "G.raud" Date: Wed, 14 Mar 2018 08:23:09 +0100 Subject: [PATCH] Pred: parse add pathspec patterns of the form 'add ' These are equivalent to the non prefixed patterns and are added only for completeness. --- src/pred.ml | 4 +++- src/pred.mli | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pred.ml b/src/pred.ml index 798db114f..26bab1809 100644 --- a/src/pred.ml +++ b/src/pred.ml @@ -37,8 +37,9 @@ let error_msg s = Printf.sprintf "bad pattern: %s\n\ A pattern must be introduced by one of the following keywords:\n\ \032 Regex, Name, Path, BelowPath, NameString, String, BelowString\n\ - \032 (or del or assoc )." s + \032 (or add or del or assoc )." s +let addPref = "add " let delPref = "del " let assocPref = "assoc " @@ -58,6 +59,7 @@ let rec select_pattern str l err = [] -> err str | (pref, g)::r -> if Util.startswith str pref then `Alt (rest pref g) + else if Util.startswith str (addPref^pref) then `Alt (rest (addPref^pref) g) else if Util.startswith str (delPref^pref) then `Dif (rest (delPref^pref) g) else if Util.startswith str (assocPref^pref) then `Nul (rest (assocPref^pref) g) else select_pattern str r err diff --git a/src/pred.mli b/src/pred.mli index 94401867d..415c40e2d 100644 --- a/src/pred.mli +++ b/src/pred.mli @@ -36,6 +36,9 @@ Seven assoc only patterns "assoc " are also recognized that record the associated string but do not set the preference for the paths matching the given pattern. + + Seven patterns "add " are also recognized that are equivalent to the + non prefixed patterns. *)