src/Pure/ProofGeneral/pgip_parser.ML
changeset 27841 55b028593335
parent 27664 0e7a7fcd403b
child 28035 7120e58464e4
equal deleted inserted replaced
27840:e9483ef084cc 27841:55b028593335
    88       | SOME k =>
    88       | SOME k =>
    89           (case Symtab.lookup command_keywords (OuterKeyword.kind_of k) of
    89           (case Symtab.lookup command_keywords (OuterKeyword.kind_of k) of
    90             NONE => [D.Unparseable {text = text}]
    90             NONE => [D.Unparseable {text = text}]
    91           | SOME f => f text));
    91           | SOME f => f text));
    92 
    92 
    93 fun parse_item (kind, toks) =
    93 fun parse_span span =
    94   let val text = implode (map (PgmlIsabelle.pgml_mode ThyEdit.present_token) toks) in
    94   let
       
    95     val kind = ThyEdit.span_kind span;
       
    96     val toks = ThyEdit.span_content span;
       
    97     val text = implode (map (PgmlIsabelle.pgml_mode ThyEdit.present_token) toks);
       
    98   in
    95     (case kind of
    99     (case kind of
    96       ThyEdit.Command name => parse_command name text
   100       ThyEdit.Command name => parse_command name text
    97     | ThyEdit.Ignored => [D.Whitespace {text = text}]
   101     | ThyEdit.Ignored => [D.Whitespace {text = text}]
    98     | ThyEdit.Unknown => [D.Unparseable {text = text}])
   102     | ThyEdit.Malformed => [D.Unparseable {text = text}])
    99   end;
   103   end;
   100 
   104 
   101 
   105 
   102 fun pgip_parser pos str =
   106 fun pgip_parser pos str =
   103   maps parse_item (ThyEdit.parse_spans pos (Source.of_string str));
   107   maps parse_span (ThyEdit.parse_spans (OuterKeyword.get_lexicons ()) pos str);
   104 
   108 
   105 end;
   109 end;