summaryrefslogtreecommitdiff
path: root/public/vendor/codemirror/mode/clike/clike.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/vendor/codemirror/mode/clike/clike.js')
-rw-r--r--public/vendor/codemirror/mode/clike/clike.js87
1 files changed, 48 insertions, 39 deletions
diff --git a/public/vendor/codemirror/mode/clike/clike.js b/public/vendor/codemirror/mode/clike/clike.js
index 4f5c0cf3..695d5cef 100644
--- a/public/vendor/codemirror/mode/clike/clike.js
+++ b/public/vendor/codemirror/mode/clike/clike.js
@@ -11,6 +11,42 @@
})(function(CodeMirror) {
"use strict";
+function Context(indented, column, type, align, prev) {
+ this.indented = indented;
+ this.column = column;
+ this.type = type;
+ this.align = align;
+ this.prev = prev;
+}
+function isStatement(type) {
+ return type == "statement" || type == "switchstatement" || type == "namespace";
+}
+function pushContext(state, col, type) {
+ var indent = state.indented;
+ if (state.context && isStatement(state.context.type) && !isStatement(type))
+ indent = state.context.indented;
+ return state.context = new Context(indent, col, type, null, state.context);
+}
+function popContext(state) {
+ var t = state.context.type;
+ if (t == ")" || t == "]" || t == "}")
+ state.indented = state.context.indented;
+ return state.context = state.context.prev;
+}
+
+function typeBefore(stream, state) {
+ if (state.prevToken == "variable" || state.prevToken == "variable-3") return true;
+ if (/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(stream.string.slice(0, stream.start))) return true;
+}
+
+function isTopScope(context) {
+ for (;;) {
+ if (!context || context.type == "top") return true;
+ if (context.type == "}" && context.prev.type != "namespace") return false;
+ context = context.prev;
+ }
+}
+
CodeMirror.defineMode("clike", function(config, parserConfig) {
var indentUnit = config.indentUnit,
statementIndentUnit = parserConfig.statementIndentUnit || indentUnit,
@@ -64,7 +100,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
}
}
if (isOperatorChar.test(ch)) {
- stream.eatWhile(isOperatorChar);
+ while (!stream.match(/^\/[\/*]/, false) && stream.eat(isOperatorChar)) {}
return "operator";
}
stream.eatWhile(/[\w\$_\xa1-\uffff]/);
@@ -111,42 +147,6 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
return "comment";
}
- function Context(indented, column, type, align, prev) {
- this.indented = indented;
- this.column = column;
- this.type = type;
- this.align = align;
- this.prev = prev;
- }
- function isStatement(type) {
- return type == "statement" || type == "switchstatement" || type == "namespace";
- }
- function pushContext(state, col, type) {
- var indent = state.indented;
- if (state.context && isStatement(state.context.type) && !isStatement(type))
- indent = state.context.indented;
- return state.context = new Context(indent, col, type, null, state.context);
- }
- function popContext(state) {
- var t = state.context.type;
- if (t == ")" || t == "]" || t == "}")
- state.indented = state.context.indented;
- return state.context = state.context.prev;
- }
-
- function typeBefore(stream, state) {
- if (state.prevToken == "variable" || state.prevToken == "variable-3") return true;
- if (/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(stream.string.slice(0, stream.start))) return true;
- }
-
- function isTopScope(context) {
- for (;;) {
- if (!context || context.type == "top") return true;
- if (context.type == "}" && context.prev.type != "namespace") return false;
- context = context.prev;
- }
- }
-
// Interface
return {
@@ -497,7 +497,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
),
types: words(
"AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either " +
- "Enumeration Equiv Error Exception Fractional Function IndexedSeq Integral Iterable " +
+ "Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable " +
"Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering " +
"Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder " +
"StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector " +
@@ -527,6 +527,15 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
"'": function(stream) {
stream.eatWhile(/[\w\$_\xa1-\uffff]/);
return "atom";
+ },
+ "=": function(stream, state) {
+ var cx = state.context
+ if (cx.type == "}" && cx.align && stream.eat(">")) {
+ state.context = new Context(cx.indented, cx.column, cx.type, null, cx.prev)
+ return "operator"
+ } else {
+ return false
+ }
}
},
modeProps: {closeBrackets: {triples: '"'}}
@@ -658,7 +667,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
def("text/x-objectivec", {
name: "clike",
- keywords: words(cKeywords + "inline restrict _Bool _Complex _Imaginery BOOL Class bycopy byref id IMP in " +
+ keywords: words(cKeywords + "inline restrict _Bool _Complex _Imaginary BOOL Class bycopy byref id IMP in " +
"inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),
types: words(cTypes),
atoms: words("YES NO NULL NILL ON OFF true false"),