MCPcopy Create free account
hub / github.com/evildecay/etcdkeeper / PythonHighlightRules

Function PythonHighlightRules

assets/etcdkeeper/framework/ace/mode-pgsql.js:190–333  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

188var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
189
190var PythonHighlightRules = function() {
191
192 var keywords = (
193 "and|as|assert|break|class|continue|def|del|elif|else|except|exec|" +
194 "finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|" +
195 "raise|return|try|while|with|yield"
196 );
197
198 var builtinConstants = (
199 "True|False|None|NotImplemented|Ellipsis|__debug__"
200 );
201
202 var builtinFunctions = (
203 "abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|" +
204 "eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|" +
205 "binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|" +
206 "float|list|raw_input|unichr|callable|format|locals|reduce|unicode|" +
207 "chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|" +
208 "cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|" +
209 "__import__|complex|hash|min|set|apply|delattr|help|next|setattr|" +
210 "buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern"
211 );
212 var keywordMapper = this.createKeywordMapper({
213 "invalid.deprecated": "debugger",
214 "support.function": builtinFunctions,
215 "constant.language": builtinConstants,
216 "keyword": keywords
217 }, "identifier");
218
219 var strPre = "(?:r|u|ur|R|U|UR|Ur|uR)?";
220
221 var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
222 var octInteger = "(?:0[oO]?[0-7]+)";
223 var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
224 var binInteger = "(?:0[bB][01]+)";
225 var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")";
226
227 var exponent = "(?:[eE][+-]?\\d+)";
228 var fraction = "(?:\\.\\d+)";
229 var intPart = "(?:\\d+)";
230 var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
231 var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + exponent + ")";
232 var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
233
234 var stringEscape = "\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})";
235
236 this.$rules = {
237 "start" : [ {
238 token : "comment",
239 regex : "#.*$"
240 }, {
241 token : "string", // multi line """ string start
242 regex : strPre + '"{3}',
243 next : "qqstring3"
244 }, {
245 token : "string", // " string
246 regex : strPre + '"(?=.)',
247 next : "qqstring"

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected