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