summaryrefslogtreecommitdiff
path: root/src/userdiff.h
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2014-01-27 11:45:06 -0800
committerRussell Belfer <rb@github.com>2014-01-27 11:45:06 -0800
commit082e82dba5b5174756b3a5fc2e385ccc59626164 (patch)
tree9191ea9e222c54163c275e1179600b02ebe264b2 /src/userdiff.h
parent4115987739fb9cc4dd82edd9998db6dbb6bc9d95 (diff)
downloadlibgit2-082e82dba5b5174756b3a5fc2e385ccc59626164.tar.gz
Update Javascript userdiff driver and tests
Writing a sample Javascript driver pointed out some extra whitespace handling that needed to be done in the diff driver. This adds some tests with some sample javascript code that I pulled off of GitHub just to see what would happen. Also, to clean up the userdiff test data, I did a "git gc" and packed up the test objects.
Diffstat (limited to 'src/userdiff.h')
-rw-r--r--src/userdiff.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/userdiff.h b/src/userdiff.h
index 93b4d0d58..2257035ac 100644
--- a/src/userdiff.h
+++ b/src/userdiff.h
@@ -193,9 +193,9 @@ PATTERNS("php",
"|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"),
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\(].*)$",
+ "^[ \t]*(function[ \t][a-zA-Z_][^\{]*)\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]?"