summaryrefslogtreecommitdiff
path: root/clformat/data/formats.sprop
blob: ba1e83c9cafe5ec0d389b70791d99a6c7dc4f3cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
######################################
# 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 ~(?<params>%1$s)?(?<modifiers>%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 #
## * The character %
## * A double-quoted string
clFormatPrefixParam (?:(?:[-+]?\d+|'.|[Vv]|#|%|".*?(?<!\\)")?)

## Matches a (possibly named) format string prefix parameter
## 
## Parameters are seperated by ','
## 
## Named parameters are indicated by a preceeding #, which is followed by a
## parameter name (any sequence of non-space, non-seperator (',', ':', ';')
## printing characters), a seperator (: or ;), then the value of the parameter
clFormatPrefix (?:(?:#[\S&&[^,:;]]+[:;]%1$s)|%1$s)

## Match a format string modifier
## A modifier is any combination of the following characters
##  * '$'	 * ':'
##  * '*'	 * '@'
##
## Duplicates have no effect
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 (?:(?<name>`?[\S&&[^/]])|(?:/(?<funcname>[\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)*)