pub struct Chrono {
pub parsers: Vec<NamedParser>,
pub refiners: Vec<NamedRefiner>,
pub missing: Vec<&'static str>,
}Expand description
upstream Chrono: an ordered list of parsers and refiners.
Fields§
§parsers: Vec<NamedParser>§refiners: Vec<NamedRefiner>§missing: Vec<&'static str>Slots in the configuration whose step isn’t ported yet. They are skipped.
Implementations§
Source§impl Chrono
impl Chrono
Sourcepub fn parse(
&self,
text: &str,
reference: &ReferenceInput,
option: &ParsingOption,
) -> Vec<ParsingResult>
pub fn parse( &self, text: &str, reference: &ReferenceInput, option: &ParsingOption, ) -> Vec<ParsingResult>
parse(text, ref, option), with “now” taken from the system clock.
Sourcepub fn parse_with_now(
&self,
text: &str,
reference: &ReferenceInput,
option: &ParsingOption,
now: JsDate,
) -> Vec<ParsingResult>
pub fn parse_with_now( &self, text: &str, reference: &ReferenceInput, option: &ParsingOption, now: JsDate, ) -> Vec<ParsingResult>
parse with an explicit “now” (used when the reference is Now), for reproducible runs.
Sourcepub fn trace_with_now(
&self,
text: &str,
reference: &ReferenceInput,
option: &ParsingOption,
now: JsDate,
) -> (Vec<StepTrace>, Vec<StepTrace>)
pub fn trace_with_now( &self, text: &str, reference: &ReferenceInput, option: &ParsingOption, now: JsDate, ) -> (Vec<StepTrace>, Vec<StepTrace>)
parse_with_now, also returning each step’s output (the harness’s per-step comparison with
chrono-node, harness/golden/frontier.js): every parser’s own results, then the results
after each refiner. Same order and semantics as parse_with_now.
Sourcepub fn refine_isolated(
&self,
context: &ParsingContext,
step: &str,
occurrence: usize,
input: Vec<ParsingResult>,
) -> Option<Vec<ParsingResult>>
pub fn refine_isolated( &self, context: &ParsingContext, step: &str, occurrence: usize, input: Vec<ParsingResult>, ) -> Option<Vec<ParsingResult>>
The occurrence-th refiner named step (0-based) run alone on input, or None if it isn’t
ported. The harness feeds it chrono-node’s input for that slot, so each refiner is checked on
every case even while an earlier step is unported (harness/golden/frontier.js).
Sourcepub fn parse_date(
&self,
text: &str,
reference: &ReferenceInput,
option: &ParsingOption,
) -> Option<JsDate>
pub fn parse_date( &self, text: &str, reference: &ReferenceInput, option: &ParsingOption, ) -> Option<JsDate>
parseDate(text, ref, option).
Sourcepub fn registered(&self) -> BTreeSet<&'static str>
pub fn registered(&self) -> BTreeSet<&'static str>
Upstream class names of the parsers and refiners actually present.