716afffe05a2fc1a2a8f5c34221fba3f.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. ace.define("ace/mode/pig_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){/* This file was autogenerated from Pig.tmLanguage (uuid: ) */
  2. "use strict";
  3. var oop = require("../lib/oop");
  4. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  5. var PigHighlightRules = function () {
  6. this.$rules = {
  7. start: [{
  8. token: "comment.block.pig",
  9. regex: /\/\*/,
  10. push: [{
  11. token: "comment.block.pig",
  12. regex: /\*\//,
  13. next: "pop"
  14. }, {
  15. defaultToken: "comment.block.pig"
  16. }]
  17. }, {
  18. token: "comment.line.double-dash.asciidoc",
  19. regex: /--.*$/
  20. }, {
  21. token: "keyword.control.pig",
  22. regex: /\b(?:ASSERT|LOAD|STORE|DUMP|FILTER|DISTINCT|FOREACH|GENERATE|STREAM|JOIN|COGROUP|GROUP|CROSS|ORDER|LIMIT|UNION|SPLIT|DESCRIBE|EXPLAIN|ILLUSTRATE|AS|BY|INTO|USING|LIMIT|PARALLEL|OUTER|INNER|DEFAULT|LEFT|SAMPLE|RANK|CUBE|ALL|KILL|QUIT|MAPREDUCE|ASC|DESC|THROUGH|SHIP|CACHE|DECLARE|CASE|WHEN|THEN|END|IN|PARTITION|FULL|IMPORT|IF|ONSCHEMA|INPUT|OUTPUT)\b/,
  23. caseInsensitive: true
  24. }, {
  25. token: "storage.datatypes.pig",
  26. regex: /\b(?:int|long|float|double|chararray|bytearray|boolean|datetime|biginteger|bigdecimal|tuple|bag|map)\b/,
  27. caseInsensitive: true
  28. }, {
  29. token: "support.function.storage.pig",
  30. regex: /\b(?:PigStorage|BinStorage|BinaryStorage|PigDump|HBaseStorage|JsonLoader|JsonStorage|AvroStorage|TextLoader|PigStreaming|TrevniStorage|AccumuloStorage)\b/
  31. }, {
  32. token: "support.function.udf.pig",
  33. regex: /\b(?:DIFF|TOBAG|TOMAP|TOP|TOTUPLE|RANDOM|FLATTEN|flatten|CUBE|ROLLUP|IsEmpty|ARITY|PluckTuple|SUBTRACT|BagToString)\b/
  34. }, {
  35. token: "support.function.udf.math.pig",
  36. regex: /\b(?:ABS|ACOS|ASIN|ATAN|CBRT|CEIL|COS|COSH|EXP|FLOOR|LOG|LOG10|ROUND|ROUND_TO|SIN|SINH|SQRT|TAN|TANH|AVG|COUNT|COUNT_STAR|MAX|MIN|SUM|COR|COV)\b/
  37. }, {
  38. token: "support.function.udf.string.pig",
  39. regex: /\b(?:CONCAT|INDEXOF|LAST_INDEX_OF|LCFIRST|LOWER|REGEX_EXTRACT|REGEX_EXTRACT_ALL|REPLACE|SIZE|STRSPLIT|SUBSTRING|TOKENIZE|TRIM|UCFIRST|UPPER|LTRIM|RTRIM|ENDSWITH|STARTSWITH|TRIM)\b/
  40. }, {
  41. token: "support.function.udf.datetime.pig",
  42. regex: /\b(?:AddDuration|CurrentTime|DaysBetween|GetDay|GetHour|GetMilliSecond|GetMinute|GetMonth|GetSecond|GetWeek|GetWeekYear|GetYear|HoursBetween|MilliSecondsBetween|MinutesBetween|MonthsBetween|SecondsBetween|SubtractDuration|ToDate|WeeksBetween|YearsBetween|ToMilliSeconds|ToString|ToUnixTime)\b/
  43. }, {
  44. token: "support.function.command.pig",
  45. regex: /\b(?:cat|cd|copyFromLocal|copyToLocal|cp|ls|mkdir|mv|pwd|rm)\b/
  46. }, {
  47. token: "variable.pig",
  48. regex: /\$[a_zA-Z0-9_]+/
  49. }, {
  50. token: "constant.language.pig",
  51. regex: /\b(?:NULL|true|false|stdin|stdout|stderr)\b/,
  52. caseInsensitive: true
  53. }, {
  54. token: "constant.numeric.pig",
  55. regex: /\b\d+(?:\.\d+)?\b/
  56. }, {
  57. token: "keyword.operator.comparison.pig",
  58. regex: /!=|==|<|>|<=|>=|\b(?:MATCHES|IS|OR|AND|NOT)\b/,
  59. caseInsensitive: true
  60. }, {
  61. token: "keyword.operator.arithmetic.pig",
  62. regex: /\+|\-|\*|\/|\%|\?|:|::|\.\.|#/
  63. }, {
  64. token: "string.quoted.double.pig",
  65. regex: /"/,
  66. push: [{
  67. token: "string.quoted.double.pig",
  68. regex: /"/,
  69. next: "pop"
  70. }, {
  71. token: "constant.character.escape.pig",
  72. regex: /\\./
  73. }, {
  74. defaultToken: "string.quoted.double.pig"
  75. }]
  76. }, {
  77. token: "string.quoted.single.pig",
  78. regex: /'/,
  79. push: [{
  80. token: "string.quoted.single.pig",
  81. regex: /'/,
  82. next: "pop"
  83. }, {
  84. token: "constant.character.escape.pig",
  85. regex: /\\./
  86. }, {
  87. defaultToken: "string.quoted.single.pig"
  88. }]
  89. }, {
  90. todo: {
  91. token: [
  92. "text",
  93. "keyword.parameter.pig",
  94. "text",
  95. "storage.type.parameter.pig"
  96. ],
  97. regex: /^(\s*)(set)(\s+)(\S+)/,
  98. caseInsensitive: true,
  99. push: [{
  100. token: "text",
  101. regex: /$/,
  102. next: "pop"
  103. }, {
  104. include: "$self"
  105. }]
  106. }
  107. }, {
  108. token: [
  109. "text",
  110. "keyword.alias.pig",
  111. "text",
  112. "storage.type.alias.pig"
  113. ],
  114. regex: /(\s*)(DEFINE|DECLARE|REGISTER)(\s+)(\S+)/,
  115. caseInsensitive: true,
  116. push: [{
  117. token: "text",
  118. regex: /;?$/,
  119. next: "pop"
  120. }]
  121. }]
  122. };
  123. this.normalizeRules();
  124. };
  125. PigHighlightRules.metaData = {
  126. fileTypes: ["pig"],
  127. name: "Pig",
  128. scopeName: "source.pig"
  129. };
  130. oop.inherits(PigHighlightRules, TextHighlightRules);
  131. exports.PigHighlightRules = PigHighlightRules;
  132. });
  133. 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";
  134. var oop = require("../../lib/oop");
  135. var Range = require("../../range").Range;
  136. var BaseFoldMode = require("./fold_mode").FoldMode;
  137. var FoldMode = exports.FoldMode = function (commentRegex) {
  138. if (commentRegex) {
  139. this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
  140. this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
  141. }
  142. };
  143. oop.inherits(FoldMode, BaseFoldMode);
  144. (function () {
  145. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  146. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  147. this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
  148. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  149. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  150. this._getFoldWidgetBase = this.getFoldWidget;
  151. this.getFoldWidget = function (session, foldStyle, row) {
  152. var line = session.getLine(row);
  153. if (this.singleLineBlockCommentRe.test(line)) {
  154. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  155. return "";
  156. }
  157. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  158. if (!fw && this.startRegionRe.test(line))
  159. return "start"; // lineCommentRegionStart
  160. return fw;
  161. };
  162. this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
  163. var line = session.getLine(row);
  164. if (this.startRegionRe.test(line))
  165. return this.getCommentRegionBlock(session, line, row);
  166. var match = line.match(this.foldingStartMarker);
  167. if (match) {
  168. var i = match.index;
  169. if (match[1])
  170. return this.openingBracketBlock(session, match[1], row, i);
  171. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  172. if (range && !range.isMultiLine()) {
  173. if (forceMultiline) {
  174. range = this.getSectionRange(session, row);
  175. }
  176. else if (foldStyle != "all")
  177. range = null;
  178. }
  179. return range;
  180. }
  181. if (foldStyle === "markbegin")
  182. return;
  183. var match = line.match(this.foldingStopMarker);
  184. if (match) {
  185. var i = match.index + match[0].length;
  186. if (match[1])
  187. return this.closingBracketBlock(session, match[1], row, i);
  188. return session.getCommentFoldRange(row, i, -1);
  189. }
  190. };
  191. this.getSectionRange = function (session, row) {
  192. var line = session.getLine(row);
  193. var startIndent = line.search(/\S/);
  194. var startRow = row;
  195. var startColumn = line.length;
  196. row = row + 1;
  197. var endRow = row;
  198. var maxRow = session.getLength();
  199. while (++row < maxRow) {
  200. line = session.getLine(row);
  201. var indent = line.search(/\S/);
  202. if (indent === -1)
  203. continue;
  204. if (startIndent > indent)
  205. break;
  206. var subRange = this.getFoldWidgetRange(session, "all", row);
  207. if (subRange) {
  208. if (subRange.start.row <= startRow) {
  209. break;
  210. }
  211. else if (subRange.isMultiLine()) {
  212. row = subRange.end.row;
  213. }
  214. else if (startIndent == indent) {
  215. break;
  216. }
  217. }
  218. endRow = row;
  219. }
  220. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  221. };
  222. this.getCommentRegionBlock = function (session, line, row) {
  223. var startColumn = line.search(/\s*$/);
  224. var maxRow = session.getLength();
  225. var startRow = row;
  226. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  227. var depth = 1;
  228. while (++row < maxRow) {
  229. line = session.getLine(row);
  230. var m = re.exec(line);
  231. if (!m)
  232. continue;
  233. if (m[1])
  234. depth--;
  235. else
  236. depth++;
  237. if (!depth)
  238. break;
  239. }
  240. var endRow = row;
  241. if (endRow > startRow) {
  242. return new Range(startRow, startColumn, endRow, line.length);
  243. }
  244. };
  245. }).call(FoldMode.prototype);
  246. });
  247. ace.define("ace/mode/pig",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/pig_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module){/*
  248. THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
  249. */
  250. "use strict";
  251. var oop = require("../lib/oop");
  252. var TextMode = require("./text").Mode;
  253. var PigHighlightRules = require("./pig_highlight_rules").PigHighlightRules;
  254. var FoldMode = require("./folding/cstyle").FoldMode;
  255. var Mode = function () {
  256. this.HighlightRules = PigHighlightRules;
  257. this.foldingRules = new FoldMode();
  258. };
  259. oop.inherits(Mode, TextMode);
  260. (function () {
  261. this.lineCommentStart = "--";
  262. this.blockComment = { start: "/*", end: "*/" };
  263. this.$id = "ace/mode/pig";
  264. }).call(Mode.prototype);
  265. exports.Mode = Mode;
  266. }); (function() {
  267. ace.require(["ace/mode/pig"], function(m) {
  268. if (typeof module == "object" && typeof exports == "object" && module) {
  269. module.exports = m;
  270. }
  271. });
  272. })();