Git: Regexp optimisation
diff --git a/components/prism-git.js b/components/prism-git.js
index e5cc4ce..54f5ea7 100644
--- a/components/prism-git.js
+++ b/components/prism-git.js
@@ -19,7 +19,7 @@ Prism.languages.git = {
/*
* a string (double and simple quote)
*/
- 'string': /("|')(\\?.)*?\1/m,
+ 'string': /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/m,
/*
* a git command. It starts with a random prompt finishing by a $, then "git" then some other parameters
@@ -35,7 +35,7 @@ Prism.languages.git = {
* $ git diff --cached
* $ git log -p
*/
- 'parameter': /\s(--|-)\w+/m
+ 'parameter': /\s--?\w+/m
}
},
diff --git a/components/prism-git.min.js b/components/prism-git.min.js
index e4b5da4..8166591 100644
--- a/components/prism-git.min.js
+++ b/components/prism-git.min.js
@@ -1 +1 @@
-Prism.languages.git={comment:/^#.*/m,deleted:/^[-–].*/m,inserted:/^\+.*/m,string:/("|')(\\?.)*?\1/m,command:{pattern:/^.*\$ git .*$/m,inside:{parameter:/\s(--|-)\w+/m}},coord:/^@@.*@@$/m,commit_sha1:/^commit \w{40}$/m};
\ No newline at end of file
+Prism.languages.git={comment:/^#.*/m,deleted:/^[-–].*/m,inserted:/^\+.*/m,string:/("|')(?:\\.|(?!\1)[^\\\r\n])*\1/m,command:{pattern:/^.*\$ git .*$/m,inside:{parameter:/\s--?\w+/m}},coord:/^@@.*@@$/m,commit_sha1:/^commit \w{40}$/m};
\ No newline at end of file