]> git.ipfire.org Git - thirdparty/git.git/blobdiff - userdiff.c
userdiff: add built-in pattern for golang
[thirdparty/git.git] / userdiff.c
index dbfb4e13cddceaa44feee51016c9b837f7f4fce1..8f5028f6b25eb570aedb9763f2456442b2e4a1aa 100644 (file)
@@ -38,6 +38,15 @@ IPATTERN("fortran",
         "|//|\\*\\*|::|[/<>=]="),
 IPATTERN("fountain", "^((\\.[^.]|(int|ext|est|int\\.?/ext|i/e)[. ]).*)$",
         "[^ \t-]+"),
+PATTERNS("golang",
+        /* Functions */
+        "^[ \t]*(func[ \t]*.*(\\{[ \t]*)?)\n"
+        /* Structs and interfaces */
+        "^[ \t]*(type[ \t].*(struct|interface)[ \t]*(\\{[ \t]*)?)",
+        /* -- */
+        "[a-zA-Z_][a-zA-Z0-9_]*"
+        "|[-+0-9.eE]+i?|0[xX]?[0-9a-fA-F]+i?"
+        "|[-+*/<>%&^|=!:]=|--|\\+\\+|<<=?|>>=?|&\\^=?|&&|\\|\\||<-|\\.{3}"),
 PATTERNS("html", "^[ \t]*(<[Hh][1-6]([ \t].*)?>.*)$",
         "[^<>= \t]+"),
 PATTERNS("java",