codemirror 3.18 with enabled the fullscreen addon

This commit is contained in:
Paolo
2013-09-26 21:52:53 +02:00
parent 633acffd28
commit ddf1998d49
166 changed files with 3820 additions and 2321 deletions

View File

@@ -36,6 +36,12 @@ CodeMirror.defineMode("python", function(conf, parserConf) {
var py3 = {'builtins': ['ascii', 'bytes', 'exec', 'print'],
'keywords': ['nonlocal', 'False', 'True', 'None']};
if(parserConf.extra_keywords != undefined){
commonkeywords = commonkeywords.concat(parserConf.extra_keywords);
}
if(parserConf.extra_builtins != undefined){
commonBuiltins = commonBuiltins.concat(parserConf.extra_builtins);
}
if (!!parserConf.version && parseInt(parserConf.version, 10) === 3) {
commonkeywords = commonkeywords.concat(py3.keywords);
commonBuiltins = commonBuiltins.concat(py3.builtins);
@@ -145,6 +151,9 @@ CodeMirror.defineMode("python", function(conf, parserConf) {
}
if (stream.match(identifiers)) {
if (state.lastToken == 'def' || state.lastToken == 'class') {
return 'def';
}
return 'variable';
}
@@ -252,7 +261,7 @@ CodeMirror.defineMode("python", function(conf, parserConf) {
// Handle '.' connected identifiers
if (current === '.') {
style = stream.match(identifiers, false) ? null : ERRORCLASS;
if (style === null && state.lastToken === 'meta') {
if (style === null && state.lastStyle === 'meta') {
// Apply 'meta' style to '.' connected identifiers when
// appropriate.
style = 'meta';
@@ -266,7 +275,7 @@ CodeMirror.defineMode("python", function(conf, parserConf) {
}
if ((style === 'variable' || style === 'builtin')
&& state.lastToken === 'meta') {
&& state.lastStyle === 'meta') {
style = 'meta';
}
@@ -307,6 +316,7 @@ CodeMirror.defineMode("python", function(conf, parserConf) {
return {
tokenize: tokenBase,
scopes: [{offset:basecolumn || 0, type:'py'}],
lastStyle: null,
lastToken: null,
lambda: false,
dedent: 0
@@ -316,12 +326,16 @@ CodeMirror.defineMode("python", function(conf, parserConf) {
token: function(stream, state) {
var style = tokenLexer(stream, state);
state.lastToken = style;
state.lastStyle = style;
if (stream.eol() && stream.lambda) {
state.lambda = false;
var current = stream.current();
if (current && style) {
state.lastToken = current;
}
if (stream.eol() && state.lambda) {
state.lambda = false;
}
return style;
},
@@ -333,9 +347,22 @@ CodeMirror.defineMode("python", function(conf, parserConf) {
return state.scopes[0].offset;
},
lineComment: "#"
lineComment: "#",
fold: "indent"
};
return external;
});
CodeMirror.defineMIME("text/x-python", "python");
(function() {
"use strict";
var words = function(str){return str.split(' ');};
CodeMirror.defineMIME("text/x-cython", {
name: "python",
extra_keywords: words("by cdef cimport cpdef ctypedef enum except"+
"extern gil include nogil property public"+
"readonly struct union DEF IF ELIF ELSE")
});
})();