<<>> <> <> <<>> DIRECTORY BasicTime USING [earliestGMT, GMT], Rope USING [ROPE]; TimeParse: CEDAR DEFINITIONS IMPORTS BasicTime = BEGIN PieceType: TYPE = RECORD[start, len: INT]; PiecesType: TYPE = LIST OF REF PieceType; DirectionType: TYPE = {heuristic, forward, backward}; ParseErrorType: TYPE = {noTime, yearOrMonthButNoDay, yearButNoMonth, dayWeekdayMismatch, twoYears, badYearInSlash}; ParseError: ERROR[errorType: ParseErrorType]; Parse: PROC[ str: Rope.ROPE, now: BasicTime.GMT, direction: DirectionType ¬ heuristic, insistTime: BOOLEAN ¬ TRUE, insistDay: BOOLEAN ¬ TRUE] RETURNS [time: BasicTime.GMT, pieces: PiecesType ¬ NIL]; <> Precision: TYPE = {years, months, days, hours, minutes, seconds, unspecified}; <> <<>> TempusParse: PROC[ rope: Rope.ROPE, baseTime: BasicTime.GMT, search: BOOLEAN ¬ TRUE] RETURNS [time: BasicTime.GMT, precision: Precision, start, length: NAT]; Adjust: PROCEDURE [ years: INT ¬ LAST[INT], months: INT ¬ LAST[INT], days: INT ¬ LAST[INT], hours: INT ¬ LAST[INT], minutes: INT ¬ LAST[INT], seconds: INT ¬ LAST[INT], -- BasicTime.earliestGMT is used to mean now baseTime: BasicTime.GMT ¬ BasicTime.earliestGMT, precisionOfResult: Precision ¬ unspecified -- unspecified means result should be precision of smallest specified argument. ] RETURNS [time: BasicTime.GMT, precision: Precision]; <> <> <> END.