From c2805e03c84b6e598556fd06d1ede7aaeea7ce9c Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 6 Mar 2012 16:17:54 -0800 Subject: 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 --- imports/codemirror/mode/ruby/LICENSE | 0 imports/codemirror/mode/ruby/index.html | 0 imports/codemirror/mode/ruby/ruby.js | 17 +++++++++++------ 3 files changed, 11 insertions(+), 6 deletions(-) mode change 100755 => 100644 imports/codemirror/mode/ruby/LICENSE mode change 100755 => 100644 imports/codemirror/mode/ruby/index.html mode change 100755 => 100644 imports/codemirror/mode/ruby/ruby.js (limited to 'imports/codemirror/mode/ruby') diff --git a/imports/codemirror/mode/ruby/LICENSE b/imports/codemirror/mode/ruby/LICENSE old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/ruby/index.html b/imports/codemirror/mode/ruby/index.html old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/ruby/ruby.js b/imports/codemirror/mode/ruby/ruby.js old mode 100755 new mode 100644 index ddc1a654..b647efd0 --- a/imports/codemirror/mode/ruby/ruby.js +++ b/imports/codemirror/mode/ruby/ruby.js @@ -13,7 +13,7 @@ CodeMirror.defineMode("ruby", function(config, parserConfig) { "require_relative", "extend", "autoload" ]); var indentWords = wordObj(["def", "class", "case", "for", "while", "do", "module", "then", - "unless", "catch", "loop", "proc"]); + "catch", "loop", "proc", "begin"]); var dedentWords = wordObj(["end", "until"]); var matching = {"[": "]", "{": "}", "(": ")"}; var curPunc; @@ -31,8 +31,9 @@ CodeMirror.defineMode("ruby", function(config, parserConfig) { } if (stream.eatSpace()) return null; var ch = stream.next(); - if (ch == "`" || ch == "'" || ch == '"' || ch == "/") { - return chain(readQuoted(ch, "string", ch == '"'), stream, state); + if (ch == "`" || ch == "'" || ch == '"' || + (ch == "/" && !stream.eol() && stream.peek() != " ")) { + return chain(readQuoted(ch, "string", ch == '"' || ch == "`"), stream, state); } else if (ch == "%") { var style, embed = false; if (stream.eat("s")) style = "atom"; @@ -165,7 +166,8 @@ CodeMirror.defineMode("ruby", function(config, parserConfig) { : "variable"; if (indentWords.propertyIsEnumerable(word)) kwtype = "indent"; else if (dedentWords.propertyIsEnumerable(word)) kwtype = "dedent"; - else if (word == "if" && stream.column() == stream.indentation()) kwtype = "indent"; + else if ((word == "if" || word == "unless") && stream.column() == stream.indentation()) + kwtype = "indent"; } if (curPunc || (style && style != "comment")) state.lastTok = word || curPunc || style; if (curPunc == "|") state.varList = !state.varList; @@ -185,11 +187,14 @@ CodeMirror.defineMode("ruby", function(config, parserConfig) { var firstChar = textAfter && textAfter.charAt(0); var ct = state.context; var closing = ct.type == matching[firstChar] || - ct.type == "keyword" && /^(?:end|until|else|elsif|when)\b/.test(textAfter); + ct.type == "keyword" && /^(?:end|until|else|elsif|when|rescue)\b/.test(textAfter); return ct.indented + (closing ? 0 : config.indentUnit) + (state.continuedLine ? config.indentUnit : 0); - } + }, + electricChars: "}de" // enD and rescuE + }; }); CodeMirror.defineMIME("text/x-ruby", "ruby"); + -- cgit v1.2.3