src/Pure/ProofGeneral/parsing.ML
changeset 22160 27cdecde8c2b
parent 22101 6d13239d5f52
child 22374 db0b80b8371c
equal deleted inserted replaced
22159:0cf0d3912239 22160:27cdecde8c2b
   244         | NONE => (* an uncategorized keyword is treated as a theory item (maybe wrong) *)
   244         | NONE => (* an uncategorized keyword is treated as a theory item (maybe wrong) *)
   245           (parse_warning ("Uncategorized command found: " ^ name ^ " -- using theoryitem");
   245           (parse_warning ("Uncategorized command found: " ^ name ^ " -- using theoryitem");
   246            [D.Theoryitem {name=NONE,objtype=NONE,text=str}])
   246            [D.Theoryitem {name=NONE,objtype=NONE,text=str}])
   247    end
   247    end
   248 
   248 
       
   249 
       
   250 (* this would be a lot neater if we could match on toks! *)
   249 fun markup_comment_whs [] = []
   251 fun markup_comment_whs [] = []
   250   | markup_comment_whs (toks as t::ts) = (* this would be a lot neater if we could match on toks! *)
   252   | markup_comment_whs (toks as t::ts) = 
   251     let
   253     let
   252         val (prewhs,rest) = take_prefix (OuterLex.is_kind OuterLex.Space) toks
   254         val (prewhs,rest) = take_prefix (OuterLex.is_kind OuterLex.Space) toks
   253     in
   255     in
   254         if not (null prewhs) then
   256         if not (null prewhs) then
   255             D.Whitespace {text=implode (map OuterLex.unparse prewhs)}
   257             D.Whitespace {text=implode (map OuterLex.unparse prewhs)}
   318          | parse_loop ([],itoks,xmls) = xmls @ (xmls_of_impropers itoks)
   320          | parse_loop ([],itoks,xmls) = xmls @ (xmls_of_impropers itoks)
   319          | parse_loop ((nm,toks,_)::trs,itoks,xmls) =
   321          | parse_loop ((nm,toks,_)::trs,itoks,xmls) =
   320            let
   322            let
   321                (* first proper token after whitespace/litcomment/whitespace is command *)
   323                (* first proper token after whitespace/litcomment/whitespace is command *)
   322                val (xmls_pre_cmd,cmditoks') = xmls_pre_cmd itoks
   324                val (xmls_pre_cmd,cmditoks') = xmls_pre_cmd itoks
   323                val (cmdtok,itoks') = case cmditoks' of x::xs => (x,xs)
   325                val (cmdtok,itoks') = 
   324                                                      | _ => error("proof_general/parse_loop impossible")
   326 		   case cmditoks' of x::xs => (x,xs)
       
   327                                    | _ => error("proof_general/parse_loop impossible")
   325                val (utoks,itoks'') = match_tokens (toks,itoks',[])
   328                val (utoks,itoks'') = match_tokens (toks,itoks',[])
   326                (* FIXME: should take trailing [w/s+] semicolon too in utoks *)
   329                (* FIXME: should take trailing [w/s+] semicolon too in utoks *)
   327 
   330 
   328                val str = implode (map OuterLex.unparse (cmdtok::utoks))
   331                val str = implode (map OuterLex.unparse (cmdtok::utoks))
   329 
   332