codemirror-rails 5.2 → 5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/codemirror/rails/version.rb +2 -2
- data/vendor/assets/javascripts/codemirror.js +34 -27
- data/vendor/assets/javascripts/codemirror/addons/display/rulers.js +1 -2
- data/vendor/assets/javascripts/codemirror/addons/edit/closebrackets.js +1 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.js +14 -23
- data/vendor/assets/javascripts/codemirror/addons/hint/sql-hint.js +12 -3
- data/vendor/assets/javascripts/codemirror/addons/lint/lint.js +6 -6
- data/vendor/assets/javascripts/codemirror/addons/search/search.js +1 -1
- data/vendor/assets/javascripts/codemirror/addons/search/searchcursor.js +2 -2
- data/vendor/assets/javascripts/codemirror/addons/tern/worker.js +1 -1
- data/vendor/assets/javascripts/codemirror/keymaps/vim.js +64 -67
- data/vendor/assets/javascripts/codemirror/modes/apl.js +1 -2
- data/vendor/assets/javascripts/codemirror/modes/asn.1.js +204 -0
- data/vendor/assets/javascripts/codemirror/modes/asterisk.js +2 -4
- data/vendor/assets/javascripts/codemirror/modes/clike.js +98 -36
- data/vendor/assets/javascripts/codemirror/modes/css.js +1 -16
- data/vendor/assets/javascripts/codemirror/modes/cypher.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/dylan.js +18 -26
- data/vendor/assets/javascripts/codemirror/modes/ecl.js +1 -2
- data/vendor/assets/javascripts/codemirror/modes/eiffel.js +0 -2
- data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +2 -2
- data/vendor/assets/javascripts/codemirror/modes/julia.js +0 -2
- data/vendor/assets/javascripts/codemirror/modes/livescript.js +2 -2
- data/vendor/assets/javascripts/codemirror/modes/mathematica.js +175 -0
- data/vendor/assets/javascripts/codemirror/modes/php.js +1 -0
- data/vendor/assets/javascripts/codemirror/modes/pig.js +15 -25
- data/vendor/assets/javascripts/codemirror/modes/sql.js +2 -2
- data/vendor/assets/javascripts/codemirror/modes/tiddlywiki.js +36 -47
- data/vendor/assets/javascripts/codemirror/modes/tiki.js +8 -19
- data/vendor/assets/javascripts/codemirror/modes/ttcn-cfg.js +214 -0
- data/vendor/assets/javascripts/codemirror/modes/ttcn.js +283 -0
- data/vendor/assets/javascripts/codemirror/modes/xquery.js +30 -40
- data/vendor/assets/stylesheets/codemirror/addons/dialog/dialog.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/monokai.css +1 -0
- data/vendor/assets/stylesheets/codemirror/themes/ttcn.css +66 -0
- metadata +8 -7
- data/vendor/assets/javascripts/codemirror/addons/mode/multiplex_test.js +0 -33
- data/vendor/assets/javascripts/codemirror/modes/less_test.js +0 -54
- data/vendor/assets/javascripts/codemirror/modes/scss_test.js +0 -110
- data/vendor/assets/javascripts/codemirror/modes/test.js +0 -67
@@ -0,0 +1,283 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
"use strict";
|
13
|
+
|
14
|
+
CodeMirror.defineMode("ttcn", function(config, parserConfig) {
|
15
|
+
var indentUnit = config.indentUnit,
|
16
|
+
keywords = parserConfig.keywords || {},
|
17
|
+
builtin = parserConfig.builtin || {},
|
18
|
+
timerOps = parserConfig.timerOps || {},
|
19
|
+
portOps = parserConfig.portOps || {},
|
20
|
+
configOps = parserConfig.configOps || {},
|
21
|
+
verdictOps = parserConfig.verdictOps || {},
|
22
|
+
sutOps = parserConfig.sutOps || {},
|
23
|
+
functionOps = parserConfig.functionOps || {},
|
24
|
+
|
25
|
+
verdictConsts = parserConfig.verdictConsts || {},
|
26
|
+
booleanConsts = parserConfig.booleanConsts || {},
|
27
|
+
otherConsts = parserConfig.otherConsts || {},
|
28
|
+
|
29
|
+
types = parserConfig.types || {},
|
30
|
+
visibilityModifiers = parserConfig.visibilityModifiers || {},
|
31
|
+
templateMatch = parserConfig.templateMatch || {},
|
32
|
+
multiLineStrings = parserConfig.multiLineStrings,
|
33
|
+
indentStatements = parserConfig.indentStatements !== false;
|
34
|
+
var isOperatorChar = /[+\-*&@=<>!\/]/;
|
35
|
+
var curPunc;
|
36
|
+
|
37
|
+
function tokenBase(stream, state) {
|
38
|
+
var ch = stream.next();
|
39
|
+
|
40
|
+
if (ch == '"' || ch == "'") {
|
41
|
+
state.tokenize = tokenString(ch);
|
42
|
+
return state.tokenize(stream, state);
|
43
|
+
}
|
44
|
+
if (/[\[\]{}\(\),;\\:\?\.]/.test(ch)) {
|
45
|
+
curPunc = ch;
|
46
|
+
return "punctuation";
|
47
|
+
}
|
48
|
+
if (ch == "#"){
|
49
|
+
stream.skipToEnd();
|
50
|
+
return "atom preprocessor";
|
51
|
+
}
|
52
|
+
if (ch == "%"){
|
53
|
+
stream.eatWhile(/\b/);
|
54
|
+
return "atom ttcn3Macros";
|
55
|
+
}
|
56
|
+
if (/\d/.test(ch)) {
|
57
|
+
stream.eatWhile(/[\w\.]/);
|
58
|
+
return "number";
|
59
|
+
}
|
60
|
+
if (ch == "/") {
|
61
|
+
if (stream.eat("*")) {
|
62
|
+
state.tokenize = tokenComment;
|
63
|
+
return tokenComment(stream, state);
|
64
|
+
}
|
65
|
+
if (stream.eat("/")) {
|
66
|
+
stream.skipToEnd();
|
67
|
+
return "comment";
|
68
|
+
}
|
69
|
+
}
|
70
|
+
if (isOperatorChar.test(ch)) {
|
71
|
+
if(ch == "@"){
|
72
|
+
if(stream.match("try") || stream.match("catch")
|
73
|
+
|| stream.match("lazy")){
|
74
|
+
return "keyword";
|
75
|
+
}
|
76
|
+
}
|
77
|
+
stream.eatWhile(isOperatorChar);
|
78
|
+
return "operator";
|
79
|
+
}
|
80
|
+
stream.eatWhile(/[\w\$_\xa1-\uffff]/);
|
81
|
+
var cur = stream.current();
|
82
|
+
|
83
|
+
if (keywords.propertyIsEnumerable(cur)) return "keyword";
|
84
|
+
if (builtin.propertyIsEnumerable(cur)) return "builtin";
|
85
|
+
|
86
|
+
if (timerOps.propertyIsEnumerable(cur)) return "def timerOps";
|
87
|
+
if (configOps.propertyIsEnumerable(cur)) return "def configOps";
|
88
|
+
if (verdictOps.propertyIsEnumerable(cur)) return "def verdictOps";
|
89
|
+
if (portOps.propertyIsEnumerable(cur)) return "def portOps";
|
90
|
+
if (sutOps.propertyIsEnumerable(cur)) return "def sutOps";
|
91
|
+
if (functionOps.propertyIsEnumerable(cur)) return "def functionOps";
|
92
|
+
|
93
|
+
if (verdictConsts.propertyIsEnumerable(cur)) return "string verdictConsts";
|
94
|
+
if (booleanConsts.propertyIsEnumerable(cur)) return "string booleanConsts";
|
95
|
+
if (otherConsts.propertyIsEnumerable(cur)) return "string otherConsts";
|
96
|
+
|
97
|
+
if (types.propertyIsEnumerable(cur)) return "builtin types";
|
98
|
+
if (visibilityModifiers.propertyIsEnumerable(cur))
|
99
|
+
return "builtin visibilityModifiers";
|
100
|
+
if (templateMatch.propertyIsEnumerable(cur)) return "atom templateMatch";
|
101
|
+
|
102
|
+
return "variable";
|
103
|
+
}
|
104
|
+
|
105
|
+
function tokenString(quote) {
|
106
|
+
return function(stream, state) {
|
107
|
+
var escaped = false, next, end = false;
|
108
|
+
while ((next = stream.next()) != null) {
|
109
|
+
if (next == quote && !escaped){
|
110
|
+
var afterQuote = stream.peek();
|
111
|
+
//look if the character after the quote is like the B in '10100010'B
|
112
|
+
if (afterQuote){
|
113
|
+
afterQuote = afterQuote.toLowerCase();
|
114
|
+
if(afterQuote == "b" || afterQuote == "h" || afterQuote == "o")
|
115
|
+
stream.next();
|
116
|
+
}
|
117
|
+
end = true; break;
|
118
|
+
}
|
119
|
+
escaped = !escaped && next == "\\";
|
120
|
+
}
|
121
|
+
if (end || !(escaped || multiLineStrings))
|
122
|
+
state.tokenize = null;
|
123
|
+
return "string";
|
124
|
+
};
|
125
|
+
}
|
126
|
+
|
127
|
+
function tokenComment(stream, state) {
|
128
|
+
var maybeEnd = false, ch;
|
129
|
+
while (ch = stream.next()) {
|
130
|
+
if (ch == "/" && maybeEnd) {
|
131
|
+
state.tokenize = null;
|
132
|
+
break;
|
133
|
+
}
|
134
|
+
maybeEnd = (ch == "*");
|
135
|
+
}
|
136
|
+
return "comment";
|
137
|
+
}
|
138
|
+
|
139
|
+
function Context(indented, column, type, align, prev) {
|
140
|
+
this.indented = indented;
|
141
|
+
this.column = column;
|
142
|
+
this.type = type;
|
143
|
+
this.align = align;
|
144
|
+
this.prev = prev;
|
145
|
+
}
|
146
|
+
|
147
|
+
function pushContext(state, col, type) {
|
148
|
+
var indent = state.indented;
|
149
|
+
if (state.context && state.context.type == "statement")
|
150
|
+
indent = state.context.indented;
|
151
|
+
return state.context = new Context(indent, col, type, null, state.context);
|
152
|
+
}
|
153
|
+
|
154
|
+
function popContext(state) {
|
155
|
+
var t = state.context.type;
|
156
|
+
if (t == ")" || t == "]" || t == "}")
|
157
|
+
state.indented = state.context.indented;
|
158
|
+
return state.context = state.context.prev;
|
159
|
+
}
|
160
|
+
|
161
|
+
//Interface
|
162
|
+
return {
|
163
|
+
startState: function(basecolumn) {
|
164
|
+
return {
|
165
|
+
tokenize: null,
|
166
|
+
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
|
167
|
+
indented: 0,
|
168
|
+
startOfLine: true
|
169
|
+
};
|
170
|
+
},
|
171
|
+
|
172
|
+
token: function(stream, state) {
|
173
|
+
var ctx = state.context;
|
174
|
+
if (stream.sol()) {
|
175
|
+
if (ctx.align == null) ctx.align = false;
|
176
|
+
state.indented = stream.indentation();
|
177
|
+
state.startOfLine = true;
|
178
|
+
}
|
179
|
+
if (stream.eatSpace()) return null;
|
180
|
+
curPunc = null;
|
181
|
+
var style = (state.tokenize || tokenBase)(stream, state);
|
182
|
+
if (style == "comment") return style;
|
183
|
+
if (ctx.align == null) ctx.align = true;
|
184
|
+
|
185
|
+
if ((curPunc == ";" || curPunc == ":" || curPunc == ",")
|
186
|
+
&& ctx.type == "statement"){
|
187
|
+
popContext(state);
|
188
|
+
}
|
189
|
+
else if (curPunc == "{") pushContext(state, stream.column(), "}");
|
190
|
+
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
191
|
+
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
192
|
+
else if (curPunc == "}") {
|
193
|
+
while (ctx.type == "statement") ctx = popContext(state);
|
194
|
+
if (ctx.type == "}") ctx = popContext(state);
|
195
|
+
while (ctx.type == "statement") ctx = popContext(state);
|
196
|
+
}
|
197
|
+
else if (curPunc == ctx.type) popContext(state);
|
198
|
+
else if (indentStatements &&
|
199
|
+
(((ctx.type == "}" || ctx.type == "top") && curPunc != ';') ||
|
200
|
+
(ctx.type == "statement" && curPunc == "newstatement")))
|
201
|
+
pushContext(state, stream.column(), "statement");
|
202
|
+
|
203
|
+
state.startOfLine = false;
|
204
|
+
|
205
|
+
return style;
|
206
|
+
},
|
207
|
+
|
208
|
+
electricChars: "{}",
|
209
|
+
blockCommentStart: "/*",
|
210
|
+
blockCommentEnd: "*/",
|
211
|
+
lineComment: "//",
|
212
|
+
fold: "brace"
|
213
|
+
};
|
214
|
+
});
|
215
|
+
|
216
|
+
function words(str) {
|
217
|
+
var obj = {}, words = str.split(" ");
|
218
|
+
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
219
|
+
return obj;
|
220
|
+
}
|
221
|
+
|
222
|
+
function def(mimes, mode) {
|
223
|
+
if (typeof mimes == "string") mimes = [mimes];
|
224
|
+
var words = [];
|
225
|
+
function add(obj) {
|
226
|
+
if (obj) for (var prop in obj) if (obj.hasOwnProperty(prop))
|
227
|
+
words.push(prop);
|
228
|
+
}
|
229
|
+
|
230
|
+
add(mode.keywords);
|
231
|
+
add(mode.builtin);
|
232
|
+
add(mode.timerOps);
|
233
|
+
add(mode.portOps);
|
234
|
+
|
235
|
+
if (words.length) {
|
236
|
+
mode.helperType = mimes[0];
|
237
|
+
CodeMirror.registerHelper("hintWords", mimes[0], words);
|
238
|
+
}
|
239
|
+
|
240
|
+
for (var i = 0; i < mimes.length; ++i)
|
241
|
+
CodeMirror.defineMIME(mimes[i], mode);
|
242
|
+
}
|
243
|
+
|
244
|
+
def(["text/x-ttcn", "text/x-ttcn3", "text/x-ttcnpp"], {
|
245
|
+
name: "ttcn",
|
246
|
+
keywords: words("activate address alive all alt altstep and and4b any" +
|
247
|
+
" break case component const continue control deactivate" +
|
248
|
+
" display do else encode enumerated except exception" +
|
249
|
+
" execute extends extension external for from function" +
|
250
|
+
" goto group if import in infinity inout interleave" +
|
251
|
+
" label language length log match message mixed mod" +
|
252
|
+
" modifies module modulepar mtc noblock not not4b nowait" +
|
253
|
+
" of on optional or or4b out override param pattern port" +
|
254
|
+
" procedure record recursive rem repeat return runs select" +
|
255
|
+
" self sender set signature system template testcase to" +
|
256
|
+
" type union value valueof var variant while with xor xor4b"),
|
257
|
+
builtin: words("bit2hex bit2int bit2oct bit2str char2int char2oct encvalue" +
|
258
|
+
" decomp decvalue float2int float2str hex2bit hex2int" +
|
259
|
+
" hex2oct hex2str int2bit int2char int2float int2hex" +
|
260
|
+
" int2oct int2str int2unichar isbound ischosen ispresent" +
|
261
|
+
" isvalue lengthof log2str oct2bit oct2char oct2hex oct2int" +
|
262
|
+
" oct2str regexp replace rnd sizeof str2bit str2float" +
|
263
|
+
" str2hex str2int str2oct substr unichar2int unichar2char" +
|
264
|
+
" enum2int"),
|
265
|
+
types: words("anytype bitstring boolean char charstring default float" +
|
266
|
+
" hexstring integer objid octetstring universal verdicttype timer"),
|
267
|
+
timerOps: words("read running start stop timeout"),
|
268
|
+
portOps: words("call catch check clear getcall getreply halt raise receive" +
|
269
|
+
" reply send trigger"),
|
270
|
+
configOps: words("create connect disconnect done kill killed map unmap"),
|
271
|
+
verdictOps: words("getverdict setverdict"),
|
272
|
+
sutOps: words("action"),
|
273
|
+
functionOps: words("apply derefers refers"),
|
274
|
+
|
275
|
+
verdictConsts: words("error fail inconc none pass"),
|
276
|
+
booleanConsts: words("true false"),
|
277
|
+
otherConsts: words("null NULL omit"),
|
278
|
+
|
279
|
+
visibilityModifiers: words("private public friend"),
|
280
|
+
templateMatch: words("complement ifpresent subset superset permutation"),
|
281
|
+
multiLineStrings: true
|
282
|
+
});
|
283
|
+
});
|
@@ -68,15 +68,6 @@ CodeMirror.defineMode("xquery", function() {
|
|
68
68
|
return kwObj;
|
69
69
|
}();
|
70
70
|
|
71
|
-
// Used as scratch variables to communicate multiple values without
|
72
|
-
// consing up tons of objects.
|
73
|
-
var type, content;
|
74
|
-
|
75
|
-
function ret(tp, style, cont) {
|
76
|
-
type = tp; content = cont;
|
77
|
-
return style;
|
78
|
-
}
|
79
|
-
|
80
71
|
function chain(stream, state, f) {
|
81
72
|
state.tokenize = f;
|
82
73
|
return f(stream, state);
|
@@ -95,7 +86,7 @@ CodeMirror.defineMode("xquery", function() {
|
|
95
86
|
|
96
87
|
if(stream.match("![CDATA", false)) {
|
97
88
|
state.tokenize = tokenCDATA;
|
98
|
-
return
|
89
|
+
return "tag";
|
99
90
|
}
|
100
91
|
|
101
92
|
if(stream.match("?", false)) {
|
@@ -112,28 +103,28 @@ CodeMirror.defineMode("xquery", function() {
|
|
112
103
|
// start code block
|
113
104
|
else if(ch == "{") {
|
114
105
|
pushStateStack(state,{ type: "codeblock"});
|
115
|
-
return
|
106
|
+
return null;
|
116
107
|
}
|
117
108
|
// end code block
|
118
109
|
else if(ch == "}") {
|
119
110
|
popStateStack(state);
|
120
|
-
return
|
111
|
+
return null;
|
121
112
|
}
|
122
113
|
// if we're in an XML block
|
123
114
|
else if(isInXmlBlock(state)) {
|
124
115
|
if(ch == ">")
|
125
|
-
return
|
116
|
+
return "tag";
|
126
117
|
else if(ch == "/" && stream.eat(">")) {
|
127
118
|
popStateStack(state);
|
128
|
-
return
|
119
|
+
return "tag";
|
129
120
|
}
|
130
121
|
else
|
131
|
-
return
|
122
|
+
return "variable";
|
132
123
|
}
|
133
124
|
// if a number
|
134
125
|
else if (/\d/.test(ch)) {
|
135
126
|
stream.match(/^\d*(?:\.\d*)?(?:E[+\-]?\d+)?/);
|
136
|
-
return
|
127
|
+
return "atom";
|
137
128
|
}
|
138
129
|
// comment start
|
139
130
|
else if (ch === "(" && stream.eat(":")) {
|
@@ -149,27 +140,27 @@ CodeMirror.defineMode("xquery", function() {
|
|
149
140
|
}
|
150
141
|
// assignment
|
151
142
|
else if(ch ===":" && stream.eat("=")) {
|
152
|
-
return
|
143
|
+
return "keyword";
|
153
144
|
}
|
154
145
|
// open paren
|
155
146
|
else if(ch === "(") {
|
156
147
|
pushStateStack(state, { type: "paren"});
|
157
|
-
return
|
148
|
+
return null;
|
158
149
|
}
|
159
150
|
// close paren
|
160
151
|
else if(ch === ")") {
|
161
152
|
popStateStack(state);
|
162
|
-
return
|
153
|
+
return null;
|
163
154
|
}
|
164
155
|
// open paren
|
165
156
|
else if(ch === "[") {
|
166
157
|
pushStateStack(state, { type: "bracket"});
|
167
|
-
return
|
158
|
+
return null;
|
168
159
|
}
|
169
160
|
// close paren
|
170
161
|
else if(ch === "]") {
|
171
162
|
popStateStack(state);
|
172
|
-
return
|
163
|
+
return null;
|
173
164
|
}
|
174
165
|
else {
|
175
166
|
var known = keywords.propertyIsEnumerable(ch) && keywords[ch];
|
@@ -204,15 +195,14 @@ CodeMirror.defineMode("xquery", function() {
|
|
204
195
|
// if the previous word was element, attribute, axis specifier, this word should be the name of that
|
205
196
|
if(isInXmlConstructor(state)) {
|
206
197
|
popStateStack(state);
|
207
|
-
return
|
198
|
+
return "variable";
|
208
199
|
}
|
209
200
|
// as previously checked, if the word is element,attribute, axis specifier, call it an "xmlconstructor" and
|
210
201
|
// push the stack so we know to look for it on the next word
|
211
202
|
if(word == "element" || word == "attribute" || known.type == "axis_specifier") pushStateStack(state, {type: "xmlconstructor"});
|
212
203
|
|
213
204
|
// if the word is known, return the details of that else just call this a generic 'word'
|
214
|
-
return known ?
|
215
|
-
ret("word", "variable", word);
|
205
|
+
return known ? known.style : "variable";
|
216
206
|
}
|
217
207
|
}
|
218
208
|
|
@@ -235,7 +225,7 @@ CodeMirror.defineMode("xquery", function() {
|
|
235
225
|
maybeNested = (ch == "(");
|
236
226
|
}
|
237
227
|
|
238
|
-
return
|
228
|
+
return "comment";
|
239
229
|
}
|
240
230
|
|
241
231
|
// tokenizer for string literals
|
@@ -247,7 +237,7 @@ CodeMirror.defineMode("xquery", function() {
|
|
247
237
|
if(isInString(state) && stream.current() == quote) {
|
248
238
|
popStateStack(state);
|
249
239
|
if(f) state.tokenize = f;
|
250
|
-
return
|
240
|
+
return "string";
|
251
241
|
}
|
252
242
|
|
253
243
|
pushStateStack(state, { type: "string", name: quote, tokenize: tokenString(quote, f) });
|
@@ -255,7 +245,7 @@ CodeMirror.defineMode("xquery", function() {
|
|
255
245
|
// if we're in a string and in an XML block, allow an embedded code block
|
256
246
|
if(stream.match("{", false) && isInXmlAttributeBlock(state)) {
|
257
247
|
state.tokenize = tokenBase;
|
258
|
-
return
|
248
|
+
return "string";
|
259
249
|
}
|
260
250
|
|
261
251
|
|
@@ -269,13 +259,13 @@ CodeMirror.defineMode("xquery", function() {
|
|
269
259
|
// if we're in a string and in an XML block, allow an embedded code block in an attribute
|
270
260
|
if(stream.match("{", false) && isInXmlAttributeBlock(state)) {
|
271
261
|
state.tokenize = tokenBase;
|
272
|
-
return
|
262
|
+
return "string";
|
273
263
|
}
|
274
264
|
|
275
265
|
}
|
276
266
|
}
|
277
267
|
|
278
|
-
return
|
268
|
+
return "string";
|
279
269
|
};
|
280
270
|
}
|
281
271
|
|
@@ -293,7 +283,7 @@ CodeMirror.defineMode("xquery", function() {
|
|
293
283
|
}
|
294
284
|
stream.eatWhile(isVariableChar);
|
295
285
|
state.tokenize = tokenBase;
|
296
|
-
return
|
286
|
+
return "variable";
|
297
287
|
}
|
298
288
|
|
299
289
|
// tokenizer for XML tags
|
@@ -303,19 +293,19 @@ CodeMirror.defineMode("xquery", function() {
|
|
303
293
|
if(isclose && stream.eat(">")) {
|
304
294
|
popStateStack(state);
|
305
295
|
state.tokenize = tokenBase;
|
306
|
-
return
|
296
|
+
return "tag";
|
307
297
|
}
|
308
298
|
// self closing tag without attributes?
|
309
299
|
if(!stream.eat("/"))
|
310
300
|
pushStateStack(state, { type: "tag", name: name, tokenize: tokenBase});
|
311
301
|
if(!stream.eat(">")) {
|
312
302
|
state.tokenize = tokenAttribute;
|
313
|
-
return
|
303
|
+
return "tag";
|
314
304
|
}
|
315
305
|
else {
|
316
306
|
state.tokenize = tokenBase;
|
317
307
|
}
|
318
|
-
return
|
308
|
+
return "tag";
|
319
309
|
};
|
320
310
|
}
|
321
311
|
|
@@ -326,14 +316,14 @@ CodeMirror.defineMode("xquery", function() {
|
|
326
316
|
if(ch == "/" && stream.eat(">")) {
|
327
317
|
if(isInXmlAttributeBlock(state)) popStateStack(state);
|
328
318
|
if(isInXmlBlock(state)) popStateStack(state);
|
329
|
-
return
|
319
|
+
return "tag";
|
330
320
|
}
|
331
321
|
if(ch == ">") {
|
332
322
|
if(isInXmlAttributeBlock(state)) popStateStack(state);
|
333
|
-
return
|
323
|
+
return "tag";
|
334
324
|
}
|
335
325
|
if(ch == "=")
|
336
|
-
return
|
326
|
+
return null;
|
337
327
|
// quoted string
|
338
328
|
if (ch == '"' || ch == "'")
|
339
329
|
return chain(stream, state, tokenString(ch, tokenAttribute));
|
@@ -351,7 +341,7 @@ CodeMirror.defineMode("xquery", function() {
|
|
351
341
|
state.tokenize = tokenBase;
|
352
342
|
}
|
353
343
|
|
354
|
-
return
|
344
|
+
return "attribute";
|
355
345
|
}
|
356
346
|
|
357
347
|
// handle comments, including nested
|
@@ -360,7 +350,7 @@ CodeMirror.defineMode("xquery", function() {
|
|
360
350
|
while (ch = stream.next()) {
|
361
351
|
if (ch == "-" && stream.match("->", true)) {
|
362
352
|
state.tokenize = tokenBase;
|
363
|
-
return
|
353
|
+
return "comment";
|
364
354
|
}
|
365
355
|
}
|
366
356
|
}
|
@@ -372,7 +362,7 @@ CodeMirror.defineMode("xquery", function() {
|
|
372
362
|
while (ch = stream.next()) {
|
373
363
|
if (ch == "]" && stream.match("]", true)) {
|
374
364
|
state.tokenize = tokenBase;
|
375
|
-
return
|
365
|
+
return "comment";
|
376
366
|
}
|
377
367
|
}
|
378
368
|
}
|
@@ -383,7 +373,7 @@ CodeMirror.defineMode("xquery", function() {
|
|
383
373
|
while (ch = stream.next()) {
|
384
374
|
if (ch == "?" && stream.match(">", true)) {
|
385
375
|
state.tokenize = tokenBase;
|
386
|
-
return
|
376
|
+
return "comment meta";
|
387
377
|
}
|
388
378
|
}
|
389
379
|
}
|