ab30fd1481481ea1a281fe8b19b2bee0.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
  2. var oop = require("../lib/oop");
  3. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  4. var DocCommentHighlightRules = function () {
  5. this.$rules = {
  6. "start": [{
  7. token: "comment.doc.tag",
  8. regex: "@[\\w\\d_]+" // TODO: fix email addresses
  9. },
  10. DocCommentHighlightRules.getTagRule(),
  11. {
  12. defaultToken: "comment.doc",
  13. caseInsensitive: true
  14. }]
  15. };
  16. };
  17. oop.inherits(DocCommentHighlightRules, TextHighlightRules);
  18. DocCommentHighlightRules.getTagRule = function (start) {
  19. return {
  20. token: "comment.doc.tag.storage.type",
  21. regex: "\\b(?:TODO|FIXME|XXX|HACK)\\b"
  22. };
  23. };
  24. DocCommentHighlightRules.getStartRule = function (start) {
  25. return {
  26. token: "comment.doc",
  27. regex: "\\/\\*(?=\\*)",
  28. next: start
  29. };
  30. };
  31. DocCommentHighlightRules.getEndRule = function (start) {
  32. return {
  33. token: "comment.doc",
  34. regex: "\\*\\/",
  35. next: start
  36. };
  37. };
  38. exports.DocCommentHighlightRules = DocCommentHighlightRules;
  39. });
  40. 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){"use strict";
  41. var oop = require("../lib/oop");
  42. var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
  43. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  44. 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";
  45. var c_cppHighlightRules = function () {
  46. var keywordControls = ("break|case|continue|default|do|else|for|goto|if|_Pragma|" +
  47. "return|switch|while|catch|operator|try|throw|using");
  48. var storageType = ("asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" +
  49. "_Imaginary|int|int8_t|int16_t|int32_t|int64_t|long|short|signed|size_t|struct|typedef|uint8_t|uint16_t|uint32_t|uint64_t|union|unsigned|void|" +
  50. "class|wchar_t|template|char16_t|char32_t");
  51. var storageModifiers = ("const|extern|register|restrict|static|volatile|inline|private|" +
  52. "protected|public|friend|explicit|virtual|export|mutable|typename|" +
  53. "constexpr|new|delete|alignas|alignof|decltype|noexcept|thread_local");
  54. var keywordOperators = ("and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|" +
  55. "const_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace");
  56. var builtinConstants = ("NULL|true|false|TRUE|FALSE|nullptr");
  57. var keywordMapper = this.$keywords = this.createKeywordMapper({
  58. "keyword.control": keywordControls,
  59. "storage.type": storageType,
  60. "storage.modifier": storageModifiers,
  61. "keyword.operator": keywordOperators,
  62. "variable.language": "this",
  63. "constant.language": builtinConstants
  64. }, "identifier");
  65. var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
  66. 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;
  67. var formatRe = "%"
  68. + /(\d+\$)?/.source // field (argument #)
  69. + /[#0\- +']*/.source // flags
  70. + /[,;:_]?/.source // separator character (AltiVec)
  71. + /((-?\d+)|\*(-?\d+\$)?)?/.source // minimum field width
  72. + /(\.((-?\d+)|\*(-?\d+\$)?)?)?/.source // precision
  73. + /(hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)?/.source // length modifier
  74. + /(\[[^"\]]+\]|[diouxXDOUeEfFgGaACcSspn%])/.source; // conversion type
  75. this.$rules = {
  76. "start": [
  77. {
  78. token: "comment",
  79. regex: "//$",
  80. next: "start"
  81. }, {
  82. token: "comment",
  83. regex: "//",
  84. next: "singleLineComment"
  85. },
  86. DocCommentHighlightRules.getStartRule("doc-start"),
  87. {
  88. token: "comment",
  89. regex: "\\/\\*",
  90. next: "comment"
  91. }, {
  92. token: "string",
  93. regex: "'(?:" + escapeRe + "|.)?'"
  94. }, {
  95. token: "string.start",
  96. regex: '"',
  97. stateName: "qqstring",
  98. next: [
  99. { token: "string", regex: /\\\s*$/, next: "qqstring" },
  100. { token: "constant.language.escape", regex: escapeRe },
  101. { token: "constant.language.escape", regex: formatRe },
  102. { token: "string.end", regex: '"|$', next: "start" },
  103. { defaultToken: "string" }
  104. ]
  105. }, {
  106. token: "string.start",
  107. regex: 'R"\\(',
  108. stateName: "rawString",
  109. next: [
  110. { token: "string.end", regex: '\\)"', next: "start" },
  111. { defaultToken: "string" }
  112. ]
  113. }, {
  114. token: "constant.numeric",
  115. regex: "0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
  116. }, {
  117. token: "constant.numeric",
  118. regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
  119. }, {
  120. token: "keyword",
  121. regex: "#\\s*(?:include|import|pragma|line|define|undef)\\b",
  122. next: "directive"
  123. }, {
  124. token: "keyword",
  125. regex: "#\\s*(?:endif|if|ifdef|else|elif|ifndef)\\b"
  126. }, {
  127. token: "support.function.C99.c",
  128. regex: cFunctions
  129. }, {
  130. token: keywordMapper,
  131. regex: "[a-zA-Z_$][a-zA-Z0-9_$]*"
  132. }, {
  133. token: "keyword.operator",
  134. regex: /--|\+\+|<<=|>>=|>>>=|<>|&&|\|\||\?:|[*%\/+\-&\^|~!<>=]=?/
  135. }, {
  136. token: "punctuation.operator",
  137. regex: "\\?|\\:|\\,|\\;|\\."
  138. }, {
  139. token: "paren.lparen",
  140. regex: "[[({]"
  141. }, {
  142. token: "paren.rparen",
  143. regex: "[\\])}]"
  144. }, {
  145. token: "text",
  146. regex: "\\s+"
  147. }
  148. ],
  149. "comment": [
  150. {
  151. token: "comment",
  152. regex: "\\*\\/",
  153. next: "start"
  154. }, {
  155. defaultToken: "comment"
  156. }
  157. ],
  158. "singleLineComment": [
  159. {
  160. token: "comment",
  161. regex: /\\$/,
  162. next: "singleLineComment"
  163. }, {
  164. token: "comment",
  165. regex: /$/,
  166. next: "start"
  167. }, {
  168. defaultToken: "comment"
  169. }
  170. ],
  171. "directive": [
  172. {
  173. token: "constant.other.multiline",
  174. regex: /\\/
  175. },
  176. {
  177. token: "constant.other.multiline",
  178. regex: /.*\\/
  179. },
  180. {
  181. token: "constant.other",
  182. regex: "\\s*<.+?>",
  183. next: "start"
  184. },
  185. {
  186. token: "constant.other",
  187. regex: '\\s*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]',
  188. next: "start"
  189. },
  190. {
  191. token: "constant.other",
  192. regex: "\\s*['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']",
  193. next: "start"
  194. },
  195. {
  196. token: "constant.other",
  197. regex: /[^\\\/]+/,
  198. next: "start"
  199. }
  200. ]
  201. };
  202. this.embedRules(DocCommentHighlightRules, "doc-", [DocCommentHighlightRules.getEndRule("start")]);
  203. this.normalizeRules();
  204. };
  205. oop.inherits(c_cppHighlightRules, TextHighlightRules);
  206. exports.c_cppHighlightRules = c_cppHighlightRules;
  207. });
  208. ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
  209. var Range = require("../range").Range;
  210. var MatchingBraceOutdent = function () { };
  211. (function () {
  212. this.checkOutdent = function (line, input) {
  213. if (!/^\s+$/.test(line))
  214. return false;
  215. return /^\s*\}/.test(input);
  216. };
  217. this.autoOutdent = function (doc, row) {
  218. var line = doc.getLine(row);
  219. var match = line.match(/^(\s*\})/);
  220. if (!match)
  221. return 0;
  222. var column = match[1].length;
  223. var openBracePos = doc.findMatchingBracket({ row: row, column: column });
  224. if (!openBracePos || openBracePos.row == row)
  225. return 0;
  226. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  227. doc.replace(new Range(row, 0, row, column - 1), indent);
  228. };
  229. this.$getIndent = function (line) {
  230. return line.match(/^\s*/)[0];
  231. };
  232. }).call(MatchingBraceOutdent.prototype);
  233. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  234. });
  235. ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict";
  236. var oop = require("../../lib/oop");
  237. var Range = require("../../range").Range;
  238. var BaseFoldMode = require("./fold_mode").FoldMode;
  239. var FoldMode = exports.FoldMode = function (commentRegex) {
  240. if (commentRegex) {
  241. this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
  242. this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
  243. }
  244. };
  245. oop.inherits(FoldMode, BaseFoldMode);
  246. (function () {
  247. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  248. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  249. this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
  250. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  251. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  252. this._getFoldWidgetBase = this.getFoldWidget;
  253. this.getFoldWidget = function (session, foldStyle, row) {
  254. var line = session.getLine(row);
  255. if (this.singleLineBlockCommentRe.test(line)) {
  256. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  257. return "";
  258. }
  259. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  260. if (!fw && this.startRegionRe.test(line))
  261. return "start"; // lineCommentRegionStart
  262. return fw;
  263. };
  264. this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
  265. var line = session.getLine(row);
  266. if (this.startRegionRe.test(line))
  267. return this.getCommentRegionBlock(session, line, row);
  268. var match = line.match(this.foldingStartMarker);
  269. if (match) {
  270. var i = match.index;
  271. if (match[1])
  272. return this.openingBracketBlock(session, match[1], row, i);
  273. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  274. if (range && !range.isMultiLine()) {
  275. if (forceMultiline) {
  276. range = this.getSectionRange(session, row);
  277. }
  278. else if (foldStyle != "all")
  279. range = null;
  280. }
  281. return range;
  282. }
  283. if (foldStyle === "markbegin")
  284. return;
  285. var match = line.match(this.foldingStopMarker);
  286. if (match) {
  287. var i = match.index + match[0].length;
  288. if (match[1])
  289. return this.closingBracketBlock(session, match[1], row, i);
  290. return session.getCommentFoldRange(row, i, -1);
  291. }
  292. };
  293. this.getSectionRange = function (session, row) {
  294. var line = session.getLine(row);
  295. var startIndent = line.search(/\S/);
  296. var startRow = row;
  297. var startColumn = line.length;
  298. row = row + 1;
  299. var endRow = row;
  300. var maxRow = session.getLength();
  301. while (++row < maxRow) {
  302. line = session.getLine(row);
  303. var indent = line.search(/\S/);
  304. if (indent === -1)
  305. continue;
  306. if (startIndent > indent)
  307. break;
  308. var subRange = this.getFoldWidgetRange(session, "all", row);
  309. if (subRange) {
  310. if (subRange.start.row <= startRow) {
  311. break;
  312. }
  313. else if (subRange.isMultiLine()) {
  314. row = subRange.end.row;
  315. }
  316. else if (startIndent == indent) {
  317. break;
  318. }
  319. }
  320. endRow = row;
  321. }
  322. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  323. };
  324. this.getCommentRegionBlock = function (session, line, row) {
  325. var startColumn = line.search(/\s*$/);
  326. var maxRow = session.getLength();
  327. var startRow = row;
  328. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  329. var depth = 1;
  330. while (++row < maxRow) {
  331. line = session.getLine(row);
  332. var m = re.exec(line);
  333. if (!m)
  334. continue;
  335. if (m[1])
  336. depth--;
  337. else
  338. depth++;
  339. if (!depth)
  340. break;
  341. }
  342. var endRow = row;
  343. if (endRow > startRow) {
  344. return new Range(startRow, startColumn, endRow, line.length);
  345. }
  346. };
  347. }).call(FoldMode.prototype);
  348. });
  349. 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){"use strict";
  350. var oop = require("../lib/oop");
  351. var TextMode = require("./text").Mode;
  352. var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules;
  353. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  354. var Range = require("../range").Range;
  355. var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
  356. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  357. var Mode = function () {
  358. this.HighlightRules = c_cppHighlightRules;
  359. this.$outdent = new MatchingBraceOutdent();
  360. this.$behaviour = new CstyleBehaviour();
  361. this.foldingRules = new CStyleFoldMode();
  362. };
  363. oop.inherits(Mode, TextMode);
  364. (function () {
  365. this.lineCommentStart = "//";
  366. this.blockComment = { start: "/*", end: "*/" };
  367. this.getNextLineIndent = function (state, line, tab) {
  368. var indent = this.$getIndent(line);
  369. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  370. var tokens = tokenizedLine.tokens;
  371. var endState = tokenizedLine.state;
  372. if (tokens.length && tokens[tokens.length - 1].type == "comment") {
  373. return indent;
  374. }
  375. if (state == "start") {
  376. var match = line.match(/^.*[\{\(\[]\s*$/);
  377. if (match) {
  378. indent += tab;
  379. }
  380. }
  381. else if (state == "doc-start") {
  382. if (endState == "start") {
  383. return "";
  384. }
  385. var match = line.match(/^\s*(\/?)\*/);
  386. if (match) {
  387. if (match[1]) {
  388. indent += " ";
  389. }
  390. indent += "* ";
  391. }
  392. }
  393. return indent;
  394. };
  395. this.checkOutdent = function (state, line, input) {
  396. return this.$outdent.checkOutdent(line, input);
  397. };
  398. this.autoOutdent = function (state, doc, row) {
  399. this.$outdent.autoOutdent(doc, row);
  400. };
  401. this.$id = "ace/mode/c_cpp";
  402. this.snippetFileId = "ace/snippets/c_cpp";
  403. }).call(Mode.prototype);
  404. exports.Mode = Mode;
  405. });
  406. ace.define("ace/mode/protobuf_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
  407. var oop = require("../lib/oop");
  408. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  409. var ProtobufHighlightRules = function () {
  410. var builtinTypes = "double|float|int32|int64|uint32|uint64|sint32|" +
  411. "sint64|fixed32|fixed64|sfixed32|sfixed64|bool|" +
  412. "string|bytes";
  413. var keywordDeclaration = "message|required|optional|repeated|package|" +
  414. "import|option|enum";
  415. var keywordMapper = this.createKeywordMapper({
  416. "keyword.declaration.protobuf": keywordDeclaration,
  417. "support.type": builtinTypes
  418. }, "identifier");
  419. this.$rules = {
  420. "start": [{
  421. token: "comment",
  422. regex: /\/\/.*$/
  423. }, {
  424. token: "comment",
  425. regex: /\/\*/,
  426. next: "comment"
  427. }, {
  428. token: "constant",
  429. regex: "<[^>]+>"
  430. }, {
  431. regex: "=",
  432. token: "keyword.operator.assignment.protobuf"
  433. }, {
  434. token: "string",
  435. regex: '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  436. }, {
  437. token: "string",
  438. regex: '[\'](?:(?:\\\\.)|(?:[^\'\\\\]))*?[\']'
  439. }, {
  440. token: "constant.numeric",
  441. regex: "0[xX][0-9a-fA-F]+\\b"
  442. }, {
  443. token: "constant.numeric",
  444. regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
  445. }, {
  446. token: keywordMapper,
  447. regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
  448. }],
  449. "comment": [{
  450. token: "comment",
  451. regex: "\\*\\/",
  452. next: "start"
  453. }, {
  454. defaultToken: "comment"
  455. }]
  456. };
  457. this.normalizeRules();
  458. };
  459. oop.inherits(ProtobufHighlightRules, TextHighlightRules);
  460. exports.ProtobufHighlightRules = ProtobufHighlightRules;
  461. });
  462. ace.define("ace/mode/protobuf",["require","exports","module","ace/lib/oop","ace/mode/c_cpp","ace/mode/protobuf_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module){/*
  463. THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
  464. */
  465. "use strict";
  466. var oop = require("../lib/oop");
  467. var CMode = require("./c_cpp").Mode;
  468. var ProtobufHighlightRules = require("./protobuf_highlight_rules").ProtobufHighlightRules;
  469. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  470. var Mode = function () {
  471. CMode.call(this);
  472. this.foldingRules = new CStyleFoldMode();
  473. this.HighlightRules = ProtobufHighlightRules;
  474. };
  475. oop.inherits(Mode, CMode);
  476. (function () {
  477. this.lineCommentStart = "//";
  478. this.blockComment = { start: "/*", end: "*/" };
  479. this.$id = "ace/mode/protobuf";
  480. }).call(Mode.prototype);
  481. exports.Mode = Mode;
  482. }); (function() {
  483. ace.require(["ace/mode/protobuf"], function(m) {
  484. if (typeof module == "object" && typeof exports == "object" && module) {
  485. module.exports = m;
  486. }
  487. });
  488. })();