! Syntax hilighting patterns and (un)comment macros for OCaml. ! to use them, type "nedit -import ocaml.pats", try them out, ! and if you like them use Preferences | Save Defaults... to ! keep them. ! ! Note: By default this binds Alt+3 to Comment and Shift+Alt+3 to Uncomment. ! It also binds F1 to switch between a .ml file and its .mli file. ! Use Preferences | Default Settings | Customize Menus | Macro Menu... ! to change the bindings if you don't like them. ! ! Version 0.7 ! Nathaniel Gray ! 6/5/2002 nedit.highlightPatterns: OCaml:1:0{\n\ Comment:"\\(\\*":"\\*\\)"::Comment::\n\ C Comment -- Ocamlyacc:"/\\*":"\\*/"::Comment::\n\ --Nested Comment:"\\(\\*":"\\*\\)"::Comment:Comment:\n\ String Literal:"""":"""":"\\n":String::\n\ --String Escapes:"\\\\(?:[\\\\""nrtb]|\\d\\d\\d|\\n)":::Character Const:String Literal:\n\ Let Var Stmt:"(?n)|(\\Y+>)(?=\\s*(?:\\Y|[(]))|(\\Y+>)(?=\\s*=\\s*function)))":::Keyword::D\n\ --Let Fun Identifier:"\\1\\2\\3":""::Label:Let Fun Stmt:DC\n\ Type Stmt:")))":::Keyword::D\n\ --And Type Identifier:"\\1":""::Storage Type:And Type Stmt:DC\n\ And Func Stmt:"":::Keyword::D\n\ --And Func Identifier:"\\1":""::Label:And Func Stmt:DC\n\ Val Stmt:"|;|\\-\\>":::Keyword::D\n\ Integer Literal:"<(?:0[xX][0-9A-Fa-f]+|0[oO][0-7]+|0[bB][01]+|[0-9]+)>":::Numeric Const::D\n\ Float Literal:"<[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?>":::Numeric Const::D\n\ Char Literal:"<'([^'\\\\]|\\\\['\\\\nrtb]|\\\\\\d\\d\\d)'>":::Character Const::D\n\ Builtin Values:"<(?:abs|abs_float|acos|asin|atan|atan2|at_exit|bool_of_string|ceil|char_of_int|classify_float|close_in|close_out|compare|cos|cosh|decr|exit|exp|failwith|float|float_of_int|float_of_string|floor|flush|frexp|fst|ignore|in_channel_length|incr|infinity|input|input_binary_int|input_byte|input_char|input_line|input_value|int_of_char|int_of_float|int_of_string|invalid_arg|ldexp|lnot|log|log10|max|max_int|min|min_int|modf|mod_float|nan|neg_infinity|not|open_in|open_in_bin|open_in_gen|open_out|open_out_bin|open_out_gen|out_channel_length|output|output_binary_int|output_byte|output_char|output_string|output_value|pos_in|pos_out|pred|prerr_char|prerr_endline|prerr_float|prerr_int|prerr_newline|prerr_string|print_char|print_endline|print_float|print_int|print_newline|print_string|raise|read_float|read_int|read_line|really_input|ref|seek_in|seek_out|set_binary_mode_in|set_binary_mode_out|sin|sinh|snd|sqrt|stderr|stdin|stdout|string_of_bool|string_of_float|string_of_int|succ|tan|tanh|truncate)>":::Subroutine1::D\n\ Module Value:"<(?:[A-Z]\\Y*)(?:\\.[A-Z]\\Y*)*(?=\\s*\\.)":::Subroutine::D\n\ Builtin Types:"<(?:int|float|string|char|bool|list|exn|array|option|format|fpclass|in_channel|out_channel|open_flag|ref|unit|[A-Z]\\Y*|'\\Y*)>":::Storage Type::D\n\ Misc Punctuation:"\\W":::Plain::D\n\ } nedit.languageModes: OCaml:.ml .mli .mll .mly::::::".,/\\`!|@#%^&*()-=+{}[]"":;<>?~$" nedit.macroCommands: \ Go to .ml/.mli File@OCaml:F1::: {\n\ if (search_string($file_name, ".mli", 0) != -1)\n\ open($file_path substring($file_name, 0, length($file_name)-4) ".ml") \n\ else if(search_string($file_name, ".ml", 0) != -1)\n\ open($file_path substring($file_name, 0, length($file_name)-3) ".mli")\n\ else\n\ dialog("Unrecognized OCaml extension on file: " $file_name, "Ok")\n\ }\n\ Comment@OCaml:Alt+3::: {\n\ selStart = $selection_start\n\ if( selStart != -1 ) {\n\ selEnd = $selection_end\n\ replace_range(selStart, selEnd, "(* " get_selection() " *)")\n\ select(selStart, selEnd + 6)\n\ } else {\n\ insert_string( "(* *)" )\n\ backward_character()\n\ backward_character()\n\ backward_character()\n\ }\n\ \n\ }\n\ Uncomment@OCaml:Shift+Alt+3::R: {\n\ sel = get_selection()\n\ selStart = $selection_start\n\ selEnd = $selection_end\n\ commentStart = search_string(sel, "(*", 0)\n\ if (substring(sel, commentStart+2, commentStart+3) == " ")\n\ keepStart = commentStart + 3\n\ else\n\ keepStart = commentStart + 2\n\ keepEnd = search_string(sel, "*)", length(sel), "backward")\n\ commentEnd = keepEnd + 2\n\ if (substring(sel, keepEnd - 1, keepEnd == " "))\n\ keepEnd = keepEnd - 1\n\ replace_range(selStart + commentStart, selStart + commentEnd, \\\n\ substring(sel, keepStart, keepEnd))\n\ select(selStart, selEnd - (keepStart-commentStart) - \\\n\ (commentEnd - keepEnd))\n\ }