Git fork

Merge branch 'ml/userdiff-rust'

The pattern "git diff/grep" use to extract funcname and words
boundary for Rust has been added.

* ml/userdiff-rust:
userdiff: two simplifications of patterns for rust
userdiff: add built-in pattern for rust

+29
+2
Documentation/gitattributes.txt
··· 833 833 834 834 - `ruby` suitable for source code in the Ruby language. 835 835 836 + - `rust` suitable for source code in the Rust language. 837 + 836 838 - `tex` suitable for source code for LaTeX documents. 837 839 838 840
+1
t/t4018-diff-funcname.sh
··· 43 43 php 44 44 python 45 45 ruby 46 + rust 46 47 tex 47 48 custom1 48 49 custom2
+5
t/t4018/rust-fn
··· 1 + pub(self) fn RIGHT<T>(x: &[T]) where T: Debug { 2 + let _ = x; 3 + // a comment 4 + let a = ChangeMe; 5 + }
+5
t/t4018/rust-impl
··· 1 + impl<'a, T: AsRef<[u8]>> std::RIGHT for Git<'a> { 2 + 3 + pub fn ChangeMe(&self) -> () { 4 + } 5 + }
+5
t/t4018/rust-struct
··· 1 + #[derive(Debug)] 2 + pub(super) struct RIGHT<'a> { 3 + name: &'a str, 4 + age: ChangeMe, 5 + }
+5
t/t4018/rust-trait
··· 1 + unsafe trait RIGHT<T> { 2 + fn len(&self) -> u32; 3 + fn ChangeMe(&self, n: u32) -> T; 4 + fn iter<F>(&self, f: F) where F: Fn(T); 5 + }
+6
userdiff.c
··· 135 135 "(@|@@|\\$)?[a-zA-Z_][a-zA-Z0-9_]*" 136 136 "|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+|\\?(\\\\C-)?(\\\\M-)?." 137 137 "|//=?|[-+*/<>%&^|=!]=|<<=?|>>=?|===|\\.{1,3}|::|[!=]~"), 138 + PATTERNS("rust", 139 + "^[\t ]*((pub(\\([^\\)]+\\))?[\t ]+)?((async|const|unsafe|extern([\t ]+\"[^\"]+\"))[\t ]+)?(struct|enum|union|mod|trait|fn|impl)[< \t]+[^;]*)$", 140 + /* -- */ 141 + "[a-zA-Z_][a-zA-Z0-9_]*" 142 + "|[0-9][0-9_a-fA-Fiosuxz]*(\\.([0-9]*[eE][+-]?)?[0-9_fF]*)?" 143 + "|[-+*\\/<>%&^|=!:]=|<<=?|>>=?|&&|\\|\\||->|=>|\\.{2}=|\\.{3}|::"), 138 144 PATTERNS("bibtex", "(@[a-zA-Z]{1,}[ \t]*\\{{0,1}[ \t]*[^ \t\"@',\\#}{~%]*).*$", 139 145 "[={}\"]|[^={}\" \t]+"), 140 146 PATTERNS("tex", "^(\\\\((sub)*section|chapter|part)\\*{0,1}\\{.*)$",