src/Pure/Tools/codegen_serializer.ML
changeset 22007 6d368bd94d66
parent 21952 dc9366853df1
child 22022 93f842eb51a8
equal deleted inserted replaced
22006:9dc365b03573 22007:6d368bd94d66
  1606   #> add_serializer ("OCaml", isar_seri_ocaml)
  1606   #> add_serializer ("OCaml", isar_seri_ocaml)
  1607   #> add_serializer ("Haskell", isar_seri_haskell)
  1607   #> add_serializer ("Haskell", isar_seri_haskell)
  1608   #> add_serializer (target_diag, (fn _ => fn _ => seri_diagnosis))
  1608   #> add_serializer (target_diag, (fn _ => fn _ => seri_diagnosis))
  1609 );
  1609 );
  1610 
  1610 
  1611 fun get_serializer thy target args cs =
  1611 fun get_serializer thy target args = fn cs =>
  1612   let
  1612   let
  1613     val data = case Symtab.lookup (CodegenSerializerData.get thy) target
  1613     val data = case Symtab.lookup (CodegenSerializerData.get thy) target
  1614      of SOME data => data
  1614      of SOME data => data
  1615       | NONE => error ("Unknown code target language: " ^ quote target);
  1615       | NONE => error ("Unknown code target language: " ^ quote target);
  1616     val seri = the_serializer data;
  1616     val seri = the_serializer data;
  1666     | NONE => error ("Unknown code target language: " ^ quote target);
  1666     | NONE => error ("Unknown code target language: " ^ quote target);
  1667 
  1667 
  1668 fun has_serialization f thy targets name =
  1668 fun has_serialization f thy targets name =
  1669   forall (
  1669   forall (
  1670     is_some o (fn tab => Symtab.lookup tab name) o f o the_syntax_expr o the
  1670     is_some o (fn tab => Symtab.lookup tab name) o f o the_syntax_expr o the
  1671       o (Symtab.lookup ((CodegenSerializerData.get) thy))
  1671       o Symtab.lookup (CodegenSerializerData.get thy)
  1672   ) targets;
  1672   ) targets;
  1673 
  1673 
  1674 val tyco_has_serialization = has_serialization #tyco;
  1674 val tyco_has_serialization = has_serialization #tyco;
  1675 val const_has_serialization = has_serialization #const;
  1675 val const_has_serialization = has_serialization #const;
  1676 
  1676