@@ -28,7 +28,8 @@ CodeMirror.defineMode("ruby", function(config) {
2828 var indentWords = wordObj ( [ "def" , "class" , "case" , "for" , "while" , "until" , "module" , "then" ,
2929 "catch" , "loop" , "proc" , "begin" ] ) ;
3030 var dedentWords = wordObj ( [ "end" , "until" ] ) ;
31- var matching = { "[" : "]" , "{" : "}" , "(" : ")" } ;
31+ var opening = { "[" : "]" , "{" : "}" , "(" : ")" } ;
32+ var closing = { "]" : "[" , "}" : "{" , ")" : "(" } ;
3233 var curPunc ;
3334
3435 function chain ( newtok , stream , state ) {
@@ -58,7 +59,7 @@ CodeMirror.defineMode("ruby", function(config) {
5859 else if ( stream . eat ( / [ w x q ] / ) ) { style = "string" ; embed = false ; }
5960 var delim = stream . eat ( / [ ^ \w \s = ] / ) ;
6061 if ( ! delim ) return "operator" ;
61- if ( matching . propertyIsEnumerable ( delim ) ) delim = matching [ delim ] ;
62+ if ( opening . propertyIsEnumerable ( delim ) ) delim = opening [ delim ] ;
6263 return chain ( readQuoted ( delim , style , embed , true ) , stream , state ) ;
6364 } else if ( ch == "#" ) {
6465 stream . skipToEnd ( ) ;
@@ -280,9 +281,9 @@ CodeMirror.defineMode("ruby", function(config) {
280281 if ( state . tokenize [ state . tokenize . length - 1 ] != tokenBase ) return CodeMirror . Pass ;
281282 var firstChar = textAfter && textAfter . charAt ( 0 ) ;
282283 var ct = state . context ;
283- var closing = ct . type == matching [ firstChar ] ||
284+ var closed = ct . type == closing [ firstChar ] ||
284285 ct . type == "keyword" && / ^ (?: e n d | u n t i l | e l s e | e l s i f | w h e n | r e s c u e ) \b / . test ( textAfter ) ;
285- return ct . indented + ( closing ? 0 : config . indentUnit ) +
286+ return ct . indented + ( closed ? 0 : config . indentUnit ) +
286287 ( state . continuedLine ? config . indentUnit : 0 ) ;
287288 } ,
288289
0 commit comments