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 |