PageRenderTime 56ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/static/dashboard/node_modules/ace-builds/src/mode-dot.js

https://gitlab.com/IvettGeorge/tecnicassanacion
JavaScript | 417 lines | 378 code | 39 blank | 0 comment | 16 complexity | 45c7dbc905252a47e582051c2f5c2764 MD5 | raw file
  1. define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
  2. "use strict";
  3. var Range = require("../range").Range;
  4. var MatchingBraceOutdent = function() {};
  5. (function() {
  6. this.checkOutdent = function(line, input) {
  7. if (! /^\s+$/.test(line))
  8. return false;
  9. return /^\s*\}/.test(input);
  10. };
  11. this.autoOutdent = function(doc, row) {
  12. var line = doc.getLine(row);
  13. var match = line.match(/^(\s*\})/);
  14. if (!match) return 0;
  15. var column = match[1].length;
  16. var openBracePos = doc.findMatchingBracket({row: row, column: column});
  17. if (!openBracePos || openBracePos.row == row) return 0;
  18. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  19. doc.replace(new Range(row, 0, row, column-1), indent);
  20. };
  21. this.$getIndent = function(line) {
  22. return line.match(/^\s*/)[0];
  23. };
  24. }).call(MatchingBraceOutdent.prototype);
  25. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  26. });
  27. define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  28. "use strict";
  29. var oop = require("../lib/oop");
  30. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  31. var DocCommentHighlightRules = function() {
  32. this.$rules = {
  33. "start" : [ {
  34. token : "comment.doc.tag",
  35. regex : "@[\\w\\d_]+" // TODO: fix email addresses
  36. },
  37. DocCommentHighlightRules.getTagRule(),
  38. {
  39. defaultToken : "comment.doc",
  40. caseInsensitive: true
  41. }]
  42. };
  43. };
  44. oop.inherits(DocCommentHighlightRules, TextHighlightRules);
  45. DocCommentHighlightRules.getTagRule = function(start) {
  46. return {
  47. token : "comment.doc.tag.storage.type",
  48. regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
  49. };
  50. };
  51. DocCommentHighlightRules.getStartRule = function(start) {
  52. return {
  53. token : "comment.doc", // doc comment
  54. regex : "\\/\\*(?=\\*)",
  55. next : start
  56. };
  57. };
  58. DocCommentHighlightRules.getEndRule = function (start) {
  59. return {
  60. token : "comment.doc", // closing comment
  61. regex : "\\*\\/",
  62. next : start
  63. };
  64. };
  65. exports.DocCommentHighlightRules = DocCommentHighlightRules;
  66. });
  67. define("ace/mode/dot_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/doc_comment_highlight_rules"], function(require, exports, module) {
  68. "use strict";
  69. var oop = require("../lib/oop");
  70. var lang = require("../lib/lang");
  71. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  72. var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
  73. var DotHighlightRules = function() {
  74. var keywords = lang.arrayToMap(
  75. ("strict|node|edge|graph|digraph|subgraph").split("|")
  76. );
  77. var attributes = lang.arrayToMap(
  78. ("damping|k|url|area|arrowhead|arrowsize|arrowtail|aspect|bb|bgcolor|center|charset|clusterrank|color|colorscheme|comment|compound|concentrate|constraint|decorate|defaultdist|dim|dimen|dir|diredgeconstraints|distortion|dpi|edgeurl|edgehref|edgetarget|edgetooltip|epsilon|esep|fillcolor|fixedsize|fontcolor|fontname|fontnames|fontpath|fontsize|forcelabels|gradientangle|group|headurl|head_lp|headclip|headhref|headlabel|headport|headtarget|headtooltip|height|href|id|image|imagepath|imagescale|label|labelurl|label_scheme|labelangle|labeldistance|labelfloat|labelfontcolor|labelfontname|labelfontsize|labelhref|labeljust|labelloc|labeltarget|labeltooltip|landscape|layer|layerlistsep|layers|layerselect|layersep|layout|len|levels|levelsgap|lhead|lheight|lp|ltail|lwidth|margin|maxiter|mclimit|mindist|minlen|mode|model|mosek|nodesep|nojustify|normalize|nslimit|nslimit1|ordering|orientation|outputorder|overlap|overlap_scaling|pack|packmode|pad|page|pagedir|pencolor|penwidth|peripheries|pin|pos|quadtree|quantum|rank|rankdir|ranksep|ratio|rects|regular|remincross|repulsiveforce|resolution|root|rotate|rotation|samehead|sametail|samplepoints|scale|searchsize|sep|shape|shapefile|showboxes|sides|size|skew|smoothing|sortv|splines|start|style|stylesheet|tailurl|tail_lp|tailclip|tailhref|taillabel|tailport|tailtarget|tailtooltip|target|tooltip|truecolor|vertices|viewport|voro_margin|weight|width|xlabel|xlp|z").split("|")
  79. );
  80. this.$rules = {
  81. "start" : [
  82. {
  83. token : "comment",
  84. regex : /\/\/.*$/
  85. }, {
  86. token : "comment",
  87. regex : /#.*$/
  88. }, {
  89. token : "comment", // multi line comment
  90. merge : true,
  91. regex : /\/\*/,
  92. next : "comment"
  93. }, {
  94. token : "string",
  95. regex : "'(?=.)",
  96. next : "qstring"
  97. }, {
  98. token : "string",
  99. regex : '"(?=.)',
  100. next : "qqstring"
  101. }, {
  102. token : "constant.numeric",
  103. regex : /[+\-]?\d+(?:(?:\.\d*)?(?:[eE][+\-]?\d+)?)?\b/
  104. }, {
  105. token : "keyword.operator",
  106. regex : /\+|=|\->/
  107. }, {
  108. token : "punctuation.operator",
  109. regex : /,|;/
  110. }, {
  111. token : "paren.lparen",
  112. regex : /[\[{]/
  113. }, {
  114. token : "paren.rparen",
  115. regex : /[\]}]/
  116. }, {
  117. token: "comment",
  118. regex: /^#!.*$/
  119. }, {
  120. token: function(value) {
  121. if (keywords.hasOwnProperty(value.toLowerCase())) {
  122. return "keyword";
  123. }
  124. else if (attributes.hasOwnProperty(value.toLowerCase())) {
  125. return "variable";
  126. }
  127. else {
  128. return "text";
  129. }
  130. },
  131. regex: "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  132. }
  133. ],
  134. "comment" : [
  135. {
  136. token : "comment", // closing comment
  137. regex : "\\*\\/",
  138. next : "start"
  139. }, {
  140. defaultToken : "comment"
  141. }
  142. ],
  143. "qqstring" : [
  144. {
  145. token : "string",
  146. regex : '[^"\\\\]+',
  147. merge : true
  148. }, {
  149. token : "string",
  150. regex : "\\\\$",
  151. next : "qqstring",
  152. merge : true
  153. }, {
  154. token : "string",
  155. regex : '"|$',
  156. next : "start",
  157. merge : true
  158. }
  159. ],
  160. "qstring" : [
  161. {
  162. token : "string",
  163. regex : "[^'\\\\]+",
  164. merge : true
  165. }, {
  166. token : "string",
  167. regex : "\\\\$",
  168. next : "qstring",
  169. merge : true
  170. }, {
  171. token : "string",
  172. regex : "'|$",
  173. next : "start",
  174. merge : true
  175. }
  176. ]
  177. };
  178. };
  179. oop.inherits(DotHighlightRules, TextHighlightRules);
  180. exports.DotHighlightRules = DotHighlightRules;
  181. });
  182. define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
  183. "use strict";
  184. var oop = require("../../lib/oop");
  185. var Range = require("../../range").Range;
  186. var BaseFoldMode = require("./fold_mode").FoldMode;
  187. var FoldMode = exports.FoldMode = function(commentRegex) {
  188. if (commentRegex) {
  189. this.foldingStartMarker = new RegExp(
  190. this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
  191. );
  192. this.foldingStopMarker = new RegExp(
  193. this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
  194. );
  195. }
  196. };
  197. oop.inherits(FoldMode, BaseFoldMode);
  198. (function() {
  199. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  200. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  201. this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
  202. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  203. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  204. this._getFoldWidgetBase = this.getFoldWidget;
  205. this.getFoldWidget = function(session, foldStyle, row) {
  206. var line = session.getLine(row);
  207. if (this.singleLineBlockCommentRe.test(line)) {
  208. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  209. return "";
  210. }
  211. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  212. if (!fw && this.startRegionRe.test(line))
  213. return "start"; // lineCommentRegionStart
  214. return fw;
  215. };
  216. this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
  217. var line = session.getLine(row);
  218. if (this.startRegionRe.test(line))
  219. return this.getCommentRegionBlock(session, line, row);
  220. var match = line.match(this.foldingStartMarker);
  221. if (match) {
  222. var i = match.index;
  223. if (match[1])
  224. return this.openingBracketBlock(session, match[1], row, i);
  225. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  226. if (range && !range.isMultiLine()) {
  227. if (forceMultiline) {
  228. range = this.getSectionRange(session, row);
  229. } else if (foldStyle != "all")
  230. range = null;
  231. }
  232. return range;
  233. }
  234. if (foldStyle === "markbegin")
  235. return;
  236. var match = line.match(this.foldingStopMarker);
  237. if (match) {
  238. var i = match.index + match[0].length;
  239. if (match[1])
  240. return this.closingBracketBlock(session, match[1], row, i);
  241. return session.getCommentFoldRange(row, i, -1);
  242. }
  243. };
  244. this.getSectionRange = function(session, row) {
  245. var line = session.getLine(row);
  246. var startIndent = line.search(/\S/);
  247. var startRow = row;
  248. var startColumn = line.length;
  249. row = row + 1;
  250. var endRow = row;
  251. var maxRow = session.getLength();
  252. while (++row < maxRow) {
  253. line = session.getLine(row);
  254. var indent = line.search(/\S/);
  255. if (indent === -1)
  256. continue;
  257. if (startIndent > indent)
  258. break;
  259. var subRange = this.getFoldWidgetRange(session, "all", row);
  260. if (subRange) {
  261. if (subRange.start.row <= startRow) {
  262. break;
  263. } else if (subRange.isMultiLine()) {
  264. row = subRange.end.row;
  265. } else if (startIndent == indent) {
  266. break;
  267. }
  268. }
  269. endRow = row;
  270. }
  271. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  272. };
  273. this.getCommentRegionBlock = function(session, line, row) {
  274. var startColumn = line.search(/\s*$/);
  275. var maxRow = session.getLength();
  276. var startRow = row;
  277. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  278. var depth = 1;
  279. while (++row < maxRow) {
  280. line = session.getLine(row);
  281. var m = re.exec(line);
  282. if (!m) continue;
  283. if (m[1]) depth--;
  284. else depth++;
  285. if (!depth) break;
  286. }
  287. var endRow = row;
  288. if (endRow > startRow) {
  289. return new Range(startRow, startColumn, endRow, line.length);
  290. }
  291. };
  292. }).call(FoldMode.prototype);
  293. });
  294. define("ace/mode/dot",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/matching_brace_outdent","ace/mode/dot_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) {
  295. "use strict";
  296. var oop = require("../lib/oop");
  297. var TextMode = require("./text").Mode;
  298. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  299. var DotHighlightRules = require("./dot_highlight_rules").DotHighlightRules;
  300. var DotFoldMode = require("./folding/cstyle").FoldMode;
  301. var Mode = function() {
  302. this.HighlightRules = DotHighlightRules;
  303. this.$outdent = new MatchingBraceOutdent();
  304. this.foldingRules = new DotFoldMode();
  305. this.$behaviour = this.$defaultBehaviour;
  306. };
  307. oop.inherits(Mode, TextMode);
  308. (function() {
  309. this.lineCommentStart = ["//", "#"];
  310. this.blockComment = {start: "/*", end: "*/"};
  311. this.getNextLineIndent = function(state, line, tab) {
  312. var indent = this.$getIndent(line);
  313. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  314. var tokens = tokenizedLine.tokens;
  315. var endState = tokenizedLine.state;
  316. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  317. return indent;
  318. }
  319. if (state == "start") {
  320. var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
  321. if (match) {
  322. indent += tab;
  323. }
  324. }
  325. return indent;
  326. };
  327. this.checkOutdent = function(state, line, input) {
  328. return this.$outdent.checkOutdent(line, input);
  329. };
  330. this.autoOutdent = function(state, doc, row) {
  331. this.$outdent.autoOutdent(doc, row);
  332. };
  333. this.$id = "ace/mode/dot";
  334. }).call(Mode.prototype);
  335. exports.Mode = Mode;
  336. }); (function() {
  337. window.require(["ace/mode/dot"], function(m) {
  338. if (typeof module == "object" && typeof exports == "object" && module) {
  339. module.exports = m;
  340. }
  341. });
  342. })();