/lenasys/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/trunk

« back to all changes in this revision

Viewing changes to codeigniter/js/ace/mode-ocaml.js

  • Committer: elof.bigestans at gmail
  • Date: 2013-04-03 08:06:30 UTC
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: elof.bigestans@gmail.com-20130403080630-r721wlstq15mdjby
Added new folders to match new folder structure

Show diffs side-by-side

added added

removed removed

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