diff options
author | 2003-02-21 15:48:17 +0000 | |
---|---|---|
committer | 2003-02-21 15:48:17 +0000 | |
commit | 48a31721daa6f9008ab36cc0157a443447e3f68b (patch) | |
tree | 972e6cdc72d3fd4fcd9bf5a82d5772506326ea37 /ide/highlight.mll | |
parent | 07c737eccfd766300be275f949ab7b9f74e67937 (diff) |
CoqIDE: robustesse / multi-buffers / menus / ... (utilisable)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@3689 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'ide/highlight.mll')
-rw-r--r-- | ide/highlight.mll | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/ide/highlight.mll b/ide/highlight.mll index 8b187c754..e58654714 100644 --- a/ide/highlight.mll +++ b/ide/highlight.mll @@ -73,3 +73,33 @@ and comment = parse | "(*" { ignore (comment lexbuf); comment lexbuf } | _ { comment lexbuf } | eof { raise End_of_file } + +{ + open Ideutils + + let highlight_slice (input_buffer:GText.buffer) (start:GText.iter) stop = + let offset = start#offset in + let s = start#get_slice ~stop in + let convert_pos = byte_offset_to_char_offset s in + let lb = Lexing.from_string s in + try + while true do + process_pending (); + let b,e,o=next_order lb in + let b,e = convert_pos b,convert_pos e in + let start = input_buffer#get_iter_at_char (offset + b) in + let stop = input_buffer#get_iter_at_char (offset + e) in + input_buffer#apply_tag_by_name ~start ~stop o + done + with End_of_file -> () + | _ -> () + + + let highlight_current_line input_buffer = + let i = get_insert input_buffer in + highlight_slice input_buffer (i#set_line_offset 0) i + + let highlight_all input_buffer = + highlight_slice input_buffer input_buffer#start_iter input_buffer#end_iter + +} |