Commit 6d476c7c authored by Jean-Christophe Filliâtre's avatar Jean-Christophe Filliâtre
Browse files

IDE : un peu de coloration syntaxique

parent a493d3a4
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<language _name="Objective Caml" version="1.0" _section="Sources" mimetypes="text/x-ocaml">
<block-comment _name = "Comment" style= "Comment" end-at-line-end = "FALSE">
<pattern-item _name = "Decimal" style = "Decimal">
<pattern-item _name = "Hex Number" style = "Base-N Integer">
<pattern-item _name = "Octal Number" style = "Base-N Integer">
<pattern-item _name = "Binary Number" style = "Base-N Integer">
<pattern-item _name = "Floating Point Number" style = "Floating Point">
<string _name = "Character Constant" style = "String" end-at-line-end = "TRUE">
<string _name = "String" style = "String" end-at-line-end = "FALSE">
<pattern-item _name = "Modules" style = "Data Type" case-sensitive="TRUE">
<keyword-list _name = "Definition keyword" style = "Keyword" case-sensitive="TRUE">
<keyword-list _name = "Expression keyword" style = "Keyword" case-sensitive="TRUE">
<keyword-list _name = "Types" style = "Data Type" case-sensitive="TRUE">
......@@ -44,6 +44,19 @@ let fname = match !file with
| Some f ->
let lang =
let file =
List.fold_right Filename.concat
[Filename.dirname Sys.argv.(0); ".."; "share"; "lang"] "why.lang"
if Sys.file_exists file then
let languages_manager = GSourceView.source_languages_manager () in
GSourceView.source_language_from_file ~languages_manager file
else begin
Format.eprintf "could not find lang file (%S)@.";
let text =
let ic = open_in fname in
let size = in_channel_length ic in
......@@ -170,6 +183,11 @@ let main () =
source_view#misc#modify_font_by_name font_name;
begin match lang with
| Some lang -> source_view#source_buffer#set_language lang
| None -> ()
source_view#source_buffer#set_highlight true;
source_view#source_buffer#set_text text;
w#add_accel_group accel_group;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment