summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Schreiber <schreiber.arthur@googlemail.com>2014-10-09 22:21:34 +0200
committerArthur Schreiber <schreiber.arthur@googlemail.com>2014-10-09 22:21:34 +0200
commit994a3006b61e0a729569770de51d5c13af6a23ed (patch)
tree6caea979dba9444c215ea6c6554419bf009dd682
parent19fa9c0ca018ccc00299222e015a182e73816dc1 (diff)
downloadlibgit2-994a3006b61e0a729569770de51d5c13af6a23ed.tar.gz
Update the javascript diff driver's function pattern.
-rw-r--r--src/userdiff.h6
-rw-r--r--tests/resources/userdiff/expected/driver/diff.javascript6
2 files changed, 6 insertions, 6 deletions
diff --git a/src/userdiff.h b/src/userdiff.h
index 523f2f8d4..91c1f42dc 100644
--- a/src/userdiff.h
+++ b/src/userdiff.h
@@ -191,9 +191,9 @@ PATTERNS("php",
"|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"),
PATTERNS("javascript",
- "^[ \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_$]*(\\.[a-zA-Z0-9_$]+)*[ \t]*=[ \t]*function([ \t][a-zA-Z_$][a-zA-Z0-9_$]*)?[^\\{]*)\n"
+ "([a-zA-Z_$][a-zA-Z0-9_$]*[ \t]*:[ \t]*function([ \t][a-zA-Z_$][a-zA-Z0-9_$]*)?[^\\{]*)\n"
+ "[^a-zA-Z0-9_\\$](function([ \t][a-zA-Z_$][a-zA-Z0-9_$]*)?[^\\{]*)",
/* -- */
"[a-zA-Z_][a-zA-Z0-9_]*"
"|[-+0-9.e]+[fFlL]?|0[xX]?[0-9a-fA-F]+[lL]?"
diff --git a/tests/resources/userdiff/expected/driver/diff.javascript b/tests/resources/userdiff/expected/driver/diff.javascript
index 44ea9cf77..4cefe5cff 100644
--- a/tests/resources/userdiff/expected/driver/diff.javascript
+++ b/tests/resources/userdiff/expected/driver/diff.javascript
@@ -2,7 +2,7 @@ diff --git a/files/file.javascript b/files/file.javascript
index 0965b37..5391797 100644
--- a/files/file.javascript
+++ b/files/file.javascript
-@@ -4,4 +4,3 @@
+@@ -4,4 +4,3 @@ function(require, exports, module)
var Key = require("./key")
- , Direction = require("./direction")
- , Image = require("./image");
@@ -15,12 +15,12 @@ index 0965b37..5391797 100644
+ this.pixelX = 10;
+ this.pixelY = 10;
-@@ -82,3 +81,3 @@ function Player(game)
+@@ -82,3 +81,3 @@ Player.prototype.moveUp = function()
Player.prototype.moveLeft = function() {
- this.x -= 1;
+ this.x -= 5;
this.direction = Direction.LEFT;
-@@ -106,3 +105,3 @@ function Player(game)
+@@ -106,3 +105,3 @@ Player.prototype.draw = function(context)
- context.drawImage(this.image.data, offsetX, offsetY, 32, 48, this.pixelX, this.pixelY - 16, 32, 48);
+ context.drawImage(this.image.data, offsetX, offsetY, 32, 48, this.pixelX, this.pixelY, 32, 48);