@teipublisher/pb-components 1.40.2 → 1.41.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/demo/pb-code-editor.html +12 -9
- package/dist/{iron-form-f540b15b.js → iron-form-9e72ac45.js} +1 -1
- package/dist/jinn-codemirror-cc5827eb.js +1 -0
- package/dist/{paper-checkbox-f6a70487.js → paper-checkbox-102e3b43.js} +120 -120
- package/dist/pb-code-editor.js +22 -0
- package/dist/pb-components-bundle.js +234 -234
- package/dist/pb-edit-app.js +33 -33
- package/dist/pb-elements.json +61 -16
- package/dist/pb-i18n-6ad23bcf.js +1 -0
- package/dist/pb-message-0fb0b538.js +911 -0
- package/dist/pb-odd-editor.js +125 -82
- package/package.json +4 -5
- package/pb-elements.json +61 -16
- package/src/pb-code-editor.js +51 -663
- package/src/pb-components.js +0 -1
- package/src/pb-odd-model-editor.js +68 -23
- package/src/pb-odd-parameter-editor.js +17 -9
- package/src/pb-odd-rendition-editor.js +19 -9
- package/css/codemirror/3024-day.css +0 -41
- package/css/codemirror/3024-night.css +0 -39
- package/css/codemirror/abbott.css +0 -268
- package/css/codemirror/abcdef.css +0 -32
- package/css/codemirror/ambiance-mobile.css +0 -5
- package/css/codemirror/ambiance.css +0 -74
- package/css/codemirror/ayu-dark.css +0 -44
- package/css/codemirror/ayu-mirage.css +0 -45
- package/css/codemirror/base16-dark.css +0 -40
- package/css/codemirror/base16-light.css +0 -38
- package/css/codemirror/bespin.css +0 -34
- package/css/codemirror/blackboard.css +0 -32
- package/css/codemirror/cobalt.css +0 -25
- package/css/codemirror/colorforth.css +0 -33
- package/css/codemirror/darcula.css +0 -53
- package/css/codemirror/dracula.css +0 -40
- package/css/codemirror/duotone-dark.css +0 -35
- package/css/codemirror/duotone-light.css +0 -36
- package/css/codemirror/eclipse.css +0 -23
- package/css/codemirror/elegant.css +0 -13
- package/css/codemirror/erlang-dark.css +0 -34
- package/css/codemirror/gruvbox-dark.css +0 -39
- package/css/codemirror/hopscotch.css +0 -34
- package/css/codemirror/icecoder.css +0 -43
- package/css/codemirror/idea.css +0 -42
- package/css/codemirror/isotope.css +0 -34
- package/css/codemirror/juejin.css +0 -30
- package/css/codemirror/lesser-dark.css +0 -47
- package/css/codemirror/liquibyte.css +0 -95
- package/css/codemirror/lucario.css +0 -37
- package/css/codemirror/material-darker.css +0 -135
- package/css/codemirror/material-ocean.css +0 -141
- package/css/codemirror/material-palenight.css +0 -141
- package/css/codemirror/material.css +0 -141
- package/css/codemirror/mbo.css +0 -37
- package/css/codemirror/mdn-like.css +0 -46
- package/css/codemirror/midnight.css +0 -39
- package/css/codemirror/monokai.css +0 -41
- package/css/codemirror/moxer.css +0 -143
- package/css/codemirror/neat.css +0 -12
- package/css/codemirror/neo.css +0 -43
- package/css/codemirror/night.css +0 -27
- package/css/codemirror/nord.css +0 -42
- package/css/codemirror/oceanic-next.css +0 -46
- package/css/codemirror/panda-syntax.css +0 -85
- package/css/codemirror/paraiso-dark.css +0 -38
- package/css/codemirror/paraiso-light.css +0 -38
- package/css/codemirror/pastel-on-dark.css +0 -52
- package/css/codemirror/railscasts.css +0 -34
- package/css/codemirror/rubyblue.css +0 -25
- package/css/codemirror/seti.css +0 -44
- package/css/codemirror/shadowfox.css +0 -52
- package/css/codemirror/solarized.css +0 -168
- package/css/codemirror/ssms.css +0 -16
- package/css/codemirror/the-matrix.css +0 -30
- package/css/codemirror/tomorrow-night-bright.css +0 -35
- package/css/codemirror/tomorrow-night-eighties.css +0 -38
- package/css/codemirror/ttcn.css +0 -64
- package/css/codemirror/twilight.css +0 -32
- package/css/codemirror/vibrant-ink.css +0 -34
- package/css/codemirror/xq-dark.css +0 -53
- package/css/codemirror/xq-light.css +0 -43
- package/css/codemirror/yeti.css +0 -44
- package/css/codemirror/yonce.css +0 -59
- package/css/codemirror/zenburn.css +0 -37
- package/dist/pb-message-1a0c0c52.js +0 -1360
- package/lib/codemirror/addon/display/placeholder.js +0 -70
- package/lib/codemirror/addon/edit/matchbrackets.js +0 -152
- package/lib/codemirror/addon/lint/lint.js +0 -282
- package/lib/codemirror/mode/css/css.js +0 -855
- package/lib/codemirror/mode/stex/stex.js +0 -249
- package/lib/codemirror/mode/xml/xml.js +0 -404
- package/lib/codemirror/mode/xquery/xquery.js +0 -434
|
@@ -1,434 +0,0 @@
|
|
|
1
|
-
function xquery(CodeMirror) {
|
|
2
|
-
|
|
3
|
-
CodeMirror.defineMode("xquery", function() {
|
|
4
|
-
|
|
5
|
-
// The keywords object is set to the result of this self executing
|
|
6
|
-
// function. Each keyword is a property of the keywords object whose
|
|
7
|
-
// value is {type: atype, style: astyle}
|
|
8
|
-
var keywords = function(){
|
|
9
|
-
// convenience functions used to build keywords object
|
|
10
|
-
function kw(type) {return {type: type, style: "keyword"};}
|
|
11
|
-
var operator = kw("operator")
|
|
12
|
-
, atom = {type: "atom", style: "atom"}
|
|
13
|
-
, punctuation = {type: "punctuation", style: null}
|
|
14
|
-
, qualifier = {type: "axis_specifier", style: "qualifier"};
|
|
15
|
-
|
|
16
|
-
// kwObj is what is return from this function at the end
|
|
17
|
-
var kwObj = {
|
|
18
|
-
',': punctuation
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
// a list of 'basic' keywords. For each add a property to kwObj with the value of
|
|
22
|
-
// {type: basic[i], style: "keyword"} e.g. 'after' --> {type: "after", style: "keyword"}
|
|
23
|
-
var basic = ['after', 'all', 'allowing', 'ancestor', 'ancestor-or-self', 'any', 'array', 'as',
|
|
24
|
-
'ascending', 'at', 'attribute', 'base-uri', 'before', 'boundary-space', 'by', 'case', 'cast',
|
|
25
|
-
'castable', 'catch', 'child', 'collation', 'comment', 'construction', 'contains', 'content',
|
|
26
|
-
'context', 'copy', 'copy-namespaces', 'count', 'decimal-format', 'declare', 'default', 'delete',
|
|
27
|
-
'descendant', 'descendant-or-self', 'descending', 'diacritics', 'different', 'distance',
|
|
28
|
-
'document', 'document-node', 'element', 'else', 'empty', 'empty-sequence', 'encoding', 'end',
|
|
29
|
-
'entire', 'every', 'exactly', 'except', 'external', 'first', 'following', 'following-sibling',
|
|
30
|
-
'for', 'from', 'ftand', 'ftnot', 'ft-option', 'ftor', 'function', 'fuzzy', 'greatest', 'group',
|
|
31
|
-
'if', 'import', 'in', 'inherit', 'insensitive', 'insert', 'instance', 'intersect', 'into',
|
|
32
|
-
'invoke', 'is', 'item', 'language', 'last', 'lax', 'least', 'let', 'levels', 'lowercase', 'map',
|
|
33
|
-
'modify', 'module', 'most', 'namespace', 'next', 'no', 'node', 'nodes', 'no-inherit',
|
|
34
|
-
'no-preserve', 'not', 'occurs', 'of', 'only', 'option', 'order', 'ordered', 'ordering',
|
|
35
|
-
'paragraph', 'paragraphs', 'parent', 'phrase', 'preceding', 'preceding-sibling', 'preserve',
|
|
36
|
-
'previous', 'processing-instruction', 'relationship', 'rename', 'replace', 'return',
|
|
37
|
-
'revalidation', 'same', 'satisfies', 'schema', 'schema-attribute', 'schema-element', 'score',
|
|
38
|
-
'self', 'sensitive', 'sentence', 'sentences', 'sequence', 'skip', 'sliding', 'some', 'stable',
|
|
39
|
-
'start', 'stemming', 'stop', 'strict', 'strip', 'switch', 'text', 'then', 'thesaurus', 'times',
|
|
40
|
-
'to', 'transform', 'treat', 'try', 'tumbling', 'type', 'typeswitch', 'union', 'unordered',
|
|
41
|
-
'update', 'updating', 'uppercase', 'using', 'validate', 'value', 'variable', 'version',
|
|
42
|
-
'weight', 'when', 'where', 'wildcards', 'window', 'with', 'without', 'word', 'words', 'xquery'];
|
|
43
|
-
for(var i=0, l=basic.length; i < l; i++) { kwObj[basic[i]] = kw(basic[i]);}
|
|
44
|
-
// a list of types. For each add a property to kwObj with the value of
|
|
45
|
-
// {type: "atom", style: "atom"}
|
|
46
|
-
var types = ['xs:anyAtomicType', 'xs:anySimpleType', 'xs:anyType', 'xs:anyURI',
|
|
47
|
-
'xs:base64Binary', 'xs:boolean', 'xs:byte', 'xs:date', 'xs:dateTime', 'xs:dateTimeStamp',
|
|
48
|
-
'xs:dayTimeDuration', 'xs:decimal', 'xs:double', 'xs:duration', 'xs:ENTITIES', 'xs:ENTITY',
|
|
49
|
-
'xs:float', 'xs:gDay', 'xs:gMonth', 'xs:gMonthDay', 'xs:gYear', 'xs:gYearMonth', 'xs:hexBinary',
|
|
50
|
-
'xs:ID', 'xs:IDREF', 'xs:IDREFS', 'xs:int', 'xs:integer', 'xs:item', 'xs:java', 'xs:language',
|
|
51
|
-
'xs:long', 'xs:Name', 'xs:NCName', 'xs:negativeInteger', 'xs:NMTOKEN', 'xs:NMTOKENS',
|
|
52
|
-
'xs:nonNegativeInteger', 'xs:nonPositiveInteger', 'xs:normalizedString', 'xs:NOTATION',
|
|
53
|
-
'xs:numeric', 'xs:positiveInteger', 'xs:precisionDecimal', 'xs:QName', 'xs:short', 'xs:string',
|
|
54
|
-
'xs:time', 'xs:token', 'xs:unsignedByte', 'xs:unsignedInt', 'xs:unsignedLong',
|
|
55
|
-
'xs:unsignedShort', 'xs:untyped', 'xs:untypedAtomic', 'xs:yearMonthDuration'];
|
|
56
|
-
for(var i=0, l=types.length; i < l; i++) { kwObj[types[i]] = atom;}
|
|
57
|
-
// each operator will add a property to kwObj with value of {type: "operator", style: "keyword"}
|
|
58
|
-
var operators = ['eq', 'ne', 'lt', 'le', 'gt', 'ge', ':=', '=', '>', '>=', '<', '<=', '.', '|', '?', 'and', 'or', 'div', 'idiv', 'mod', '*', '/', '+', '-'];
|
|
59
|
-
for(var i=0, l=operators.length; i < l; i++) { kwObj[operators[i]] = operator;}
|
|
60
|
-
// each axis_specifiers will add a property to kwObj with value of {type: "axis_specifier", style: "qualifier"}
|
|
61
|
-
var axis_specifiers = ["self::", "attribute::", "child::", "descendant::", "descendant-or-self::", "parent::",
|
|
62
|
-
"ancestor::", "ancestor-or-self::", "following::", "preceding::", "following-sibling::", "preceding-sibling::"];
|
|
63
|
-
for(var i=0, l=axis_specifiers.length; i < l; i++) { kwObj[axis_specifiers[i]] = qualifier; }
|
|
64
|
-
return kwObj;
|
|
65
|
-
}();
|
|
66
|
-
|
|
67
|
-
function chain(stream, state, f) {
|
|
68
|
-
state.tokenize = f;
|
|
69
|
-
return f(stream, state);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// the primary mode tokenizer
|
|
73
|
-
function tokenBase(stream, state) {
|
|
74
|
-
var ch = stream.next(),
|
|
75
|
-
mightBeFunction = false,
|
|
76
|
-
isEQName = isEQNameAhead(stream);
|
|
77
|
-
|
|
78
|
-
// an XML tag (if not in some sub, chained tokenizer)
|
|
79
|
-
if (ch == "<") {
|
|
80
|
-
if(stream.match("!--", true))
|
|
81
|
-
return chain(stream, state, tokenXMLComment);
|
|
82
|
-
|
|
83
|
-
if(stream.match("![CDATA", false)) {
|
|
84
|
-
state.tokenize = tokenCDATA;
|
|
85
|
-
return "tag";
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if(stream.match("?", false)) {
|
|
89
|
-
return chain(stream, state, tokenPreProcessing);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
var isclose = stream.eat("/");
|
|
93
|
-
stream.eatSpace();
|
|
94
|
-
var tagName = "", c;
|
|
95
|
-
while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c;
|
|
96
|
-
|
|
97
|
-
return chain(stream, state, tokenTag(tagName, isclose));
|
|
98
|
-
}
|
|
99
|
-
// start code block
|
|
100
|
-
else if(ch == "{") {
|
|
101
|
-
pushStateStack(state, { type: "codeblock"});
|
|
102
|
-
return null;
|
|
103
|
-
}
|
|
104
|
-
// end code block
|
|
105
|
-
else if(ch == "}") {
|
|
106
|
-
popStateStack(state);
|
|
107
|
-
return null;
|
|
108
|
-
}
|
|
109
|
-
// if we're in an XML block
|
|
110
|
-
else if(isInXmlBlock(state)) {
|
|
111
|
-
if(ch == ">")
|
|
112
|
-
return "tag";
|
|
113
|
-
else if(ch == "/" && stream.eat(">")) {
|
|
114
|
-
popStateStack(state);
|
|
115
|
-
return "tag";
|
|
116
|
-
}
|
|
117
|
-
else
|
|
118
|
-
return "variable";
|
|
119
|
-
}
|
|
120
|
-
// if a number
|
|
121
|
-
else if (/\d/.test(ch)) {
|
|
122
|
-
stream.match(/^\d*(?:\.\d*)?(?:E[+\-]?\d+)?/);
|
|
123
|
-
return "atom";
|
|
124
|
-
}
|
|
125
|
-
// comment start
|
|
126
|
-
else if (ch === "(" && stream.eat(":")) {
|
|
127
|
-
pushStateStack(state, { type: "comment"});
|
|
128
|
-
return chain(stream, state, tokenComment);
|
|
129
|
-
}
|
|
130
|
-
// quoted string
|
|
131
|
-
else if (!isEQName && (ch === '"' || ch === "'"))
|
|
132
|
-
return chain(stream, state, tokenString(ch));
|
|
133
|
-
// variable
|
|
134
|
-
else if(ch === "$") {
|
|
135
|
-
return chain(stream, state, tokenVariable);
|
|
136
|
-
}
|
|
137
|
-
// assignment
|
|
138
|
-
else if(ch ===":" && stream.eat("=")) {
|
|
139
|
-
return "keyword";
|
|
140
|
-
}
|
|
141
|
-
// open paren
|
|
142
|
-
else if(ch === "(") {
|
|
143
|
-
pushStateStack(state, { type: "paren"});
|
|
144
|
-
return null;
|
|
145
|
-
}
|
|
146
|
-
// close paren
|
|
147
|
-
else if(ch === ")") {
|
|
148
|
-
popStateStack(state);
|
|
149
|
-
return null;
|
|
150
|
-
}
|
|
151
|
-
// open paren
|
|
152
|
-
else if(ch === "[") {
|
|
153
|
-
pushStateStack(state, { type: "bracket"});
|
|
154
|
-
return null;
|
|
155
|
-
}
|
|
156
|
-
// close paren
|
|
157
|
-
else if(ch === "]") {
|
|
158
|
-
popStateStack(state);
|
|
159
|
-
return null;
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
var known = keywords.propertyIsEnumerable(ch) && keywords[ch];
|
|
163
|
-
|
|
164
|
-
// if there's a EQName ahead, consume the rest of the string portion, it's likely a function
|
|
165
|
-
if(isEQName && ch === '\"') while(stream.next() !== '"'){}
|
|
166
|
-
if(isEQName && ch === '\'') while(stream.next() !== '\''){}
|
|
167
|
-
|
|
168
|
-
// gobble up a word if the character is not known
|
|
169
|
-
if(!known) stream.eatWhile(/[\w\$_-]/);
|
|
170
|
-
|
|
171
|
-
// gobble a colon in the case that is a lib func type call fn:doc
|
|
172
|
-
var foundColon = stream.eat(":");
|
|
173
|
-
|
|
174
|
-
// if there's not a second colon, gobble another word. Otherwise, it's probably an axis specifier
|
|
175
|
-
// which should get matched as a keyword
|
|
176
|
-
if(!stream.eat(":") && foundColon) {
|
|
177
|
-
stream.eatWhile(/[\w\$_-]/);
|
|
178
|
-
}
|
|
179
|
-
// if the next non whitespace character is an open paren, this is probably a function (if not a keyword of other sort)
|
|
180
|
-
if(stream.match(/^[ \t]*\(/, false)) {
|
|
181
|
-
mightBeFunction = true;
|
|
182
|
-
}
|
|
183
|
-
// is the word a keyword?
|
|
184
|
-
var word = stream.current();
|
|
185
|
-
known = keywords.propertyIsEnumerable(word) && keywords[word];
|
|
186
|
-
|
|
187
|
-
// if we think it's a function call but not yet known,
|
|
188
|
-
// set style to variable for now for lack of something better
|
|
189
|
-
if(mightBeFunction && !known) known = {type: "function_call", style: "variable def"};
|
|
190
|
-
|
|
191
|
-
// if the previous word was element, attribute, axis specifier, this word should be the name of that
|
|
192
|
-
if(isInXmlConstructor(state)) {
|
|
193
|
-
popStateStack(state);
|
|
194
|
-
return "variable";
|
|
195
|
-
}
|
|
196
|
-
// as previously checked, if the word is element,attribute, axis specifier, call it an "xmlconstructor" and
|
|
197
|
-
// push the stack so we know to look for it on the next word
|
|
198
|
-
if(word == "element" || word == "attribute" || known.type == "axis_specifier") pushStateStack(state, {type: "xmlconstructor"});
|
|
199
|
-
|
|
200
|
-
// if the word is known, return the details of that else just call this a generic 'word'
|
|
201
|
-
return known ? known.style : "variable";
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// handle comments, including nested
|
|
206
|
-
function tokenComment(stream, state) {
|
|
207
|
-
var maybeEnd = false, maybeNested = false, nestedCount = 0, ch;
|
|
208
|
-
while (ch = stream.next()) {
|
|
209
|
-
if (ch == ")" && maybeEnd) {
|
|
210
|
-
if(nestedCount > 0)
|
|
211
|
-
nestedCount--;
|
|
212
|
-
else {
|
|
213
|
-
popStateStack(state);
|
|
214
|
-
break;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
else if(ch == ":" && maybeNested) {
|
|
218
|
-
nestedCount++;
|
|
219
|
-
}
|
|
220
|
-
maybeEnd = (ch == ":");
|
|
221
|
-
maybeNested = (ch == "(");
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
return "comment";
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// tokenizer for string literals
|
|
228
|
-
// optionally pass a tokenizer function to set state.tokenize back to when finished
|
|
229
|
-
function tokenString(quote, f) {
|
|
230
|
-
return function(stream, state) {
|
|
231
|
-
var ch;
|
|
232
|
-
|
|
233
|
-
if(isInString(state) && stream.current() == quote) {
|
|
234
|
-
popStateStack(state);
|
|
235
|
-
if(f) state.tokenize = f;
|
|
236
|
-
return "string";
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
pushStateStack(state, { type: "string", name: quote, tokenize: tokenString(quote, f) });
|
|
240
|
-
|
|
241
|
-
// if we're in a string and in an XML block, allow an embedded code block
|
|
242
|
-
if(stream.match("{", false) && isInXmlAttributeBlock(state)) {
|
|
243
|
-
state.tokenize = tokenBase;
|
|
244
|
-
return "string";
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
while (ch = stream.next()) {
|
|
249
|
-
if (ch == quote) {
|
|
250
|
-
popStateStack(state);
|
|
251
|
-
if(f) state.tokenize = f;
|
|
252
|
-
break;
|
|
253
|
-
}
|
|
254
|
-
else {
|
|
255
|
-
// if we're in a string and in an XML block, allow an embedded code block in an attribute
|
|
256
|
-
if(stream.match("{", false) && isInXmlAttributeBlock(state)) {
|
|
257
|
-
state.tokenize = tokenBase;
|
|
258
|
-
return "string";
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
return "string";
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// tokenizer for variables
|
|
269
|
-
function tokenVariable(stream, state) {
|
|
270
|
-
var isVariableChar = /[\w\$_-]/;
|
|
271
|
-
|
|
272
|
-
// a variable may start with a quoted EQName so if the next character is quote, consume to the next quote
|
|
273
|
-
if(stream.eat("\"")) {
|
|
274
|
-
while(stream.next() !== '\"'){} stream.eat(":");
|
|
275
|
-
} else {
|
|
276
|
-
stream.eatWhile(isVariableChar);
|
|
277
|
-
if(!stream.match(":=", false)) stream.eat(":");
|
|
278
|
-
}
|
|
279
|
-
stream.eatWhile(isVariableChar);
|
|
280
|
-
state.tokenize = tokenBase;
|
|
281
|
-
return "variable";
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
// tokenizer for XML tags
|
|
285
|
-
function tokenTag(name, isclose) {
|
|
286
|
-
return function(stream, state) {
|
|
287
|
-
stream.eatSpace();
|
|
288
|
-
if(isclose && stream.eat(">")) {
|
|
289
|
-
popStateStack(state);
|
|
290
|
-
state.tokenize = tokenBase;
|
|
291
|
-
return "tag";
|
|
292
|
-
}
|
|
293
|
-
// self closing tag without attributes?
|
|
294
|
-
if(!stream.eat("/"))
|
|
295
|
-
pushStateStack(state, { type: "tag", name: name, tokenize: tokenBase});
|
|
296
|
-
if(!stream.eat(">")) {
|
|
297
|
-
state.tokenize = tokenAttribute;
|
|
298
|
-
return "tag";
|
|
299
|
-
}
|
|
300
|
-
else {
|
|
301
|
-
state.tokenize = tokenBase;
|
|
302
|
-
}
|
|
303
|
-
return "tag";
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
// tokenizer for XML attributes
|
|
308
|
-
function tokenAttribute(stream, state) {
|
|
309
|
-
var ch = stream.next();
|
|
310
|
-
|
|
311
|
-
if(ch == "/" && stream.eat(">")) {
|
|
312
|
-
if(isInXmlAttributeBlock(state)) popStateStack(state);
|
|
313
|
-
if(isInXmlBlock(state)) popStateStack(state);
|
|
314
|
-
return "tag";
|
|
315
|
-
}
|
|
316
|
-
if(ch == ">") {
|
|
317
|
-
if(isInXmlAttributeBlock(state)) popStateStack(state);
|
|
318
|
-
return "tag";
|
|
319
|
-
}
|
|
320
|
-
if(ch == "=")
|
|
321
|
-
return null;
|
|
322
|
-
// quoted string
|
|
323
|
-
if (ch == '"' || ch == "'")
|
|
324
|
-
return chain(stream, state, tokenString(ch, tokenAttribute));
|
|
325
|
-
|
|
326
|
-
if(!isInXmlAttributeBlock(state))
|
|
327
|
-
pushStateStack(state, { type: "attribute", tokenize: tokenAttribute});
|
|
328
|
-
|
|
329
|
-
stream.eat(/[a-zA-Z_:]/);
|
|
330
|
-
stream.eatWhile(/[-a-zA-Z0-9_:.]/);
|
|
331
|
-
stream.eatSpace();
|
|
332
|
-
|
|
333
|
-
// the case where the attribute has not value and the tag was closed
|
|
334
|
-
if(stream.match(">", false) || stream.match("/", false)) {
|
|
335
|
-
popStateStack(state);
|
|
336
|
-
state.tokenize = tokenBase;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
return "attribute";
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
// handle comments, including nested
|
|
343
|
-
function tokenXMLComment(stream, state) {
|
|
344
|
-
var ch;
|
|
345
|
-
while (ch = stream.next()) {
|
|
346
|
-
if (ch == "-" && stream.match("->", true)) {
|
|
347
|
-
state.tokenize = tokenBase;
|
|
348
|
-
return "comment";
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
// handle CDATA
|
|
355
|
-
function tokenCDATA(stream, state) {
|
|
356
|
-
var ch;
|
|
357
|
-
while (ch = stream.next()) {
|
|
358
|
-
if (ch == "]" && stream.match("]", true)) {
|
|
359
|
-
state.tokenize = tokenBase;
|
|
360
|
-
return "comment";
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
// handle preprocessing instructions
|
|
366
|
-
function tokenPreProcessing(stream, state) {
|
|
367
|
-
var ch;
|
|
368
|
-
while (ch = stream.next()) {
|
|
369
|
-
if (ch == "?" && stream.match(">", true)) {
|
|
370
|
-
state.tokenize = tokenBase;
|
|
371
|
-
return "comment meta";
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
// functions to test the current context of the state
|
|
378
|
-
function isInXmlBlock(state) { return isIn(state, "tag"); }
|
|
379
|
-
function isInXmlAttributeBlock(state) { return isIn(state, "attribute"); }
|
|
380
|
-
function isInXmlConstructor(state) { return isIn(state, "xmlconstructor"); }
|
|
381
|
-
function isInString(state) { return isIn(state, "string"); }
|
|
382
|
-
|
|
383
|
-
function isEQNameAhead(stream) {
|
|
384
|
-
// assume we've already eaten a quote (")
|
|
385
|
-
if(stream.current() === '"')
|
|
386
|
-
return stream.match(/^[^\"]+\"\:/, false);
|
|
387
|
-
else if(stream.current() === '\'')
|
|
388
|
-
return stream.match(/^[^\"]+\'\:/, false);
|
|
389
|
-
else
|
|
390
|
-
return false;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
function isIn(state, type) {
|
|
394
|
-
return (state.stack.length && state.stack[state.stack.length - 1].type == type);
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
function pushStateStack(state, newState) {
|
|
398
|
-
state.stack.push(newState);
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
function popStateStack(state) {
|
|
402
|
-
state.stack.pop();
|
|
403
|
-
var reinstateTokenize = state.stack.length && state.stack[state.stack.length-1].tokenize;
|
|
404
|
-
state.tokenize = reinstateTokenize || tokenBase;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
// the interface for the mode API
|
|
408
|
-
return {
|
|
409
|
-
startState: function() {
|
|
410
|
-
return {
|
|
411
|
-
tokenize: tokenBase,
|
|
412
|
-
cc: [],
|
|
413
|
-
stack: []
|
|
414
|
-
};
|
|
415
|
-
},
|
|
416
|
-
|
|
417
|
-
token: function(stream, state) {
|
|
418
|
-
if (stream.eatSpace()) return null;
|
|
419
|
-
var style = state.tokenize(stream, state);
|
|
420
|
-
return style;
|
|
421
|
-
},
|
|
422
|
-
|
|
423
|
-
blockCommentStart: "(:",
|
|
424
|
-
blockCommentEnd: ":)"
|
|
425
|
-
|
|
426
|
-
};
|
|
427
|
-
|
|
428
|
-
});
|
|
429
|
-
|
|
430
|
-
CodeMirror.defineMIME("application/xquery", "xquery");
|
|
431
|
-
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
export default xquery;
|