Debian Codegraph @

extensions/CodeEditor/modules/lib/ace/mode-plsql.js

raw symbols SCIP
1 ace.define("ace/mode/plsql_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){/* ***** BEGIN LICENSE BLOCK *****
2 * Distributed under the BSD license:
3 *
4 * Copyright (c) 2012, Ajax.org B.V.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of Ajax.org B.V. nor the
15 * names of its contributors may be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * ***** END LICENSE BLOCK ***** */
30 "use strict";
31 var oop = require("../lib/oop");
32 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
33 var plsqlHighlightRules = function () {
34 var keywords = ("all|alter|and|any|array|arrow|as|asc|at|begin|between|by|case|check|clusters|cluster|colauth|columns|compress|connect|crash|create|cross|current|database|declare|default|delete|desc|distinct|drop|else|end|exception|exclusive|exists|fetch|form|for|foreign|from|goto|grant|group|having|identified|if|in|inner|indexes|index|insert|intersect|into|is|join|key|left|like|lock|minus|mode|natural|nocompress|not|nowait|null|of|on|option|or|order,overlaps|outer|primary|prior|procedure|public|range|record|references|resource|revoke|right|select|share|size|sql|start|subtype|tabauth|table|then|to|type|union|unique|update|use|values|view|views|when|where|with");
35 var builtinConstants = ("true|false");
36 var builtinFunctions = ("abs|acos|add_months|ascii|asciistr|asin|atan|atan2|avg|bfilename|bin_to_num|bitand|cardinality|case|cast|ceil|chartorowid|chr|coalesce|compose|concat|convert|corr|cos|cosh|count|covar_pop|covar_samp|cume_dist|current_date|current_timestamp|dbtimezone|decode|decompose|dense_rank|dump|empty_blob|empty_clob|exp|extract|first_value|floor|from_tz|greatest|group_id|hextoraw|initcap|instr|instr2|instr4|instrb|instrc|lag|last_day|last_value|lead|least|length|length2|length4|lengthb|lengthc|listagg|ln|lnnvl|localtimestamp|log|lower|lpad|ltrim|max|median|min|mod|months_between|nanvl|nchr|new_time|next_day|nth_value|nullif|numtodsinterval|numtoyminterval|nvl|nvl2|power|rank|rawtohex|regexp_count|regexp_instr|regexp_replace|regexp_substr|remainder|replace|round|rownum|rpad|rtrim|sessiontimezone|sign|sin|sinh|soundex|sqrt|stddev|substr|sum|sys_context|sysdate|systimestamp|tan|tanh|to_char|to_clob|to_date|to_dsinterval|to_lob|to_multi_byte|to_nclob|to_number|to_single_byte|to_timestamp|to_timestamp_tz|to_yminterval|translate|trim|trunc|tz_offset|uid|upper|user|userenv|var_pop|var_samp|variance|vsize");
37 var dataTypes = ("char|nchar|nvarchar2|varchar2|long|raw|" +
38 "number|numeric|float|dec|decimal|integer|int|smallint|real|double|precision|" +
39 "date|timestamp|interval|year|day|" +
40 "bfile|blob|clob|nclob|" +
41 "rowid|urowid");
42 var keywordMapper = this.createKeywordMapper({
43 "support.function": builtinFunctions,
44 "keyword": keywords,
45 "constant.language": builtinConstants,
46 "storage.type": dataTypes
47 }, "identifier", true);
48 this.$rules = {
49 "start": [{
50 token: "comment",
51 regex: "--.*$"
52 }, {
53 token: "comment",
54 start: "/\\*",
55 end: "\\*/"
56 }, {
57 token: "string", // " string
58 regex: '".*?"'
59 }, {
60 token: "string", // ' string
61 regex: "'.*?'"
62 }, {
63 token: "constant.numeric", // float
64 regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
65 }, {
66 token: keywordMapper,
67 regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
68 }, {
69 token: "keyword.operator",
70 regex: "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
71 }, {
72 token: "paren.lparen",
73 regex: "[\\(]"
74 }, {
75 token: "paren.rparen",
76 regex: "[\\)]"
77 }, {
78 token: "text",
79 regex: "\\s+"
80 }]
81 };
82 this.normalizeRules();
83 };
84 oop.inherits(plsqlHighlightRules, TextHighlightRules);
85 exports.plsqlHighlightRules = plsqlHighlightRules;
86
87 });
88
89 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";
90 var oop = require("../../lib/oop");
91 var Range = require("../../range").Range;
92 var BaseFoldMode = require("./fold_mode").FoldMode;
93 var FoldMode = exports.FoldMode = function (commentRegex) {
94 if (commentRegex) {
95 this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
96 this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
97 }
98 };
99 oop.inherits(FoldMode, BaseFoldMode);
100 (function () {
101 this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
102 this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
103 this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
104 this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
105 this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
106 this._getFoldWidgetBase = this.getFoldWidget;
107 this.getFoldWidget = function (session, foldStyle, row) {
108 var line = session.getLine(row);
109 if (this.singleLineBlockCommentRe.test(line)) {
110 if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
111 return "";
112 }
113 var fw = this._getFoldWidgetBase(session, foldStyle, row);
114 if (!fw && this.startRegionRe.test(line))
115 return "start"; // lineCommentRegionStart
116 return fw;
117 };
118 this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
119 var line = session.getLine(row);
120 if (this.startRegionRe.test(line))
121 return this.getCommentRegionBlock(session, line, row);
122 var match = line.match(this.foldingStartMarker);
123 if (match) {
124 var i = match.index;
125 if (match[1])
126 return this.openingBracketBlock(session, match[1], row, i);
127 var range = session.getCommentFoldRange(row, i + match[0].length, 1);
128 if (range && !range.isMultiLine()) {
129 if (forceMultiline) {
130 range = this.getSectionRange(session, row);
131 }
132 else if (foldStyle != "all")
133 range = null;
134 }
135 return range;
136 }
137 if (foldStyle === "markbegin")
138 return;
139 var match = line.match(this.foldingStopMarker);
140 if (match) {
141 var i = match.index + match[0].length;
142 if (match[1])
143 return this.closingBracketBlock(session, match[1], row, i);
144 return session.getCommentFoldRange(row, i, -1);
145 }
146 };
147 this.getSectionRange = function (session, row) {
148 var line = session.getLine(row);
149 var startIndent = line.search(/\S/);
150 var startRow = row;
151 var startColumn = line.length;
152 row = row + 1;
153 var endRow = row;
154 var maxRow = session.getLength();
155 while (++row < maxRow) {
156 line = session.getLine(row);
157 var indent = line.search(/\S/);
158 if (indent === -1)
159 continue;
160 if (startIndent > indent)
161 break;
162 var subRange = this.getFoldWidgetRange(session, "all", row);
163 if (subRange) {
164 if (subRange.start.row <= startRow) {
165 break;
166 }
167 else if (subRange.isMultiLine()) {
168 row = subRange.end.row;
169 }
170 else if (startIndent == indent) {
171 break;
172 }
173 }
174 endRow = row;
175 }
176 return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
177 };
178 this.getCommentRegionBlock = function (session, line, row) {
179 var startColumn = line.search(/\s*$/);
180 var maxRow = session.getLength();
181 var startRow = row;
182 var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
183 var depth = 1;
184 while (++row < maxRow) {
185 line = session.getLine(row);
186 var m = re.exec(line);
187 if (!m)
188 continue;
189 if (m[1])
190 depth--;
191 else
192 depth++;
193 if (!depth)
194 break;
195 }
196 var endRow = row;
197 if (endRow > startRow) {
198 return new Range(startRow, startColumn, endRow, line.length);
199 }
200 };
201 }).call(FoldMode.prototype);
202
203 });
204
205 ace.define("ace/mode/folding/sql",["require","exports","module","ace/lib/oop","ace/mode/folding/cstyle"], function(require, exports, module){"use strict";
206 var oop = require("../../lib/oop");
207 var BaseFoldMode = require("./cstyle").FoldMode;
208 var FoldMode = exports.FoldMode = function () { };
209 oop.inherits(FoldMode, BaseFoldMode);
210 (function () {
211 }).call(FoldMode.prototype);
212
213 });
214
215 ace.define("ace/mode/plsql",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/plsql_highlight_rules","ace/mode/folding/sql"], function(require, exports, module){/* ***** BEGIN LICENSE BLOCK *****
216 * Distributed under the BSD license:
217 *
218 * Copyright (c) 2012, Ajax.org B.V.
219 * All rights reserved.
220 *
221 * Redistribution and use in source and binary forms, with or without
222 * modification, are permitted provided that the following conditions are met:
223 * * Redistributions of source code must retain the above copyright
224 * notice, this list of conditions and the following disclaimer.
225 * * Redistributions in binary form must reproduce the above copyright
226 * notice, this list of conditions and the following disclaimer in the
227 * documentation and/or other materials provided with the distribution.
228 * * Neither the name of Ajax.org B.V. nor the
229 * names of its contributors may be used to endorse or promote products
230 * derived from this software without specific prior written permission.
231 *
232 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
233 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
234 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
235 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
236 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
237 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
238 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
239 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
240 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
241 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
242 *
243 * ***** END LICENSE BLOCK ***** */
244 "use strict";
245 var oop = require("../lib/oop");
246 var TextMode = require("./text").Mode;
247 var PLSqlHighlightRules = require("./plsql_highlight_rules").plsqlHighlightRules;
248 var FoldMode = require("./folding/sql").FoldMode;
249 var Mode = function () {
250 this.HighlightRules = PLSqlHighlightRules;
251 this.foldingRules = new FoldMode();
252 };
253 oop.inherits(Mode, TextMode);
254 (function () {
255 this.lineCommentStart = "--";
256 this.blockComment = { start: "/*", end: "*/" };
257 this.$id = "ace/mode/plsql";
258 }).call(Mode.prototype);
259 exports.Mode = Mode;
260
261 }); (function() {
262 ace.require(["ace/mode/plsql"], function(m) {
263 if (typeof module == "object" && typeof exports == "object" && module) {
264 module.exports = m;
265 }
266 });
267 })();
268