Merge branch 'bc/fortran-userdiff' into maint

* bc/fortran-userdiff:
  userdiff.c: add builtin fortran regex patterns
This commit is contained in:
Junio C Hamano 2010-12-02 11:25:36 -08:00
Родитель 5501bf854c 909a5494f8
Коммит f3a70e9cc6
3 изменённых файлов: 20 добавлений и 1 удалений

Просмотреть файл

@ -477,6 +477,8 @@ patterns are available:
- `csharp` suitable for source code in the C# language.
- `fortran` suitable for source code in the Fortran language.
- `html` suitable for HTML/XHTML documents.
- `java` suitable for source code in the Java language.

Просмотреть файл

@ -32,7 +32,7 @@ EOF
sed 's/beer\\/beer,\\/' < Beer.java > Beer-correct.java
builtin_patterns="bibtex cpp csharp html java objc pascal php python ruby tex"
builtin_patterns="bibtex cpp csharp fortran html java objc pascal php python ruby tex"
for p in $builtin_patterns
do
test_expect_success "builtin $p pattern compiles" '

Просмотреть файл

@ -9,7 +9,23 @@ static int drivers_alloc;
#define PATTERNS(name, pattern, word_regex) \
{ name, NULL, -1, { pattern, REG_EXTENDED }, word_regex }
#define IPATTERN(name, pattern, word_regex) \
{ name, NULL, -1, { pattern, REG_EXTENDED | REG_ICASE }, word_regex }
static struct userdiff_driver builtin_drivers[] = {
IPATTERN("fortran",
"!^([C*]|[ \t]*!)\n"
"!^[ \t]*MODULE[ \t]+PROCEDURE[ \t]\n"
"^[ \t]*((END[ \t]+)?(PROGRAM|MODULE|BLOCK[ \t]+DATA"
"|([^'\" \t]+[ \t]+)*(SUBROUTINE|FUNCTION))[ \t]+[A-Z].*)$",
/* -- */
"[a-zA-Z][a-zA-Z0-9_]*"
"|\\.([Ee][Qq]|[Nn][Ee]|[Gg][TtEe]|[Ll][TtEe]|[Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee]|[Aa][Nn][Dd]|[Oo][Rr]|[Nn]?[Ee][Qq][Vv]|[Nn][Oo][Tt])\\."
/* numbers and format statements like 2E14.4, or ES12.6, 9X.
* Don't worry about format statements without leading digits since
* they would have been matched above as a variable anyway. */
"|[-+]?[0-9.]+([AaIiDdEeFfLlTtXx][Ss]?[-+]?[0-9.]*)?(_[a-zA-Z0-9][a-zA-Z0-9_]*)?"
"|//|\\*\\*|::|[/<>=]="
"|[^[:space:]]|[\x80-\xff]+"),
PATTERNS("html", "^[ \t]*(<[Hh][1-6][ \t].*>.*)$",
"[^<>= \t]+|[^[:space:]]|[\x80-\xff]+"),
PATTERNS("java",
@ -101,6 +117,7 @@ PATTERNS("csharp",
{ "default", NULL, -1, { NULL, 0 } },
};
#undef PATTERNS
#undef IPATTERN
static struct userdiff_driver driver_true = {
"diff=true",