diff options
author | Russell Belfer <rb@github.com> | 2014-01-24 15:46:15 -0800 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2014-01-24 15:46:15 -0800 |
commit | 7cc001cefb787ddacb53c74a94173674ac6bd587 (patch) | |
tree | f29ba707420f72ca4300f11090858208d9deea81 /src | |
parent | 027b8edac7e91480623815193ed994db808064f6 (diff) | |
download | libgit2-7cc001cefb787ddacb53c74a94173674ac6bd587.tar.gz |
Add PHP and Javascript diff drivers
Since I don't have permission yet on the code from Git, I decided
I'd take a stab at writing patterns for PHP and Javascript myself.
I think these are pretty weak, but probably better than the
default behavior without them.
Diffstat (limited to 'src')
-rw-r--r-- | src/userdiff.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/userdiff.h b/src/userdiff.h index 1f2318507..318761567 100644 --- a/src/userdiff.h +++ b/src/userdiff.h @@ -180,6 +180,22 @@ PATTERNS("csharp", "[a-zA-Z_][a-zA-Z0-9_]*" "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?" "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"), + +PATTERNS("php", + "^[ \t]*((public|private|protected|static|final)[ \t]+)*((class|function)[ \t].*)$", + /* -- */ + "[a-zA-Z_][a-zA-Z0-9_]*" + "|[-+0-9.e]+[fFlL]?|0[xX]?[0-9a-fA-F]+[lL]?" + "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"), + +PATTERNS("javascript", + "^[ \t]*(\(?function[ \t].*)$\n" + "^[ \t]*(var[ \t]+[a-zA-Z_][a-zA-Z0-9_]*[ \t]*=[ \t]*function[ \t\(].*)$\n" + "^[ \t]*([a-zA-Z_][a-zA-Z0-9_]*[ \t]*:[ \t]*function[ \t\(].*)$", + /* -- */ + "[a-zA-Z_][a-zA-Z0-9_]*" + "|[-+0-9.e]+[fFlL]?|0[xX]?[0-9a-fA-F]+[lL]?" + "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"), }; #undef IPATTERN |