update plugin files
This commit is contained in:
4
plugins/codemirror/mode/clojure/clojure.js
vendored
4
plugins/codemirror/mode/clojure/clojure.js
vendored
@@ -160,10 +160,10 @@ CodeMirror.defineMode("clojure", function (options) {
|
||||
var numberLiteral = /^(?:[+\-]?\d+(?:(?:N|(?:[eE][+\-]?\d+))|(?:\.?\d*(?:M|(?:[eE][+\-]?\d+))?)|\/\d+|[xX][0-9a-fA-F]+|r[0-9a-zA-Z]+)?(?=[\\\[\]\s"#'(),;@^`{}~]|$))/;
|
||||
var characterLiteral = /^(?:\\(?:backspace|formfeed|newline|return|space|tab|o[0-7]{3}|u[0-9A-Fa-f]{4}|x[0-9A-Fa-f]{4}|.)?(?=[\\\[\]\s"(),;@^`{}~]|$))/;
|
||||
|
||||
// simple-namespace := /^[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*/
|
||||
// simple-namespace := /^[^\\\/\[\]\d\s"#'(),;@^`{}~.][^\\\[\]\s"(),;@^`{}~.\/]*/
|
||||
// simple-symbol := /^(?:\/|[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*)/
|
||||
// qualified-symbol := (<simple-namespace>(<.><simple-namespace>)*</>)?<simple-symbol>
|
||||
var qualifiedSymbol = /^(?:(?:[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*(?:\.[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*)*\/)?(?:\/|[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*)*(?=[\\\[\]\s"(),;@^`{}~]|$))/;
|
||||
var qualifiedSymbol = /^(?:(?:[^\\\/\[\]\d\s"#'(),;@^`{}~.][^\\\[\]\s"(),;@^`{}~.\/]*(?:\.[^\\\/\[\]\d\s"#'(),;@^`{}~.][^\\\[\]\s"(),;@^`{}~.\/]*)*\/)?(?:\/|[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*)*(?=[\\\[\]\s"(),;@^`{}~]|$))/;
|
||||
|
||||
function base(stream, state) {
|
||||
if (stream.eatSpace() || stream.eat(",")) return ["space", null];
|
||||
|
||||
@@ -616,13 +616,18 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
||||
if (value == "|" || value == "&") return cont(typeexpr)
|
||||
if (type == "string" || type == "number" || type == "atom") return cont(afterType);
|
||||
if (type == "[") return cont(pushlex("]"), commasep(typeexpr, "]", ","), poplex, afterType)
|
||||
if (type == "{") return cont(pushlex("}"), commasep(typeprop, "}", ",;"), poplex, afterType)
|
||||
if (type == "{") return cont(pushlex("}"), typeprops, poplex, afterType)
|
||||
if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType, afterType)
|
||||
if (type == "<") return cont(commasep(typeexpr, ">"), typeexpr)
|
||||
}
|
||||
function maybeReturnType(type) {
|
||||
if (type == "=>") return cont(typeexpr)
|
||||
}
|
||||
function typeprops(type) {
|
||||
if (type == "}") return cont()
|
||||
if (type == "," || type == ";") return cont(typeprops)
|
||||
return pass(typeprop, typeprops)
|
||||
}
|
||||
function typeprop(type, value) {
|
||||
if (type == "variable" || cx.style == "keyword") {
|
||||
cx.marked = "property"
|
||||
|
||||
4
plugins/codemirror/mode/scheme/scheme.js
vendored
4
plugins/codemirror/mode/scheme/scheme.js
vendored
@@ -26,8 +26,8 @@ CodeMirror.defineMode("scheme", function () {
|
||||
return obj;
|
||||
}
|
||||
|
||||
var keywords = makeKeywords("λ case-lambda call/cc class define-class exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci<? char-ci=? char-ci>=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char<? char=? char>=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt #f floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci<? string-ci=? string-ci>=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string<? string=? string>=? string>? string? substring symbol->string symbol? #t tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?");
|
||||
var indentKeys = makeKeywords("define let letrec let* lambda");
|
||||
var keywords = makeKeywords("λ case-lambda call/cc class cond-expand define-class define-values exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax define-macro defmacro delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci<? char-ci=? char-ci>=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char<? char=? char>=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt #f floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci<? string-ci=? string-ci>=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string<? string=? string>=? string>? string? substring symbol->string symbol? #t tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?");
|
||||
var indentKeys = makeKeywords("define let letrec let* lambda define-macro defmacro let-syntax letrec-syntax let-values let*-values define-syntax syntax-rules define-values when unless");
|
||||
|
||||
function stateStack(indent, type, prev) { // represents a state stack object
|
||||
this.indent = indent;
|
||||
|
||||
3
plugins/codemirror/mode/shell/shell.js
vendored
3
plugins/codemirror/mode/shell/shell.js
vendored
@@ -71,7 +71,8 @@ CodeMirror.defineMode('shell', function() {
|
||||
return 'attribute';
|
||||
}
|
||||
if (ch == "<") {
|
||||
var heredoc = stream.match(/^<-?\s+(.*)/)
|
||||
if (stream.match("<<")) return "operator"
|
||||
var heredoc = stream.match(/^<-?\s*['"]?([^'"]*)['"]?/)
|
||||
if (heredoc) {
|
||||
state.tokens.unshift(tokenHeredoc(heredoc[1]))
|
||||
return 'string-2'
|
||||
|
||||
14
plugins/codemirror/mode/soy/soy.js
vendored
14
plugins/codemirror/mode/soy/soy.js
vendored
@@ -463,8 +463,15 @@
|
||||
return null;
|
||||
|
||||
case "tag":
|
||||
var endTag = state.tag[0] == "/";
|
||||
var tagName = endTag ? state.tag.substring(1) : state.tag;
|
||||
var endTag;
|
||||
var tagName;
|
||||
if (state.tag === undefined) {
|
||||
endTag = true;
|
||||
tagName = '';
|
||||
} else {
|
||||
endTag = state.tag[0] == "/";
|
||||
tagName = endTag ? state.tag.substring(1) : state.tag;
|
||||
}
|
||||
var tag = tags[tagName];
|
||||
if (stream.match(/^\/?}/)) {
|
||||
var selfClosed = stream.current() == "/}";
|
||||
@@ -576,12 +583,11 @@
|
||||
return "keyword";
|
||||
} else if (match = stream.match(/^<\{/)) {
|
||||
state.soyState.push("template-call-expression");
|
||||
state.tag = "print";
|
||||
state.indent += 2 * config.indentUnit;
|
||||
state.soyState.push("tag");
|
||||
return "keyword";
|
||||
} else if (match = stream.match(/^<\/>/)) {
|
||||
state.indent -= 2 * config.indentUnit;
|
||||
state.indent -= 1 * config.indentUnit;
|
||||
return "keyword";
|
||||
}
|
||||
|
||||
|
||||
137
plugins/codemirror/mode/verilog/verilog.js
vendored
137
plugins/codemirror/mode/verilog/verilog.js
vendored
@@ -16,6 +16,12 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
|
||||
var indentUnit = config.indentUnit,
|
||||
statementIndentUnit = parserConfig.statementIndentUnit || indentUnit,
|
||||
dontAlignCalls = parserConfig.dontAlignCalls,
|
||||
// compilerDirectivesUseRegularIndentation - If set, Compiler directive
|
||||
// indentation follows the same rules as everything else. Otherwise if
|
||||
// false, compiler directives will track their own indentation.
|
||||
// For example, `ifdef nested inside another `ifndef will be indented,
|
||||
// but a `ifdef inside a function block may not be indented.
|
||||
compilerDirectivesUseRegularIndentation = parserConfig.compilerDirectivesUseRegularIndentation,
|
||||
noIndentKeywords = parserConfig.noIndentKeywords || [],
|
||||
multiLineStrings = parserConfig.multiLineStrings,
|
||||
hooks = parserConfig.hooks || {};
|
||||
@@ -62,7 +68,7 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
|
||||
binary_module_path_operator ::=
|
||||
== | != | && | || | & | | | ^ | ^~ | ~^
|
||||
*/
|
||||
var isOperatorChar = /[\+\-\*\/!~&|^%=?:]/;
|
||||
var isOperatorChar = /[\+\-\*\/!~&|^%=?:<>]/;
|
||||
var isBracketChar = /[\[\]{}()]/;
|
||||
|
||||
var unsignedNumber = /\d[0-9_]*/;
|
||||
@@ -72,8 +78,13 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
|
||||
var hexLiteral = /\d*\s*'s?h\s*[0-9a-fxz?][0-9a-fxz?_]*/i;
|
||||
var realLiteral = /(\d[\d_]*(\.\d[\d_]*)?E-?[\d_]+)|(\d[\d_]*\.\d[\d_]*)/i;
|
||||
|
||||
var closingBracketOrWord = /^((\w+)|[)}\]])/;
|
||||
var closingBracketOrWord = /^((`?\w+)|[)}\]])/;
|
||||
var closingBracket = /[)}\]]/;
|
||||
var compilerDirectiveRegex = new RegExp(
|
||||
"^(`(?:ifdef|ifndef|elsif|else|endif|undef|undefineall|define|include|begin_keywords|celldefine|default|" +
|
||||
"nettype|end_keywords|endcelldefine|line|nounconnected_drive|pragma|resetall|timescale|unconnected_drive))\\b");
|
||||
var compilerDirectiveBeginRegex = /^(`(?:ifdef|ifndef|elsif|else))\b/;
|
||||
var compilerDirectiveEndRegex = /^(`(?:elsif|else|endif))\b/;
|
||||
|
||||
var curPunc;
|
||||
var curKeyword;
|
||||
@@ -96,6 +107,7 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
|
||||
openClose["do" ] = "while";
|
||||
openClose["fork" ] = "join;join_any;join_none";
|
||||
openClose["covergroup"] = "endgroup";
|
||||
openClose["macro_begin"] = "macro_end";
|
||||
|
||||
for (var i in noIndentKeywords) {
|
||||
var keyword = noIndentKeywords[i];
|
||||
@@ -105,7 +117,7 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
|
||||
}
|
||||
|
||||
// Keywords which open statements that are ended with a semi-colon
|
||||
var statementKeywords = words("always always_comb always_ff always_latch assert assign assume else export for foreach forever if import initial repeat while");
|
||||
var statementKeywords = words("always always_comb always_ff always_latch assert assign assume else export for foreach forever if import initial repeat while extern typedef");
|
||||
|
||||
function tokenBase(stream, state) {
|
||||
var ch = stream.peek(), style;
|
||||
@@ -125,6 +137,23 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
|
||||
if (ch == '`') {
|
||||
stream.next();
|
||||
if (stream.eatWhile(/[\w\$_]/)) {
|
||||
var cur = stream.current();
|
||||
curKeyword = cur;
|
||||
// Macros that end in _begin, are start of block and end with _end
|
||||
if (cur.startsWith("`uvm_") && cur.endsWith("_begin")) {
|
||||
var keywordClose = curKeyword.substr(0,curKeyword.length - 5) + "end";
|
||||
openClose[cur] = keywordClose;
|
||||
curPunc = "newblock";
|
||||
} else {
|
||||
stream.eatSpace();
|
||||
if (stream.peek() == '(') {
|
||||
// Check if this is a block
|
||||
curPunc = "newmacro";
|
||||
}
|
||||
var withSpace = stream.current();
|
||||
// Move the stream back before the spaces
|
||||
stream.backUp(withSpace.length - cur.length);
|
||||
}
|
||||
return "def";
|
||||
} else {
|
||||
return null;
|
||||
@@ -145,6 +174,12 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
|
||||
stream.eatWhile(/[\d_.]/);
|
||||
return "def";
|
||||
}
|
||||
// Event
|
||||
if (ch == '@') {
|
||||
stream.next();
|
||||
stream.eatWhile(/[@]/);
|
||||
return "def";
|
||||
}
|
||||
// Strings
|
||||
if (ch == '"') {
|
||||
stream.next();
|
||||
@@ -178,6 +213,7 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
|
||||
|
||||
// Operators
|
||||
if (stream.eatWhile(isOperatorChar)) {
|
||||
curPunc = stream.current();
|
||||
return "meta";
|
||||
}
|
||||
|
||||
@@ -187,6 +223,15 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
|
||||
if (keywords[cur]) {
|
||||
if (openClose[cur]) {
|
||||
curPunc = "newblock";
|
||||
if (cur === "fork") {
|
||||
// Fork can be a statement instead of block in cases of:
|
||||
// "disable fork;" and "wait fork;" (trailing semicolon)
|
||||
stream.eatSpace()
|
||||
if (stream.peek() == ';') {
|
||||
curPunc = "newstatement";
|
||||
}
|
||||
stream.backUp(stream.current().length - cur.length);
|
||||
}
|
||||
}
|
||||
if (statementKeywords[cur]) {
|
||||
curPunc = "newstatement";
|
||||
@@ -226,16 +271,17 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
|
||||
return "comment";
|
||||
}
|
||||
|
||||
function Context(indented, column, type, align, prev) {
|
||||
function Context(indented, column, type, scopekind, align, prev) {
|
||||
this.indented = indented;
|
||||
this.column = column;
|
||||
this.type = type;
|
||||
this.scopekind = scopekind;
|
||||
this.align = align;
|
||||
this.prev = prev;
|
||||
}
|
||||
function pushContext(state, col, type) {
|
||||
function pushContext(state, col, type, scopekind) {
|
||||
var indent = state.indented;
|
||||
var c = new Context(indent, col, type, null, state.context);
|
||||
var c = new Context(indent, col, type, scopekind ? scopekind : "", null, state.context);
|
||||
return state.context = c;
|
||||
}
|
||||
function popContext(state) {
|
||||
@@ -261,6 +307,16 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
|
||||
}
|
||||
}
|
||||
|
||||
function isInsideScopeKind(ctx, scopekind) {
|
||||
if (ctx == null) {
|
||||
return false;
|
||||
}
|
||||
if (ctx.scopekind === scopekind) {
|
||||
return true;
|
||||
}
|
||||
return isInsideScopeKind(ctx.prev, scopekind);
|
||||
}
|
||||
|
||||
function buildElectricInputRegEx() {
|
||||
// Reindentation should occur on any bracket char: {}()[]
|
||||
// or on a match of any of the block closing keywords, at
|
||||
@@ -287,8 +343,9 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
|
||||
startState: function(basecolumn) {
|
||||
var state = {
|
||||
tokenize: null,
|
||||
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
|
||||
context: new Context((basecolumn || 0) - indentUnit, 0, "top", "top", false),
|
||||
indented: 0,
|
||||
compilerDirectiveIndented: 0,
|
||||
startOfLine: true
|
||||
};
|
||||
if (hooks.startState) hooks.startState(state);
|
||||
@@ -313,15 +370,42 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
|
||||
curPunc = null;
|
||||
curKeyword = null;
|
||||
var style = (state.tokenize || tokenBase)(stream, state);
|
||||
if (style == "comment" || style == "meta" || style == "variable") return style;
|
||||
if (style == "comment" || style == "meta" || style == "variable") {
|
||||
if (((curPunc === "=") || (curPunc === "<=")) && !isInsideScopeKind(ctx, "assignment")) {
|
||||
// '<=' could be nonblocking assignment or lessthan-equals (which shouldn't cause indent)
|
||||
// Search through the context to see if we are already in an assignment.
|
||||
// '=' could be inside port declaration with comma or ')' afterward, or inside for(;;) block.
|
||||
pushContext(state, stream.column() + curPunc.length, "assignment", "assignment");
|
||||
if (ctx.align == null) ctx.align = true;
|
||||
}
|
||||
return style;
|
||||
}
|
||||
if (ctx.align == null) ctx.align = true;
|
||||
|
||||
if (curPunc == ctx.type) {
|
||||
popContext(state);
|
||||
} else if ((curPunc == ";" && ctx.type == "statement") ||
|
||||
var isClosingAssignment = ctx.type == "assignment" &&
|
||||
closingBracket.test(curPunc) && ctx.prev && ctx.prev.type === curPunc;
|
||||
if (curPunc == ctx.type || isClosingAssignment) {
|
||||
if (isClosingAssignment) {
|
||||
ctx = popContext(state);
|
||||
}
|
||||
ctx = popContext(state);
|
||||
if (curPunc == ")") {
|
||||
// Handle closing macros, assuming they could have a semicolon or begin/end block inside.
|
||||
if (ctx && (ctx.type === "macro")) {
|
||||
ctx = popContext(state);
|
||||
while (ctx && (ctx.type == "statement" || ctx.type == "assignment")) ctx = popContext(state);
|
||||
}
|
||||
} else if (curPunc == "}") {
|
||||
// Handle closing statements like constraint block: "foreach () {}" which
|
||||
// do not have semicolon at end.
|
||||
if (ctx && (ctx.type === "statement")) {
|
||||
while (ctx && (ctx.type == "statement")) ctx = popContext(state);
|
||||
}
|
||||
}
|
||||
} else if (((curPunc == ";" || curPunc == ",") && (ctx.type == "statement" || ctx.type == "assignment")) ||
|
||||
(ctx.type && isClosing(curKeyword, ctx.type))) {
|
||||
ctx = popContext(state);
|
||||
while (ctx && ctx.type == "statement") ctx = popContext(state);
|
||||
while (ctx && (ctx.type == "statement" || ctx.type == "assignment")) ctx = popContext(state);
|
||||
} else if (curPunc == "{") {
|
||||
pushContext(state, stream.column(), "}");
|
||||
} else if (curPunc == "[") {
|
||||
@@ -329,9 +413,9 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
|
||||
} else if (curPunc == "(") {
|
||||
pushContext(state, stream.column(), ")");
|
||||
} else if (ctx && ctx.type == "endcase" && curPunc == ":") {
|
||||
pushContext(state, stream.column(), "statement");
|
||||
pushContext(state, stream.column(), "statement", "case");
|
||||
} else if (curPunc == "newstatement") {
|
||||
pushContext(state, stream.column(), "statement");
|
||||
pushContext(state, stream.column(), "statement", curKeyword);
|
||||
} else if (curPunc == "newblock") {
|
||||
if (curKeyword == "function" && ctx && (ctx.type == "statement" || ctx.type == "endgroup")) {
|
||||
// The 'function' keyword can appear in some other contexts where it actually does not
|
||||
@@ -339,9 +423,23 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
|
||||
// Do nothing in this case
|
||||
} else if (curKeyword == "task" && ctx && ctx.type == "statement") {
|
||||
// Same thing for task
|
||||
} else if (curKeyword == "class" && ctx && ctx.type == "statement") {
|
||||
// Same thing for class (e.g. typedef)
|
||||
} else {
|
||||
var close = openClose[curKeyword];
|
||||
pushContext(state, stream.column(), close);
|
||||
pushContext(state, stream.column(), close, curKeyword);
|
||||
}
|
||||
} else if (curPunc == "newmacro" || (curKeyword && curKeyword.match(compilerDirectiveRegex))) {
|
||||
if (curPunc == "newmacro") {
|
||||
// Macros (especially if they have parenthesis) potentially have a semicolon
|
||||
// or complete statement/block inside, and should be treated as such.
|
||||
pushContext(state, stream.column(), "macro", "macro");
|
||||
}
|
||||
if (curKeyword.match(compilerDirectiveEndRegex)) {
|
||||
state.compilerDirectiveIndented -= statementIndentUnit;
|
||||
}
|
||||
if (curKeyword.match(compilerDirectiveBeginRegex)) {
|
||||
state.compilerDirectiveIndented += statementIndentUnit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -361,8 +459,15 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
|
||||
var possibleClosing = textAfter.match(closingBracketOrWord);
|
||||
if (possibleClosing)
|
||||
closing = isClosing(possibleClosing[0], ctx.type);
|
||||
if (!compilerDirectivesUseRegularIndentation && textAfter.match(compilerDirectiveRegex)) {
|
||||
if (textAfter.match(compilerDirectiveEndRegex)) {
|
||||
return state.compilerDirectiveIndented - statementIndentUnit;
|
||||
}
|
||||
return state.compilerDirectiveIndented;
|
||||
}
|
||||
if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit);
|
||||
else if (closingBracket.test(ctx.type) && ctx.align && !dontAlignCalls) return ctx.column + (closing ? 0 : 1);
|
||||
else if ((closingBracket.test(ctx.type) || ctx.type == "assignment")
|
||||
&& ctx.align && !dontAlignCalls) return ctx.column + (closing ? 0 : 1);
|
||||
else if (ctx.type == ")" && !closing) return ctx.indented + statementIndentUnit;
|
||||
else return ctx.indented + (closing ? 0 : indentUnit);
|
||||
},
|
||||
|
||||
4
plugins/codemirror/mode/wast/wast.js
vendored
4
plugins/codemirror/mode/wast/wast.js
vendored
@@ -14,8 +14,8 @@
|
||||
CodeMirror.defineSimpleMode('wast', {
|
||||
start: [
|
||||
{regex: /[+\-]?(?:nan(?::0x[0-9a-fA-F]+)?|infinity|inf|0x[0-9a-fA-F]+\.?[0-9a-fA-F]*p[+\/-]?\d+|\d+(?:\.\d*)?[eE][+\-]?\d*|\d+\.\d*|0x[0-9a-fA-F]+|\d+)/, token: "number"},
|
||||
{regex: /mut|nop|block|if|then|else|loop|br_if|br_table|br|call(_indirect)?|drop|end|return(_call(_indirect)?)?|local\.(get|set|tee)|global\.(get|set)|i(32|64)\.(store(8|16)|(load(8|16)_[su]))|i64\.(load32_[su]|store32)|[fi](32|64)\.(const|load|store)|f(32|64)\.(abs|add|ceil|copysign|div|eq|floor|[gl][et]|max|min|mul|nearest|neg?|sqrt|sub|trunc)|i(32|64)\.(a[dn]d|c[lt]z|(div|rem)_[su]|eqz?|[gl][te]_[su]|mul|ne|popcnt|rot[lr]|sh(l|r_[su])|sub|x?or)|i64\.extend_[su]_i32|i32\.wrap_i64|i(32|64)\.trunc_f(32|64)_[su]|f(32|64)\.convert_i(32|64)_[su]|f64\.promote_f32|f32\.demote_f64|f32\.reinterpret_i32|i32\.reinterpret_f32|f64\.reinterpret_i64|i64\.reinterpret_f64|select|unreachable|current_memory|memory(\.((atomic\.(notify|wait(32|64)))|grow|size))?|type|func|param|result|local|global|module|table|start|elem|data|align|offset|import|export|i64\.atomic\.(load32_u|store32|rmw32\.(a[dn]d|sub|x?or|(cmp)?xchg)_u)|i(32|64)\.atomic\.(load((8|16)_u)?|store(8|16)?|rmw(\.(a[dn]d|sub|x?or|(cmp)?xchg)|(8|16)\.(a[dn]d|sub|x?or|(cmp)?xchg)_u))|v128\.(load|store|const|not|andnot|and|or|xor|bitselect)|i(8x16|16x8|32x4|64x2)\.(shl|shr_[su])|i(8x16|16x8)\.(extract_lane_[su]|((add|sub)_saturate_[su])|avgr_u)|(i(8x16|16x8|32x4|64x2)|f(32x4|64x2))\.(splat|replace_lane|neg|add|sub)|i(8x16|16x8|32x4)\.(eq|ne|([lg][te]_[su])|abs|any_true|all_true|bitmask|((min|max)_[su]))|f(32x4|64x2)\.(eq|ne|[lg][te]|abs|sqrt|mul|div|min|max)|[fi](32x4|64x2)\.extract_lane|v8x16\.(shuffle|swizzle)|i16x8\.(load8x8_[su]|narrow_i32x4_[su]|widen_(low|high)_i8x16_[su]|mul)|i32x4\.(load16x4_[su]|widen_(low|high)_i16x8_[su]|mul|trunc_sat_f32x4_[su])|i64x2\.(load32x2_[su]|mul)|(v(8x16|16x8|32x4|64x2)\.load_splat)|i8x16\.narrow_i16x8_[su]|f32x4\.convert_i32x4_[su]/, token: "keyword"},
|
||||
{regex: /\b(anyfunc|[fi](32|64))\b/, token: "atom"},
|
||||
{regex: /mut|nop|block|if|then|else|loop|br_if|br_table|br|call(_indirect)?|drop|end|return(_call(_indirect)?)?|local\.(get|set|tee)|global\.(get|set)|i(32|64)\.(store(8|16)|(load(8|16)_[su]))|i64\.(load32_[su]|store32)|[fi](32|64)\.(const|load|store)|f(32|64)\.(abs|add|ceil|copysign|div|eq|floor|[gl][et]|max|min|mul|nearest|neg?|sqrt|sub|trunc)|i(32|64)\.(a[dn]d|c[lt]z|(div|rem)_[su]|eqz?|[gl][te]_[su]|mul|ne|popcnt|rot[lr]|sh(l|r_[su])|sub|x?or)|i64\.extend_[su]_i32|i32\.wrap_i64|i(32|64)\.trunc_f(32|64)_[su]|f(32|64)\.convert_i(32|64)_[su]|f64\.promote_f32|f32\.demote_f64|f32\.reinterpret_i32|i32\.reinterpret_f32|f64\.reinterpret_i64|i64\.reinterpret_f64|select|unreachable|current_memory|memory(\.((atomic\.(notify|wait(32|64)))|grow|size))?|type|\bfunc\b|param|result|local|global|module|start|elem|data|align|offset|import|export|i64\.atomic\.(load32_u|store32|rmw32\.(a[dn]d|sub|x?or|(cmp)?xchg)_u)|i(32|64)\.atomic\.(load((8|16)_u)?|store(8|16)?|rmw(\.(a[dn]d|sub|x?or|(cmp)?xchg)|(8|16)\.(a[dn]d|sub|x?or|(cmp)?xchg)_u))|v128\.(load|store|const|not|andnot|and|or|xor|bitselect)|i(8x16|16x8|32x4|64x2)\.(shl|shr_[su])|i(8x16|16x8)\.(extract_lane_[su]|((add|sub)_saturate_[su])|avgr_u)|(i(8x16|16x8|32x4|64x2)|f(32x4|64x2))\.(splat|replace_lane|neg|add|sub)|i(8x16|16x8|32x4)\.(eq|ne|([lg][te]_[su])|abs|any_true|all_true|bitmask|((min|max)_[su]))|f(32x4|64x2)\.(eq|ne|[lg][te]|abs|sqrt|mul|div|min|max)|[fi](32x4|64x2)\.extract_lane|v8x16\.(shuffle|swizzle)|i16x8\.(load8x8_[su]|narrow_i32x4_[su]|widen_(low|high)_i8x16_[su]|mul)|i32x4\.(load16x4_[su]|widen_(low|high)_i16x8_[su]|mul|trunc_sat_f32x4_[su])|i64x2\.(load32x2_[su]|mul)|(v(8x16|16x8|32x4|64x2)\.load_splat)|i8x16\.narrow_i16x8_[su]|f32x4\.convert_i32x4_[su]|ref\.(func|(is_)?null)|\bextern\b|table(\.(size|get|set|size|grow|fill|init|copy))?/, token: "keyword"},
|
||||
{regex: /\b(funcref|externref|[fi](32|64))\b/, token: "atom"},
|
||||
{regex: /\$([a-zA-Z0-9_`\+\-\*\/\\\^~=<>!\?@#$%&|:\.]+)/, token: "variable-2"},
|
||||
{regex: /"(?:[^"\\\x00-\x1f\x7f]|\\[nt\\'"]|\\[0-9a-fA-F][0-9a-fA-F])*"/, token: "string"},
|
||||
{regex: /\(;.*?/, token: "comment", next: "comment"},
|
||||
|
||||
Reference in New Issue
Block a user