Vergleich admin/jscripts/codemirror/mode/javascript/javascript.js - 1.8.0 - 1.8.10

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 19Zeile 19
  var jsonldMode = parserConfig.jsonld;
var jsonMode = parserConfig.json || jsonldMode;
var isTS = parserConfig.typescript;

  var jsonldMode = parserConfig.jsonld;
var jsonMode = parserConfig.json || jsonldMode;
var isTS = parserConfig.typescript;

 
  var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/;


// Tokenizer



// Tokenizer


Zeile 132Zeile 133
    } else if (isOperatorChar.test(ch)) {
stream.eatWhile(isOperatorChar);
return ret("operator", "operator", stream.current());

    } else if (isOperatorChar.test(ch)) {
stream.eatWhile(isOperatorChar);
return ret("operator", "operator", stream.current());

    } else {
stream.eatWhile(/[\w\$_]/);

    } else if (wordRE.test(ch)) {
stream.eatWhile(wordRE);

      var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
return (known && state.lastType != ".") ? ret(known.type, known.style, word) :
ret("variable", "variable", word);

      var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
return (known && state.lastType != ".") ? ret(known.type, known.style, word) :
ret("variable", "variable", word);

Zeile 202Zeile 203
        if (--depth == 0) break;
} else if (bracket >= 3 && bracket < 6) {
++depth;

        if (--depth == 0) break;
} else if (bracket >= 3 && bracket < 6) {
++depth;

      } else if (/[$\w]/.test(ch)) {

      } else if (wordRE.test(ch)) {

        sawSomething = true;

        sawSomething = true;

 
      } else if (/["'\/]/.test(ch)) {
return;

      } else if (sawSomething && !depth) {
++pos;
break;

      } else if (sawSomething && !depth) {
++pos;
break;

Zeile 298Zeile 301
    var result = function() {
var state = cx.state, indent = state.indented;
if (state.lexical.type == "stat") indent = state.lexical.indented;

    var result = function() {
var state = cx.state, indent = state.indented;
if (state.lexical.type == "stat") indent = state.lexical.indented;

 
      else for (var outer = state.lexical; outer && outer.type == ")" && outer.align; outer = outer.prev)
indent = outer.indented;

      state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info);
};
result.lex = true;

      state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info);
};
result.lex = true;

Zeile 388Zeile 393
  function maybeoperatorNoComma(type, value, noComma) {
var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;
var expr = noComma == false ? expression : expressionNoComma;

  function maybeoperatorNoComma(type, value, noComma) {
var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;
var expr = noComma == false ? expression : expressionNoComma;

    if (value == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);

    if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);

    if (type == "operator") {
if (/\+\+|--/.test(value)) return cont(me);
if (value == "?") return cont(expression, expect(":"), expr);

    if (type == "operator") {
if (/\+\+|--/.test(value)) return cont(me);
if (value == "?") return cont(expression, expect(":"), expr);

Zeile 414Zeile 419
  }
function arrowBody(type) {
findFatArrow(cx.stream, cx.state);

  }
function arrowBody(type) {
findFatArrow(cx.stream, cx.state);

    if (type == "{") return pass(statement);
return pass(expression);

    return pass(type == "{" ? statement : expression);


  }
function arrowBodyNoComma(type) {
findFatArrow(cx.stream, cx.state);

  }
function arrowBodyNoComma(type) {
findFatArrow(cx.stream, cx.state);

    if (type == "{") return pass(statement);
return pass(expressionNoComma);

    return pass(type == "{" ? statement : expressionNoComma);


  }
function maybelabel(type) {
if (type == ":") return cont(poplex, statement);

  }
function maybelabel(type) {
if (type == ":") return cont(poplex, statement);

Zeile 481Zeile 484
  }
function typedef(type) {
if (type == "variable"){cx.marked = "variable-3"; return cont();}

  }
function typedef(type) {
if (type == "variable"){cx.marked = "variable-3"; return cont();}

  }

  }

  function vardef() {
return pass(pattern, maybetype, maybeAssign, vardefCont);
}

  function vardef() {
return pass(pattern, maybetype, maybeAssign, vardefCont);
}

Zeile 589Zeile 592
  }
function maybeArrayComprehension(type) {
if (type == "for") return pass(comprehension, expect("]"));

  }
function maybeArrayComprehension(type) {
if (type == "for") return pass(comprehension, expect("]"));

    if (type == ",") return cont(commasep(expressionNoComma, "]"));

    if (type == ",") return cont(commasep(maybeexpressionNoComma, "]"));

    return pass(commasep(expressionNoComma, "]"));
}
function comprehension(type) {
if (type == "for") return cont(forspec, comprehension);
if (type == "if") return cont(expression, comprehension);

    return pass(commasep(expressionNoComma, "]"));
}
function comprehension(type) {
if (type == "for") return cont(forspec, comprehension);
if (type == "if") return cont(expression, comprehension);

 
  }

function isContinuedStatement(state, textAfter) {
return state.lastType == "operator" || state.lastType == "," ||
isOperatorChar.test(textAfter.charAt(0)) ||
/[,.]/.test(textAfter.charAt(0));

  }

// Interface

  }

// Interface

Zeile 648Zeile 657
      else if (type == "form" && firstChar == "{") return lexical.indented;
else if (type == "form") return lexical.indented + indentUnit;
else if (type == "stat")

      else if (type == "form" && firstChar == "{") return lexical.indented;
else if (type == "form") return lexical.indented + indentUnit;
else if (type == "stat")

        return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? statementIndent || indentUnit : 0);

        return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0);

      else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false)
return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
else if (lexical.align) return lexical.column + (closing ? 0 : 1);
else return lexical.indented + (closing ? 0 : indentUnit);
},


      else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false)
return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
else if (lexical.align) return lexical.column + (closing ? 0 : 1);
else return lexical.indented + (closing ? 0 : indentUnit);
},


    electricChars: ":{}",

    electricInput: /^\s*(?:case .*?:|default:|\{|\})$/,

    blockCommentStart: jsonMode ? null : "/*",
blockCommentEnd: jsonMode ? null : "*/",
lineComment: jsonMode ? null : "//",

    blockCommentStart: jsonMode ? null : "/*",
blockCommentEnd: jsonMode ? null : "*/",
lineComment: jsonMode ? null : "//",

Zeile 667Zeile 676
  };
});


  };
});


CodeMirror.registerHelper("wordChars", "javascript", /[\\w$]/);

CodeMirror.registerHelper("wordChars", "javascript", /[\w$]/);


CodeMirror.defineMIME("text/javascript", "javascript");
CodeMirror.defineMIME("text/ecmascript", "javascript");


CodeMirror.defineMIME("text/javascript", "javascript");
CodeMirror.defineMIME("text/ecmascript", "javascript");