aboutsummaryrefslogtreecommitdiff
path: root/imports/codemirror/mode/python
diff options
context:
space:
mode:
authorAnanya Sen2012-07-16 16:04:05 -0700
committerAnanya Sen2012-07-16 16:04:05 -0700
commit0e04fff0ea80fa5cbe96b8354db38bd334aea83a (patch)
tree212d164c0f83d80394e34f1df532ea0461ad328d /imports/codemirror/mode/python
parent5146f224258929415adf4a8022e492454b4e2476 (diff)
downloadninja-0e04fff0ea80fa5cbe96b8354db38bd334aea83a.tar.gz
upgrade to codemirror 2.3
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com> Conflicts: js/code-editor/codemirror-ninja/theme/lesser-dark-ninja.css Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'imports/codemirror/mode/python')
-rw-r--r--imports/codemirror/mode/python/python.js30
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;