From e9271f470a5c61562d40b4ecf2fbeef123ac127a Mon Sep 17 00:00:00 2001 From: Benjamin Culkin Date: Mon, 11 Sep 2017 17:50:19 -0700 Subject: Start work on implementation of CL format --- BJC-Utils2/data/formats.sprop | 24 ++++++++++++++++++++++++ BJC-Utils2/data/regexes.sprop | 16 ++++++++++++++++ 2 files changed, 40 insertions(+) (limited to 'BJC-Utils2/data') diff --git a/BJC-Utils2/data/formats.sprop b/BJC-Utils2/data/formats.sprop index 7d8fc94..73ebc29 100644 --- a/BJC-Utils2/data/formats.sprop +++ b/BJC-Utils2/data/formats.sprop @@ -1,5 +1,29 @@ # File storage for format strings +################################################# +# Generic format strings for regular expressions. +################################################# + +## Format a regular expression for matching a delimiter separated list. +## Takes two parameters +## 1) The expression for each term +## 2) The expression for the delimiter +delimSeparatedList (?:%1$s(?:%2$s%1$s)*) + +###################################### +# CL format string regular expressions +###################################### + +## Format a regular expression for matching a potential CL format directive +## Has two parts +## 1) The optional set of prefix parameters +## 2) The optional modifier +## Captures three things +## 1) The prefix parameters +## 2) The modifiers +## 3) The directive name +clFormatDirective ~(?%1$s)?(?%2$s?)(?\S) + #################################################### # Format strings for handling double-quoted strings. #################################################### diff --git a/BJC-Utils2/data/regexes.sprop b/BJC-Utils2/data/regexes.sprop index cdacea0..dadc09c 100644 --- a/BJC-Utils2/data/regexes.sprop +++ b/BJC-Utils2/data/regexes.sprop @@ -34,6 +34,22 @@ fpExponent [eE][+-]? ## NOTE: The incomplete parts are finished by where it is inserted. fpLeader [\x00-\x20]*[+-]?(?:NaN|Infinity| +###################################### +# CL format string regular expressions +###################################### + +## Matches a format string prefix parameter +## A prefix parameter is one of +## * A signed decimal number +## * A single character preceded by a single quote +## * The letter V (or v) +## * The character # +clFormatPrefix (?:[-+]?\d+|'\S|[Vv]|#) + +## Match a format string modifier +## A modifier is either : or @, or both in either order +clFormatModifier (?:@|:|@:|:@) + ############################################## # Miscellaneous validation regular expressions ############################################## -- cgit v1.2.3