src/Pure/ProofGeneral/pgip_isabelle.ML
changeset 23680 09ccdb1b93ba
parent 23603 4a2e36475367
child 23799 20f58293fc5e
equal deleted inserted replaced
23679:57dceb84d1a0 23680:09ccdb1b93ba
    70     (map (fn p=> (p, element_async p, supported_optional_attrs p))
    70     (map (fn p=> (p, element_async p, supported_optional_attrs p))
    71          accepted_names);
    71          accepted_names);
    72 end
    72 end
    73 
    73 
    74 
    74 
    75 (* Now we have to parse strings constructed elsewhere in Isabelle, which is silly!
       
    76    This is another case where Isabelle should use structured types
       
    77    from the ground up to help its interfaces, instead of just plain
       
    78    strings.
       
    79 *)
       
    80 fun unquote s = case explode s of 
       
    81 		    "\""::xs => (case (rev xs) of
       
    82 				    "\""::_ => SOME (String.substring(s,1,(String.size s) - 2))
       
    83 			         | _ => NONE)
       
    84 		  | _ => NONE
       
    85 
       
    86 fun location_of_position pos = 
    75 fun location_of_position pos = 
    87     let val line = Position.line_of pos
    76     let val line = Position.line_of pos
    88 	val (url,descr) = 
    77 	val (url,descr) = 
    89 	    (case Position.name_of pos of
    78 	    (case Position.file_of pos of
    90 		 NONE => (NONE,NONE)
    79 	       NONE => (NONE, NONE)
    91 	       | SOME possiblyfile => 
    80 	     | SOME fname => 
    92 		 (case unquote possiblyfile of
    81 	       let val path = Path.explode fname in
    93 		      SOME fname => let val path = (Path.explode fname) in
    82 		 case ThyLoad.check_file NONE path of
    94 					case ThyLoad.check_file NONE path of
    83 		   SOME _ => (SOME (PgipTypes.pgipurl_of_path path), NONE)
    95 					    SOME _ => (SOME (PgipTypes.pgipurl_of_path path), NONE)
    84 		 | NONE => (NONE, SOME fname)
    96 					  | NONE => (NONE,SOME fname)
    85 	       end);
    97 				    end
    86     in
    98 		    | _ => (NONE,SOME possiblyfile)))
       
    99     in 
       
   100 	{ descr=descr, url=url, line=line, column=NONE, char=NONE, length=NONE }
    87 	{ descr=descr, url=url, line=line, column=NONE, char=NONE, length=NONE }
   101     end 
    88     end
   102 
    89 
   103 
    90 
   104 val [ObjTheoryBody,
    91 val [ObjTheoryBody,
   105      ObjTheoryDecl,
    92      ObjTheoryDecl,
   106      ObjTheoryBodySubsection,
    93      ObjTheoryBodySubsection,