dewbead library
Parse dewdrop output lines (dewbead) into structured calendar events.
Two stages keep NOW isolated: parse (NOW-free syntax) and resolve (NOW-based absolutization). parseDewbead runs both.
Classes
- AbsoluteDate
-
(yyyy-)mm-dd. year null -> inferred in resolve. - ClockTime
-
HH:MM— an absolute 24-hour wall-clock time. - DatePart
- The date component of a datetime — NOW-free. The anchor is the offset unit.
- Datetime
-
date_part [/time_part]. time null -> all-day. - DatetimeEndpoint
-
~t+2/02:00— a full end datetime (date always explicit). - Delta
-
A signed relative amount, e.g.
+85m->Delta(85, minute). - DewbeadAst
- Pure syntactic parse of one dewbead record (NOW-free).
- DurationEndpoint
-
~+90m— duration added to start. First char of the token is+/-. - EndpointSpec
-
The
~endpoint token (event only) — NOW-free. - MonthDate
-
mo [±N] . D— day dom of the month N months from now. - ParsedEvent
- A fully resolved calendar item.
- ParseResult
-
Result of parsing a document: successfully events plus per-record
errors. A document of
Nyields both lists empty. - RecordError
- One failed record from a parse: reason and the raw segment rawInput.
- RelativeTime
-
n ±N…— added to NOW. The parser guarantees the owning date_part isTodayDate(0)when the time is a RelativeTime; the AST does not re-check. - TimePart
-
The optional time component after
/. Absence means all-day. - TodayDate
-
t [±N]— today + N days. offset 0 means today. - WeekDate
-
w [±N] . WD— the weekday of the week N weeks from now (Monday start).
Enums
- DewbeadType
- What a dewbead record represents.
- ParseError
- Why a dewbead record could not be parsed.
- ReviewFlag
- Code-owned review hints attached to a ParsedEvent.
- TimeUnit
- Unit for a Delta amount.
- Weekday
- Day of week. Enum index 0..6 maps to ISO 1..7 (Mon..Sun).
Functions
-
parse(
String document) → ParseAstResult - Stage 1: parse a dewbead document into ASTs without touching NOW.
-
parseDewbead(
String document, DateTime now, {String? sourceText}) → ParseResult - Parse and resolve a dewbead document in one call.
-
resolve(
DewbeadAst ast, DateTime now, {String? sourceText}) → ParsedEvent -
Stage 2: resolve a DewbeadAst against
nowinto a ParsedEvent.
Typedefs
-
ParseAstResult
= ({List<
DewbeadAst> asts, List<RecordError> errors}) -
Result of stage-1 parse: successfully parsed
astsplus per-recorderrors, preserving partial-failure semantics across;;.