diff options
author | Kruti Shah | 2012-07-17 12:40:00 -0700 |
---|---|---|
committer | Kruti Shah | 2012-07-17 12:40:00 -0700 |
commit | bf2d7bdb22c28089dc1067bc9094ebc590daac87 (patch) | |
tree | 2156d9920ea1b7db49ed6460545fea7cda121bae /imports/codemirror/mode/python | |
parent | 7e2c2dbd040ed79a3f0678f91bd4b6db9cf69231 (diff) | |
parent | b4b3e45d6684e77d361b4f8ca5be4889428320c5 (diff) | |
download | ninja-bf2d7bdb22c28089dc1067bc9094ebc590daac87.tar.gz |
Merge branch 'refs/heads/TimelineUberJD' into Timeline-local-kruti
Diffstat (limited to 'imports/codemirror/mode/python')
-rw-r--r-- | imports/codemirror/mode/python/python.js | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/imports/codemirror/mode/python/python.js b/imports/codemirror/mode/python/python.js index cfe8a774..d6888e8e 100644 --- a/imports/codemirror/mode/python/python.js +++ b/imports/codemirror/mode/python/python.js | |||
@@ -249,32 +249,30 @@ CodeMirror.defineMode("python", function(conf, parserConf) { | |||
249 | 249 | ||
250 | // Handle '.' connected identifiers | 250 | // Handle '.' connected identifiers |
251 | if (current === '.') { | 251 | if (current === '.') { |
252 | style = state.tokenize(stream, state); | 252 | style = stream.match(identifiers, false) ? null : ERRORCLASS; |
253 | current = stream.current(); | 253 | if (style === null && state.lastToken === 'meta') { |
254 | if (style === 'variable' || style === 'builtin') { | 254 | // Apply 'meta' style to '.' connected identifiers when |
255 | return 'variable'; | 255 | // appropriate. |
256 | } else { | 256 | style = 'meta'; |
257 | return ERRORCLASS; | ||
258 | } | 257 | } |
258 | return style; | ||
259 | } | 259 | } |
260 | 260 | ||
261 | // Handle decorators | 261 | // Handle decorators |
262 | if (current === '@') { | 262 | if (current === '@') { |
263 | style = state.tokenize(stream, state); | 263 | return stream.match(identifiers, false) ? 'meta' : ERRORCLASS; |
264 | current = stream.current(); | 264 | } |
265 | if (style === 'variable' | 265 | |
266 | || current === '@staticmethod' | 266 | if ((style === 'variable' || style === 'builtin') |
267 | || current === '@classmethod') { | 267 | && state.lastToken === 'meta') { |
268 | return 'meta'; | 268 | style = 'meta'; |
269 | } else { | ||
270 | return ERRORCLASS; | ||
271 | } | ||
272 | } | 269 | } |
273 | 270 | ||
274 | // Handle scope changes. | 271 | // Handle scope changes. |
275 | if (current === 'pass' || current === 'return') { | 272 | if (current === 'pass' || current === 'return') { |
276 | state.dedent += 1; | 273 | state.dedent += 1; |
277 | } | 274 | } |
275 | if (current === 'lambda') state.lambda = true; | ||
278 | if ((current === ':' && !state.lambda && state.scopes[0].type == 'py') | 276 | if ((current === ':' && !state.lambda && state.scopes[0].type == 'py') |
279 | || indentInfo === 'indent') { | 277 | || indentInfo === 'indent') { |
280 | indent(stream, state); | 278 | indent(stream, state); |
@@ -316,7 +314,7 @@ CodeMirror.defineMode("python", function(conf, parserConf) { | |||
316 | token: function(stream, state) { | 314 | token: function(stream, state) { |
317 | var style = tokenLexer(stream, state); | 315 | var style = tokenLexer(stream, state); |
318 | 316 | ||
319 | state.lastToken = {style:style, content: stream.current()}; | 317 | state.lastToken = style; |
320 | 318 | ||
321 | if (stream.eol() && stream.lambda) { | 319 | if (stream.eol() && stream.lambda) { |
322 | state.lambda = false; | 320 | state.lambda = false; |