5ead99d987b31962ae1b64c2f01804d6.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. ace.define("ace/mode/ocaml_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 OcamlHighlightRules = function () {
  5. var keywords = ("and|as|assert|begin|class|constraint|do|done|downto|else|end|" +
  6. "exception|external|for|fun|function|functor|if|in|include|" +
  7. "inherit|initializer|lazy|let|match|method|module|mutable|new|" +
  8. "object|of|open|or|private|rec|sig|struct|then|to|try|type|val|" +
  9. "virtual|when|while|with");
  10. var builtinConstants = ("true|false");
  11. var builtinFunctions = ("abs|abs_big_int|abs_float|abs_num|abstract_tag|accept|access|acos|add|" +
  12. "add_available_units|add_big_int|add_buffer|add_channel|add_char|" +
  13. "add_initializer|add_int_big_int|add_interfaces|add_num|add_string|" +
  14. "add_substitute|add_substring|alarm|allocated_bytes|allow_only|" +
  15. "allow_unsafe_modules|always|append|appname_get|appname_set|" +
  16. "approx_num_exp|approx_num_fix|arg|argv|arith_status|array|" +
  17. "array1_of_genarray|array2_of_genarray|array3_of_genarray|asin|asr|" +
  18. "assoc|assq|at_exit|atan|atan2|auto_synchronize|background|basename|" +
  19. "beginning_of_input|big_int_of_int|big_int_of_num|big_int_of_string|bind|" +
  20. "bind_class|bind_tag|bits|bits_of_float|black|blit|blit_image|blue|bool|" +
  21. "bool_of_string|bounded_full_split|bounded_split|bounded_split_delim|" +
  22. "bprintf|break|broadcast|bscanf|button_down|c_layout|capitalize|cardinal|" +
  23. "cardinal|catch|catch_break|ceil|ceiling_num|channel|char|char_of_int|" +
  24. "chdir|check|check_suffix|chmod|choose|chop_extension|chop_suffix|chown|" +
  25. "chown|chr|chroot|classify_float|clear|clear_available_units|" +
  26. "clear_close_on_exec|clear_graph|clear_nonblock|clear_parser|" +
  27. "close|close|closeTk|close_box|close_graph|close_in|close_in_noerr|" +
  28. "close_out|close_out_noerr|close_process|close_process|" +
  29. "close_process_full|close_process_in|close_process_out|close_subwindow|" +
  30. "close_tag|close_tbox|closedir|closedir|closure_tag|code|combine|" +
  31. "combine|combine|command|compact|compare|compare_big_int|compare_num|" +
  32. "complex32|complex64|concat|conj|connect|contains|contains_from|contents|" +
  33. "copy|cos|cosh|count|count|counters|create|create_alarm|create_image|" +
  34. "create_matrix|create_matrix|create_matrix|create_object|" +
  35. "create_object_and_run_initializers|create_object_opt|create_process|" +
  36. "create_process|create_process_env|create_process_env|create_table|" +
  37. "current|current_dir_name|current_point|current_x|current_y|curveto|" +
  38. "custom_tag|cyan|data_size|decr|decr_num|default_available_units|delay|" +
  39. "delete_alarm|descr_of_in_channel|descr_of_out_channel|destroy|diff|dim|" +
  40. "dim1|dim2|dim3|dims|dirname|display_mode|div|div_big_int|div_num|" +
  41. "double_array_tag|double_tag|draw_arc|draw_char|draw_circle|draw_ellipse|" +
  42. "draw_image|draw_poly|draw_poly_line|draw_rect|draw_segments|draw_string|" +
  43. "dummy_pos|dummy_table|dump_image|dup|dup2|elements|empty|end_of_input|" +
  44. "environment|eprintf|epsilon_float|eq_big_int|eq_num|equal|err_formatter|" +
  45. "error_message|escaped|establish_server|executable_name|execv|execve|execvp|" +
  46. "execvpe|exists|exists2|exit|exp|failwith|fast_sort|fchmod|fchown|field|" +
  47. "file|file_exists|fill|fill_arc|fill_circle|fill_ellipse|fill_poly|fill_rect|" +
  48. "filter|final_tag|finalise|find|find_all|first_chars|firstkey|flatten|" +
  49. "float|float32|float64|float_of_big_int|float_of_bits|float_of_int|" +
  50. "float_of_num|float_of_string|floor|floor_num|flush|flush_all|flush_input|" +
  51. "flush_str_formatter|fold|fold_left|fold_left2|fold_right|fold_right2|" +
  52. "for_all|for_all2|force|force_newline|force_val|foreground|fork|" +
  53. "format_of_string|formatter_of_buffer|formatter_of_out_channel|" +
  54. "fortran_layout|forward_tag|fprintf|frexp|from|from_channel|from_file|" +
  55. "from_file_bin|from_function|from_string|fscanf|fst|fstat|ftruncate|" +
  56. "full_init|full_major|full_split|gcd_big_int|ge_big_int|ge_num|" +
  57. "genarray_of_array1|genarray_of_array2|genarray_of_array3|get|" +
  58. "get_all_formatter_output_functions|get_approx_printing|get_copy|" +
  59. "get_ellipsis_text|get_error_when_null_denominator|get_floating_precision|" +
  60. "get_formatter_output_functions|get_formatter_tag_functions|get_image|" +
  61. "get_margin|get_mark_tags|get_max_boxes|get_max_indent|get_method|" +
  62. "get_method_label|get_normalize_ratio|get_normalize_ratio_when_printing|" +
  63. "get_print_tags|get_state|get_variable|getcwd|getegid|getegid|getenv|" +
  64. "getenv|getenv|geteuid|geteuid|getgid|getgid|getgrgid|getgrgid|getgrnam|" +
  65. "getgrnam|getgroups|gethostbyaddr|gethostbyname|gethostname|getitimer|" +
  66. "getlogin|getpeername|getpid|getppid|getprotobyname|getprotobynumber|" +
  67. "getpwnam|getpwuid|getservbyname|getservbyport|getsockname|getsockopt|" +
  68. "getsockopt_float|getsockopt_int|getsockopt_optint|gettimeofday|getuid|" +
  69. "global_replace|global_substitute|gmtime|green|grid|group_beginning|" +
  70. "group_end|gt_big_int|gt_num|guard|handle_unix_error|hash|hash_param|" +
  71. "hd|header_size|i|id|ignore|in_channel_length|in_channel_of_descr|incr|" +
  72. "incr_num|index|index_from|inet_addr_any|inet_addr_of_string|infinity|" +
  73. "infix_tag|init|init_class|input|input_binary_int|input_byte|input_char|" +
  74. "input_line|input_value|int|int16_signed|int16_unsigned|int32|int64|" +
  75. "int8_signed|int8_unsigned|int_of_big_int|int_of_char|int_of_float|" +
  76. "int_of_num|int_of_string|integer_num|inter|interactive|inv|invalid_arg|" +
  77. "is_block|is_empty|is_implicit|is_int|is_int_big_int|is_integer_num|" +
  78. "is_relative|iter|iter2|iteri|join|junk|key_pressed|kill|kind|kprintf|" +
  79. "kscanf|land|last_chars|layout|lazy_from_fun|lazy_from_val|lazy_is_val|" +
  80. "lazy_tag|ldexp|le_big_int|le_num|length|lexeme|lexeme_char|lexeme_end|" +
  81. "lexeme_end_p|lexeme_start|lexeme_start_p|lineto|link|list|listen|lnot|" +
  82. "loadfile|loadfile_private|localtime|lock|lockf|log|log10|logand|lognot|" +
  83. "logor|logxor|lor|lower_window|lowercase|lseek|lsl|lsr|lstat|lt_big_int|" +
  84. "lt_num|lxor|magenta|magic|mainLoop|major|major_slice|make|make_formatter|" +
  85. "make_image|make_lexer|make_matrix|make_self_init|map|map2|map_file|mapi|" +
  86. "marshal|match_beginning|match_end|matched_group|matched_string|max|" +
  87. "max_array_length|max_big_int|max_elt|max_float|max_int|max_num|" +
  88. "max_string_length|mem|mem_assoc|mem_assq|memq|merge|min|min_big_int|" +
  89. "min_elt|min_float|min_int|min_num|minor|minus_big_int|minus_num|" +
  90. "minus_one|mkdir|mkfifo|mktime|mod|mod_big_int|mod_float|mod_num|modf|" +
  91. "mouse_pos|moveto|mul|mult_big_int|mult_int_big_int|mult_num|nan|narrow|" +
  92. "nat_of_num|nativeint|neg|neg_infinity|new_block|new_channel|new_method|" +
  93. "new_variable|next|nextkey|nice|nice|no_scan_tag|norm|norm2|not|npeek|" +
  94. "nth|nth_dim|num_digits_big_int|num_dims|num_of_big_int|num_of_int|" +
  95. "num_of_nat|num_of_ratio|num_of_string|O|obj|object_tag|ocaml_version|" +
  96. "of_array|of_channel|of_float|of_int|of_int32|of_list|of_nativeint|" +
  97. "of_string|one|openTk|open_box|open_connection|open_graph|open_hbox|" +
  98. "open_hovbox|open_hvbox|open_in|open_in_bin|open_in_gen|open_out|" +
  99. "open_out_bin|open_out_gen|open_process|open_process_full|open_process_in|" +
  100. "open_process_out|open_subwindow|open_tag|open_tbox|open_temp_file|" +
  101. "open_vbox|opendbm|opendir|openfile|or|os_type|out_channel_length|" +
  102. "out_channel_of_descr|output|output_binary_int|output_buffer|output_byte|" +
  103. "output_char|output_string|output_value|over_max_boxes|pack|params|" +
  104. "parent_dir_name|parse|parse_argv|partition|pause|peek|pipe|pixels|" +
  105. "place|plot|plots|point_color|polar|poll|pop|pos_in|pos_out|pow|" +
  106. "power_big_int_positive_big_int|power_big_int_positive_int|" +
  107. "power_int_positive_big_int|power_int_positive_int|power_num|" +
  108. "pp_close_box|pp_close_tag|pp_close_tbox|pp_force_newline|" +
  109. "pp_get_all_formatter_output_functions|pp_get_ellipsis_text|" +
  110. "pp_get_formatter_output_functions|pp_get_formatter_tag_functions|" +
  111. "pp_get_margin|pp_get_mark_tags|pp_get_max_boxes|pp_get_max_indent|" +
  112. "pp_get_print_tags|pp_open_box|pp_open_hbox|pp_open_hovbox|pp_open_hvbox|" +
  113. "pp_open_tag|pp_open_tbox|pp_open_vbox|pp_over_max_boxes|pp_print_as|" +
  114. "pp_print_bool|pp_print_break|pp_print_char|pp_print_cut|pp_print_float|" +
  115. "pp_print_flush|pp_print_if_newline|pp_print_int|pp_print_newline|" +
  116. "pp_print_space|pp_print_string|pp_print_tab|pp_print_tbreak|" +
  117. "pp_set_all_formatter_output_functions|pp_set_ellipsis_text|" +
  118. "pp_set_formatter_out_channel|pp_set_formatter_output_functions|" +
  119. "pp_set_formatter_tag_functions|pp_set_margin|pp_set_mark_tags|" +
  120. "pp_set_max_boxes|pp_set_max_indent|pp_set_print_tags|pp_set_tab|" +
  121. "pp_set_tags|pred|pred_big_int|pred_num|prerr_char|prerr_endline|" +
  122. "prerr_float|prerr_int|prerr_newline|prerr_string|print|print_as|" +
  123. "print_bool|print_break|print_char|print_cut|print_endline|print_float|" +
  124. "print_flush|print_if_newline|print_int|print_newline|print_space|" +
  125. "print_stat|print_string|print_tab|print_tbreak|printf|prohibit|" +
  126. "public_method_label|push|putenv|quo_num|quomod_big_int|quote|raise|" +
  127. "raise_window|ratio_of_num|rcontains_from|read|read_float|read_int|" +
  128. "read_key|read_line|readdir|readdir|readlink|really_input|receive|recv|" +
  129. "recvfrom|red|ref|regexp|regexp_case_fold|regexp_string|" +
  130. "regexp_string_case_fold|register|register_exception|rem|remember_mode|" +
  131. "remove|remove_assoc|remove_assq|rename|replace|replace_first|" +
  132. "replace_matched|repr|reset|reshape|reshape_1|reshape_2|reshape_3|rev|" +
  133. "rev_append|rev_map|rev_map2|rewinddir|rgb|rhs_end|rhs_end_pos|rhs_start|" +
  134. "rhs_start_pos|rindex|rindex_from|rlineto|rmdir|rmoveto|round_num|" +
  135. "run_initializers|run_initializers_opt|scanf|search_backward|" +
  136. "search_forward|seek_in|seek_out|select|self|self_init|send|sendto|set|" +
  137. "set_all_formatter_output_functions|set_approx_printing|" +
  138. "set_binary_mode_in|set_binary_mode_out|set_close_on_exec|" +
  139. "set_close_on_exec|set_color|set_ellipsis_text|" +
  140. "set_error_when_null_denominator|set_field|set_floating_precision|" +
  141. "set_font|set_formatter_out_channel|set_formatter_output_functions|" +
  142. "set_formatter_tag_functions|set_line_width|set_margin|set_mark_tags|" +
  143. "set_max_boxes|set_max_indent|set_method|set_nonblock|set_nonblock|" +
  144. "set_normalize_ratio|set_normalize_ratio_when_printing|set_print_tags|" +
  145. "set_signal|set_state|set_tab|set_tag|set_tags|set_text_size|" +
  146. "set_window_title|setgid|setgid|setitimer|setitimer|setsid|setsid|" +
  147. "setsockopt|setsockopt|setsockopt_float|setsockopt_float|setsockopt_int|" +
  148. "setsockopt_int|setsockopt_optint|setsockopt_optint|setuid|setuid|" +
  149. "shift_left|shift_left|shift_left|shift_right|shift_right|shift_right|" +
  150. "shift_right_logical|shift_right_logical|shift_right_logical|show_buckets|" +
  151. "shutdown|shutdown|shutdown_connection|shutdown_connection|sigabrt|" +
  152. "sigalrm|sigchld|sigcont|sigfpe|sighup|sigill|sigint|sigkill|sign_big_int|" +
  153. "sign_num|signal|signal|sigpending|sigpending|sigpipe|sigprocmask|" +
  154. "sigprocmask|sigprof|sigquit|sigsegv|sigstop|sigsuspend|sigsuspend|" +
  155. "sigterm|sigtstp|sigttin|sigttou|sigusr1|sigusr2|sigvtalrm|sin|singleton|" +
  156. "sinh|size|size|size_x|size_y|sleep|sleep|sleep|slice_left|slice_left|" +
  157. "slice_left_1|slice_left_2|slice_right|slice_right|slice_right_1|" +
  158. "slice_right_2|snd|socket|socket|socket|socketpair|socketpair|sort|sound|" +
  159. "split|split_delim|sprintf|sprintf|sqrt|sqrt|sqrt_big_int|square_big_int|" +
  160. "square_num|sscanf|stable_sort|stable_sort|stable_sort|stable_sort|stable_sort|" +
  161. "stable_sort|stat|stat|stat|stat|stat|stats|stats|std_formatter|stdbuf|" +
  162. "stderr|stderr|stderr|stdib|stdin|stdin|stdin|stdout|stdout|stdout|" +
  163. "str_formatter|string|string_after|string_before|string_match|" +
  164. "string_of_big_int|string_of_bool|string_of_float|string_of_format|" +
  165. "string_of_inet_addr|string_of_inet_addr|string_of_int|string_of_num|" +
  166. "string_partial_match|string_tag|sub|sub|sub_big_int|sub_left|sub_num|" +
  167. "sub_right|subset|subset|substitute_first|substring|succ|succ|" +
  168. "succ|succ|succ_big_int|succ_num|symbol_end|symbol_end_pos|symbol_start|" +
  169. "symbol_start_pos|symlink|symlink|sync|synchronize|system|system|system|" +
  170. "tag|take|tan|tanh|tcdrain|tcdrain|tcflow|tcflow|tcflush|tcflush|" +
  171. "tcgetattr|tcgetattr|tcsendbreak|tcsendbreak|tcsetattr|tcsetattr|" +
  172. "temp_file|text_size|time|time|time|timed_read|timed_write|times|times|" +
  173. "tl|tl|tl|to_buffer|to_channel|to_float|to_hex|to_int|to_int32|to_list|" +
  174. "to_list|to_list|to_nativeint|to_string|to_string|to_string|to_string|" +
  175. "to_string|top|top|total_size|transfer|transp|truncate|truncate|truncate|" +
  176. "truncate|truncate|truncate|try_lock|umask|umask|uncapitalize|uncapitalize|" +
  177. "uncapitalize|union|union|unit_big_int|unlink|unlink|unlock|unmarshal|" +
  178. "unsafe_blit|unsafe_fill|unsafe_get|unsafe_get|unsafe_set|unsafe_set|" +
  179. "update|uppercase|uppercase|uppercase|uppercase|usage|utimes|utimes|wait|" +
  180. "wait|wait|wait|wait_next_event|wait_pid|wait_read|wait_signal|" +
  181. "wait_timed_read|wait_timed_write|wait_write|waitpid|white|" +
  182. "widen|window_id|word_size|wrap|wrap_abort|write|yellow|yield|zero|zero_big_int|" +
  183. "Arg|Arith_status|Array|Array1|Array2|Array3|ArrayLabels|Big_int|Bigarray|" +
  184. "Buffer|Callback|CamlinternalOO|Char|Complex|Condition|Dbm|Digest|Dynlink|" +
  185. "Event|Filename|Format|Gc|Genarray|Genlex|Graphics|GraphicsX11|Hashtbl|" +
  186. "Int32|Int64|LargeFile|Lazy|Lexing|List|ListLabels|Make|Map|Marshal|" +
  187. "MoreLabels|Mutex|Nativeint|Num|Obj|Oo|Parsing|Pervasives|Printexc|" +
  188. "Printf|Queue|Random|Scanf|Scanning|Set|Sort|Stack|State|StdLabels|Str|" +
  189. "Stream|String|StringLabels|Sys|Thread|ThreadUnix|Tk|Unix|UnixLabels|Weak");
  190. var keywordMapper = this.createKeywordMapper({
  191. "variable.language": "this",
  192. "keyword": keywords,
  193. "constant.language": builtinConstants,
  194. "support.function": builtinFunctions
  195. }, "identifier");
  196. var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
  197. var octInteger = "(?:0[oO]?[0-7]+)";
  198. var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
  199. var binInteger = "(?:0[bB][01]+)";
  200. var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")";
  201. var exponent = "(?:[eE][+-]?\\d+)";
  202. var fraction = "(?:\\.\\d+)";
  203. var intPart = "(?:\\d+)";
  204. var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
  205. var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + exponent + ")";
  206. var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
  207. this.$rules = {
  208. "start": [
  209. {
  210. token: "comment",
  211. regex: '\\(\\*.*?\\*\\)\\s*?$'
  212. },
  213. {
  214. token: "comment",
  215. regex: '\\(\\*.*',
  216. next: "comment"
  217. },
  218. {
  219. token: "string",
  220. regex: '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  221. },
  222. {
  223. token: "string",
  224. regex: "'.'"
  225. },
  226. {
  227. token: "string",
  228. regex: '"',
  229. next: "qstring"
  230. },
  231. {
  232. token: "constant.numeric",
  233. regex: "(?:" + floatNumber + "|\\d+)[jJ]\\b"
  234. },
  235. {
  236. token: "constant.numeric",
  237. regex: floatNumber
  238. },
  239. {
  240. token: "constant.numeric",
  241. regex: integer + "\\b"
  242. },
  243. {
  244. token: keywordMapper,
  245. regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
  246. },
  247. {
  248. token: "keyword.operator",
  249. regex: "\\+\\.|\\-\\.|\\*\\.|\\/\\.|#|;;|\\+|\\-|\\*|\\*\\*\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|<-|="
  250. },
  251. {
  252. token: "paren.lparen",
  253. regex: "[[({]"
  254. },
  255. {
  256. token: "paren.rparen",
  257. regex: "[\\])}]"
  258. },
  259. {
  260. token: "text",
  261. regex: "\\s+"
  262. }
  263. ],
  264. "comment": [
  265. {
  266. token: "comment",
  267. regex: "\\*\\)",
  268. next: "start"
  269. },
  270. {
  271. defaultToken: "comment"
  272. }
  273. ],
  274. "qstring": [
  275. {
  276. token: "string",
  277. regex: '"',
  278. next: "start"
  279. }, {
  280. token: "string",
  281. regex: '.+'
  282. }
  283. ]
  284. };
  285. };
  286. oop.inherits(OcamlHighlightRules, TextHighlightRules);
  287. exports.OcamlHighlightRules = OcamlHighlightRules;
  288. });
  289. ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
  290. var Range = require("../range").Range;
  291. var MatchingBraceOutdent = function () { };
  292. (function () {
  293. this.checkOutdent = function (line, input) {
  294. if (!/^\s+$/.test(line))
  295. return false;
  296. return /^\s*\}/.test(input);
  297. };
  298. this.autoOutdent = function (doc, row) {
  299. var line = doc.getLine(row);
  300. var match = line.match(/^(\s*\})/);
  301. if (!match)
  302. return 0;
  303. var column = match[1].length;
  304. var openBracePos = doc.findMatchingBracket({ row: row, column: column });
  305. if (!openBracePos || openBracePos.row == row)
  306. return 0;
  307. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  308. doc.replace(new Range(row, 0, row, column - 1), indent);
  309. };
  310. this.$getIndent = function (line) {
  311. return line.match(/^\s*/)[0];
  312. };
  313. }).call(MatchingBraceOutdent.prototype);
  314. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  315. });
  316. ace.define("ace/mode/ocaml",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ocaml_highlight_rules","ace/mode/matching_brace_outdent","ace/range"], function(require, exports, module){"use strict";
  317. var oop = require("../lib/oop");
  318. var TextMode = require("./text").Mode;
  319. var OcamlHighlightRules = require("./ocaml_highlight_rules").OcamlHighlightRules;
  320. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  321. var Range = require("../range").Range;
  322. var Mode = function () {
  323. this.HighlightRules = OcamlHighlightRules;
  324. this.$behaviour = this.$defaultBehaviour;
  325. this.$outdent = new MatchingBraceOutdent();
  326. };
  327. oop.inherits(Mode, TextMode);
  328. var indenter = /(?:[({[=:]|[-=]>|\b(?:else|try|with))\s*$/;
  329. (function () {
  330. this.toggleCommentLines = function (state, doc, startRow, endRow) {
  331. var i, line;
  332. var outdent = true;
  333. var re = /^\s*\(\*(.*)\*\)/;
  334. for (i = startRow; i <= endRow; i++) {
  335. if (!re.test(doc.getLine(i))) {
  336. outdent = false;
  337. break;
  338. }
  339. }
  340. var range = new Range(0, 0, 0, 0);
  341. for (i = startRow; i <= endRow; i++) {
  342. line = doc.getLine(i);
  343. range.start.row = i;
  344. range.end.row = i;
  345. range.end.column = line.length;
  346. doc.replace(range, outdent ? line.match(re)[1] : "(*" + line + "*)");
  347. }
  348. };
  349. this.getNextLineIndent = function (state, line, tab) {
  350. var indent = this.$getIndent(line);
  351. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  352. if (!(tokens.length && tokens[tokens.length - 1].type === 'comment') &&
  353. state === 'start' && indenter.test(line))
  354. indent += tab;
  355. return indent;
  356. };
  357. this.checkOutdent = function (state, line, input) {
  358. return this.$outdent.checkOutdent(line, input);
  359. };
  360. this.autoOutdent = function (state, doc, row) {
  361. this.$outdent.autoOutdent(doc, row);
  362. };
  363. this.$id = "ace/mode/ocaml";
  364. }).call(Mode.prototype);
  365. exports.Mode = Mode;
  366. }); (function() {
  367. ace.require(["ace/mode/ocaml"], function(m) {
  368. if (typeof module == "object" && typeof exports == "object" && module) {
  369. module.exports = m;
  370. }
  371. });
  372. })();