Skip to content

Commit 6d1c9c5

Browse files
avargitster
authored andcommitted
userdiff style: declare patterns with consistent style
Change those patterns which were declared with a regex on the same line as the "PATTERNS()" line to put that regex on the next line, and add missing "/* -- */" separator comments between the pattern and word_regex. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ddd164d commit 6d1c9c5

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

userdiff.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ PATTERNS("bash",
4444
/* -- */
4545
/* Characters not in the default $IFS value */
4646
"[^ \t]+"),
47-
PATTERNS("bibtex", "(@[a-zA-Z]{1,}[ \t]*\\{{0,1}[ \t]*[^ \t\"@',\\#}{~%]*).*$",
47+
PATTERNS("bibtex",
48+
"(@[a-zA-Z]{1,}[ \t]*\\{{0,1}[ \t]*[^ \t\"@',\\#}{~%]*).*$",
49+
/* -- */
4850
"[={}\"]|[^={}\" \t]+"),
4951
PATTERNS("cpp",
5052
/* Jump targets or access declarations */
@@ -121,7 +123,9 @@ IPATTERN("fortran",
121123
* they would have been matched above as a variable anyway. */
122124
"|[-+]?[0-9.]+([AaIiDdEeFfLlTtXx][Ss]?[-+]?[0-9.]*)?(_[a-zA-Z0-9][a-zA-Z0-9_]*)?"
123125
"|//|\\*\\*|::|[/<>=]="),
124-
IPATTERN("fountain", "^((\\.[^.]|(int|ext|est|int\\.?/ext|i/e)[. ]).*)$",
126+
IPATTERN("fountain",
127+
"^((\\.[^.]|(int|ext|est|int\\.?/ext|i/e)[. ]).*)$",
128+
/* -- */
125129
"[^ \t-]+"),
126130
PATTERNS("golang",
127131
/* Functions */
@@ -132,7 +136,9 @@ PATTERNS("golang",
132136
"[a-zA-Z_][a-zA-Z0-9_]*"
133137
"|[-+0-9.eE]+i?|0[xX]?[0-9a-fA-F]+i?"
134138
"|[-+*/<>%&^|=!:]=|--|\\+\\+|<<=?|>>=?|&\\^=?|&&|\\|\\||<-|\\.{3}"),
135-
PATTERNS("html", "^[ \t]*(<[Hh][1-6]([ \t].*)?>.*)$",
139+
PATTERNS("html",
140+
"^[ \t]*(<[Hh][1-6]([ \t].*)?>.*)$",
141+
/* -- */
136142
"[^<>= \t]+"),
137143
PATTERNS("java",
138144
"!^[ \t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\n"
@@ -144,6 +150,7 @@ PATTERNS("java",
144150
"|--|\\+\\+|<<=?|>>>?=?|&&|\\|\\|"),
145151
PATTERNS("markdown",
146152
"^ {0,3}#{1,6}[ \t].*",
153+
/* -- */
147154
"[^<>= \t]+"),
148155
PATTERNS("matlab",
149156
/*
@@ -152,6 +159,7 @@ PATTERNS("matlab",
152159
* that is understood by both.
153160
*/
154161
"^[[:space:]]*((classdef|function)[[:space:]].*)$|^(%%%?|##)[[:space:]].*$",
162+
/* -- */
155163
"[a-zA-Z_][a-zA-Z0-9_]*|[-+0-9.e]+|[=~<>]=|\\.[*/\\^']|\\|\\||&&"),
156164
PATTERNS("objc",
157165
/* Negate C statements that can look like functions */
@@ -212,13 +220,15 @@ PATTERNS("php",
212220
"[a-zA-Z_][a-zA-Z0-9_]*"
213221
"|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+"
214222
"|[-+*/<>%&^|=!.]=|--|\\+\\+|<<=?|>>=?|===|&&|\\|\\||::|->"),
215-
PATTERNS("python", "^[ \t]*((class|(async[ \t]+)?def)[ \t].*)$",
223+
PATTERNS("python",
224+
"^[ \t]*((class|(async[ \t]+)?def)[ \t].*)$",
216225
/* -- */
217226
"[a-zA-Z_][a-zA-Z0-9_]*"
218227
"|[-+0-9.e]+[jJlL]?|0[xX]?[0-9a-fA-F]+[lL]?"
219228
"|[-+*/<>%&^|=!]=|//=?|<<=?|>>=?|\\*\\*=?"),
220229
/* -- */
221-
PATTERNS("ruby", "^[ \t]*((class|module|def)[ \t].*)$",
230+
PATTERNS("ruby",
231+
"^[ \t]*((class|module|def)[ \t].*)$",
222232
/* -- */
223233
"(@|@@|\\$)?[a-zA-Z_][a-zA-Z0-9_]*"
224234
"|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+|\\?(\\\\C-)?(\\\\M-)?."

0 commit comments

Comments
 (0)