mode-glsl.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  1. ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  2. "use strict";
  3. var oop = require("../lib/oop");
  4. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  5. var DocCommentHighlightRules = function() {
  6. this.$rules = {
  7. "start" : [ {
  8. token : "comment.doc.tag",
  9. regex : "@[\\w\\d_]+" // TODO: fix email addresses
  10. },
  11. DocCommentHighlightRules.getTagRule(),
  12. {
  13. defaultToken : "comment.doc",
  14. caseInsensitive: true
  15. }]
  16. };
  17. };
  18. oop.inherits(DocCommentHighlightRules, TextHighlightRules);
  19. DocCommentHighlightRules.getTagRule = function(start) {
  20. return {
  21. token : "comment.doc.tag.storage.type",
  22. regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
  23. };
  24. }
  25. DocCommentHighlightRules.getStartRule = function(start) {
  26. return {
  27. token : "comment.doc", // doc comment
  28. regex : "\\/\\*(?=\\*)",
  29. next : start
  30. };
  31. };
  32. DocCommentHighlightRules.getEndRule = function (start) {
  33. return {
  34. token : "comment.doc", // closing comment
  35. regex : "\\*\\/",
  36. next : start
  37. };
  38. };
  39. exports.DocCommentHighlightRules = DocCommentHighlightRules;
  40. });
  41. ace.define("ace/mode/c_cpp_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
  42. "use strict";
  43. var oop = require("../lib/oop");
  44. var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
  45. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  46. var cFunctions = exports.cFunctions = "\\b(?:hypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len))))\\b"
  47. var c_cppHighlightRules = function() {
  48. var keywordControls = (
  49. "break|case|continue|default|do|else|for|goto|if|_Pragma|" +
  50. "return|switch|while|catch|operator|try|throw|using"
  51. );
  52. var storageType = (
  53. "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" +
  54. "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" +
  55. "class|wchar_t|template|char16_t|char32_t"
  56. );
  57. var storageModifiers = (
  58. "const|extern|register|restrict|static|volatile|inline|private|" +
  59. "protected|public|friend|explicit|virtual|export|mutable|typename|" +
  60. "constexpr|new|delete|alignas|alignof|decltype|noexcept|thread_local"
  61. );
  62. var keywordOperators = (
  63. "and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq" +
  64. "const_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace"
  65. );
  66. var builtinConstants = (
  67. "NULL|true|false|TRUE|FALSE|nullptr"
  68. );
  69. var keywordMapper = this.$keywords = this.createKeywordMapper({
  70. "keyword.control" : keywordControls,
  71. "storage.type" : storageType,
  72. "storage.modifier" : storageModifiers,
  73. "keyword.operator" : keywordOperators,
  74. "variable.language": "this",
  75. "constant.language": builtinConstants
  76. }, "identifier");
  77. var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
  78. var escapeRe = /\\(?:['"?\\abfnrtv]|[0-7]{1,3}|x[a-fA-F\d]{2}|u[a-fA-F\d]{4}U[a-fA-F\d]{8}|.)/.source;
  79. this.$rules = {
  80. "start" : [
  81. {
  82. token : "comment",
  83. regex : "//$",
  84. next : "start"
  85. }, {
  86. token : "comment",
  87. regex : "//",
  88. next : "singleLineComment"
  89. },
  90. DocCommentHighlightRules.getStartRule("doc-start"),
  91. {
  92. token : "comment", // multi line comment
  93. regex : "\\/\\*",
  94. next : "comment"
  95. }, {
  96. token : "string", // character
  97. regex : "'(?:" + escapeRe + "|.)?'"
  98. }, {
  99. token : "string.start",
  100. regex : '"',
  101. stateName: "qqstring",
  102. next: [
  103. { token: "string", regex: /\\\s*$/, next: "qqstring" },
  104. { token: "constant.language.escape", regex: escapeRe },
  105. { token: "constant.language.escape", regex: /%[^'"\\]/ },
  106. { token: "string.end", regex: '"|$', next: "start" },
  107. { defaultToken: "string"}
  108. ]
  109. }, {
  110. token : "string.start",
  111. regex : 'R"\\(',
  112. stateName: "rawString",
  113. next: [
  114. { token: "string.end", regex: '\\)"', next: "start" },
  115. { defaultToken: "string"}
  116. ]
  117. }, {
  118. token : "constant.numeric", // hex
  119. regex : "0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
  120. }, {
  121. token : "constant.numeric", // float
  122. regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
  123. }, {
  124. token : "keyword", // pre-compiler directives
  125. regex : "#\\s*(?:include|import|pragma|line|define|undef)\\b",
  126. next : "directive"
  127. }, {
  128. token : "keyword", // special case pre-compiler directive
  129. regex : "#\\s*(?:endif|if|ifdef|else|elif|ifndef)\\b"
  130. }, {
  131. token : "support.function.C99.c",
  132. regex : cFunctions
  133. }, {
  134. token : keywordMapper,
  135. regex : "[a-zA-Z_$][a-zA-Z0-9_$]*"
  136. }, {
  137. token : "keyword.operator",
  138. regex : /--|\+\+|<<=|>>=|>>>=|<>|&&|\|\||\?:|[*%\/+\-&\^|~!<>=]=?/
  139. }, {
  140. token : "punctuation.operator",
  141. regex : "\\?|\\:|\\,|\\;|\\."
  142. }, {
  143. token : "paren.lparen",
  144. regex : "[[({]"
  145. }, {
  146. token : "paren.rparen",
  147. regex : "[\\])}]"
  148. }, {
  149. token : "text",
  150. regex : "\\s+"
  151. }
  152. ],
  153. "comment" : [
  154. {
  155. token : "comment", // closing comment
  156. regex : ".*?\\*\\/",
  157. next : "start"
  158. }, {
  159. token : "comment", // comment spanning whole line
  160. regex : ".+"
  161. }
  162. ],
  163. "singleLineComment" : [
  164. {
  165. token : "comment",
  166. regex : /\\$/,
  167. next : "singleLineComment"
  168. }, {
  169. token : "comment",
  170. regex : /$/,
  171. next : "start"
  172. }, {
  173. defaultToken: "comment"
  174. }
  175. ],
  176. "directive" : [
  177. {
  178. token : "constant.other.multiline",
  179. regex : /\\/
  180. },
  181. {
  182. token : "constant.other.multiline",
  183. regex : /.*\\/
  184. },
  185. {
  186. token : "constant.other",
  187. regex : "\\s*<.+?>",
  188. next : "start"
  189. },
  190. {
  191. token : "constant.other", // single line
  192. regex : '\\s*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]',
  193. next : "start"
  194. },
  195. {
  196. token : "constant.other", // single line
  197. regex : "\\s*['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']",
  198. next : "start"
  199. },
  200. {
  201. token : "constant.other",
  202. regex : /[^\\\/]+/,
  203. next : "start"
  204. }
  205. ]
  206. };
  207. this.embedRules(DocCommentHighlightRules, "doc-",
  208. [ DocCommentHighlightRules.getEndRule("start") ]);
  209. this.normalizeRules();
  210. };
  211. oop.inherits(c_cppHighlightRules, TextHighlightRules);
  212. exports.c_cppHighlightRules = c_cppHighlightRules;
  213. });
  214. ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
  215. "use strict";
  216. var Range = require("../range").Range;
  217. var MatchingBraceOutdent = function() {};
  218. (function() {
  219. this.checkOutdent = function(line, input) {
  220. if (! /^\s+$/.test(line))
  221. return false;
  222. return /^\s*\}/.test(input);
  223. };
  224. this.autoOutdent = function(doc, row) {
  225. var line = doc.getLine(row);
  226. var match = line.match(/^(\s*\})/);
  227. if (!match) return 0;
  228. var column = match[1].length;
  229. var openBracePos = doc.findMatchingBracket({row: row, column: column});
  230. if (!openBracePos || openBracePos.row == row) return 0;
  231. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  232. doc.replace(new Range(row, 0, row, column-1), indent);
  233. };
  234. this.$getIndent = function(line) {
  235. return line.match(/^\s*/)[0];
  236. };
  237. }).call(MatchingBraceOutdent.prototype);
  238. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  239. });
  240. ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
  241. "use strict";
  242. var oop = require("../../lib/oop");
  243. var Range = require("../../range").Range;
  244. var BaseFoldMode = require("./fold_mode").FoldMode;
  245. var FoldMode = exports.FoldMode = function(commentRegex) {
  246. if (commentRegex) {
  247. this.foldingStartMarker = new RegExp(
  248. this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
  249. );
  250. this.foldingStopMarker = new RegExp(
  251. this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
  252. );
  253. }
  254. };
  255. oop.inherits(FoldMode, BaseFoldMode);
  256. (function() {
  257. this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
  258. this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
  259. this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
  260. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  261. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  262. this._getFoldWidgetBase = this.getFoldWidget;
  263. this.getFoldWidget = function(session, foldStyle, row) {
  264. var line = session.getLine(row);
  265. if (this.singleLineBlockCommentRe.test(line)) {
  266. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  267. return "";
  268. }
  269. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  270. if (!fw && this.startRegionRe.test(line))
  271. return "start"; // lineCommentRegionStart
  272. return fw;
  273. };
  274. this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
  275. var line = session.getLine(row);
  276. if (this.startRegionRe.test(line))
  277. return this.getCommentRegionBlock(session, line, row);
  278. var match = line.match(this.foldingStartMarker);
  279. if (match) {
  280. var i = match.index;
  281. if (match[1])
  282. return this.openingBracketBlock(session, match[1], row, i);
  283. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  284. if (range && !range.isMultiLine()) {
  285. if (forceMultiline) {
  286. range = this.getSectionRange(session, row);
  287. } else if (foldStyle != "all")
  288. range = null;
  289. }
  290. return range;
  291. }
  292. if (foldStyle === "markbegin")
  293. return;
  294. var match = line.match(this.foldingStopMarker);
  295. if (match) {
  296. var i = match.index + match[0].length;
  297. if (match[1])
  298. return this.closingBracketBlock(session, match[1], row, i);
  299. return session.getCommentFoldRange(row, i, -1);
  300. }
  301. };
  302. this.getSectionRange = function(session, row) {
  303. var line = session.getLine(row);
  304. var startIndent = line.search(/\S/);
  305. var startRow = row;
  306. var startColumn = line.length;
  307. row = row + 1;
  308. var endRow = row;
  309. var maxRow = session.getLength();
  310. while (++row < maxRow) {
  311. line = session.getLine(row);
  312. var indent = line.search(/\S/);
  313. if (indent === -1)
  314. continue;
  315. if (startIndent > indent)
  316. break;
  317. var subRange = this.getFoldWidgetRange(session, "all", row);
  318. if (subRange) {
  319. if (subRange.start.row <= startRow) {
  320. break;
  321. } else if (subRange.isMultiLine()) {
  322. row = subRange.end.row;
  323. } else if (startIndent == indent) {
  324. break;
  325. }
  326. }
  327. endRow = row;
  328. }
  329. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  330. };
  331. this.getCommentRegionBlock = function(session, line, row) {
  332. var startColumn = line.search(/\s*$/);
  333. var maxRow = session.getLength();
  334. var startRow = row;
  335. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  336. var depth = 1;
  337. while (++row < maxRow) {
  338. line = session.getLine(row);
  339. var m = re.exec(line);
  340. if (!m) continue;
  341. if (m[1]) depth--;
  342. else depth++;
  343. if (!depth) break;
  344. }
  345. var endRow = row;
  346. if (endRow > startRow) {
  347. return new Range(startRow, startColumn, endRow, line.length);
  348. }
  349. };
  350. }).call(FoldMode.prototype);
  351. });
  352. ace.define("ace/mode/c_cpp",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/c_cpp_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
  353. "use strict";
  354. var oop = require("../lib/oop");
  355. var TextMode = require("./text").Mode;
  356. var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules;
  357. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  358. var Range = require("../range").Range;
  359. var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
  360. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  361. var Mode = function() {
  362. this.HighlightRules = c_cppHighlightRules;
  363. this.$outdent = new MatchingBraceOutdent();
  364. this.$behaviour = new CstyleBehaviour();
  365. this.foldingRules = new CStyleFoldMode();
  366. };
  367. oop.inherits(Mode, TextMode);
  368. (function() {
  369. this.lineCommentStart = "//";
  370. this.blockComment = {start: "/*", end: "*/"};
  371. this.getNextLineIndent = function(state, line, tab) {
  372. var indent = this.$getIndent(line);
  373. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  374. var tokens = tokenizedLine.tokens;
  375. var endState = tokenizedLine.state;
  376. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  377. return indent;
  378. }
  379. if (state == "start") {
  380. var match = line.match(/^.*[\{\(\[]\s*$/);
  381. if (match) {
  382. indent += tab;
  383. }
  384. } else if (state == "doc-start") {
  385. if (endState == "start") {
  386. return "";
  387. }
  388. var match = line.match(/^\s*(\/?)\*/);
  389. if (match) {
  390. if (match[1]) {
  391. indent += " ";
  392. }
  393. indent += "* ";
  394. }
  395. }
  396. return indent;
  397. };
  398. this.checkOutdent = function(state, line, input) {
  399. return this.$outdent.checkOutdent(line, input);
  400. };
  401. this.autoOutdent = function(state, doc, row) {
  402. this.$outdent.autoOutdent(doc, row);
  403. };
  404. this.$id = "ace/mode/c_cpp";
  405. }).call(Mode.prototype);
  406. exports.Mode = Mode;
  407. });
  408. ace.define("ace/mode/glsl_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/c_cpp_highlight_rules"], function(require, exports, module) {
  409. "use strict";
  410. var oop = require("../lib/oop");
  411. var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules;
  412. var glslHighlightRules = function() {
  413. var keywords = (
  414. "attribute|const|uniform|varying|break|continue|do|for|while|" +
  415. "if|else|in|out|inout|float|int|void|bool|true|false|" +
  416. "lowp|mediump|highp|precision|invariant|discard|return|mat2|mat3|" +
  417. "mat4|vec2|vec3|vec4|ivec2|ivec3|ivec4|bvec2|bvec3|bvec4|sampler2D|" +
  418. "samplerCube|struct"
  419. );
  420. var buildinConstants = (
  421. "radians|degrees|sin|cos|tan|asin|acos|atan|pow|" +
  422. "exp|log|exp2|log2|sqrt|inversesqrt|abs|sign|floor|ceil|fract|mod|" +
  423. "min|max|clamp|mix|step|smoothstep|length|distance|dot|cross|" +
  424. "normalize|faceforward|reflect|refract|matrixCompMult|lessThan|" +
  425. "lessThanEqual|greaterThan|greaterThanEqual|equal|notEqual|any|all|" +
  426. "not|dFdx|dFdy|fwidth|texture2D|texture2DProj|texture2DLod|" +
  427. "texture2DProjLod|textureCube|textureCubeLod|" +
  428. "gl_MaxVertexAttribs|gl_MaxVertexUniformVectors|gl_MaxVaryingVectors|" +
  429. "gl_MaxVertexTextureImageUnits|gl_MaxCombinedTextureImageUnits|" +
  430. "gl_MaxTextureImageUnits|gl_MaxFragmentUniformVectors|gl_MaxDrawBuffers|" +
  431. "gl_DepthRangeParameters|gl_DepthRange|" +
  432. "gl_Position|gl_PointSize|" +
  433. "gl_FragCoord|gl_FrontFacing|gl_PointCoord|gl_FragColor|gl_FragData"
  434. );
  435. var keywordMapper = this.createKeywordMapper({
  436. "variable.language": "this",
  437. "keyword": keywords,
  438. "constant.language": buildinConstants
  439. }, "identifier");
  440. this.$rules = new c_cppHighlightRules().$rules;
  441. this.$rules.start.forEach(function(rule) {
  442. if (typeof rule.token == "function")
  443. rule.token = keywordMapper;
  444. })
  445. };
  446. oop.inherits(glslHighlightRules, c_cppHighlightRules);
  447. exports.glslHighlightRules = glslHighlightRules;
  448. });
  449. ace.define("ace/mode/glsl",["require","exports","module","ace/lib/oop","ace/mode/c_cpp","ace/mode/glsl_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
  450. "use strict";
  451. var oop = require("../lib/oop");
  452. var CMode = require("./c_cpp").Mode;
  453. var glslHighlightRules = require("./glsl_highlight_rules").glslHighlightRules;
  454. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  455. var Range = require("../range").Range;
  456. var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
  457. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  458. var Mode = function() {
  459. this.HighlightRules = glslHighlightRules;
  460. this.$outdent = new MatchingBraceOutdent();
  461. this.$behaviour = new CstyleBehaviour();
  462. this.foldingRules = new CStyleFoldMode();
  463. };
  464. oop.inherits(Mode, CMode);
  465. (function() {
  466. this.$id = "ace/mode/glsl";
  467. }).call(Mode.prototype);
  468. exports.Mode = Mode;
  469. });