vendor/assets/javascripts/codemirror/modes/python.js in codemirror-rails-2.3 vs vendor/assets/javascripts/codemirror/modes/python.js in codemirror-rails-2.21

- old
+ new

@@ -247,34 +247,36 @@ var style = state.tokenize(stream, state); var current = stream.current(); // Handle '.' connected identifiers if (current === '.') { - style = stream.match(identifiers, false) ? null : ERRORCLASS; - if (style === null && state.lastToken === 'meta') { - // Apply 'meta' style to '.' connected identifiers when - // appropriate. - style = 'meta'; + style = state.tokenize(stream, state); + current = stream.current(); + if (style === 'variable' || style === 'builtin') { + return 'variable'; + } else { + return ERRORCLASS; } - return style; } // Handle decorators if (current === '@') { - return stream.match(identifiers, false) ? 'meta' : ERRORCLASS; + style = state.tokenize(stream, state); + current = stream.current(); + if (style === 'variable' + || current === '@staticmethod' + || current === '@classmethod') { + return 'meta'; + } else { + return ERRORCLASS; + } } - - if ((style === 'variable' || style === 'builtin') - && state.lastToken === 'meta') { - style = 'meta'; - } // Handle scope changes. if (current === 'pass' || current === 'return') { state.dedent += 1; } - if (current === 'lambda') state.lambda = true; if ((current === ':' && !state.lambda && state.scopes[0].type == 'py') || indentInfo === 'indent') { indent(stream, state); } var delimiter_index = '[({'.indexOf(current); @@ -312,10 +314,10 @@ }, token: function(stream, state) { var style = tokenLexer(stream, state); - state.lastToken = style; + state.lastToken = {style:style, content: stream.current()}; if (stream.eol() && stream.lambda) { state.lambda = false; }