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 endStatement = parserConfig.endStatement || /^[;:,]$/; 69 70 var curPunc, isDefKeyword; 71 72 function tokenBase(stream, state) { 73 var ch = stream.next(); 74 if (hooks[ch]) { 75 var result = hooks[ch](stream, state); 76 if (result !== false) return result; 77 } 78 if (ch == '"' || ch == "'") { 79 state.tokenize = tokenString(ch); 80 return state.tokenize(stream, state); 81 } 82 if (isPunctuationChar.test(ch)) { 83 curPunc = ch; 84 return null; 85 } 86 if (numberStart.test(ch)) { 87 stream.backUp(1) 88 if (stream.match(number)) return "number" 89 stream.next() 90 } 91 if (ch == "/") { 92 if (stream.eat("*")) { 93 state.tokenize = tokenComment; 94 return tokenComment(stream, state); 95 } 96 if (stream.eat("/")) { 97 stream.skipToEnd(); 98 return "comment"; 99 } 100 } 101 if (isOperatorChar.test(ch)) { 102 while (!stream.match(/^\/[\/*]/, false) && stream.eat(isOperatorChar)) {} 103 return "operator"; 104 } 105 stream.eatWhile(/[\w\$_\xa1-\uffff]/); 106 if (namespaceSeparator) while (stream.match(namespaceSeparator)) 107 stream.eatWhile(/[\w\$_\xa1-\uffff]/); 108 109 var cur = stream.current(); 110 if (contains(keywords, cur)) { 111 if (contains(blockKeywords, cur)) curPunc = "newstatement"; 112 if (contains(defKeywords, cur)) isDefKeyword = true; 113 return "keyword"; 114 } 115 if (contains(types, cur)) return "variable-3"; 116 if (contains(builtin, cur)) { 117 if (contains(blockKeywords, cur)) curPunc = "newstatement";
118 return "builtin"; 119 } 120 if (contains(atoms, cur)) return "atom"; 121 return "variable"; 122 } 123 124 function tokenString(quote) { 125 return function(stream, state) { 126 var escaped = false, next, end = false; 127 while ((next = stream.next()) != null) { 128 if (next == quote && !escaped) {end = true; break;} 129 escaped = !escaped && next == "\\"; 130 } 131 if (end || !(escaped || multiLineStrings)) 132 state.tokenize = null; 133 return "string"; 134 }; 135 } 136 137 function tokenComment(stream, state) { 138 var maybeEnd = false, ch; 139 while (ch = stream.next()) { 140 if (ch == "/" && maybeEnd) { 141 state.tokenize = null; 142 break; 143 } 144 maybeEnd = (ch == "*"); 145 } 146 return "comment"; 147 } 148 149 function maybeEOL(stream, state) { 150 if (parserConfig.typeFirstDefinitions && stream.eol() && isTopScope(state.context)) 151 state.typeAtEndOfLine = typeBefore(stream, state, stream.pos) 152 } 153 154 // Interface 155 156 return { 157 startState: function(basecolumn) { 158 return { 159 tokenize: null, 160 context: new Context((basecolumn || 0) - indentUnit, 0, "top", null, false), 161 indented: 0, 162 startOfLine: true, 163 prevToken: null 164 }; 165 }, 166 167 token: function(stream, state) { 168 var ctx = state.context; 169 if (stream.sol()) { 170 if (ctx.align == null) ctx.align = false; 171 state.indented = stream.indentation(); 172 state.startOfLine = true; 173 } 174 if (stream.eatSpace()) { maybeEOL(stream, state); return null; } 175 curPunc = isDefKeyword = null; 176 var style = (state.tokenize || tokenBase)(stream, state); 177 if (style == "comment" || style == "meta") return style; 178 if (ctx.align == null) ctx.align = true; 179 180 if (endStatement.test(curPunc)) 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"), 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"), 433 typeFirstDefinitions: true, 434 atoms: words("true false null"), 435 endStatement: /^[;:]$/, 436 number: /^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i, 437 hooks: { 438 "@": function(stream) { 439 stream.eatWhile(/[\w\$_]/); 440 return "meta"; 441 } 442 }, 443 modeProps: {fold: ["brace", "import"]} 444 }); 445 446 def("text/x-csharp", { 447 name: "clike", 448 keywords: words("abstract as async await base break case catch checked class const continue" + 449 " default delegate do else enum event explicit extern finally fixed for" + 450 " foreach goto if implicit in interface internal is lock namespace new" + 451 " operator out override params private protected public readonly ref return sealed" + 452 " sizeof stackalloc static struct switch this throw try typeof unchecked" + 453 " unsafe using virtual void volatile while add alias ascending descending dynamic from get" + 454 " global group into join let orderby partial remove select set value var yield"), 455 types: words("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func" + 456 " Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32" + 457 " UInt64 bool byte char decimal double short int long object" + 458 " sbyte float string ushort uint ulong"), 459 blockKeywords: words("catch class do else finally for foreach if struct switch try while"), 460 defKeywords: words("class interface namespace struct var"), 461 typeFirstDefinitions: true, 462 atoms: words("true false null"), 463 hooks: { 464 "@": function(stream, state) { 465 if (stream.eat('"')) { 466 state.tokenize = tokenAtString; 467 return tokenAtString(stream, state); 468 } 469 stream.eatWhile(/[\w\$_]/); 470 return "meta"; 471 } 472 } 473 }); 474 475 function tokenTripleString(stream, state) { 476 var escaped = false; 477 while (!stream.eol()) { 478 if (!escaped && stream.match('"""')) { 479 state.tokenize = null; 480 break; 481 } 482 escaped = stream.next() == "\\" && !escaped; 483 } 484 return "string"; 485 } 486 487 def("text/x-scala", { 488 name: "clike", 489 keywords: words( 490 491 /* scala */ 492 "abstract case catch class def do else extends final finally for forSome if " + 493 "implicit import lazy match new null object override package private protected return " + 494 "sealed super this throw trait try type val var while with yield _ : = => <- <: " + 495 "<% >: # @ " + 496 497 /* package scala */ 498 "assert assume require print println printf readLine readBoolean readByte readShort " + 499 "readChar readInt readLong readFloat readDouble " + 500 501 ":: #:: " 502 ), 503 types: words( 504 "AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either " + 505 "Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable " + 506 "Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering " + 507 "Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder " + 508 "StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector " + 509 510 /* package java.lang */ 511 "Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable " + 512 "Compiler Double Exception Float Integer Long Math Number Object Package Pair Process " + 513 "Runtime Runnable SecurityManager Short StackTraceElement StrictMath String " + 514 "StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void" 515 ), 516 multiLineStrings: true, 517 blockKeywords: words("catch class do else finally for forSome if match switch try while"), 518 defKeywords: words("class def object package trait type val var"), 519 atoms: words("true false null"), 520 indentStatements: false, 521 indentSwitch: false, 522 hooks: { 523 "@": function(stream) { 524 stream.eatWhile(/[\w\$_]/); 525 return "meta"; 526 }, 527 '"': function(stream, state) { 528 if (!stream.match('""')) return false;
529 state.tokenize = tokenTripleString; 530 return state.tokenize(stream, state); 531 }, 532 "'": function(stream) { 533 stream.eatWhile(/[\w\$_\xa1-\uffff]/); 534 return "atom"; 535 }, 536 "=": function(stream, state) { 537 var cx = state.context 538 if (cx.type == "}" && cx.align && stream.eat(">")) { 539 state.context = new Context(cx.indented, cx.column, cx.type, cx.info, null, cx.prev) 540 return "operator" 541 } else { 542 return false 543 } 544 } 545 }, 546 modeProps: {closeBrackets: {triples: '"'}} 547 }); 548 549 function tokenKotlinString(tripleString){ 550 return function (stream, state) { 551 var escaped = false, next, end = false; 552 while (!stream.eol()) { 553 if (!tripleString && !escaped && stream.match('"') ) {end = true; break;} 554 if (tripleString && stream.match('"""')) {end = true; break;} 555 next = stream.next(); 556 if(!escaped && next == "$" && stream.match('{')) 557 stream.skipTo("}"); 558 escaped = !escaped && next == "\\" && !tripleString; 559 } 560 if (end || !tripleString) 561 state.tokenize = null; 562 return "string"; 563 } 564 } 565 566 def("text/x-kotlin", { 567 name: "clike", 568 keywords: words( 569 /*keywords*/ 570 "package as typealias class interface this super val " + 571 "var fun for is in This throw return " + 572 "break continue object if else while do try when !in !is as? " + 573 574 /*soft keywords*/ 575 "file import where by get set abstract enum open inner override private public internal " + 576 "protected catch finally out final vararg reified dynamic companion constructor init " + 577 "sealed field property receiver param sparam lateinit data inline noinline tailrec " + 578 "external annotation crossinline const operator infix" 579 ), 580 types: words( 581 /* package java.lang */ 582 "Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable " + 583 "Compiler Double Exception Float Integer Long Math Number Object Package Pair Process " + 584 "Runtime Runnable SecurityManager Short StackTraceElement StrictMath String " + 585 "StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void" 586 ), 587 intendSwitch: false, 588 indentStatements: false, 589 multiLineStrings: true, 590 blockKeywords: words("catch class do else finally for if where try while enum"), 591 defKeywords: words("class val var object package interface fun"), 592 atoms: words("true false null this"), 593 hooks: { 594 '"': function(stream, state) { 595 state.tokenize = tokenKotlinString(stream.match('""')); 596 return state.tokenize(stream, state); 597 } 598 }, 599 modeProps: {closeBrackets: {triples: '"'}} 600 }); 601 602 def(["x-shader/x-vertex", "x-shader/x-fragment"], { 603 name: "clike", 604 keywords: words("sampler1D sampler2D sampler3D samplerCube " + 605 "sampler1DShadow sampler2DShadow " + 606 "const attribute uniform varying " + 607 "break continue discard return " + 608 "for while do if else struct " + 609 "in out inout"), 610 types: words("float int bool void " + 611 "vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 " + 612 "mat2 mat3 mat4"), 613 blockKeywords: words("for while do if else struct"), 614 builtin: words("radians degrees sin cos tan asin acos atan " + 615 "pow exp log exp2 sqrt inversesqrt " + 616 "abs sign floor ceil fract mod min max clamp mix step smoothstep " + 617 "length distance dot cross normalize ftransform faceforward " + 618 "reflect refract matrixCompMult " + 619 "lessThan lessThanEqual greaterThan greaterThanEqual " + 620 "equal notEqual any all not " + 621 "texture1D texture1DProj texture1DLod texture1DProjLod " + 622 "texture2D texture2DProj texture2DLod texture2DProjLod " + 623 "texture3D texture3DProj texture3DLod texture3DProjLod " + 624 "textureCube textureCubeLod " + 625 "shadow1D shadow2D shadow1DProj shadow2DProj " + 626 "shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod " + 627 "dFdx dFdy fwidth " + 628 "noise1 noise2 noise3 noise4"), 629 atoms: words("true false " + 630 "gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex " + 631 "gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 " + 632 "gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 " + 633 "gl_FogCoord gl_PointCoord " + 634 "gl_Position gl_PointSize gl_ClipVertex " + 635 "gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor " + 636 "gl_TexCoord gl_FogFragCoord " + 637 "gl_FragCoord gl_FrontFacing " + 638 "gl_FragData gl_FragDepth " + 639 "gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix " + 640 "gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse " + 641 "gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse " + 642 "gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose " + 643 "gl_ProjectionMatrixInverseTranspose " + 644 "gl_ModelViewProjectionMatrixInverseTranspose " + 645 "gl_TextureMatrixInverseTranspose " + 646 "gl_NormalScale gl_DepthRange gl_ClipPlane " + 647 "gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel " + 648 "gl_FrontLightModelProduct gl_BackLightModelProduct " + 649 "gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ " + 650 "gl_FogParameters " + 651 "gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords " + 652 "gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats " + 653 "gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits " + 654 "gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits " + 655 "gl_MaxDrawBuffers"), 656 indentSwitch: false, 657 hooks: {"#": cppHook}, 658 modeProps: {fold: ["brace", "include"]} 659 }); 660 661 def("text/x-nesc", { 662 name: "clike",
663 keywords: words(cKeywords + "as atomic async call command component components configuration event generic " + 664 "implementation includes interface module new norace nx_struct nx_union post provides " + 665 "signal task uses abstract extends"), 666 types: words(cTypes), 667 blockKeywords: words("case do else for if switch while struct"), 668 atoms: words("null true false"), 669 hooks: {"#": cppHook}, 670 modeProps: {fold: ["brace", "include"]} 671 }); 672 673 def("text/x-objectivec", { 674 name: "clike", 675 keywords: words(cKeywords + "inline restrict _Bool _Complex _Imaginary BOOL Class bycopy byref id IMP in " + 676 "inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"), 677 types: words(cTypes), 678 atoms: words("YES NO NULL NILL ON OFF true false"), 679 hooks: { 680 "@": function(stream) { 681 stream.eatWhile(/[\w\$]/); 682 return "keyword"; 683 }, 684 "#": cppHook, 685 indent: function(_state, ctx, textAfter) { 686 if (ctx.type == "statement" && /^@\w/.test(textAfter)) return ctx.indented 687 } 688 }, 689 modeProps: {fold: "brace"} 690 }); 691 692 def("text/x-squirrel", { 693 name: "clike", 694 keywords: words("base break clone continue const default delete enum extends function in class" + 695 " foreach local resume return this throw typeof yield constructor instanceof static"), 696 types: words(cTypes), 697 blockKeywords: words("case catch class else for foreach if switch try while"), 698 defKeywords: words("function local class"), 699 typeFirstDefinitions: true, 700 atoms: words("true false null"), 701 hooks: {"#": cppHook}, 702 modeProps: {fold: ["brace", "include"]} 703 }); 704 705 // Ceylon Strings need to deal with interpolation 706 var stringTokenizer = null; 707 function tokenCeylonString(type) { 708 return function(stream, state) { 709 var escaped = false, next, end = false; 710 while (!stream.eol()) { 711 if (!escaped && stream.match('"') && 712 (type == "single" || stream.match('""'))) { 713 end = true; 714 break; 715 } 716 if (!escaped && stream.match('``')) { 717 stringTokenizer = tokenCeylonString(type); 718 end = true; 719 break; 720 } 721 next = stream.next(); 722 escaped = type == "single" && !escaped && next == "\\"; 723 } 724 if (end) 725 state.tokenize = null; 726 return "string"; 727 } 728 } 729 730 def("text/x-ceylon", { 731 name: "clike", 732 keywords: words("abstracts alias assembly assert assign break case catch class continue dynamic else" + 733 " exists extends finally for function given if import in interface is let module new" + 734 " nonempty object of out outer package return satisfies super switch then this throw" + 735 " try value void while"), 736 types: function(word) { 737 // In Ceylon all identifiers that start with an uppercase are types 738 var first = word.charAt(0); 739 return (first === first.toUpperCase() && first !== first.toLowerCase()); 740 }, 741 blockKeywords: words("case catch class dynamic else finally for function if interface module new object switch try while"), 742 defKeywords: words("class dynamic function interface module object package value"), 743 builtin: words("abstract actual aliased annotation by default deprecated doc final formal late license" + 744 " native optional sealed see serializable shared suppressWarnings tagged throws variable"), 745 isPunctuationChar: /[\[\]{}\(\),;\:\.`]/, 746 isOperatorChar: /[+\-*&%=<>!?|^~:\/]/, 747 numberStart: /[\d#$]/, 748 number: /^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i, 749 multiLineStrings: true, 750 typeFirstDefinitions: true, 751 atoms: words("true false null larger smaller equal empty finished"), 752 indentSwitch: false, 753 styleDefs: false, 754 hooks: { 755 "@": function(stream) { 756 stream.eatWhile(/[\w\$_]/); 757 return "meta"; 758 }, 759 '"': function(stream, state) { 760 state.tokenize = tokenCeylonString(stream.match('""') ? "triple" : "single"); 761 return state.tokenize(stream, state); 762 }, 763 '`': function(stream, state) { 764 if (!stringTokenizer || !stream.match('`')) return false;
765 state.tokenize = stringTokenizer; 766 stringTokenizer = null; 767 return state.tokenize(stream, state); 768 }, 769 "'": function(stream) { 770 stream.eatWhile(/[\w\$_\xa1-\uffff]/); 771 return "atom"; 772 }, 773 token: function(_stream, state, style) { 774 if ((style == "variable" || style == "variable-3") && 775 state.prevToken == ".") { 776 return "variable-2"; 777 } 778 } 779 }, 780 modeProps: { 781 fold: ["brace", "import"], 782 closeBrackets: {triples: '"'} 783 } 784 }); 785 786});
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.