]> git.ipfire.org Git - thirdparty/git.git/blobdiff - userdiff.c
Merge branch 'en/merge-ort-api-null-impl'
[thirdparty/git.git] / userdiff.c
index f6a4b0fb2e26916df383dbb74167b3f41b034bc9..3f81a2261c5e97e5cf50c1dc45ed196da8759f69 100644 (file)
@@ -23,6 +23,27 @@ IPATTERN("ada",
         "[a-zA-Z][a-zA-Z0-9_]*"
         "|[-+]?[0-9][0-9#_.aAbBcCdDeEfF]*([eE][+-]?[0-9_]+)?"
         "|=>|\\.\\.|\\*\\*|:=|/=|>=|<=|<<|>>|<>"),
+PATTERNS("bash",
+        /* Optional leading indentation */
+        "^[ \t]*"
+        /* Start of captured text */
+        "("
+        "("
+            /* POSIX identifier with mandatory parentheses */
+            "[a-zA-Z_][a-zA-Z0-9_]*[ \t]*\\([ \t]*\\))"
+        "|"
+            /* Bashism identifier with optional parentheses */
+            "(function[ \t]+[a-zA-Z_][a-zA-Z0-9_]*(([ \t]*\\([ \t]*\\))|([ \t]+))"
+        ")"
+        /* Optional whitespace */
+        "[ \t]*"
+        /* Compound command starting with `{`, `(`, `((` or `[[` */
+        "(\\{|\\(\\(?|\\[\\[)"
+        /* End of captured text */
+        ")",
+        /* -- */
+        /* Characters not in the default $IFS value */
+        "[^ \t]+"),
 PATTERNS("dts",
         "!;\n"
         "!=\n"
@@ -147,7 +168,7 @@ PATTERNS("perl",
         "|=~|!~"
         "|<<|<>|<=>|>>"),
 PATTERNS("php",
-        "^[\t ]*(((public|protected|private|static)[\t ]+)*function.*)$\n"
+        "^[\t ]*(((public|protected|private|static|abstract|final)[\t ]+)*function.*)$\n"
         "^[\t ]*((((final|abstract)[\t ]+)?class|interface|trait).*)$",
         /* -- */
         "[a-zA-Z_][a-zA-Z0-9_]*"
@@ -165,7 +186,7 @@ PATTERNS("ruby", "^[ \t]*((class|module|def)[ \t].*)$",
         "|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+|\\?(\\\\C-)?(\\\\M-)?."
         "|//=?|[-+*/<>%&^|=!]=|<<=?|>>=?|===|\\.{1,3}|::|[!=]~"),
 PATTERNS("rust",
-        "^[\t ]*((pub(\\([^\\)]+\\))?[\t ]+)?((async|const|unsafe|extern([\t ]+\"[^\"]+\"))[\t ]+)?(struct|enum|union|mod|trait|fn|impl)[< \t]+[^;]*)$",
+        "^[\t ]*((pub(\\([^\\)]+\\))?[\t ]+)?((async|const|unsafe|extern([\t ]+\"[^\"]+\"))[\t ]+)?(struct|enum|union|mod|trait|fn|impl|macro_rules!)[< \t]+[^;]*)$",
         /* -- */
         "[a-zA-Z_][a-zA-Z0-9_]*"
         "|[0-9][0-9_a-fA-Fiosuxz]*(\\.([0-9]*[eE][+-]?)?[0-9_fF]*)?"