import { NumberFormatSection } from './number_format_section'; import type { TextPart } from '../../treb-base-types/src/index'; export declare class FormatParser { protected static date_pattern: boolean; protected static pattern: string; protected static char_index: number; protected static characters: number[]; protected static sections: NumberFormatSection[]; protected static current_section: NumberFormatSection; protected static preserve_formatting_characters: boolean; protected static decimal_mark: number; protected static group_separator: number; /** * parser is static (essentially a singleton). state is ephemeral. * * it's a little hard to unify parsing for dates and numbers. * luckily we don't have to parse that often; only when a format * is created. so we will do some extra work here. */ static Parse(pattern: string): NumberFormatSection[]; protected static ConsumeString(): string; protected static ConsumeFormatting(): string; /** * pre-scan for fractional format, check for legal/illegal chars. * fraction format has an optional integer, spaces, then the fractional * part. * * except for the denominator, all characters are represented as # or ?, * but formats seem to be a little forgiving (not sure we have to be). * essentially, should look something like * ``` * # ##/## * ? ??/?? * #/32 * #/64 * # #/16 * ``` */ protected static ScanFractionFormat(): boolean; /** * number format proper contains only the following characters: * +-0#., * anything else will be ignored * * [UPDATE] fractional number formats can contain spaces and * the / character (in fact they would have to contain that). * */ protected static ConsumeNumberFormat(): void; protected static AppendCharAsText(advance_pointer?: boolean): void; protected static AppendString(text: string): void; protected static AppendTextPart(part: TextPart): void; protected static ConsumeChar(): void; /** * we treat it as a date pattern if there's an unquoted date/time letter * (one of [hmsdyHMSDY]). technically mixing date formats and number * formats (#0) is illegal. we will just drop into number formats for those. */ protected static ParseDatePattern(): boolean; /** * date parts are repeated sequences (e.g. ddd). we allow * fractional seconds with ss.00. */ protected static ConsumeDatePart(): TextPart; /** * special patterns for am/pm in date formats */ protected static ConsumeAMPM(): TextPart | undefined; protected static DatePatternConsumeChar(): void; }