PageSourceSearch

https://scala-lang.org/resources/js/vendor/codemirror/clike.js

js scala-lang.org collected 2026-10-01 06:57:00 UTC 30,852 bytes, 788 lines download raw bytes

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
14function Context(indented, column, type, info, align, prev) {
15  this.indented = indented;
16  this.column = column;
17  this.type = type;
18  this.info = info;
19  this.align = align;
20  this.prev = prev;
21}
22function pushContext(state, col, type, info) {
23  var indent = state.indented;
24  if (state.context && state.context.type == "statement" && type != "statement")
25    indent = state.context.indented;
26  return state.context = new Context(indent, col, type, info, null, state.context);
27}
28function popContext(state) {
29  var t = state.context.type;
30  if (t == ")" || t == "]" || t == "}")
31    state.indented = state.context.indented;
32  return state.context = state.context.prev;
33}
34
35function typeBefore(stream, state, pos) {
36  if (state.prevToken == "variable" || state.prevToken == "variable-3") return true;
37  if (/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(stream.string.slice(0, pos))) return true;
38  if (state.typeAtEndOfLine && stream.column() == stream.indentation()) return true;
39}
40
41function isTopScope(context) {
42  for (;;) {
43    if (!context || context.type == "top") return true;
44    if (context.type == "}" && context.prev.info != "namespace") return false;
45    context = context.prev;
46  }
47}
48
49CodeMirror.defineMode("clike", function(config, parserConfig) {
50  var indentUnit = config.indentUnit,
51      statementIndentUnit = parserConfig.statementIndentUnit || indentUnit,
52      dontAlignCalls = parserConfig.dontAlignCalls,
53      keywords = parserConfig.keywords || {},
54      types = parserConfig.types || {},
55      builtin = parserConfig.builtin || {},
56      blockKeywords = parserConfig.blockKeywords || {},
57      defKeywords = parserConfig.defKeywords || {},
58      atoms = parserConfig.atoms || {},
59      hooks = parserConfig.hooks || {},
60      multiLineStrings = parserConfig.multiLineStrings,
61      indentStatements = parserConfig.indentStatements !== false,
62      indentSwitch = parserConfig.indentSwitch !== false,
63      namespaceSeparator = parserConfig.namespaceSeparator,
64      isPunctuationChar = parserConfig.isPunctuationChar || /[\[\]{}\(\),;\:\.]/,
65      numberStart = parserConfig.numberStart || /[\d\.]/,
66      number = parserConfig.number || /^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,
67      isOperatorChar = parserConfig.isOperatorChar || /[+\-*&%=<>!?|\/]/;
68
69  var curPunc, isDefKeyword;
70
71  function tokenBase(stream, state) {
72    var ch = stream.next();
73    if (hooks[ch]) {
74      var result = hooks[ch](stream, state);
75      if (result !== false) return result;
76    }
77    if (ch == '"' || ch == "'") {
78      state.tokenize = tokenString(ch);
79      return state.tokenize(stream, state);
80    }
81    if (isPunctuationChar.test(ch)) {
82      curPunc = ch;
83      return null;
84    }
85    if (numberStart.test(ch)) {
86      stream.backUp(1)
87      if (stream.match(number)) return "number"
88      stream.next()
89    }
90    if (ch == "/") {
91      if (stream.eat("*")) {
92        state.tokenize = tokenComment;
93        return tokenComment(stream, state);
94      }
95      if (stream.eat("/")) {
96        stream.skipToEnd();
97        return "comment";
98      }
99    }
100    if (isOperatorChar.test(ch)) {
101      while (!stream.match(/^\/[\/*]/, false) && stream.eat(isOperatorChar)) {}
102      return "operator";
103    }
104    stream.eatWhile(/[\w\$_\xa1-\uffff]/);
105    if (namespaceSeparator) while (stream.match(namespaceSeparator))
106      stream.eatWhile(/[\w\$_\xa1-\uffff]/);
107
108    var cur = stream.current();
109    if (contains(keywords, cur)) {
110      if (contains(blockKeywords, cur)) curPunc = "newstatement";
111      if (contains(defKeywords, cur)) isDefKeyword = true;
112      return "keyword";
113    }
114    if (contains(types, cur)) return "variable-3";
115    if (contains(builtin, cur)) {
116      if (contains(blockKeywords, cur)) curPunc = "newstatement";
117      return "builtin";
118    }
119    if (contains(atoms, cur)) return "atom";
120    return "variable";
121  }
122
123  function tokenString(quote) {
124    return function(stream, state) {
125      var escaped = false, next, end = false;
126      while ((next = stream.next()) != null) {
127        if (next == quote && !escaped) {end = true; break;}
128        escaped = !escaped && next == "\\";
129      }
130      if (end || !(escaped || multiLineStrings))
131        state.tokenize = null;
132      return "string";
133    };
134  }
135
136  function tokenComment(stream, state) {
137    var maybeEnd = false, ch;
138    while (ch = stream.next()) {
139      if (ch == "/" && maybeEnd) {
140        state.tokenize = null;
141        break;
142      }
143      maybeEnd = (ch == "*");
144    }
145    return "comment";
146  }
147
148  function maybeEOL(stream, state) {
149    if (parserConfig.typeFirstDefinitions && stream.eol() && isTopScope(state.context))
150      state.typeAtEndOfLine = typeBefore(stream, state, stream.pos)
151  }
152
153  // Interface
154
155  return {
156    startState: function(basecolumn) {
157      return {
158        tokenize: null,
159        context: new Context((basecolumn || 0) - indentUnit, 0, "top", null, false),
160        indented: 0,
161        startOfLine: true,
162        prevToken: null
163      };
164    },
165
166    token: function(stream, state) {
167      var ctx = state.context;
168      if (stream.sol()) {
169        if (ctx.align == null) ctx.align = false;
170        state.indented = stream.indentation();
171        state.startOfLine = true;
172      }
173      if (stream.eatSpace()) { maybeEOL(stream, state); return null; }
174      curPunc = isDefKeyword = null;
175      var style = (state.tokenize || tokenBase)(stream, state);
176      if (style == "comment" || style == "meta") return style;
177      if (ctx.align == null) ctx.align = true;
178
179      if (curPunc == ";" || curPunc == ":" || (curPunc == "," && stream.match(/^\s*(?:\/\/.*)?$/, false)))
180        while (state.context.type == "statement") popContext(state);
181      else if (curPunc == "{") pushContext(state, stream.column(), "}");
182      else if (curPunc == "[") pushContext(state, stream.column(), "]");
183      else if (curPunc == "(") pushContext(state, stream.column(), ")");
184      else if (curPunc == "}") {
185        while (ctx.type == "statement") ctx = popContext(state);
186        if (ctx.type == "}") ctx = popContext(state);
187        while (ctx.type == "statement") ctx = popContext(state);
188      }
189      else if (curPunc == ctx.type) popContext(state);
190      else if (indentStatements &&
191               (((ctx.type == "}" || ctx.type == "top") && curPunc != ";") ||
192                (ctx.type == "statement" && curPunc == "newstatement"))) {
193        pushContext(state, stream.column(), "statement", stream.current());
194      }
195
196      if (style == "variable" &&
197          ((state.prevToken == "def" ||
198            (parserConfig.typeFirstDefinitions && typeBefore(stream, state, stream.start) &&
199             isTopScope(state.context) && stream.match(/^\s*\(/, false)))))
200        style = "def";
201
202      if (hooks.token) {
203        var result = hooks.token(stream, state, style);
204        if (result !== undefined) style = result;
205      }
206
207      if (style == "def" && parserConfig.styleDefs === false) style = "variable";
208
209      state.startOfLine = false;
210      state.prevToken = isDefKeyword ? "def" : style || curPunc;
211      maybeEOL(stream, state);
212      return style;
213    },
214
215    indent: function(state, textAfter) {
216      if (state.tokenize != tokenBase && state.tokenize != null || state.typeAtEndOfLine) return CodeMirror.Pass;
217      var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
218      if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
219      if (parserConfig.dontIndentStatements)
220        while (ctx.type == "statement" && parserConfig.dontIndentStatements.test(ctx.info))
221          ctx = ctx.prev
222      if (hooks.indent) {
223        var hook = hooks.indent(state, ctx, textAfter);
224        if (typeof hook == "number") return hook
225      }
226      var closing = firstChar == ctx.type;
227      var switchBlock = ctx.prev && ctx.prev.info == "switch";
228      if (parserConfig.allmanIndentation && /[{(]/.test(firstChar)) {
229        while (ctx.type != "top" && ctx.type != "}") ctx = ctx.prev
230        return ctx.indented
231      }
232      if (ctx.type == "statement")
233        return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit);
234      if (ctx.align && (!dontAlignCalls || ctx.type != ")"))
235        return ctx.column + (closing ? 0 : 1);
236      if (ctx.type == ")" && !closing)
237        return ctx.indented + statementIndentUnit;
238
239      return ctx.indented + (closing ? 0 : indentUnit) +
240        (!closing && switchBlock && !/^(?:case|default)\b/.test(textAfter) ? indentUnit : 0);
241    },
242
243    electricInput: indentSwitch ? /^\s*(?:case .*?:|default:|\{\}?|\})$/ : /^\s*[{}]$/,
244    blockCommentStart: "/*",
245    blockCommentEnd: "*/",
246    lineComment: "//",
247    fold: "brace"
248  };
249});
250
251  function words(str) {
252    var obj = {}, words = str.split(" ");
253    for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
254    return obj;
255  }
256  function contains(words, word) {
257    if (typeof words === "function") {
258      return words(word);
259    } else {
260      return words.propertyIsEnumerable(word);
261    }
262  }
263  var cKeywords = "auto if break case register continue return default do sizeof " +
264    "static else struct switch extern typedef union for goto while enum const volatile";
265  var cTypes = "int long char short double float unsigned signed void size_t ptrdiff_t";
266
267  function cppHook(stream, state) {
268    if (!state.startOfLine) return false
269    for (var ch, next = null; ch = stream.peek();) {
270      if (ch == "\\" && stream.match(/^.$/)) {
271        next = cppHook
272        break
273      } else if (ch == "/" && stream.match(/^\/[\/\*]/, false)) {
274        break
275      }
276      stream.next()
277    }
278    state.tokenize = next
279    return "meta"
280  }
281
282  function pointerHook(_stream, state) {
283    if (state.prevToken == "variable-3") return "variable-3";
284    return false;
285  }
286
287  function cpp14Literal(stream) {
288    stream.eatWhile(/[\w\.']/);
289    return "number";
290  }
291
292  function cpp11StringHook(stream, state) {
293    stream.backUp(1);
294    // Raw strings.
295    if (stream.match(/(R|u8R|uR|UR|LR)/)) {
296      var match = stream.match(/"([^\s\\()]{0,16})\(/);
297      if (!match) {
298        return false;
299      }
300      state.cpp11RawStringDelim = match[1];
301      state.tokenize = tokenRawString;
302      return tokenRawString(stream, state);
303    }
304    // Unicode strings/chars.
305    if (stream.match(/(u8|u|U|L)/)) {
306      if (stream.match(/["']/, /* eat */ false)) {
307        return "string";
308      }
309      return false;
310    }
311    // Ignore this hook.
312    stream.next();
313    return false;
314  }
315
316  function cppLooksLikeConstructor(word) {
317    var lastTwo = /(\w+)::(\w+)$/.exec(word);
318    return lastTwo && lastTwo[1] == lastTwo[2];
319  }
320
321  // C#-style strings where "" escapes a quote.
322  function tokenAtString(stream, state) {
323    var next;
324    while ((next = stream.next()) != null) {
325      if (next == '"' && !stream.eat('"')) {
326        state.tokenize = null;
327        break;
328      }
329    }
330    return "string";
331  }
332
333  // C++11 raw string literal is <prefix>"<delim>( anything )<delim>", where
334  // <delim> can be a string up to 16 characters long.
335  function tokenRawString(stream, state) {
336    // Escape characters that have special regex meanings.
337    var delim = state.cpp11RawStringDelim.replace(/[^\w\s]/g, '\\$&');
338    var match = stream.match(new RegExp(".*?\\)" + delim + '"'));
339    if (match)
340      state.tokenize = null;
341    else
342      stream.skipToEnd();
343    return "string";
344  }
345
346  function def(mimes, mode) {
347    if (typeof mimes == "string") mimes = [mimes];
348    var words = [];
349    function add(obj) {
350      if (obj) for (var prop in obj) if (obj.hasOwnProperty(prop))
351        words.push(prop);
352    }
353    add(mode.keywords);
354    add(mode.types);
355    add(mode.builtin);
356    add(mode.atoms);
357    if (words.length) {
358      mode.helperType = mimes[0];
359      CodeMirror.registerHelper("hintWords", mimes[0], words);
360    }
361
362    for (var i = 0; i < mimes.length; ++i)
363      CodeMirror.defineMIME(mimes[i], mode);
364  }
365
366  def(["text/x-csrc", "text/x-c", "text/x-chdr"], {
367    name: "clike",
368    keywords: words(cKeywords),
369    types: words(cTypes + " bool _Complex _Bool float_t double_t intptr_t intmax_t " +
370                 "int8_t int16_t int32_t int64_t uintptr_t uintmax_t uint8_t uint16_t " +
371                 "uint32_t uint64_t"),
372    blockKeywords: words("case do else for if switch while struct"),
373    defKeywords: words("struct"),
374    typeFirstDefinitions: true,
375    atoms: words("null true false"),
376    hooks: {"#": cppHook, "*": pointerHook},
377    modeProps: {fold: ["brace", "include"]}
378  });
379
380  def(["text/x-c++src", "text/x-c++hdr"], {
381    name: "clike",
382    keywords: words(cKeywords + " asm dynamic_cast namespace reinterpret_cast try explicit new " +
383                    "static_cast typeid catch operator template typename class friend private " +
384                    "this using const_cast inline public throw virtual delete mutable protected " +
385                    "alignas alignof constexpr decltype nullptr noexcept thread_local final " +
386                    "static_assert override"),
387    types: words(cTypes + " bool wchar_t"),
388    blockKeywords: words("catch class do else finally for if struct switch try while"),
389    defKeywords: words("class namespace struct enum union"),
390    typeFirstDefinitions: true,
391    atoms: words("true false null"),
392    dontIndentStatements: /^template$/,
393    hooks: {
394      "#": cppHook,
395      "*": pointerHook,
396      "u": cpp11StringHook,
397      "U": cpp11StringHook,
398      "L": cpp11StringHook,
399      "R": cpp11StringHook,
400      "0": cpp14Literal,
401      "1": cpp14Literal,
402      "2": cpp14Literal,
403      "3": cpp14Literal,
404      "4": cpp14Literal,
405      "5": cpp14Literal,
406      "6": cpp14Literal,
407      "7": cpp14Literal,
408      "8": cpp14Literal,
409      "9": cpp14Literal,
410      token: function(stream, state, style) {
411        if (style == "variable" && stream.peek() == "(" &&
412            (state.prevToken == ";" || state.prevToken == null ||
413             state.prevToken == "}") &&
414            cppLooksLikeConstructor(stream.current()))
415          return "def";
416      }
417    },
418    namespaceSeparator: "::",
419    modeProps: {fold: ["brace", "include"]}
420  });
421
422  def("text/x-java", {
423    name: "clike",
424    keywords: words("abstract assert break case catch class const continue default " +
425                    "do else enum extends final finally float for goto if implements import " +
426                    "instanceof interface native new package private protected public " +
427                    "return static strictfp super switch synchronized this throw throws transient " +
428                    "try volatile while @interface"),
429    types: words("byte short int long float double boolean char void Boolean Byte Character Double Float " +
430                 "Integer Long Number Object Short String StringBuffer StringBuilder Void"),
431    blockKeywords: words("catch class do else finally for if switch try while"),
432    defKeywords: words("class interface package enum @interface"),
433    typeFirstDefinitions: true,
434    atoms: words("true false null"),
435    number: /^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,
436    hooks: {
437      "@": function(stream) {
438        // Don't match the @interface keyword.
439        if (stream.match('interface', false)) return false;
440
441        stream.eatWhile(/[\w\$_]/);
442        return "meta";
443      }
444    },
445    modeProps: {fold: ["brace", "import"]}
446  });
447
448  def("text/x-csharp", {
449    name: "clike",
450    keywords: words("abstract as async await base break case catch checked class const continue" +
451                    " default delegate do else enum event explicit extern finally fixed for" +
452                    " foreach goto if implicit in interface internal is lock namespace new" +
453                    " operator out override params private protected public readonly ref return sealed" +
454                    " sizeof stackalloc static struct switch this throw try typeof unchecked" +
455                    " unsafe using virtual void volatile while add alias ascending descending dynamic from get" +
456                    " global group into join let orderby partial remove select set value var yield"),
457    types: words("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func" +
458                 " Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32" +
459                 " UInt64 bool byte char decimal double short int long object"  +
460                 " sbyte float string ushort uint ulong"),
461    blockKeywords: words("catch class do else finally for foreach if struct switch try while"),
462    defKeywords: words("class interface namespace struct var"),
463    typeFirstDefinitions: true,
464    atoms: words("true false null"),
465    hooks: {
466      "@": function(stream, state) {
467        if (stream.eat('"')) {
468          state.tokenize = tokenAtString;
469          return tokenAtString(stream, state);
470        }
471        stream.eatWhile(/[\w\$_]/);
472        return "meta";
473      }
474    }
475  });
476
477  function tokenTripleString(stream, state) {
478    var escaped = false;
479    while (!stream.eol()) {
480      if (!escaped && stream.match('"""')) {
481        state.tokenize = null;
482        break;
483      }
484      escaped = stream.next() == "\\" && !escaped;
485    }
486    return "string";
487  }
488
489  def("text/x-scala", {
490    name: "clike",
491    keywords: words(
492
493      /* scala */
494      "abstract case catch class def do else extends final finally for forSome if " +
495      "implicit import lazy match new null object override package private protected return " +
496      "sealed super this throw trait try type val var while with yield _ : = => <- <: " +
497      "<% >: # @ " +
498
499      /* package scala */
500      "assert assume require print println printf readLine readBoolean readByte readShort " +
501      "readChar readInt readLong readFloat readDouble " +
502
503      ":: #:: "
504    ),
505    types: words(
506      "AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either " +
507      "Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable " +
508      "Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering " +
509      "Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder " +
510      "StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector " +
511
512      /* package java.lang */
513      "Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable " +
514      "Compiler Double Exception Float Integer Long Math Number Object Package Pair Process " +
515      "Runtime Runnable SecurityManager Short StackTraceElement StrictMath String " +
516      "StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"
517    ),
518    multiLineStrings: true,
519    blockKeywords: words("catch class do else finally for forSome if match switch try while"),
520    defKeywords: words("class def object package trait type val var"),
521    atoms: words("true false null"),
522    indentStatements: false,
523    indentSwitch: false,
524    hooks: {
525      "@": function(stream) {
526        stream.eatWhile(/[\w\$_]/);
527        return "meta";
528      },
529      '"': function(stream, state) {
530        if (!stream.match('""')) return false;
531        state.tokenize = tokenTripleString;
532        return state.tokenize(stream, state);
533      },
534      "'": function(stream) {
535        stream.eatWhile(/[\w\$_\xa1-\uffff]/);
536        return "atom";
537      },
538      "=": function(stream, state) {
539        var cx = state.context
540        if (cx.type == "}" && cx.align && stream.eat(">")) {
541          state.context = new Context(cx.indented, cx.column, cx.type, cx.info, null, cx.prev)
542          return "operator"
543        } else {
544          return false
545        }
546      }
547    },
548    modeProps: {closeBrackets: {triples: '"'}}
549  });
550
551  function tokenKotlinString(tripleString){
552    return function (stream, state) {
553      var escaped = false, next, end = false;
554      while (!stream.eol()) {
555        if (!tripleString && !escaped && stream.match('"') ) {end = true; break;}
556        if (tripleString && stream.match('"""')) {end = true; break;}
557        next = stream.next();
558        if(!escaped && next == "$" && stream.match('{'))
559          stream.skipTo("}");
560        escaped = !escaped && next == "\\" && !tripleString;
561      }
562      if (end || !tripleString)
563        state.tokenize = null;
564      return "string";
565    }
566  }
567
568  def("text/x-kotlin", {
569    name: "clike",
570    keywords: words(
571      /*keywords*/
572      "package as typealias class interface this super val " +
573      "var fun for is in This throw return " +
574      "break continue object if else while do try when !in !is as? " +
575
576      /*soft keywords*/
577      "file import where by get set abstract enum open inner override private public internal " +
578      "protected catch finally out final vararg reified dynamic companion constructor init " +
579      "sealed field property receiver param sparam lateinit data inline noinline tailrec " +
580      "external annotation crossinline const operator infix"
581    ),
582    types: words(
583      /* package java.lang */
584      "Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable " +
585      "Compiler Double Exception Float Integer Long Math Number Object Package Pair Process " +
586      "Runtime Runnable SecurityManager Short StackTraceElement StrictMath String " +
587      "StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"
588    ),
589    intendSwitch: false,
590    indentStatements: false,
591    multiLineStrings: true,
592    blockKeywords: words("catch class do else finally for if where try while enum"),
593    defKeywords: words("class val var object package interface fun"),
594    atoms: words("true false null this"),
595    hooks: {
596      '"': function(stream, state) {
597        state.tokenize = tokenKotlinString(stream.match('""'));
598        return state.tokenize(stream, state);
599      }
600    },
601    modeProps: {closeBrackets: {triples: '"'}}
602  });
603
604  def(["x-shader/x-vertex", "x-shader/x-fragment"], {
605    name: "clike",
606    keywords: words("sampler1D sampler2D sampler3D samplerCube " +
607                    "sampler1DShadow sampler2DShadow " +
608                    "const attribute uniform varying " +
609                    "break continue discard return " +
610                    "for while do if else struct " +
611                    "in out inout"),
612    types: words("float int bool void " +
613                 "vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 " +
614                 "mat2 mat3 mat4"),
615    blockKeywords: words("for while do if else struct"),
616    builtin: words("radians degrees sin cos tan asin acos atan " +
617                    "pow exp log exp2 sqrt inversesqrt " +
618                    "abs sign floor ceil fract mod min max clamp mix step smoothstep " +
619                    "length distance dot cross normalize ftransform faceforward " +
620                    "reflect refract matrixCompMult " +
621                    "lessThan lessThanEqual greaterThan greaterThanEqual " +
622                    "equal notEqual any all not " +
623                    "texture1D texture1DProj texture1DLod texture1DProjLod " +
624                    "texture2D texture2DProj texture2DLod texture2DProjLod " +
625                    "texture3D texture3DProj texture3DLod texture3DProjLod " +
626                    "textureCube textureCubeLod " +
627                    "shadow1D shadow2D shadow1DProj shadow2DProj " +
628                    "shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod " +
629                    "dFdx dFdy fwidth " +
630                    "noise1 noise2 noise3 noise4"),
631    atoms: words("true false " +
632                "gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex " +
633                "gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 " +
634                "gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 " +
635                "gl_FogCoord gl_PointCoord " +
636                "gl_Position gl_PointSize gl_ClipVertex " +
637                "gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor " +
638                "gl_TexCoord gl_FogFragCoord " +
639                "gl_FragCoord gl_FrontFacing " +
640                "gl_FragData gl_FragDepth " +
641                "gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix " +
642                "gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse " +
643                "gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse " +
644                "gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose " +
645                "gl_ProjectionMatrixInverseTranspose " +
646                "gl_ModelViewProjectionMatrixInverseTranspose " +
647                "gl_TextureMatrixInverseTranspose " +
648                "gl_NormalScale gl_DepthRange gl_ClipPlane " +
649                "gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel " +
650                "gl_FrontLightModelProduct gl_BackLightModelProduct " +
651                "gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ " +
652                "gl_FogParameters " +
653                "gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords " +
654                "gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats " +
655                "gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits " +
656                "gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits " +
657                "gl_MaxDrawBuffers"),
658    indentSwitch: false,
659    hooks: {"#": cppHook},
660    modeProps: {fold: ["brace", "include"]}
661  });
662
663  def("text/x-nesc", {
664    name: "clike",
665    keywords: words(cKeywords + "as atomic async call command component components configuration event generic " +
666                    "implementation includes interface module new norace nx_struct nx_union post provides " +
667                    "signal task uses abstract extends"),
668    types: words(cTypes),
669    blockKeywords: words("case do else for if switch while struct"),
670    atoms: words("null true false"),
671    hooks: {"#": cppHook},
672    modeProps: {fold: ["brace", "include"]}
673  });
674
675  def("text/x-objectivec", {
676    name: "clike",
677    keywords: words(cKeywords + "inline restrict _Bool _Complex _Imaginary BOOL Class bycopy byref id IMP in " +
678                    "inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),
679    types: words(cTypes),
680    atoms: words("YES NO NULL NILL ON OFF true false"),
681    hooks: {
682      "@": function(stream) {
683        stream.eatWhile(/[\w\$]/);
684        return "keyword";
685      },
686      "#": cppHook,
687      indent: function(_state, ctx, textAfter) {
688        if (ctx.type == "statement" && /^@\w/.test(textAfter)) return ctx.indented
689      }
690    },
691    modeProps: {fold: "brace"}
692  });
693
694  def("text/x-squirrel", {
695    name: "clike",
696    keywords: words("base break clone continue const default delete enum extends function in class" +
697                    " foreach local resume return this throw typeof yield constructor instanceof static"),
698    types: words(cTypes),
699    blockKeywords: words("case catch class else for foreach if switch try while"),
700    defKeywords: words("function local class"),
701    typeFirstDefinitions: true,
702    atoms: words("true false null"),
703    hooks: {"#": cppHook},
704    modeProps: {fold: ["brace", "include"]}
705  });
706
707  // Ceylon Strings need to deal with interpolation
708  var stringTokenizer = null;
709  function tokenCeylonString(type) {
710    return function(stream, state) {
711      var escaped = false, next, end = false;
712      while (!stream.eol()) {
713        if (!escaped && stream.match('"') &&
714              (type == "single" || stream.match('""'))) {
715          end = true;
716          break;
717        }
718        if (!escaped && stream.match('``')) {
719          stringTokenizer = tokenCeylonString(type);
720          end = true;
721          break;
722        }
723        next = stream.next();
724        escaped = type == "single" && !escaped && next == "\\";
725      }
726      if (end)
727          state.tokenize = null;
728      return "string";
729    }
730  }
731
732  def("text/x-ceylon", {
733    name: "clike",
734    keywords: words("abstracts alias assembly assert assign break case catch class continue dynamic else" +
735                    " exists extends finally for function given if import in interface is let module new" +
736                    " nonempty object of out outer package return satisfies super switch then this throw" +
737                    " try value void while"),
738    types: function(word) {
739        // In Ceylon all identifiers that start with an uppercase are types
740        var first = word.charAt(0);
741        return (first === first.toUpperCase() && first !== first.toLowerCase());
742    },
743    blockKeywords: words("case catch class dynamic else finally for function if interface module new object switch try while"),
744    defKeywords: words("class dynamic function interface module object package value"),
745    builtin: words("abstract actual aliased annotation by default deprecated doc final formal late license" +
746                   " native optional sealed see serializable shared suppressWarnings tagged throws variable"),
747    isPunctuationChar: /[\[\]{}\(\),;\:\.`]/,
748    isOperatorChar: /[+\-*&%=<>!?|^~:\/]/,
749    numberStart: /[\d#$]/,
750    number: /^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,
751    multiLineStrings: true,
752    typeFirstDefinitions: true,
753    atoms: words("true false null larger smaller equal empty finished"),
754    indentSwitch: false,
755    styleDefs: false,
756    hooks: {
757      "@": function(stream) {
758        stream.eatWhile(/[\w\$_]/);
759        return "meta";
760      },
761      '"': function(stream, state) {
762          state.tokenize = tokenCeylonString(stream.match('""') ? "triple" : "single");
763          return state.tokenize(stream, state);
764        },
765      '`': function(stream, state) {
766          if (!stringTokenizer || !stream.match('`')) return false;
767          state.tokenize = stringTokenizer;
768          stringTokenizer = null;
769          return state.tokenize(stream, state);
770        },
771      "'": function(stream) {
772        stream.eatWhile(/[\w\$_\xa1-\uffff]/);
773        return "atom";
774      },
775      token: function(_stream, state, style) {
776          if ((style == "variable" || style == "variable-3") &&
777              state.prevToken == ".") {
778            return "variable-2";
779          }
780        }
781    },
782    modeProps: {
783        fold: ["brace", "import"],
784        closeBrackets: {triples: '"'}
785    }
786  });
787
788});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.