Skip to content

Commit

Permalink
Compatibility 4.01, 4.02, 4.03
Browse files Browse the repository at this point in the history
  • Loading branch information
lefessan authored and AltGr committed Jun 1, 2016
1 parent cdfb0ec commit f7fa291
Show file tree
Hide file tree
Showing 12 changed files with 311 additions and 64 deletions.
4 changes: 2 additions & 2 deletions opam
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ tags: [
"org:ocamlpro"
"org:typerex"
]
dev-repo: "https://github.com/OCamlPro/ocp-index.git#4.03"
dev-repo: "https://github.com/OCamlPro/ocp-index.git"
build: [
["./configure" "--prefix" prefix]
[make]
Expand All @@ -26,7 +26,7 @@ depends: [
]
depopts: "lambda-term"
conflicts: "lambda-term" {< "1.7"}
available: [ocaml-version >= "4.03"]
available: [ocaml-version >= "4.01.0" ]
messages: "For ocp-browser, please also install package lambda-term" {! lambda-term:installed}
post-messages:
"This package requires additional configuration for use in editors. Either install package 'user-setup', or manually:
Expand Down
13 changes: 8 additions & 5 deletions src/browserMain.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ let rec eq l1 l2 = match l1, l2 with
{LibIndex. path = path2 ; name = name2 } :: t2 ->
path1 = path2 && name1 = name2 && eq t1 t2

(** Provide an association LibIndex.kind -> tag (= string) -> style
(* * Provide an association LibIndex.kind -> tag (= string) -> style
In order to encode styles in [Format.tag]. *)
let kind_to_tag, tag_to_style, register_ressource =
let h = Hashtbl.create 11 in
let kind_to_tag = function
| LibIndex.Type | OpenType -> "Type"
#if OCAML_VERSION >= "4.03"
| LibIndex.OpenType
#endif
| LibIndex.Type -> "Type"
| Value -> "Value"
| Exception -> "Exception"
| Field _ -> "Field"
Expand Down Expand Up @@ -407,7 +410,7 @@ class virtual line_editor = object(self)
end


(** Strip one path level.
(* * Strip one path level.
Do the following transformation:
"Foo.Bar." -> "Foo."
Expand Down Expand Up @@ -553,7 +556,7 @@ let size (str : LTerm_text.t) =
if fst str.(last) <> newline then incr rows ;
{LTerm_geom. rows = !rows ; cols = !cols }

(** The show box shows the result of a research.
(* * The show box shows the result of a research.
[content] is a list zipper positioned at the focused element.
Left and right lists are elements before and after the focus.
Expand Down Expand Up @@ -785,7 +788,7 @@ let event_handler (cbox : #completion_box) (sbox:#show_box) options show_help =
true
| _ -> false

(** Express the result as an event mapped on the content of the completion box.
(* * Express the result as an event mapped on the content of the completion box.
*)
let show_completion show_box input =
let zipper n l =
Expand Down
12 changes: 9 additions & 3 deletions src/grepMain.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@

module Grep : sig

(** [ident path, filename, input channel, [line, column, length]]
(* * [ident path, filename, input channel, [line, column, length]]
Finds occurence of given ident in an opened file.
Results are in reverse order. *)
val ident: string list -> string -> in_channel -> (int * int * int) list

(** [regex, filename, input channel, [line, column, length]]
(* * [regex, filename, input channel, [line, column, length]]
Finds matches of a regexp in the strings of an opened ocaml file.
Results are in reverse order. *)
val strings_re: Re.re -> string -> in_channel -> (int * int * int) list
Expand Down Expand Up @@ -85,7 +85,14 @@ end = struct
Filename.basename
(try Filename.chop_extension f with Invalid_argument _ -> f)
in
#if OCAML_VERSION >= "4.03"
String.mapi (function 0 -> Char.uppercase_ascii | _ -> fun x -> x) s
#elif OCAML_VERSION >= "4.02"
String.mapi (function 0 -> Char.uppercase | _ -> fun x -> x) s
#else
s.[0] <- Char.uppercase s.[0];
s
#endif
in
let f (curpath, lookfor, last_scope, acc) scope tok pos =
let lookfor =
Expand Down Expand Up @@ -319,4 +326,3 @@ let () =
(* idea: single utility to color parts of source with syntactic context:
pattern, expr, type, topexpr, module, record ...
Could be used for better completion, analysis etc.*)

Loading

0 comments on commit f7fa291

Please sign in to comment.