( s: RootedRuntimeState, start: ComparatorStartChar )
| 30 | import { writeUnexpectedCharacterMessage } from "./operator.ts" |
| 31 | |
| 32 | export const parseBound = ( |
| 33 | s: RootedRuntimeState, |
| 34 | start: ComparatorStartChar |
| 35 | ): void => { |
| 36 | const comparator = shiftComparator(s, start) |
| 37 | if (s.root.is("unit")) { |
| 38 | if (typeof s.root.unit === "number" && Number.isFinite(s.root.unit)) { |
| 39 | s.reduceLeftBound(s.root.unit, comparator) |
| 40 | s.unsetRoot() |
| 41 | return |
| 42 | } |
| 43 | if (s.root.unit instanceof Date) { |
| 44 | const literal = |
| 45 | `d'${s.root.meta.description ?? s.root.unit.toISOString()}'` as const |
| 46 | s.unsetRoot() |
| 47 | s.reduceLeftBound(literal, comparator) |
| 48 | return |
| 49 | } |
| 50 | } |
| 51 | return parseRightBound(s, comparator) |
| 52 | } |
| 53 | |
| 54 | export type parseBound< |
| 55 | s extends StaticState, |
no test coverage detected