From 941a5bcff34154cd8f236ec5b2348e4721242db1 Mon Sep 17 00:00:00 2001 From: "Benjamin J. Culkin" Date: Sun, 16 Sep 2018 22:01:43 -0300 Subject: More module refactoring --- clformat/data/formats.sprop | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 clformat/data/formats.sprop (limited to 'clformat/data/formats.sprop') diff --git a/clformat/data/formats.sprop b/clformat/data/formats.sprop new file mode 100644 index 0000000..c44ab51 --- /dev/null +++ b/clformat/data/formats.sprop @@ -0,0 +1,42 @@ +###################################### +# 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 +## 4) The function name, if the directive was a function call. +clFormatDirective ~(?%1$s)?(?%2$s?)(?:%3$s) + +## 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+|'.|[Vv]|#|%)?) + +## Match a format string modifier +## A modifier is any combination of $, :, * and @; duplicates don't matter though +clFormatModifier (?:[@$:*]+) + +## Matches a directive name. +## A directive name is either +## 1) A single, non-whitespace, non-/ character, optionally preceded by a grave +## 2) A name enclosed in /'s +clFormatName (?:(?`?[\S&&[^/]])|(?:/(?[\S&&[^/]]+)/)) + +################################################# +# 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)*) -- cgit v1.2.3