| 1 |
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"; |
| 2 |
var oop = require("../lib/oop"); |
| 3 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 4 |
var DocCommentHighlightRules = function () { |
| 5 |
this.$rules = { |
| 6 |
"start": [ |
| 7 |
{ |
| 8 |
token: "comment.doc.tag", |
| 9 |
regex: "@\\w+(?=\\s|$)" |
| 10 |
}, DocCommentHighlightRules.getTagRule(), { |
| 11 |
defaultToken: "comment.doc", |
| 12 |
caseInsensitive: true |
| 13 |
} |
| 14 |
] |
| 15 |
}; |
| 16 |
}; |
| 17 |
oop.inherits(DocCommentHighlightRules, TextHighlightRules); |
| 18 |
DocCommentHighlightRules.getTagRule = function (start) { |
| 19 |
return { |
| 20 |
token: "comment.doc.tag.storage.type", |
| 21 |
regex: "\\b(?:TODO|FIXME|XXX|HACK)\\b" |
| 22 |
}; |
| 23 |
}; |
| 24 |
DocCommentHighlightRules.getStartRule = function (start) { |
| 25 |
return { |
| 26 |
token: "comment.doc", |
| 27 |
regex: "\\/\\*(?=\\*)", |
| 28 |
next: start |
| 29 |
}; |
| 30 |
}; |
| 31 |
DocCommentHighlightRules.getEndRule = function (start) { |
| 32 |
return { |
| 33 |
token: "comment.doc", |
| 34 |
regex: "\\*\\/", |
| 35 |
next: start |
| 36 |
}; |
| 37 |
}; |
| 38 |
exports.DocCommentHighlightRules = DocCommentHighlightRules; |
| 39 |
|
| 40 |
}); |
| 41 |
|
| 42 |
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"; |
| 43 |
var oop = require("../lib/oop"); |
| 44 |
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; |
| 45 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 46 |
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"; |
| 47 |
var c_cppHighlightRules = function (extraKeywords) { |
| 48 |
var keywordControls = ("break|case|continue|default|do|else|for|goto|if|_Pragma|" + |
| 49 |
"return|switch|while|catch|operator|try|throw|using"); |
| 50 |
var storageType = ("asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" + |
| 51 |
"_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|" + |
| 52 |
"class|wchar_t|template|char16_t|char32_t"); |
| 53 |
var storageModifiers = ("const|extern|register|restrict|static|volatile|inline|private|" + |
| 54 |
"protected|public|friend|explicit|virtual|export|mutable|typename|" + |
| 55 |
"constexpr|new|delete|alignas|alignof|decltype|noexcept|thread_local"); |
| 56 |
var keywordOperators = ("and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|" + |
| 57 |
"const_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace"); |
| 58 |
var builtinConstants = ("NULL|true|false|TRUE|FALSE|nullptr"); |
| 59 |
var keywordMapper = this.$keywords = this.createKeywordMapper(Object.assign({ |
| 60 |
"keyword.control": keywordControls, |
| 61 |
"storage.type": storageType, |
| 62 |
"storage.modifier": storageModifiers, |
| 63 |
"keyword.operator": keywordOperators, |
| 64 |
"variable.language": "this", |
| 65 |
"constant.language": builtinConstants, |
| 66 |
"support.function.C99.c": cFunctions |
| 67 |
}, extraKeywords), "identifier"); |
| 68 |
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b"; |
| 69 |
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; |
| 70 |
var formatRe = "%" |
| 71 |
+ /(\d+\$)?/.source |
| 72 |
+ /[#0\- +']*/.source |
| 73 |
+ /[,;:_]?/.source |
| 74 |
+ /((-?\d+)|\*(-?\d+\$)?)?/.source |
| 75 |
+ /(\.((-?\d+)|\*(-?\d+\$)?)?)?/.source |
| 76 |
+ /(hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)?/.source |
| 77 |
+ /(\[[^"\]]+\]|[diouxXDOUeEfFgGaACcSspn%])/.source; |
| 78 |
this.$rules = { |
| 79 |
"start": [ |
| 80 |
{ |
| 81 |
token: "comment", |
| 82 |
regex: "//$", |
| 83 |
next: "start" |
| 84 |
}, { |
| 85 |
token: "comment", |
| 86 |
regex: "//", |
| 87 |
next: "singleLineComment" |
| 88 |
}, |
| 89 |
DocCommentHighlightRules.getStartRule("doc-start"), |
| 90 |
{ |
| 91 |
token: "comment", |
| 92 |
regex: "\\/\\*", |
| 93 |
next: "comment" |
| 94 |
}, { |
| 95 |
token: "string", |
| 96 |
regex: "'(?:" + escapeRe + "|.)?'" |
| 97 |
}, { |
| 98 |
token: "string.start", |
| 99 |
regex: '"', |
| 100 |
stateName: "qqstring", |
| 101 |
next: [ |
| 102 |
{ token: "string", regex: /\\\s*$/, next: "qqstring" }, |
| 103 |
{ token: "constant.language.escape", regex: escapeRe }, |
| 104 |
{ token: "constant.language.escape", regex: formatRe }, |
| 105 |
{ token: "string.end", regex: '"|$', next: "start" }, |
| 106 |
{ defaultToken: "string" } |
| 107 |
] |
| 108 |
}, { |
| 109 |
token: "string.start", |
| 110 |
regex: 'R"\\(', |
| 111 |
stateName: "rawString", |
| 112 |
next: [ |
| 113 |
{ token: "string.end", regex: '\\)"', next: "start" }, |
| 114 |
{ defaultToken: "string" } |
| 115 |
] |
| 116 |
}, { |
| 117 |
token: "constant.numeric", |
| 118 |
regex: "0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" |
| 119 |
}, { |
| 120 |
token: "constant.numeric", |
| 121 |
regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" |
| 122 |
}, { |
| 123 |
token: "keyword", |
| 124 |
regex: "#\\s*(?:include|import|pragma|line|define|undef)\\b", |
| 125 |
next: "directive" |
| 126 |
}, { |
| 127 |
token: "keyword", |
| 128 |
regex: "#\\s*(?:endif|if|ifdef|else|elif|ifndef)\\b" |
| 129 |
}, { |
| 130 |
token: keywordMapper, |
| 131 |
regex: "[a-zA-Z_$][a-zA-Z0-9_$]*" |
| 132 |
}, { |
| 133 |
token: "keyword.operator", |
| 134 |
regex: /--|\+\+|<<=|>>=|>>>=|<>|&&|\|\||\?:|[*%\/+\-&\^|~!<>=]=?/ |
| 135 |
}, { |
| 136 |
token: "punctuation.operator", |
| 137 |
regex: "\\?|\\:|\\,|\\;|\\." |
| 138 |
}, { |
| 139 |
token: "paren.lparen", |
| 140 |
regex: "[[({]" |
| 141 |
}, { |
| 142 |
token: "paren.rparen", |
| 143 |
regex: "[\\])}]" |
| 144 |
}, { |
| 145 |
token: "text", |
| 146 |
regex: "\\s+" |
| 147 |
} |
| 148 |
], |
| 149 |
"comment": [ |
| 150 |
{ |
| 151 |
token: "comment", |
| 152 |
regex: "\\*\\/", |
| 153 |
next: "start" |
| 154 |
}, { |
| 155 |
defaultToken: "comment" |
| 156 |
} |
| 157 |
], |
| 158 |
"singleLineComment": [ |
| 159 |
{ |
| 160 |
token: "comment", |
| 161 |
regex: /\\$/, |
| 162 |
next: "singleLineComment" |
| 163 |
}, { |
| 164 |
token: "comment", |
| 165 |
regex: /$/, |
| 166 |
next: "start" |
| 167 |
}, { |
| 168 |
defaultToken: "comment" |
| 169 |
} |
| 170 |
], |
| 171 |
"directive": [ |
| 172 |
{ |
| 173 |
token: "constant.other.multiline", |
| 174 |
regex: /\\/ |
| 175 |
}, |
| 176 |
{ |
| 177 |
token: "constant.other.multiline", |
| 178 |
regex: /.*\\/ |
| 179 |
}, |
| 180 |
{ |
| 181 |
token: "constant.other", |
| 182 |
regex: "\\s*<.+?>", |
| 183 |
next: "start" |
| 184 |
}, |
| 185 |
{ |
| 186 |
token: "constant.other", |
| 187 |
regex: '\\s*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]', |
| 188 |
next: "start" |
| 189 |
}, |
| 190 |
{ |
| 191 |
token: "constant.other", |
| 192 |
regex: "\\s*['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']", |
| 193 |
next: "start" |
| 194 |
}, |
| 195 |
{ |
| 196 |
token: "constant.other", |
| 197 |
regex: /[^\\\/]+/, |
| 198 |
next: "start" |
| 199 |
} |
| 200 |
] |
| 201 |
}; |
| 202 |
this.embedRules(DocCommentHighlightRules, "doc-", [DocCommentHighlightRules.getEndRule("start")]); |
| 203 |
this.normalizeRules(); |
| 204 |
}; |
| 205 |
oop.inherits(c_cppHighlightRules, TextHighlightRules); |
| 206 |
exports.c_cppHighlightRules = c_cppHighlightRules; |
| 207 |
|
| 208 |
}); |
| 209 |
|
| 210 |
ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict"; |
| 211 |
var Range = require("../range").Range; |
| 212 |
var MatchingBraceOutdent = function () { }; |
| 213 |
(function () { |
| 214 |
this.checkOutdent = function (line, input) { |
| 215 |
if (!/^\s+$/.test(line)) |
| 216 |
return false; |
| 217 |
return /^\s*\}/.test(input); |
| 218 |
}; |
| 219 |
this.autoOutdent = function (doc, row) { |
| 220 |
var line = doc.getLine(row); |
| 221 |
var match = line.match(/^(\s*\})/); |
| 222 |
if (!match) |
| 223 |
return 0; |
| 224 |
var column = match[1].length; |
| 225 |
var openBracePos = doc.findMatchingBracket({ row: row, column: column }); |
| 226 |
if (!openBracePos || openBracePos.row == row) |
| 227 |
return 0; |
| 228 |
var indent = this.$getIndent(doc.getLine(openBracePos.row)); |
| 229 |
doc.replace(new Range(row, 0, row, column - 1), indent); |
| 230 |
}; |
| 231 |
this.$getIndent = function (line) { |
| 232 |
return line.match(/^\s*/)[0]; |
| 233 |
}; |
| 234 |
}).call(MatchingBraceOutdent.prototype); |
| 235 |
exports.MatchingBraceOutdent = MatchingBraceOutdent; |
| 236 |
|
| 237 |
}); |
| 238 |
|
| 239 |
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"; |
| 240 |
var oop = require("../../lib/oop"); |
| 241 |
var Range = require("../../range").Range; |
| 242 |
var BaseFoldMode = require("./fold_mode").FoldMode; |
| 243 |
var FoldMode = exports.FoldMode = function (commentRegex) { |
| 244 |
if (commentRegex) { |
| 245 |
this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)); |
| 246 |
this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)); |
| 247 |
} |
| 248 |
}; |
| 249 |
oop.inherits(FoldMode, BaseFoldMode); |
| 250 |
(function () { |
| 251 |
this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; |
| 252 |
this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; |
| 253 |
this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/; |
| 254 |
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; |
| 255 |
this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; |
| 256 |
this._getFoldWidgetBase = this.getFoldWidget; |
| 257 |
this.getFoldWidget = function (session, foldStyle, row) { |
| 258 |
var line = session.getLine(row); |
| 259 |
if (this.singleLineBlockCommentRe.test(line)) { |
| 260 |
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) |
| 261 |
return ""; |
| 262 |
} |
| 263 |
var fw = this._getFoldWidgetBase(session, foldStyle, row); |
| 264 |
if (!fw && this.startRegionRe.test(line)) |
| 265 |
return "start"; |
| 266 |
return fw; |
| 267 |
}; |
| 268 |
this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) { |
| 269 |
var line = session.getLine(row); |
| 270 |
if (this.startRegionRe.test(line)) |
| 271 |
return this.getCommentRegionBlock(session, line, row); |
| 272 |
var match = line.match(this.foldingStartMarker); |
| 273 |
if (match) { |
| 274 |
var i = match.index; |
| 275 |
if (match[1]) |
| 276 |
return this.openingBracketBlock(session, match[1], row, i); |
| 277 |
var range = session.getCommentFoldRange(row, i + match[0].length, 1); |
| 278 |
if (range && !range.isMultiLine()) { |
| 279 |
if (forceMultiline) { |
| 280 |
range = this.getSectionRange(session, row); |
| 281 |
} |
| 282 |
else if (foldStyle != "all") |
| 283 |
range = null; |
| 284 |
} |
| 285 |
return range; |
| 286 |
} |
| 287 |
if (foldStyle === "markbegin") |
| 288 |
return; |
| 289 |
var match = line.match(this.foldingStopMarker); |
| 290 |
if (match) { |
| 291 |
var i = match.index + match[0].length; |
| 292 |
if (match[1]) |
| 293 |
return this.closingBracketBlock(session, match[1], row, i); |
| 294 |
return session.getCommentFoldRange(row, i, -1); |
| 295 |
} |
| 296 |
}; |
| 297 |
this.getSectionRange = function (session, row) { |
| 298 |
var line = session.getLine(row); |
| 299 |
var startIndent = line.search(/\S/); |
| 300 |
var startRow = row; |
| 301 |
var startColumn = line.length; |
| 302 |
row = row + 1; |
| 303 |
var endRow = row; |
| 304 |
var maxRow = session.getLength(); |
| 305 |
while (++row < maxRow) { |
| 306 |
line = session.getLine(row); |
| 307 |
var indent = line.search(/\S/); |
| 308 |
if (indent === -1) |
| 309 |
continue; |
| 310 |
if (startIndent > indent) |
| 311 |
break; |
| 312 |
var subRange = this.getFoldWidgetRange(session, "all", row); |
| 313 |
if (subRange) { |
| 314 |
if (subRange.start.row <= startRow) { |
| 315 |
break; |
| 316 |
} |
| 317 |
else if (subRange.isMultiLine()) { |
| 318 |
row = subRange.end.row; |
| 319 |
} |
| 320 |
else if (startIndent == indent) { |
| 321 |
break; |
| 322 |
} |
| 323 |
} |
| 324 |
endRow = row; |
| 325 |
} |
| 326 |
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); |
| 327 |
}; |
| 328 |
this.getCommentRegionBlock = function (session, line, row) { |
| 329 |
var startColumn = line.search(/\s*$/); |
| 330 |
var maxRow = session.getLength(); |
| 331 |
var startRow = row; |
| 332 |
var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; |
| 333 |
var depth = 1; |
| 334 |
while (++row < maxRow) { |
| 335 |
line = session.getLine(row); |
| 336 |
var m = re.exec(line); |
| 337 |
if (!m) |
| 338 |
continue; |
| 339 |
if (m[1]) |
| 340 |
depth--; |
| 341 |
else |
| 342 |
depth++; |
| 343 |
if (!depth) |
| 344 |
break; |
| 345 |
} |
| 346 |
var endRow = row; |
| 347 |
if (endRow > startRow) { |
| 348 |
return new Range(startRow, startColumn, endRow, line.length); |
| 349 |
} |
| 350 |
}; |
| 351 |
}).call(FoldMode.prototype); |
| 352 |
|
| 353 |
}); |
| 354 |
|
| 355 |
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"; |
| 356 |
var oop = require("../lib/oop"); |
| 357 |
var TextMode = require("./text").Mode; |
| 358 |
var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules; |
| 359 |
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; |
| 360 |
var CStyleFoldMode = require("./folding/cstyle").FoldMode; |
| 361 |
var Mode = function () { |
| 362 |
this.HighlightRules = c_cppHighlightRules; |
| 363 |
this.$outdent = new MatchingBraceOutdent(); |
| 364 |
this.$behaviour = this.$defaultBehaviour; |
| 365 |
this.foldingRules = new CStyleFoldMode(); |
| 366 |
}; |
| 367 |
oop.inherits(Mode, TextMode); |
| 368 |
(function () { |
| 369 |
this.lineCommentStart = "//"; |
| 370 |
this.blockComment = { start: "/*", end: "*/" }; |
| 371 |
this.getNextLineIndent = function (state, line, tab) { |
| 372 |
var indent = this.$getIndent(line); |
| 373 |
var tokenizedLine = this.getTokenizer().getLineTokens(line, state); |
| 374 |
var tokens = tokenizedLine.tokens; |
| 375 |
var endState = tokenizedLine.state; |
| 376 |
if (tokens.length && tokens[tokens.length - 1].type == "comment") { |
| 377 |
return indent; |
| 378 |
} |
| 379 |
if (state == "start") { |
| 380 |
var match = line.match(/^.*[\{\(\[]\s*$/); |
| 381 |
if (match) { |
| 382 |
indent += tab; |
| 383 |
} |
| 384 |
} |
| 385 |
else if (state == "doc-start") { |
| 386 |
if (endState == "start") { |
| 387 |
return ""; |
| 388 |
} |
| 389 |
var match = line.match(/^\s*(\/?)\*/); |
| 390 |
if (match) { |
| 391 |
if (match[1]) { |
| 392 |
indent += " "; |
| 393 |
} |
| 394 |
indent += "* "; |
| 395 |
} |
| 396 |
} |
| 397 |
return indent; |
| 398 |
}; |
| 399 |
this.checkOutdent = function (state, line, input) { |
| 400 |
return this.$outdent.checkOutdent(line, input); |
| 401 |
}; |
| 402 |
this.autoOutdent = function (state, doc, row) { |
| 403 |
this.$outdent.autoOutdent(doc, row); |
| 404 |
}; |
| 405 |
this.$id = "ace/mode/c_cpp"; |
| 406 |
this.snippetFileId = "ace/snippets/c_cpp"; |
| 407 |
}).call(Mode.prototype); |
| 408 |
exports.Mode = Mode; |
| 409 |
|
| 410 |
}); (function() { |
| 411 |
ace.require(["ace/mode/c_cpp"], function(m) { |
| 412 |
if (typeof module == "object" && typeof exports == "object" && module) { |
| 413 |
module.exports = m; |
| 414 |
} |
| 415 |
}); |
| 416 |
})(); |
| 417 |
|