src/Pure/Syntax/syntax.ML
changeset 38228 ada3ab6b9085
parent 37684 d123b1e08856
child 38229 61d0fe8b96ac
equal deleted inserted replaced
38227:6bbb42843b6e 38228:ada3ab6b9085
   458 (* read token -- with optional YXML encoding of position *)
   458 (* read token -- with optional YXML encoding of position *)
   459 
   459 
   460 fun read_token str =
   460 fun read_token str =
   461   let val (text, pos) =
   461   let val (text, pos) =
   462     (case YXML.parse str handle Fail msg => error msg of
   462     (case YXML.parse str handle Fail msg => error msg of
   463       XML.Elem ("token", props, [XML.Text text]) => (text, Position.of_properties props)
   463     (* FIXME avoid literal strings *)
   464     | XML.Elem ("token", props, []) => ("", Position.of_properties props)
   464       XML.Elem (("token", props), [XML.Text text]) => (text, Position.of_properties props)
       
   465     | XML.Elem (("token", props), []) => ("", Position.of_properties props)
   465     | XML.Text text => (text, Position.none)
   466     | XML.Text text => (text, Position.none)
   466     | _ => (str, Position.none))
   467     | _ => (str, Position.none))
   467   in (Symbol_Pos.explode (text, pos), pos) end;
   468   in (Symbol_Pos.explode (text, pos), pos) end;
   468 
   469 
   469 
   470