555 lines
24 KiB
JavaScript
555 lines
24 KiB
JavaScript
|
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";
|
||
|
var oop = require("../lib/oop");
|
||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||
|
var DocCommentHighlightRules = function () {
|
||
|
this.$rules = {
|
||
|
"start": [
|
||
|
{
|
||
|
token: "comment.doc.tag",
|
||
|
regex: "@\\w+(?=\\s|$)"
|
||
|
}, DocCommentHighlightRules.getTagRule(), {
|
||
|
defaultToken: "comment.doc",
|
||
|
caseInsensitive: true
|
||
|
}
|
||
|
]
|
||
|
};
|
||
|
};
|
||
|
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||
|
DocCommentHighlightRules.getTagRule = function (start) {
|
||
|
return {
|
||
|
token: "comment.doc.tag.storage.type",
|
||
|
regex: "\\b(?:TODO|FIXME|XXX|HACK)\\b"
|
||
|
};
|
||
|
};
|
||
|
DocCommentHighlightRules.getStartRule = function (start) {
|
||
|
return {
|
||
|
token: "comment.doc",
|
||
|
regex: "\\/\\*(?=\\*)",
|
||
|
next: start
|
||
|
};
|
||
|
};
|
||
|
DocCommentHighlightRules.getEndRule = function (start) {
|
||
|
return {
|
||
|
token: "comment.doc",
|
||
|
regex: "\\*\\/",
|
||
|
next: start
|
||
|
};
|
||
|
};
|
||
|
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
||
|
|
||
|
});
|
||
|
|
||
|
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";
|
||
|
var oop = require("../lib/oop");
|
||
|
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||
|
var cFunctions = exports.cFunctions = "hypot|hypotf|hypotl|sscanf|system|snprintf|scanf|scalbn|scalbnf|scalbnl|scalbln|scalblnf|scalblnl|sin|sinh|sinhf|sinhl|sinf|sinl|signal|signbit|strstr|strspn|strncpy|strncat|strncmp|strcspn|strchr|strcoll|strcpy|strcat|strcmp|strtoimax|strtod|strtoul|strtoull|strtoumax|strtok|strtof|strtol|strtold|strtoll|strerror|strpbrk|strftime|strlen|strrchr|strxfrm|sprintf|setjmp|setvbuf|setlocale|setbuf|sqrt|sqrtf|sqrtl|swscanf|swprintf|srand|nearbyint|nearbyintf|nearbyintl|nexttoward|nexttowardf|nexttowardl|nextafter|nextafterf|nextafterl|nan|nanf|nanl|csin|csinh|csinhf|csinhl|csinf|csinl|csqrt|csqrtf|csqrtl|ccos|ccosh|ccoshf|ccosf|ccosl|cimag|cimagf|cimagl|ctime|ctan|ctanh|ctanhf|ctanhl|ctanf|ctanl|cos|cosh|coshf|coshl|cosf|cosl|conj|conjf|conjl|copysign|copysignf|copysignl|cpow|cpowf|cpowl|cproj|cprojf|cprojl|ceil|ceilf|ceill|cexp|cexpf|cexpl|clock|clog|clogf|clogl|clearerr|casin|casinh|casinhf|casinhl|casinf|casinl|cacos|cacosh|cacoshf|cacoshl|cacosf|cacosl|catan|catanh|catanhf|catanhl|catanf|catanl|calloc|carg|cargf|cargl|cabs|cabsf|cabsl|creal|crealf|creall|cbrt|cbrtf|cbrtl|time|toupper|tolower|tan|tanh|tanhf|tanhl|tanf|tanl|trunc|truncf|truncl|tgamma|tgammaf|tgammal|tmpnam|tmpfile|isspace|isnormal|isnan|iscntrl|isinf|isdigit|isunordered|isupper|ispunct|isprint|isfinite|iswspace|iswcntrl|iswctype|iswdigit|iswupper|iswpunct|iswprint|iswlower|iswalnum|iswalpha|iswgraph|iswxdigit|iswblank|islower|isless|islessequal|islessgreater|isalnum|isalpha|isgreater|isgreaterequal|isgraph|isxdigit|isblank|ilogb|ilogbf|ilogbl|imaxdiv|imaxabs|div|difftime|_Exit|ungetc|ungetwc|pow|powf|powl|puts|putc|putchar|putwc|putwchar|perror|printf|erf|erfc|erfcf|erfcl|erff|erfl|exit|exp|exp2|exp2f|exp2l|expf|expl|expm1|expm1f|expm1l|vsscanf|vsnprintf|vscanf|vsprintf|vswscanf|vswprintf|vprintf|vfscanf|vfprintf|vfwscanf|vfwprintf|vwscanf|vwprintf|va_start|va_copy|va_end|va_arg|qsort|fscanf|fsetpos|fseek|fclose|ftell|fopen|fdim|fdimf|fdiml|fpclassify|fputs|fputc|fputws|fputwc|fprintf|feholdexcept|fesetenv|fesetexceptflag|fesetround|feclearexcept|fetestexcept|feof|feupdateenv|feraiseexcept|ferror|fegetenv|fegetexceptflag|fegetround|fflush|fwscanf|fwide|fwprintf|fwrite|floor|floorf|floorl|fabs|fabsf|fabsl|fgets|fgetc|fgetpos|fgetws|fgetwc|freopen|free|fread|frexp|frexpf|frexpl|fmin|fminf|fminl|fmod|fmodf|fmodl|fma|fmaf|fmal|fmax|fmaxf|fmaxl|ldiv|ldexp|ldexpf|ldexpl|longjmp|localtime|localeconv|log|log1p|log1pf|log1pl|log10|log10f|log10l|log2|log2f|log2l|logf|logl|logb|logbf|logbl|labs|lldiv|llabs|llrint|llrintf|llrintl|llround|llroundf|llroundl|lrint|lrintf|lrintl|lround|lroundf|lroundl|lgamma|lgammaf|lgammal|wscanf|wcsstr|wcsspn|wcsncpy|wcsncat|wcsncmp|wcscspn|wcschr|wcscoll|wcscpy|wcscat|wcscmp|wcstoimax|wcstod|wcstoul|wcstoull|wcstoumax|wcstok|wcstof|wcstol|wcstold|wcstoll|wcstombs|wcspbrk|wcsftime|wcslen|wcsrchr|wcsrtombs|wcsxfrm|wctob|wctomb|wcrtomb|wprintf|wmemset|wmemchr|wmemcpy|wmemcmp|wmemmove|assert|asctime|asin|asinh|asinhf|asinhl|asinf|asinl|acos|acosh|acoshf|acoshl|acosf|acosl|atoi|atof|atol|atoll|atexit|atan|atanh|atanhf|atanhl|atan2|atan2f|atan2l|atanf|atanl|abs|abort|gets|getc|getchar|getenv|getwc|getwchar|gmtime|rint|rintf|rintl|round|roundf|roundl|rename|realloc|rewind|remove|remquo|remquof|remquol|remainder|remainderf|remainderl|rand|raise|bsearch|btowc|modf|modff|modfl|memset|memchr|memcpy|memcmp|memmove|mktime|malloc|mbsinit|mbstowcs|mbsrtowcs|mbtowc|mblen|mbrtowc|mbrlen";
|
||
|
var c_cppHighlightRules = function (extraKeywords) {
|
||
|
var keywordControls = ("break|case|continue|default|do|else|for|goto|if|_Pragma|" +
|
||
|
"return|switch|while|catch|operator|try|throw|using");
|
||
|
var storageType = ("asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" +
|
||
|
"_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|" +
|
||
|
"class|wchar_t|template|char16_t|char32_t");
|
||
|
var storageModifiers = ("const|extern|register|restrict|static|volatile|inline|private|" +
|
||
|
"protected|public|friend|explicit|virtual|export|mutable|typename|" +
|
||
|
"constexpr|new|delete|alignas|alignof|decltype|noexcept|thread_local");
|
||
|
var keywordOperators = ("and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|" +
|
||
|
"const_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace");
|
||
|
var builtinConstants = ("NULL|true|false|TRUE|FALSE|nullptr");
|
||
|
var keywordMapper = this.$keywords = this.createKeywordMapper(Object.assign({
|
||
|
"keyword.control": keywordControls,
|
||
|
"storage.type": storageType,
|
||
|
"storage.modifier": storageModifiers,
|
||
|
"keyword.operator": keywordOperators,
|
||
|
"variable.language": "this",
|
||
|
"constant.language": builtinConstants,
|
||
|
"support.function.C99.c": cFunctions
|
||
|
}, extraKeywords), "identifier");
|
||
|
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
|
||
|
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;
|
||
|
var formatRe = "%"
|
||
|
+ /(\d+\$)?/.source // field (argument #)
|
||
|
+ /[#0\- +']*/.source // flags
|
||
|
+ /[,;:_]?/.source // separator character (AltiVec)
|
||
|
+ /((-?\d+)|\*(-?\d+\$)?)?/.source // minimum field width
|
||
|
+ /(\.((-?\d+)|\*(-?\d+\$)?)?)?/.source // precision
|
||
|
+ /(hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)?/.source // length modifier
|
||
|
+ /(\[[^"\]]+\]|[diouxXDOUeEfFgGaACcSspn%])/.source; // conversion type
|
||
|
this.$rules = {
|
||
|
"start": [
|
||
|
{
|
||
|
token: "comment",
|
||
|
regex: "//$",
|
||
|
next: "start"
|
||
|
}, {
|
||
|
token: "comment",
|
||
|
regex: "//",
|
||
|
next: "singleLineComment"
|
||
|
},
|
||
|
DocCommentHighlightRules.getStartRule("doc-start"),
|
||
|
{
|
||
|
token: "comment",
|
||
|
regex: "\\/\\*",
|
||
|
next: "comment"
|
||
|
}, {
|
||
|
token: "string",
|
||
|
regex: "'(?:" + escapeRe + "|.)?'"
|
||
|
}, {
|
||
|
token: "string.start",
|
||
|
regex: '"',
|
||
|
stateName: "qqstring",
|
||
|
next: [
|
||
|
{ token: "string", regex: /\\\s*$/, next: "qqstring" },
|
||
|
{ token: "constant.language.escape", regex: escapeRe },
|
||
|
{ token: "constant.language.escape", regex: formatRe },
|
||
|
{ token: "string.end", regex: '"|$', next: "start" },
|
||
|
{ defaultToken: "string" }
|
||
|
]
|
||
|
}, {
|
||
|
token: "string.start",
|
||
|
regex: 'R"\\(',
|
||
|
stateName: "rawString",
|
||
|
next: [
|
||
|
{ token: "string.end", regex: '\\)"', next: "start" },
|
||
|
{ defaultToken: "string" }
|
||
|
]
|
||
|
}, {
|
||
|
token: "constant.numeric",
|
||
|
regex: "0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
|
||
|
}, {
|
||
|
token: "constant.numeric",
|
||
|
regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
|
||
|
}, {
|
||
|
token: "keyword",
|
||
|
regex: "#\\s*(?:include|import|pragma|line|define|undef)\\b",
|
||
|
next: "directive"
|
||
|
}, {
|
||
|
token: "keyword",
|
||
|
regex: "#\\s*(?:endif|if|ifdef|else|elif|ifndef)\\b"
|
||
|
}, {
|
||
|
token: keywordMapper,
|
||
|
regex: "[a-zA-Z_$][a-zA-Z0-9_$]*"
|
||
|
}, {
|
||
|
token: "keyword.operator",
|
||
|
regex: /--|\+\+|<<=|>>=|>>>=|<>|&&|\|\||\?:|[*%\/+\-&\^|~!<>=]=?/
|
||
|
}, {
|
||
|
token: "punctuation.operator",
|
||
|
regex: "\\?|\\:|\\,|\\;|\\."
|
||
|
}, {
|
||
|
token: "paren.lparen",
|
||
|
regex: "[[({]"
|
||
|
}, {
|
||
|
token: "paren.rparen",
|
||
|
regex: "[\\])}]"
|
||
|
}, {
|
||
|
token: "text",
|
||
|
regex: "\\s+"
|
||
|
}
|
||
|
],
|
||
|
"comment": [
|
||
|
{
|
||
|
token: "comment",
|
||
|
regex: "\\*\\/",
|
||
|
next: "start"
|
||
|
}, {
|
||
|
defaultToken: "comment"
|
||
|
}
|
||
|
],
|
||
|
"singleLineComment": [
|
||
|
{
|
||
|
token: "comment",
|
||
|
regex: /\\$/,
|
||
|
next: "singleLineComment"
|
||
|
}, {
|
||
|
token: "comment",
|
||
|
regex: /$/,
|
||
|
next: "start"
|
||
|
}, {
|
||
|
defaultToken: "comment"
|
||
|
}
|
||
|
],
|
||
|
"directive": [
|
||
|
{
|
||
|
token: "constant.other.multiline",
|
||
|
regex: /\\/
|
||
|
},
|
||
|
{
|
||
|
token: "constant.other.multiline",
|
||
|
regex: /.*\\/
|
||
|
},
|
||
|
{
|
||
|
token: "constant.other",
|
||
|
regex: "\\s*<.+?>",
|
||
|
next: "start"
|
||
|
},
|
||
|
{
|
||
|
token: "constant.other",
|
||
|
regex: '\\s*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]',
|
||
|
next: "start"
|
||
|
},
|
||
|
{
|
||
|
token: "constant.other",
|
||
|
regex: "\\s*['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']",
|
||
|
next: "start"
|
||
|
},
|
||
|
{
|
||
|
token: "constant.other",
|
||
|
regex: /[^\\\/]+/,
|
||
|
next: "start"
|
||
|
}
|
||
|
]
|
||
|
};
|
||
|
this.embedRules(DocCommentHighlightRules, "doc-", [DocCommentHighlightRules.getEndRule("start")]);
|
||
|
this.normalizeRules();
|
||
|
};
|
||
|
oop.inherits(c_cppHighlightRules, TextHighlightRules);
|
||
|
exports.c_cppHighlightRules = c_cppHighlightRules;
|
||
|
|
||
|
});
|
||
|
|
||
|
ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
|
||
|
var Range = require("../range").Range;
|
||
|
var MatchingBraceOutdent = function () { };
|
||
|
(function () {
|
||
|
this.checkOutdent = function (line, input) {
|
||
|
if (!/^\s+$/.test(line))
|
||
|
return false;
|
||
|
return /^\s*\}/.test(input);
|
||
|
};
|
||
|
this.autoOutdent = function (doc, row) {
|
||
|
var line = doc.getLine(row);
|
||
|
var match = line.match(/^(\s*\})/);
|
||
|
if (!match)
|
||
|
return 0;
|
||
|
var column = match[1].length;
|
||
|
var openBracePos = doc.findMatchingBracket({ row: row, column: column });
|
||
|
if (!openBracePos || openBracePos.row == row)
|
||
|
return 0;
|
||
|
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||
|
doc.replace(new Range(row, 0, row, column - 1), indent);
|
||
|
};
|
||
|
this.$getIndent = function (line) {
|
||
|
return line.match(/^\s*/)[0];
|
||
|
};
|
||
|
}).call(MatchingBraceOutdent.prototype);
|
||
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||
|
|
||
|
});
|
||
|
|
||
|
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";
|
||
|
var oop = require("../../lib/oop");
|
||
|
var Range = require("../../range").Range;
|
||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||
|
var FoldMode = exports.FoldMode = function (commentRegex) {
|
||
|
if (commentRegex) {
|
||
|
this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
|
||
|
this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
|
||
|
}
|
||
|
};
|
||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||
|
(function () {
|
||
|
this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
|
||
|
this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
|
||
|
this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
|
||
|
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
|
||
|
this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
|
||
|
this._getFoldWidgetBase = this.getFoldWidget;
|
||
|
this.getFoldWidget = function (session, foldStyle, row) {
|
||
|
var line = session.getLine(row);
|
||
|
if (this.singleLineBlockCommentRe.test(line)) {
|
||
|
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
|
||
|
return "";
|
||
|
}
|
||
|
var fw = this._getFoldWidgetBase(session, foldStyle, row);
|
||
|
if (!fw && this.startRegionRe.test(line))
|
||
|
return "start"; // lineCommentRegionStart
|
||
|
return fw;
|
||
|
};
|
||
|
this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
|
||
|
var line = session.getLine(row);
|
||
|
if (this.startRegionRe.test(line))
|
||
|
return this.getCommentRegionBlock(session, line, row);
|
||
|
var match = line.match(this.foldingStartMarker);
|
||
|
if (match) {
|
||
|
var i = match.index;
|
||
|
if (match[1])
|
||
|
return this.openingBracketBlock(session, match[1], row, i);
|
||
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
||
|
if (range && !range.isMultiLine()) {
|
||
|
if (forceMultiline) {
|
||
|
range = this.getSectionRange(session, row);
|
||
|
}
|
||
|
else if (foldStyle != "all")
|
||
|
range = null;
|
||
|
}
|
||
|
return range;
|
||
|
}
|
||
|
if (foldStyle === "markbegin")
|
||
|
return;
|
||
|
var match = line.match(this.foldingStopMarker);
|
||
|
if (match) {
|
||
|
var i = match.index + match[0].length;
|
||
|
if (match[1])
|
||
|
return this.closingBracketBlock(session, match[1], row, i);
|
||
|
return session.getCommentFoldRange(row, i, -1);
|
||
|
}
|
||
|
};
|
||
|
this.getSectionRange = function (session, row) {
|
||
|
var line = session.getLine(row);
|
||
|
var startIndent = line.search(/\S/);
|
||
|
var startRow = row;
|
||
|
var startColumn = line.length;
|
||
|
row = row + 1;
|
||
|
var endRow = row;
|
||
|
var maxRow = session.getLength();
|
||
|
while (++row < maxRow) {
|
||
|
line = session.getLine(row);
|
||
|
var indent = line.search(/\S/);
|
||
|
if (indent === -1)
|
||
|
continue;
|
||
|
if (startIndent > indent)
|
||
|
break;
|
||
|
var subRange = this.getFoldWidgetRange(session, "all", row);
|
||
|
if (subRange) {
|
||
|
if (subRange.start.row <= startRow) {
|
||
|
break;
|
||
|
}
|
||
|
else if (subRange.isMultiLine()) {
|
||
|
row = subRange.end.row;
|
||
|
}
|
||
|
else if (startIndent == indent) {
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
endRow = row;
|
||
|
}
|
||
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
||
|
};
|
||
|
this.getCommentRegionBlock = function (session, line, row) {
|
||
|
var startColumn = line.search(/\s*$/);
|
||
|
var maxRow = session.getLength();
|
||
|
var startRow = row;
|
||
|
var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
|
||
|
var depth = 1;
|
||
|
while (++row < maxRow) {
|
||
|
line = session.getLine(row);
|
||
|
var m = re.exec(line);
|
||
|
if (!m)
|
||
|
continue;
|
||
|
if (m[1])
|
||
|
depth--;
|
||
|
else
|
||
|
depth++;
|
||
|
if (!depth)
|
||
|
break;
|
||
|
}
|
||
|
var endRow = row;
|
||
|
if (endRow > startRow) {
|
||
|
return new Range(startRow, startColumn, endRow, line.length);
|
||
|
}
|
||
|
};
|
||
|
}).call(FoldMode.prototype);
|
||
|
|
||
|
});
|
||
|
|
||
|
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/mode/folding/cstyle"], function(require, exports, module){"use strict";
|
||
|
var oop = require("../lib/oop");
|
||
|
var TextMode = require("./text").Mode;
|
||
|
var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules;
|
||
|
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||
|
var Mode = function () {
|
||
|
this.HighlightRules = c_cppHighlightRules;
|
||
|
this.$outdent = new MatchingBraceOutdent();
|
||
|
this.$behaviour = this.$defaultBehaviour;
|
||
|
this.foldingRules = new CStyleFoldMode();
|
||
|
};
|
||
|
oop.inherits(Mode, TextMode);
|
||
|
(function () {
|
||
|
this.lineCommentStart = "//";
|
||
|
this.blockComment = { start: "/*", end: "*/" };
|
||
|
this.getNextLineIndent = function (state, line, tab) {
|
||
|
var indent = this.$getIndent(line);
|
||
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||
|
var tokens = tokenizedLine.tokens;
|
||
|
var endState = tokenizedLine.state;
|
||
|
if (tokens.length && tokens[tokens.length - 1].type == "comment") {
|
||
|
return indent;
|
||
|
}
|
||
|
if (state == "start") {
|
||
|
var match = line.match(/^.*[\{\(\[]\s*$/);
|
||
|
if (match) {
|
||
|
indent += tab;
|
||
|
}
|
||
|
}
|
||
|
else if (state == "doc-start") {
|
||
|
if (endState == "start") {
|
||
|
return "";
|
||
|
}
|
||
|
var match = line.match(/^\s*(\/?)\*/);
|
||
|
if (match) {
|
||
|
if (match[1]) {
|
||
|
indent += " ";
|
||
|
}
|
||
|
indent += "* ";
|
||
|
}
|
||
|
}
|
||
|
return indent;
|
||
|
};
|
||
|
this.checkOutdent = function (state, line, input) {
|
||
|
return this.$outdent.checkOutdent(line, input);
|
||
|
};
|
||
|
this.autoOutdent = function (state, doc, row) {
|
||
|
this.$outdent.autoOutdent(doc, row);
|
||
|
};
|
||
|
this.$id = "ace/mode/c_cpp";
|
||
|
this.snippetFileId = "ace/snippets/c_cpp";
|
||
|
}).call(Mode.prototype);
|
||
|
exports.Mode = Mode;
|
||
|
|
||
|
});
|
||
|
|
||
|
ace.define("ace/mode/nix_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
|
||
|
var oop = require("../lib/oop");
|
||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||
|
var NixHighlightRules = function () {
|
||
|
var constantLanguage = "true|false";
|
||
|
var keywordControl = "with|import|if|else|then|inherit";
|
||
|
var keywordDeclaration = "let|in|rec";
|
||
|
var keywordMapper = this.createKeywordMapper({
|
||
|
"constant.language.nix": constantLanguage,
|
||
|
"keyword.control.nix": keywordControl,
|
||
|
"keyword.declaration.nix": keywordDeclaration
|
||
|
}, "identifier");
|
||
|
this.$rules = {
|
||
|
"start": [{
|
||
|
token: "comment",
|
||
|
regex: /#.*$/
|
||
|
}, {
|
||
|
token: "comment",
|
||
|
regex: /\/\*/,
|
||
|
next: "comment"
|
||
|
}, {
|
||
|
token: "constant",
|
||
|
regex: "<[^>]+>"
|
||
|
}, {
|
||
|
regex: "(==|!=|<=?|>=?)",
|
||
|
token: ["keyword.operator.comparison.nix"]
|
||
|
}, {
|
||
|
regex: "((?:[+*/%-]|\\~)=)",
|
||
|
token: ["keyword.operator.assignment.arithmetic.nix"]
|
||
|
}, {
|
||
|
regex: "=",
|
||
|
token: "keyword.operator.assignment.nix"
|
||
|
}, {
|
||
|
token: "string",
|
||
|
regex: "''",
|
||
|
next: "qqdoc"
|
||
|
}, {
|
||
|
token: "string",
|
||
|
regex: "'",
|
||
|
next: "qstring"
|
||
|
}, {
|
||
|
token: "string",
|
||
|
regex: '"',
|
||
|
push: "qqstring"
|
||
|
}, {
|
||
|
token: "constant.numeric",
|
||
|
regex: "0[xX][0-9a-fA-F]+\\b"
|
||
|
}, {
|
||
|
token: "constant.numeric",
|
||
|
regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||
|
}, {
|
||
|
token: keywordMapper,
|
||
|
regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||
|
}, {
|
||
|
regex: "}",
|
||
|
token: function (val, start, stack) {
|
||
|
return stack[1] && stack[1].charAt(0) == "q" ? "constant.language.escape" : "text";
|
||
|
},
|
||
|
next: "pop"
|
||
|
}],
|
||
|
"comment": [{
|
||
|
token: "comment",
|
||
|
regex: "\\*\\/",
|
||
|
next: "start"
|
||
|
}, {
|
||
|
defaultToken: "comment"
|
||
|
}],
|
||
|
"qqdoc": [
|
||
|
{
|
||
|
token: "constant.language.escape",
|
||
|
regex: /\$\{/,
|
||
|
push: "start"
|
||
|
}, {
|
||
|
token: "string",
|
||
|
regex: "''",
|
||
|
next: "pop"
|
||
|
}, {
|
||
|
defaultToken: "string"
|
||
|
}
|
||
|
],
|
||
|
"qqstring": [
|
||
|
{
|
||
|
token: "constant.language.escape",
|
||
|
regex: /\$\{/,
|
||
|
push: "start"
|
||
|
}, {
|
||
|
token: "string",
|
||
|
regex: '"',
|
||
|
next: "pop"
|
||
|
}, {
|
||
|
defaultToken: "string"
|
||
|
}
|
||
|
],
|
||
|
"qstring": [
|
||
|
{
|
||
|
token: "constant.language.escape",
|
||
|
regex: /\$\{/,
|
||
|
push: "start"
|
||
|
}, {
|
||
|
token: "string",
|
||
|
regex: "'",
|
||
|
next: "pop"
|
||
|
}, {
|
||
|
defaultToken: "string"
|
||
|
}
|
||
|
]
|
||
|
};
|
||
|
this.normalizeRules();
|
||
|
};
|
||
|
oop.inherits(NixHighlightRules, TextHighlightRules);
|
||
|
exports.NixHighlightRules = NixHighlightRules;
|
||
|
|
||
|
});
|
||
|
|
||
|
ace.define("ace/mode/nix",["require","exports","module","ace/lib/oop","ace/mode/c_cpp","ace/mode/nix_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module){/*
|
||
|
THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
|
||
|
*/
|
||
|
"use strict";
|
||
|
var oop = require("../lib/oop");
|
||
|
var CMode = require("./c_cpp").Mode;
|
||
|
var NixHighlightRules = require("./nix_highlight_rules").NixHighlightRules;
|
||
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||
|
var Mode = function () {
|
||
|
CMode.call(this);
|
||
|
this.HighlightRules = NixHighlightRules;
|
||
|
this.foldingRules = new CStyleFoldMode();
|
||
|
this.$behaviour = this.$defaultBehaviour;
|
||
|
};
|
||
|
oop.inherits(Mode, CMode);
|
||
|
(function () {
|
||
|
this.lineCommentStart = "#";
|
||
|
this.blockComment = { start: "/*", end: "*/" };
|
||
|
this.$id = "ace/mode/nix";
|
||
|
}).call(Mode.prototype);
|
||
|
exports.Mode = Mode;
|
||
|
|
||
|
}); (function() {
|
||
|
ace.require(["ace/mode/nix"], function(m) {
|
||
|
if (typeof module == "object" && typeof exports == "object" && module) {
|
||
|
module.exports = m;
|
||
|
}
|
||
|
});
|
||
|
})();
|
||
|
|