Commit 92bede234b5dee0450176d73f622f138514957c3

Rose 2013-01-27T19:47:43

Reorganized code

diff --git a/components/prism-coffeescript.js b/components/prism-coffeescript.js
index 6e80608..6f47888 100644
--- a/components/prism-coffeescript.js
+++ b/components/prism-coffeescript.js
@@ -1,23 +1,18 @@
 Prism.languages.coffeescript = Prism.languages.extend('javascript', {
+  'block-comment': /([#]{3}\s*\r?\n(.*\s*\r*\n*)\s*?\r?\n[#]{3})/g,
+  'comment': /(\s|^)([#]{1}[^#^\r^\n]{2,}?(\r?\n|$))/g,
   'keyword': /\b(this|window|delete|class|extends|namespace|extend|ar|let|if|else|while|do|for|each|of|return|in|instanceof|new|with|typeof|try|catch|finally|null|undefined|break|continue)\b/g,
 });
 
 Prism.languages.insertBefore('coffeescript', 'keyword', {
-
-  'block-comment': /([#]{3}\s*\r?\n(.*\s*\r*\n*)\s*?\r?\n[#]{3})/g,
-
-  'comment': /([#]{1}[^#^\r^\n]{2,}?(\r?\n|$))/g,
-
   'function': {
-    pattern: /[a-z|A-z]+\s*:\s*(\([.|a-z\s|,|:|{|}|\"|\'|=]*\))?\s*->/gi,
+    pattern: /[a-z|A-z]+\s*[:|=]\s*(\([.|a-z\s|,|:|{|}|\"|\'|=]*\))?\s*->/gi,
     inside: {
-      'function-name': /[_?a-z-|A-Z-]+(\s*:)| @[_?$?a-z-|A-Z-]+(\s*)| /g,
+      'function-name': /[_?a-z-|A-Z-]+(\s*[:|=])| @[_?$?a-z-|A-Z-]+(\s*)| /g,
       'operator': /[-+]{1,2}|!|=?<|=?>|={1,2}|(&){1,2}|\|?\||\?|\*|\//g
     }
   },
 
-  'string': /("|')(\\?.)*?\1/g,
-
   'class-name': {
     pattern: /(class\s+)[a-z-]+[\.a-z]*\s/gi,
     lookbehind: true
diff --git a/components/prism-coffeescript.min.js b/components/prism-coffeescript.min.js
index 73f8814..31ce7cb 100644
--- a/components/prism-coffeescript.min.js
+++ b/components/prism-coffeescript.min.js
@@ -1 +1 @@
-Prism.languages.coffeescript=Prism.languages.extend("javascript",{keyword:/\b(this|window|delete|class|extends|namespace|extend|ar|let|if|else|while|do|for|each|of|return|in|instanceof|new|with|typeof|try|catch|finally|null|undefined|break|continue)\b/g});Prism.languages.insertBefore("coffeescript","keyword",{"block-comment":/([#]{3}\s*\r?\n(.*\s*\r*\n*)\s*?\r?\n[#]{3})/g,comment:/([#]{1}[^#^\r^\n]{2,}?(\r?\n|$))/g,"function":{pattern:/[a-z|A-z]+\s*:\s*(\([.|a-z\s|,|:|{|}|\"|\'|=]*\))?\s*->/gi,inside:{"function-name":/[_?a-z-|A-Z-]+(\s*:)| @[_?$?a-z-|A-Z-]+(\s*)| /g,operator:/[-+]{1,2}|!|=?<|=?>|={1,2}|(&){1,2}|\|?\||\?|\*|\//g}},string:/("|')(\\?.)*?\1/g,"class-name":{pattern:/(class\s+)[a-z-]+[\.a-z]*\s/gi,lookbehind:true},"attr-name":/[_?a-z-|A-Z-]+(\s*:)| @[_?$?a-z-|A-Z-]+(\s*)| /g})
+Prism.languages.coffeescript=Prism.languages.extend("javascript",{"block-comment":/([#]{3}\s*\r?\n(.*\s*\r*\n*)\s*?\r?\n[#]{3})/g,comment:/(\s|^)([#]{1}[^#^\r^\n]{2,}?(\r?\n|$))/g,keyword:/\b(this|window|delete|class|extends|namespace|extend|ar|let|if|else|while|do|for|each|of|return|in|instanceof|new|with|typeof|try|catch|finally|null|undefined|break|continue)\b/g});Prism.languages.insertBefore("coffeescript","keyword",{"function":{pattern:/[a-z|A-z]+\s*[:|=]\s*(\([.|a-z\s|,|:|{|}|\"|\'|=]*\))?\s*->/gi,inside:{"function-name":/[_?a-z-|A-Z-]+(\s*[:|=])| @[_?$?a-z-|A-Z-]+(\s*)| /g,operator:/[-+]{1,2}|!|=?<|=?>|={1,2}|(&){1,2}|\|?\||\?|\*|\//g}},"class-name":{pattern:/(class\s+)[a-z-]+[\.a-z]*\s/gi,lookbehind:true},"attr-name":/[_?a-z-|A-Z-]+(\s*:)| @[_?$?a-z-|A-Z-]+(\s*)| /g})
diff --git a/prism.js b/prism.js
index c88f13f..239c615 100644
--- a/prism.js
+++ b/prism.js
@@ -480,25 +480,20 @@ if (Prism.languages.markup) {
 ********************************************** */
 
 Prism.languages.coffeescript = Prism.languages.extend('javascript', {
+  'block-comment': /([#]{3}\s*\r?\n(.*\s*\r*\n*)\s*?\r?\n[#]{3})/g,
+  'comment': /(\s|^)([#]{1}[^#^\r^\n]{2,}?(\r?\n|$))/g,
   'keyword': /\b(this|window|delete|class|extends|namespace|extend|ar|let|if|else|while|do|for|each|of|return|in|instanceof|new|with|typeof|try|catch|finally|null|undefined|break|continue)\b/g,
 });
 
 Prism.languages.insertBefore('coffeescript', 'keyword', {
-
-	'block-comment': /([#]{3}\s*\r?\n(.*\s*\r*\n*)\s*?\r?\n[#]{3})/g,
-
-  'comment': /([#]{1}[^#^\r^\n]{2,}?(\r?\n|$))/g,
-
   'function': {
-    pattern: /[a-z|A-z]+\s*:\s*(\([.|a-z\s|,|:|{|}|\"|\'|=]*\))?\s*-&gt;/gi,
+    pattern: /[a-z|A-z]+\s*[:|=]\s*(\([.|a-z\s|,|:|{|}|\"|\'|=]*\))?\s*-&gt;/gi,
     inside: {
-      'function-name': /[_?a-z-|A-Z-]+(\s*:)| @[_?$?a-z-|A-Z-]+(\s*)| /g,
+      'function-name': /[_?a-z-|A-Z-]+(\s*[:|=])| @[_?$?a-z-|A-Z-]+(\s*)| /g,
       'operator': /[-+]{1,2}|!|=?&lt;|=?&gt;|={1,2}|(&amp;){1,2}|\|?\||\?|\*|\//g
     }
   },
 
-  'string': /("|')(\\?.)*?\1/g,
-
   'class-name': {
     pattern: /(class\s+)[a-z-]+[\.a-z]*\s/gi,
     lookbehind: true