src/Pure/Tools/jedit.ML
changeset 61621 70b8085f51b4
parent 61620 01db1bed4487
child 63669 256fc20716f2
equal deleted inserted replaced
61620:01db1bed4487 61621:70b8085f51b4
    42         (case XML.parse txt of
    42         (case XML.parse txt of
    43           XML.Elem (("ACTIONS", _), body) => maps (parse_named "ACTION") body
    43           XML.Elem (("ACTIONS", _), body) => maps (parse_named "ACTION") body
    44         | _ => [])
    44         | _ => [])
    45     | (_, rc) => error ("Cannot unzip jedit.jar\nreturn code = " ^ string_of_int rc)));
    45     | (_, rc) => error ("Cannot unzip jedit.jar\nreturn code = " ^ string_of_int rc)));
    46 
    46 
    47 fun is_action a =
    47 val all_actions =
    48   member (op =) (Lazy.force isabelle_jedit_actions) a orelse
    48   Lazy.lazy (fn () =>
    49   member (op =) (Lazy.force isabelle_jedit_dockables) a orelse
    49     Lazy.force isabelle_jedit_actions @
    50   member (op =) (Lazy.force jedit_actions) a;
    50     Lazy.force isabelle_jedit_dockables @
       
    51     Lazy.force jedit_actions);
    51 
    52 
    52 in
    53 in
    53 
    54 
    54 fun check_action (a, pos) =
    55 fun check_action (name, pos) =
    55   if is_action a then a
    56   if member (op =) (Lazy.force all_actions) name then name
    56   else error ("Bad jEdit action " ^ quote a ^ Position.here pos);
    57   else
       
    58     let
       
    59       val completion =
       
    60         Completion.make (name, pos)
       
    61           (fn completed =>
       
    62             Lazy.force all_actions
       
    63             |> filter completed
       
    64             |> sort_strings
       
    65             |> map (fn a => (a, ("action", a))));
       
    66       val report = Markup.markup_report (Completion.reported_text completion);
       
    67     in error ("Bad jEdit action " ^ quote name ^ Position.here pos ^ report) end
    57 
    68 
    58 end;
    69 end;
    59 
    70 
    60 end;
    71 end;