diff options
author | Valerio Virgillito | 2012-03-06 16:17:54 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-03-06 16:17:54 -0800 |
commit | c2805e03c84b6e598556fd06d1ede7aaeea7ce9c (patch) | |
tree | b033421762f5e0fedbc8700bfc1f175c7c5cabcf /imports/codemirror/mode/ruby | |
parent | 1cd89d4d06e3a8f2c221628b19cf26a2c69f5d3f (diff) | |
download | ninja-c2805e03c84b6e598556fd06d1ede7aaeea7ce9c.tar.gz |
Squashed commit FileIO-Build-Candidate into Master
Fixing issues with HTML and CSS URLs. Adjusted RegEx logic. Also code a mirror update and undo/redo changes were merged into this request.
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'imports/codemirror/mode/ruby')
-rw-r--r--[-rwxr-xr-x] | imports/codemirror/mode/ruby/LICENSE | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | imports/codemirror/mode/ruby/index.html | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | imports/codemirror/mode/ruby/ruby.js | 17 |
3 files changed, 11 insertions, 6 deletions
diff --git a/imports/codemirror/mode/ruby/LICENSE b/imports/codemirror/mode/ruby/LICENSE index ac09fc40..ac09fc40 100755..100644 --- a/imports/codemirror/mode/ruby/LICENSE +++ b/imports/codemirror/mode/ruby/LICENSE | |||
diff --git a/imports/codemirror/mode/ruby/index.html b/imports/codemirror/mode/ruby/index.html index 6d33db19..6d33db19 100755..100644 --- a/imports/codemirror/mode/ruby/index.html +++ b/imports/codemirror/mode/ruby/index.html | |||
diff --git a/imports/codemirror/mode/ruby/ruby.js b/imports/codemirror/mode/ruby/ruby.js index ddc1a654..b647efd0 100755..100644 --- a/imports/codemirror/mode/ruby/ruby.js +++ b/imports/codemirror/mode/ruby/ruby.js | |||
@@ -13,7 +13,7 @@ CodeMirror.defineMode("ruby", function(config, parserConfig) { | |||
13 | "require_relative", "extend", "autoload" | 13 | "require_relative", "extend", "autoload" |
14 | ]); | 14 | ]); |
15 | var indentWords = wordObj(["def", "class", "case", "for", "while", "do", "module", "then", | 15 | var indentWords = wordObj(["def", "class", "case", "for", "while", "do", "module", "then", |
16 | "unless", "catch", "loop", "proc"]); | 16 | "catch", "loop", "proc", "begin"]); |
17 | var dedentWords = wordObj(["end", "until"]); | 17 | var dedentWords = wordObj(["end", "until"]); |
18 | var matching = {"[": "]", "{": "}", "(": ")"}; | 18 | var matching = {"[": "]", "{": "}", "(": ")"}; |
19 | var curPunc; | 19 | var curPunc; |
@@ -31,8 +31,9 @@ CodeMirror.defineMode("ruby", function(config, parserConfig) { | |||
31 | } | 31 | } |
32 | if (stream.eatSpace()) return null; | 32 | if (stream.eatSpace()) return null; |
33 | var ch = stream.next(); | 33 | var ch = stream.next(); |
34 | if (ch == "`" || ch == "'" || ch == '"' || ch == "/") { | 34 | if (ch == "`" || ch == "'" || ch == '"' || |
35 | return chain(readQuoted(ch, "string", ch == '"'), stream, state); | 35 | (ch == "/" && !stream.eol() && stream.peek() != " ")) { |
36 | return chain(readQuoted(ch, "string", ch == '"' || ch == "`"), stream, state); | ||
36 | } else if (ch == "%") { | 37 | } else if (ch == "%") { |
37 | var style, embed = false; | 38 | var style, embed = false; |
38 | if (stream.eat("s")) style = "atom"; | 39 | if (stream.eat("s")) style = "atom"; |
@@ -165,7 +166,8 @@ CodeMirror.defineMode("ruby", function(config, parserConfig) { | |||
165 | : "variable"; | 166 | : "variable"; |
166 | if (indentWords.propertyIsEnumerable(word)) kwtype = "indent"; | 167 | if (indentWords.propertyIsEnumerable(word)) kwtype = "indent"; |
167 | else if (dedentWords.propertyIsEnumerable(word)) kwtype = "dedent"; | 168 | else if (dedentWords.propertyIsEnumerable(word)) kwtype = "dedent"; |
168 | else if (word == "if" && stream.column() == stream.indentation()) kwtype = "indent"; | 169 | else if ((word == "if" || word == "unless") && stream.column() == stream.indentation()) |
170 | kwtype = "indent"; | ||
169 | } | 171 | } |
170 | if (curPunc || (style && style != "comment")) state.lastTok = word || curPunc || style; | 172 | if (curPunc || (style && style != "comment")) state.lastTok = word || curPunc || style; |
171 | if (curPunc == "|") state.varList = !state.varList; | 173 | if (curPunc == "|") state.varList = !state.varList; |
@@ -185,11 +187,14 @@ CodeMirror.defineMode("ruby", function(config, parserConfig) { | |||
185 | var firstChar = textAfter && textAfter.charAt(0); | 187 | var firstChar = textAfter && textAfter.charAt(0); |
186 | var ct = state.context; | 188 | var ct = state.context; |
187 | var closing = ct.type == matching[firstChar] || | 189 | var closing = ct.type == matching[firstChar] || |
188 | ct.type == "keyword" && /^(?:end|until|else|elsif|when)\b/.test(textAfter); | 190 | ct.type == "keyword" && /^(?:end|until|else|elsif|when|rescue)\b/.test(textAfter); |
189 | return ct.indented + (closing ? 0 : config.indentUnit) + | 191 | return ct.indented + (closing ? 0 : config.indentUnit) + |
190 | (state.continuedLine ? config.indentUnit : 0); | 192 | (state.continuedLine ? config.indentUnit : 0); |
191 | } | 193 | }, |
194 | electricChars: "}de" // enD and rescuE | ||
195 | |||
192 | }; | 196 | }; |
193 | }); | 197 | }); |
194 | 198 | ||
195 | CodeMirror.defineMIME("text/x-ruby", "ruby"); | 199 | CodeMirror.defineMIME("text/x-ruby", "ruby"); |
200 | |||