@domorium/validator 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,5 +26,5 @@ export interface ConfigurableLexerOptions extends ILexerConfig {
26
26
  export declare class ConfigurableLexer extends Lexer {
27
27
  private readonly zeroBased;
28
28
  constructor(config?: ConfigurableLexerOptions);
29
- tokenize(text: string, initialMode?: string): ILexingResult;
29
+ tokenize(text: string): ILexingResult;
30
30
  }
@@ -6,7 +6,10 @@ export interface GedcomDate {
6
6
  month?: string;
7
7
  /** Counted in `calendar` and `epoch`: a Hebrew year is not a Gregorian one. */
8
8
  year: number;
9
- /** The year after `year`, where 5.5.1 writes both as `1750/51`. */
9
+ /**
10
+ * The year after `year`, where 5.5.1 writes both as `1750/51`. Never before
11
+ * the common era: the Old Style / New Style overlap it records is after it.
12
+ */
10
13
  dualYear?: number;
11
14
  /** `BCE` however 5.5.1 spells it, or an extension tag. */
12
15
  epoch?: string;
@@ -34,6 +34,11 @@ export declare enum GedcomErrorCode {
34
34
  ImpossibleDay = "VAL014",
35
35
  /** A header naming HEAD.SYST before HEAD.GEDC: the file is PAF. */
36
36
  PersonalAncestralFile = "VAL015",
37
+ /**
38
+ * A Gregorian or Julian date naming year 0. The rule is GEDCOM 7's; 5.5.1 is
39
+ * silent and held to it, as its calendars are the same ones.
40
+ */
41
+ ImpossibleYear = "VAL016",
37
42
  /** A pointer whose xref names no record of the required type. */
38
43
  UnresolvedXref = "unresolved-xref",
39
44
  /** A line whose level cannot follow the line above it. */
@@ -7,9 +7,17 @@
7
7
  * states: how long a month is, and which years February gets a 29th in.
8
8
  * GREGORIAN and JULIAN share the twelve month tags and their lengths and differ
9
9
  * only in that rule, which is why one table serves both.
10
+ *
11
+ * The year neither calendar numbers, 0, is judged on what a grammar read
12
+ * instead, as only the grammar knows which token is the year.
10
13
  */
11
14
  import { GedcomScheme } from "../schemes/schema-types";
15
+ import type { GedcomDate } from "../types/date";
12
16
  export declare const LENGTHS: Record<string, number>;
17
+ export interface ImpossibleYear {
18
+ year: number;
19
+ calendar: string;
20
+ }
13
21
  export interface ImpossibleDay {
14
22
  day: number;
15
23
  month: string;
@@ -19,3 +27,8 @@ export interface ImpossibleDay {
19
27
  export declare function isLeapYear(year: number, calendar: string): boolean;
20
28
  export declare function daysInMonth(month: string, year: number | null, calendar: string): number | null;
21
29
  export declare function impossibleDays(scheme: GedcomScheme, value: string): ImpossibleDay[];
30
+ /**
31
+ * Judged on what a grammar read rather than on tokens: only the grammar knows
32
+ * that `0BC` is a year and an epoch, or that `_CAL 0` is not Gregorian.
33
+ */
34
+ export declare function impossibleYears(dates: GedcomDate[]): ImpossibleYear[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domorium/validator",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "GEDCOM 5.5.1 and 7.0 parser and validator",
5
5
  "keywords": [
6
6
  "gedcom",