src/Pure/General/antiquote.ML
changeset 62749 eba34ff9671c
parent 62213 c56c2d50dd6d
child 62797 e08c44eed27f
equal deleted inserted replaced
62748:aa0084adce1f 62749:eba34ff9671c
    14   val split_lines: text_antiquote list -> text_antiquote list list
    14   val split_lines: text_antiquote list -> text_antiquote list list
    15   val antiq_reports: 'a antiquote list -> Position.report list
    15   val antiq_reports: 'a antiquote list -> Position.report list
    16   val scan_control: Symbol_Pos.T list -> control * Symbol_Pos.T list
    16   val scan_control: Symbol_Pos.T list -> control * Symbol_Pos.T list
    17   val scan_antiq: Symbol_Pos.T list -> antiq * Symbol_Pos.T list
    17   val scan_antiq: Symbol_Pos.T list -> antiq * Symbol_Pos.T list
    18   val scan_antiquote: Symbol_Pos.T list -> text_antiquote * Symbol_Pos.T list
    18   val scan_antiquote: Symbol_Pos.T list -> text_antiquote * Symbol_Pos.T list
    19   val read': Position.T -> Symbol_Pos.T list -> text_antiquote list
    19   val parse: Position.T -> Symbol_Pos.T list -> text_antiquote list
    20   val read: Input.source -> text_antiquote list
    20   val read: Input.source -> text_antiquote list
    21 end;
    21 end;
    22 
    22 
    23 structure Antiquote: ANTIQUOTE =
    23 structure Antiquote: ANTIQUOTE =
    24 struct
    24 struct
   121 end;
   121 end;
   122 
   122 
   123 
   123 
   124 (* read *)
   124 (* read *)
   125 
   125 
   126 fun read' pos syms =
   126 fun parse pos syms =
   127   (case Scan.read Symbol_Pos.stopper (Scan.repeat scan_antiquote) syms of
   127   (case Scan.read Symbol_Pos.stopper (Scan.repeat scan_antiquote) syms of
   128     SOME ants => (Position.reports (antiq_reports ants); ants)
   128     SOME ants => ants
   129   | NONE => error ("Malformed quotation/antiquotation source" ^ Position.here pos));
   129   | NONE => error ("Malformed quotation/antiquotation source" ^ Position.here pos));
   130 
   130 
   131 fun read source = read' (Input.pos_of source) (Input.source_explode source);
   131 fun read source =
       
   132   let
       
   133     val ants = parse (Input.pos_of source) (Input.source_explode source);
       
   134     val _ = Position.reports (antiq_reports ants);
       
   135   in ants end;
   132 
   136 
   133 end;
   137 end;