#include "multilex.h"
#include "encoding.h"
#include "interface.h"
+#include "date.h"
int count_level = 0;
int fail = 0;
int gedcom_high_level_debug = 0;
int compatibility = 0;
Gedcom_err_mech error_mechanism = IMMED_FAIL;
+Gedcom_val_struct val;
char line_item_buf[MAXGEDCLINELEN * UTF_FACTOR + 1];
char *line_item_buf_ptr;
head_sour_sect : OPEN DELIM TAG_SOUR mand_line_item
{ set_compatibility($4);
$<ctxt>$ = start_element(ELT_HEAD_SOUR, PARENT,
- $1, $3, $4, $4);
+ $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(SOUR, $<ctxt>$)
}
head_sour_subs
head_sour_vers_sect : OPEN DELIM TAG_VERS mand_line_item
{ $<ctxt>$ = start_element(ELT_HEAD_SOUR_VERS, PARENT,
- $1, $3, $4, $4);
+ $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(VERS, $<ctxt>$)
}
no_std_subs
;
head_sour_name_sect : OPEN DELIM TAG_NAME mand_line_item
{ $<ctxt>$ = start_element(ELT_HEAD_SOUR_NAME, PARENT,
- $1, $3, $4, $4);
+ $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(NAME, $<ctxt>$)
}
no_std_subs
;
head_sour_corp_sect : OPEN DELIM TAG_CORP mand_line_item
{ $<ctxt>$ = start_element(ELT_HEAD_SOUR_CORP, PARENT,
- $1, $3, $4, $4);
+ $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(CORP, $<ctxt>$)
}
head_sour_corp_subs
head_sour_data_sect : OPEN DELIM TAG_DATA mand_line_item
{ $<ctxt>$ = start_element(ELT_HEAD_SOUR_DATA, PARENT,
- $1, $3, $4, $4);
+ $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(DATA, $<ctxt>$)
}
head_sour_data_subs
;
head_sour_data_date_sect : OPEN DELIM TAG_DATE mand_line_item
- { $<ctxt>$ = start_element(ELT_HEAD_SOUR_DATA_DATE,
- PARENT, $1, $3, $4, $4);
+ { struct date_value dv = gedcom_parse_date($4);
+ $<ctxt>$ = start_element(ELT_HEAD_SOUR_DATA_DATE,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_DATE(dv));
START(DATE, $<ctxt>$)
}
no_std_subs
;
head_sour_data_copr_sect : OPEN DELIM TAG_COPR mand_line_item
{ $<ctxt>$ = start_element(ELT_HEAD_SOUR_DATA_COPR,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(COPR, $<ctxt>$)
}
no_std_subs
/* HEAD.DEST */
head_dest_sect : OPEN DELIM TAG_DEST mand_line_item
{ $<ctxt>$ = start_element(ELT_HEAD_DEST,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(DEST, $<ctxt>$)
}
no_std_subs
/* HEAD.DATE */
head_date_sect : OPEN DELIM TAG_DATE mand_line_item
- { $<ctxt>$ = start_element(ELT_HEAD_DATE,
- PARENT, $1, $3, $4, $4);
+ { struct date_value dv = gedcom_parse_date($4);
+ $<ctxt>$ = start_element(ELT_HEAD_DATE,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_DATE(dv));
START(DATE, $<ctxt>$)
}
head_date_subs
head_date_time_sect : OPEN DELIM TAG_TIME mand_line_item
{ $<ctxt>$ = start_element(ELT_HEAD_DATE_TIME,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(TIME, $<ctxt>$)
}
no_std_subs
/* HEAD.SUBM */
head_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
{ $<ctxt>$ = start_element(ELT_HEAD_SUBM,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(SUBM, $<ctxt>$)
}
no_std_subs
/* HEAD.SUBN */
head_subn_sect : OPEN DELIM TAG_SUBN mand_pointer
{ $<ctxt>$ = start_element(ELT_HEAD_SUBN,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(SUBN, $<ctxt>$)
}
no_std_subs
/* HEAD.FILE */
head_file_sect : OPEN DELIM TAG_FILE mand_line_item
{ $<ctxt>$ = start_element(ELT_HEAD_FILE,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(FILE, $<ctxt>$)
}
no_std_subs
/* HEAD.COPR */
head_copr_sect : OPEN DELIM TAG_COPR mand_line_item
{ $<ctxt>$ = start_element(ELT_HEAD_COPR,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(COPR, $<ctxt>$)
}
no_std_subs
;
head_gedc_vers_sect : OPEN DELIM TAG_VERS mand_line_item
{ $<ctxt>$ = start_element(ELT_HEAD_GEDC_VERS,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(VERS, $<ctxt>$)
}
no_std_subs
;
head_gedc_form_sect : OPEN DELIM TAG_FORM mand_line_item
{ $<ctxt>$ = start_element(ELT_HEAD_GEDC_FORM,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(FORM, $<ctxt>$)
}
no_std_subs
head_char_sect : OPEN DELIM TAG_CHAR mand_line_item
{ if (open_conv_to_internal($4) == 0) YYERROR;
$<ctxt>$ = start_element(ELT_HEAD_CHAR,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(CHAR, $<ctxt>$)
}
head_char_subs
;
head_char_vers_sect : OPEN DELIM TAG_VERS mand_line_item
{ $<ctxt>$ = start_element(ELT_HEAD_CHAR_VERS,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(VERS, $<ctxt>$)
}
no_std_subs
/* HEAD.LANG */
head_lang_sect : OPEN DELIM TAG_LANG mand_line_item
{ $<ctxt>$ = start_element(ELT_HEAD_LANG,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(LANG, $<ctxt>$)
}
no_std_subs
;
head_plac_form_sect : OPEN DELIM TAG_FORM mand_line_item
{ $<ctxt>$ = start_element(ELT_HEAD_PLAC_FORM,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(FORM, $<ctxt>$)
}
no_std_subs
/* HEAD.NOTE */
head_note_sect : OPEN DELIM TAG_NOTE mand_line_item
{ $<ctxt>$ = start_element(ELT_HEAD_NOTE,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(NOTE, $<ctxt>$)
}
head_note_subs
/* FAM.HUSB */
fam_husb_sect : OPEN DELIM TAG_HUSB mand_pointer
{ $<ctxt>$ = start_element(ELT_FAM_HUSB,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(HUSB, $<ctxt>$)
}
no_std_subs
/* FAM.WIFE */
fam_wife_sect : OPEN DELIM TAG_WIFE mand_pointer
{ $<ctxt>$ = start_element(ELT_FAM_WIFE,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(WIFE, $<ctxt>$)
}
no_std_subs
/* FAM.CHIL */
fam_chil_sect : OPEN DELIM TAG_CHIL mand_pointer
{ $<ctxt>$ = start_element(ELT_FAM_CHIL,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(CHIL, $<ctxt>$)
}
no_std_subs
/* FAM.NCHI */
fam_nchi_sect : OPEN DELIM TAG_NCHI mand_line_item
{ $<ctxt>$ = start_element(ELT_FAM_NCHI,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(NCHI, $<ctxt>$)
}
no_std_subs
/* FAM.SUBM */
fam_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
{ $<ctxt>$ = start_element(ELT_FAM_SUBM,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(SUBM, $<ctxt>$)
}
no_std_subs
/* INDI.RESN */
indi_resn_sect : OPEN DELIM TAG_RESN mand_line_item
{ $<ctxt>$ = start_element(ELT_INDI_RESN,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(RESN, $<ctxt>$)
}
no_std_subs
/* INDI.SEX */
indi_sex_sect : OPEN DELIM TAG_SEX mand_line_item
{ $<ctxt>$ = start_element(ELT_INDI_SEX,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(SEX, $<ctxt>$)
}
no_std_subs
/* INDI.SUBM */
indi_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
{ $<ctxt>$ = start_element(ELT_INDI_SUBM,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(SUBM, $<ctxt>$)
}
no_std_subs
/* INDI.ALIA */
indi_alia_sect : OPEN DELIM TAG_ALIA mand_pointer
{ $<ctxt>$ = start_element(ELT_INDI_ALIA,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(ALIA, $<ctxt>$)
}
no_std_subs
/* INDI.ANCI */
indi_anci_sect : OPEN DELIM TAG_ANCI mand_pointer
{ $<ctxt>$ = start_element(ELT_INDI_ANCI,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(ANCI, $<ctxt>$)
}
no_std_subs
/* INDI.DESI */
indi_desi_sect : OPEN DELIM TAG_DESI mand_pointer
{ $<ctxt>$ = start_element(ELT_INDI_DESI,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(DESI, $<ctxt>$)
}
no_std_subs
/* INDI.RFN */
indi_rfn_sect : OPEN DELIM TAG_RFN mand_line_item
{ $<ctxt>$ = start_element(ELT_INDI_RFN,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(RFN, $<ctxt>$)
}
no_std_subs
/* INDI.AFN */
indi_afn_sect : OPEN DELIM TAG_AFN mand_line_item
{ $<ctxt>$ = start_element(ELT_INDI_AFN,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(AFN, $<ctxt>$)
}
no_std_subs
/* OBJE.FORM */
obje_form_sect : OPEN DELIM TAG_FORM mand_line_item
{ $<ctxt>$ = start_element(ELT_OBJE_FORM,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(FORM, $<ctxt>$)
}
no_std_subs
/* OBJE.TITL */
obje_titl_sect : OPEN DELIM TAG_TITL mand_line_item
{ $<ctxt>$ = start_element(ELT_OBJE_TITL,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(TITL, $<ctxt>$)
}
no_std_subs
obje_blob_cont_sect : OPEN DELIM TAG_CONT mand_line_item
{ $<ctxt>$ = start_element(ELT_OBJE_BLOB_CONT,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(CONT, $<ctxt>$)
}
no_std_subs
/* OBJE.OBJE */
obje_obje_sect : OPEN DELIM TAG_OBJE mand_pointer
{ $<ctxt>$ = start_element(ELT_OBJE_OBJE,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(OBJE, $<ctxt>$)
}
no_std_subs
/* REPO.NAME */
repo_name_sect : OPEN DELIM TAG_NAME mand_line_item
{ $<ctxt>$ = start_element(ELT_REPO_NAME,
- PARENT, $1, $3, $4, $4);
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
START(NAME, $<ctxt>$)
}
no_std_subs
/* SOUR.DATA */
sour_data_sect : OPEN DELIM TAG_DATA
- { START(DATA, NULL) }
+ { $<ctxt>$ = start_element(ELT_SOUR_DATA,
+ PARENT, $1, $3, NULL, NULL);
+ START(DATA, $<ctxt>$)
+ }
sour_data_subs
{ CHECK0 }
- CLOSE { }
+ CLOSE
+ { end_element(ELT_SOUR_DATA, PARENT, $<ctxt>4, NULL);
+ }
;
sour_data_subs : /* empty */
;
sour_data_even_sect : OPEN DELIM TAG_EVEN mand_line_item
- { START(EVEN, NULL) }
+ { $<ctxt>$ = start_element(ELT_SOUR_DATA_EVEN,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(EVEN, $<ctxt>$)
+ }
sour_data_even_subs
{ CHECK0 }
- CLOSE { }
+ CLOSE
+ { end_element(ELT_SOUR_DATA_EVEN, PARENT,
+ $<ctxt>5, NULL);
+ }
;
sour_data_even_subs : /* empty */
;
sour_data_even_date_sect : OPEN DELIM TAG_DATE mand_line_item
- { START(DATE, NULL) } no_std_subs { CHECK0 } CLOSE { }
+ { struct date_value dv = gedcom_parse_date($4);
+ $<ctxt>$ = start_element(ELT_SOUR_DATA_EVEN_DATE,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_DATE(dv));
+ START(DATE, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_SOUR_DATA_EVEN_DATE, PARENT,
+ $<ctxt>5, NULL);
+ }
;
sour_data_even_plac_sect : OPEN DELIM TAG_PLAC mand_line_item
- { START(PLAC, NULL) } no_std_subs { CHECK0 } CLOSE { }
+ { $<ctxt>$ = start_element(ELT_SOUR_DATA_EVEN_PLAC,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(PLAC, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_SOUR_DATA_EVEN_PLAC, PARENT,
+ $<ctxt>5, NULL);
+ }
;
sour_data_agnc_sect : OPEN DELIM TAG_AGNC mand_line_item
- { START(AGNC, NULL) } no_std_subs { CHECK0 } CLOSE { }
+ { $<ctxt>$ = start_element(ELT_SOUR_DATA_AGNC,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(AGNC, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_SOUR_DATA_AGNC, PARENT,
+ $<ctxt>5, NULL);
+ }
;
/* SOUR.AUTH */
sour_auth_sect : OPEN DELIM TAG_AUTH mand_line_item
- { START(AUTH, NULL) }
+ { $<ctxt>$ = start_element(ELT_SOUR_AUTH,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(AUTH, $<ctxt>$)
+ }
sour_auth_subs
{ CHECK0 }
- CLOSE { }
+ CLOSE
+ { end_element(ELT_SOUR_AUTH, PARENT, $<ctxt>5, NULL);
+ }
;
sour_auth_subs : /* empty */
/* SOUR.TITL */
sour_titl_sect : OPEN DELIM TAG_TITL mand_line_item
- { START(TITL, NULL) }
+ { $<ctxt>$ = start_element(ELT_SOUR_TITL,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(TITL, $<ctxt>$)
+ }
sour_titl_subs
{ CHECK0 }
- CLOSE { }
+ CLOSE
+ { end_element(ELT_SOUR_TITL, PARENT, $<ctxt>5, NULL);
+ }
;
sour_titl_subs : /* empty */
/* SOUR.ABBR */
sour_abbr_sect : OPEN DELIM TAG_ABBR mand_line_item
- { START(ABBR, NULL) } no_std_subs { CHECK0 } CLOSE { }
+ { $<ctxt>$ = start_element(ELT_SOUR_ABBR,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(ABBR, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_SOUR_ABBR, PARENT, $<ctxt>5, NULL);
+ }
;
/* SOUR.PUBL */
sour_publ_sect : OPEN DELIM TAG_PUBL mand_line_item
- { START(PUBL, NULL) }
+ { $<ctxt>$ = start_element(ELT_SOUR_PUBL,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(PUBL, $<ctxt>$)
+ }
sour_publ_subs
{ CHECK0 }
- CLOSE { }
+ CLOSE
+ { end_element(ELT_SOUR_PUBL, PARENT, $<ctxt>5, NULL);
+ }
;
sour_publ_subs : /* empty */
/* SOUR.TEXT */
sour_text_sect : OPEN DELIM TAG_TEXT mand_line_item
- { START(TEXT, NULL) }
+ { $<ctxt>$ = start_element(ELT_SOUR_TEXT,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(TEXT, $<ctxt>$)
+ }
sour_text_subs
{ CHECK0 }
- CLOSE { }
+ CLOSE
+ { end_element(ELT_SOUR_TEXT, PARENT, $<ctxt>5, NULL);
+ }
;
sour_text_subs : /* empty */
/* SUBN.SUBM */
subn_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
- { START(SUBM, NULL) } no_std_subs { CHECK0 } CLOSE { }
+ { $<ctxt>$ = start_element(ELT_SUBN_SUBM,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(SUBM, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_SUBN_SUBM, PARENT, $<ctxt>5, NULL);
+ }
;
/* SUBN.FAMF */
subn_famf_sect : OPEN DELIM TAG_FAMF mand_line_item
- { START(FAMF, NULL) } no_std_subs { CHECK0 } CLOSE { }
+ { $<ctxt>$ = start_element(ELT_SUBN_FAMF,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(FAMF, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_SUBN_FAMF, PARENT, $<ctxt>5, NULL);
+ }
;
/* SUBN.TEMP */
subn_temp_sect : OPEN DELIM TAG_TEMP mand_line_item
- { START(TEMP, NULL) } no_std_subs { CHECK0 } CLOSE { }
+ { $<ctxt>$ = start_element(ELT_SUBN_TEMP,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(TEMP, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_SUBN_TEMP, PARENT, $<ctxt>5, NULL);
+ }
;
/* SUBN.ANCE */
subn_ance_sect : OPEN DELIM TAG_ANCE mand_line_item
- { START(ANCE, NULL) } no_std_subs { CHECK0 } CLOSE { }
+ { $<ctxt>$ = start_element(ELT_SUBN_ANCE,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(ANCE, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_SUBN_ANCE, PARENT, $<ctxt>5, NULL);
+ }
;
/* SUBN.DESC */
subn_desc_sect : OPEN DELIM TAG_DESC mand_line_item
- { START(DESC, NULL) } no_std_subs { CHECK0 } CLOSE { }
+ { $<ctxt>$ = start_element(ELT_SUBN_DESC,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(DESC, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_SUBN_DESC, PARENT, $<ctxt>5, NULL);
+ }
;
/* SUBN.ORDI */
subn_ordi_sect : OPEN DELIM TAG_ORDI mand_line_item
- { START(ORDI, NULL) } no_std_subs { CHECK0 } CLOSE { }
+ { $<ctxt>$ = start_element(ELT_SUBN_ORDI,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(ORDI, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_SUBN_ORDI, PARENT, $<ctxt>5, NULL);
+ }
;
/* SUBN.RIN */
subn_rin_sect : OPEN DELIM TAG_RIN mand_line_item
- { START(RIN, NULL) } no_std_subs { CHECK0 } CLOSE { }
+ { $<ctxt>$ = start_element(ELT_SUBN_RIN,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(RIN, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_SUBN_RIN, PARENT, $<ctxt>5, NULL);
+ }
;
/*********************************************************************/
/* SUBM.NAME */
subm_name_sect : OPEN DELIM TAG_NAME mand_line_item
- { START(NAME, NULL) } no_std_subs { CHECK0 } CLOSE { }
+ { $<ctxt>$ = start_element(ELT_SUBM_NAME,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(NAME, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_SUBM_NAME, PARENT, $<ctxt>5, NULL);
+ }
;
/* SUBM.LANG */
subm_lang_sect : OPEN DELIM TAG_LANG mand_line_item
- { START(LANG, NULL) } no_std_subs { CHECK0 } CLOSE { }
+ { $<ctxt>$ = start_element(ELT_SUBM_LANG,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(LANG, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_SUBM_LANG, PARENT, $<ctxt>5, NULL);
+ }
;
/* SUBM.RFN */
subm_rfn_sect : OPEN DELIM TAG_RFN mand_line_item
- { START(RFN, NULL) } no_std_subs { CHECK0 } CLOSE { }
+ { $<ctxt>$ = start_element(ELT_SUBM_RFN,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(RFN, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_SUBM_RFN, PARENT, $<ctxt>5, NULL);
+ }
;
/* SUBM.RIN */
subm_rin_sect : OPEN DELIM TAG_RIN mand_line_item
- { START(RIN, NULL) } no_std_subs { CHECK0 } CLOSE { }
+ { $<ctxt>$ = start_element(ELT_SUBM_RIN,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(RIN, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_SUBM_RIN, PARENT, $<ctxt>5, NULL);
+ }
;
/*********************************************************************/
;
addr_sect : OPEN DELIM TAG_ADDR mand_line_item
- { START(ADDR, NULL) }
+ { $<ctxt>$ = start_element(ELT_SUB_ADDR,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(ADDR, $<ctxt>$)
+ }
addr_subs
{ CHECK0 }
- CLOSE { }
+ CLOSE
+ { end_element(ELT_SUB_ADDR, PARENT, $<ctxt>5, NULL);
+ }
;
addr_subs : /* empty */
;
addr_cont_sect : OPEN DELIM TAG_CONT mand_line_item
- { START(CONT, NULL) } no_std_subs { CHECK0 } CLOSE { }
+ { $<ctxt>$ = start_element(ELT_SUB_ADDR_CONT,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(CONT, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_SUB_ADDR_CONT, PARENT, $<ctxt>5, NULL);
+ }
;
addr_adr1_sect : OPEN DELIM TAG_ADR1 mand_line_item
- { START(ADR1, NULL) } no_std_subs { CHECK0 } CLOSE { }
+ { $<ctxt>$ = start_element(ELT_SUB_ADDR_ADR1,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(ADR1, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_SUB_ADDR_ADR1, PARENT, $<ctxt>5, NULL);
+ }
;
addr_adr2_sect : OPEN DELIM TAG_ADR2 mand_line_item
- { START(ADR2, NULL) } no_std_subs { CHECK0 } CLOSE { }
+ { $<ctxt>$ = start_element(ELT_SUB_ADDR_ADR2,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(ADR2, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_SUB_ADDR_ADR2, PARENT, $<ctxt>5, NULL);
+ }
;
addr_city_sect : OPEN DELIM TAG_CITY mand_line_item
- { START(CITY, NULL) } no_std_subs { CHECK0 } CLOSE { }
+ { $<ctxt>$ = start_element(ELT_SUB_ADDR_CITY,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(CITY, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_SUB_ADDR_CITY, PARENT, $<ctxt>5, NULL);
+ }
;
addr_stae_sect : OPEN DELIM TAG_STAE mand_line_item
- { START(STAE, NULL) } no_std_subs { CHECK0 } CLOSE { }
+ { $<ctxt>$ = start_element(ELT_SUB_ADDR_STAE,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(STAE, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_SUB_ADDR_STAE, PARENT, $<ctxt>5, NULL);
+ }
;
addr_post_sect : OPEN DELIM TAG_POST mand_line_item
- { START(POST, NULL) } no_std_subs { CHECK0 } CLOSE { }
+ { $<ctxt>$ = start_element(ELT_SUB_ADDR_POST,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(POST, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_SUB_ADDR_POST, PARENT, $<ctxt>5, NULL);
+ }
;
addr_ctry_sect : OPEN DELIM TAG_CTRY mand_line_item
- { START(CTRY, NULL) } no_std_subs { CHECK0 } CLOSE { }
+ { $<ctxt>$ = start_element(ELT_SUB_ADDR_CTRY,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(CTRY, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_SUB_ADDR_CTRY, PARENT, $<ctxt>5, NULL);
+ }
;
phon_sect : OPEN DELIM TAG_PHON mand_line_item
- { START(PHON, NULL) } no_std_subs { CHECK0 } CLOSE { }
+ { $<ctxt>$ = start_element(ELT_SUB_PHON,
+ PARENT, $1, $3, $4,
+ GEDCOM_MAKE_STRING($4));
+ START(PHON, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_SUB_PHON, PARENT, $<ctxt>5, NULL);
+ }
;
/* ASSOCIATION STRUCTURE */
}
}
opt_value
- { $<ctxt>$ = start_element(ELT_USER, PARENT, $1, $4, $6, $6);
+ { $<ctxt>$ = start_element(ELT_USER, PARENT, $1, $4, $6,
+ GEDCOM_MAKE_STRING($6));
START($4, $<ctxt>$);
}
user_sects
--- /dev/null
+/* Lexer for Gedcom dates
+ Copyright (C) 2001 The Genes Development Team
+ This file is part of the Gedcom parser library.
+ Contributed by Peter Verthez <Peter.Verthez@advalvas.be>, 2001.
+
+ The Gedcom parser library is free software; you can redistribute it
+ and/or modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The Gedcom parser library is distributed in the hope that it will be
+ useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the Gedcom parser library; if not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* $Id$ */
+/* $Name$ */
+
+%{
+#include "date.h"
+#include "gedcom_date.tab.h"
+
+#define YY_NO_UNPUT
+
+static char buf[MAX_DATE_TOKEN][MAX_PHRASE_LEN+1];
+static int token_nr = 0;
+%}
+
+%option case-insensitive
+%s PHRASE
+
+%%
+
+%{
+
+#define SIMPLE_RETURN(TOKEN) \
+ { if (token_nr >= MAX_DATE_TOKEN) { \
+ gedcom_date_error(_("Date token stack overflow")); \
+ return BADTOKEN; \
+ } \
+ memset(buf[token_nr], 0, MAX_PHRASE_LEN+1); \
+ strncpy(buf[token_nr], yytext, yyleng); \
+ gedcom_date_lval.string = buf[token_nr++]; \
+ return TOKEN; \
+ }
+%}
+
+[ \t]+ /* ignore whitespace between tokens */
+
+@#DGREGORIAN@ SIMPLE_RETURN(ESC_DATE_GREG)
+@#DJULIAN@ SIMPLE_RETURN(ESC_DATE_JULN)
+@#DHEBREW@ SIMPLE_RETURN(ESC_DATE_HEBR)
+"@#DFRENCH R@" SIMPLE_RETURN(ESC_DATE_FREN)
+
+FROM SIMPLE_RETURN(MOD_FROM)
+TO SIMPLE_RETURN(MOD_TO)
+BEF SIMPLE_RETURN(MOD_BEF)
+AFT SIMPLE_RETURN(MOD_AFT)
+BET SIMPLE_RETURN(MOD_BET)
+AND SIMPLE_RETURN(MOD_AND)
+ABT SIMPLE_RETURN(MOD_ABT)
+CAL SIMPLE_RETURN(MOD_CAL)
+EST SIMPLE_RETURN(MOD_EST)
+INT SIMPLE_RETURN(MOD_INT)
+
+JAN SIMPLE_RETURN(MON_JAN)
+FEB SIMPLE_RETURN(MON_FEB)
+MAR SIMPLE_RETURN(MON_MAR)
+APR SIMPLE_RETURN(MON_APR)
+MAY SIMPLE_RETURN(MON_MAY)
+JUN SIMPLE_RETURN(MON_JUN)
+JUL SIMPLE_RETURN(MON_JUL)
+AUG SIMPLE_RETURN(MON_AUG)
+SEP SIMPLE_RETURN(MON_SEP)
+OCT SIMPLE_RETURN(MON_OCT)
+NOV SIMPLE_RETURN(MON_NOV)
+DEC SIMPLE_RETURN(MON_DEC)
+TSH SIMPLE_RETURN(MON_TSH)
+CSH SIMPLE_RETURN(MON_CSH)
+KSL SIMPLE_RETURN(MON_KSL)
+TVT SIMPLE_RETURN(MON_TVT)
+SHV SIMPLE_RETURN(MON_SHV)
+ADR SIMPLE_RETURN(MON_ADR)
+ADS SIMPLE_RETURN(MON_ADS)
+NSN SIMPLE_RETURN(MON_NSN)
+IYR SIMPLE_RETURN(MON_IYR)
+SVN SIMPLE_RETURN(MON_SVN)
+TMZ SIMPLE_RETURN(MON_TMZ)
+AAV SIMPLE_RETURN(MON_AAV)
+ELL SIMPLE_RETURN(MON_ELL)
+VEND SIMPLE_RETURN(MON_VEND)
+BRUM SIMPLE_RETURN(MON_BRUM)
+FRIM SIMPLE_RETURN(MON_FRIM)
+NIVO SIMPLE_RETURN(MON_NIVO)
+PLUV SIMPLE_RETURN(MON_PLUV)
+VENT SIMPLE_RETURN(MON_VENT)
+GERM SIMPLE_RETURN(MON_GERM)
+FLOR SIMPLE_RETURN(MON_FLOR)
+PRAI SIMPLE_RETURN(MON_PRAI)
+MESS SIMPLE_RETURN(MON_MESS)
+THER SIMPLE_RETURN(MON_THER)
+FRUC SIMPLE_RETURN(MON_FRUC)
+COMP SIMPLE_RETURN(MON_COMP)
+
+"(" { BEGIN(PHRASE);
+ SIMPLE_RETURN(OPEN);
+ }
+<PHRASE>[^\)]* SIMPLE_RETURN(TEXT);
+<PHRASE>")" { BEGIN(INITIAL);
+ SIMPLE_RETURN(CLOSE);
+ }
+
+"/" SIMPLE_RETURN(SLASH)
+[0-9]+ SIMPLE_RETURN(NUMBER)
+
+%%
+
+int yywrap()
+{
+ return 1;
+}
+
+static YY_BUFFER_STATE hndl;
+
+void init_gedcom_date_lex(char* string)
+{
+ token_nr = 0;
+ hndl = yy_scan_string(string);
+}
+
+void close_gedcom_date_lex()
+{
+ yy_delete_buffer(hndl);
+}
--- /dev/null
+/* Parser for Gedcom dates.
+ Copyright (C) 2001 The Genes Development Team
+ This file is part of the Gedcom parser library.
+ Contributed by Peter Verthez <Peter.Verthez@advalvas.be>, 2001.
+
+ The Gedcom parser library is free software; you can redistribute it
+ and/or modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The Gedcom parser library is distributed in the hope that it will be
+ useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the Gedcom parser library; if not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* $Id$ */
+/* $Name$ */
+
+%{
+#include <stdlib.h>
+#include "date.h"
+%}
+
+%union {
+ char *string;
+ struct date_value date_val;
+ struct date date;
+}
+
+%token <string> ESC_DATE_GREG
+%token <string> ESC_DATE_JULN
+%token <string> ESC_DATE_HEBR
+%token <string> ESC_DATE_FREN
+%token <string> MOD_FROM
+%token <string> MOD_TO
+%token <string> MOD_BEF
+%token <string> MOD_AFT
+%token <string> MOD_BET
+%token <string> MOD_AND
+%token <string> MOD_ABT
+%token <string> MOD_CAL
+%token <string> MOD_EST
+%token <string> MOD_INT
+%token <string> MON_JAN
+%token <string> MON_FEB
+%token <string> MON_MAR
+%token <string> MON_APR
+%token <string> MON_MAY
+%token <string> MON_JUN
+%token <string> MON_JUL
+%token <string> MON_AUG
+%token <string> MON_SEP
+%token <string> MON_OCT
+%token <string> MON_NOV
+%token <string> MON_DEC
+%token <string> MON_TSH
+%token <string> MON_CSH
+%token <string> MON_KSL
+%token <string> MON_TVT
+%token <string> MON_SHV
+%token <string> MON_ADR
+%token <string> MON_ADS
+%token <string> MON_NSN
+%token <string> MON_IYR
+%token <string> MON_SVN
+%token <string> MON_TMZ
+%token <string> MON_AAV
+%token <string> MON_ELL
+%token <string> MON_VEND
+%token <string> MON_BRUM
+%token <string> MON_FRIM
+%token <string> MON_NIVO
+%token <string> MON_PLUV
+%token <string> MON_VENT
+%token <string> MON_GERM
+%token <string> MON_FLOR
+%token <string> MON_PRAI
+%token <string> MON_MESS
+%token <string> MON_THER
+%token <string> MON_FRUC
+%token <string> MON_COMP
+%token <string> OPEN
+%token <string> CLOSE
+%token <string> TEXT
+%token <string> NUMBER
+%token <string> SLASH
+%token <string> BADTOKEN
+
+%type <date_val> date_value
+%type <date_val> date_period
+%type <date_val> date_range
+%type <date_val> date_approx
+%type <date_val> date_interpr
+%type <string> date_phrase
+%type <date> date
+
+%%
+
+date_value : date { make_date_value(DV_NO_MODIFIER,
+ $1, def_date, ""); }
+ | date_period
+ | date_range
+ | date_approx
+ | date_interpr
+ | date_phrase { make_date_value(DV_PHRASE,
+ def_date, def_date, $1); }
+ ;
+
+date : ESC_DATE_GREG date_greg { copy_date(&$$, date_s);
+ $$.cal = CAL_GREGORIAN; }
+ | ESC_DATE_JULN date_juln { copy_date(&$$, date_s);
+ $$.cal = CAL_JULIAN; }
+ | ESC_DATE_HEBR date_hebr { copy_date(&$$, date_s);
+ $$.cal = CAL_HEBREW; }
+ | ESC_DATE_FREN date_fren { copy_date(&$$, date_s);
+ $$.cal = CAL_FRENCH_REV; }
+ | date_greg { copy_date(&$$, date_s);
+ $$.cal = CAL_GREGORIAN; }
+ ;
+
+date_period : MOD_FROM date { make_date_value(DV_FROM,
+ $2, def_date, ""); }
+ | MOD_TO date { make_date_value(DV_TO,
+ $2, def_date, ""); }
+ | MOD_FROM date { copy_date(&$<date>$, $2); }
+ MOD_TO date
+ { make_date_value(DV_FROM_TO, $<date>3, $5, ""); }
+ ;
+
+date_range : MOD_BEF date { make_date_value(DV_BEFORE,
+ $2, def_date, ""); }
+ | MOD_AFT date { make_date_value(DV_AFTER,
+ $2, def_date, ""); }
+ | MOD_BET date { copy_date(&$<date>$, $2); }
+ MOD_AND date
+ { make_date_value(DV_BETWEEN, $<date>3, $5, ""); }
+ ;
+
+date_approx : MOD_ABT date { make_date_value(DV_ABOUT,
+ $2, def_date, ""); }
+ | MOD_CAL date { make_date_value(DV_CALCULATED,
+ $2, def_date, ""); }
+ | MOD_EST date { make_date_value(DV_ESTIMATED,
+ $2, def_date, ""); }
+ ;
+
+date_interpr : MOD_INT date date_phrase
+ { make_date_value(DV_INTERPRETED, $2, def_date, $3); }
+ ;
+
+date_phrase : OPEN TEXT CLOSE { $$ = $2; }
+ ;
+
+date_greg : day month_greg year_greg
+ | month_greg year_greg
+ | year_greg
+ ;
+
+date_juln : day month_greg year
+ | month_greg year
+ | year
+ ;
+
+date_hebr : day month_hebr year
+ | month_hebr year
+ | year
+ ;
+
+date_fren : day month_fren year
+ | month_fren year
+ | year
+ ;
+
+day : NUMBER
+ {
+ if (strlen($1) <= MAX_DAY_LEN) {
+ strcpy(date_s.day_str, $1);
+ date_s.day = atoi($1);
+ }
+ else {
+ gedcom_date_error(_("Too many characters in day '%s'"),
+ $1);
+ }
+ }
+ ;
+
+month_greg : MON_JAN { strcpy(date_s.month_str, $1);
+ date_s.month = 1; }
+ | MON_FEB { strcpy(date_s.month_str, $1);
+ date_s.month = 2; }
+ | MON_MAR { strcpy(date_s.month_str, $1);
+ date_s.month = 3; }
+ | MON_APR { strcpy(date_s.month_str, $1);
+ date_s.month = 4; }
+ | MON_MAY { strcpy(date_s.month_str, $1);
+ date_s.month = 5; }
+ | MON_JUN { strcpy(date_s.month_str, $1);
+ date_s.month = 6; }
+ | MON_JUL { strcpy(date_s.month_str, $1);
+ date_s.month = 7; }
+ | MON_AUG { strcpy(date_s.month_str, $1);
+ date_s.month = 8; }
+ | MON_SEP { strcpy(date_s.month_str, $1);
+ date_s.month = 9; }
+ | MON_OCT { strcpy(date_s.month_str, $1);
+ date_s.month = 10; }
+ | MON_NOV { strcpy(date_s.month_str, $1);
+ date_s.month = 11; }
+ | MON_DEC { strcpy(date_s.month_str, $1);
+ date_s.month = 12; }
+ ;
+
+month_hebr : MON_TSH { strcpy(date_s.month_str, $1);
+ date_s.month = 1; }
+ | MON_CSH { strcpy(date_s.month_str, $1);
+ date_s.month = 2; }
+ | MON_KSL { strcpy(date_s.month_str, $1);
+ date_s.month = 3; }
+ | MON_TVT { strcpy(date_s.month_str, $1);
+ date_s.month = 4; }
+ | MON_SHV { strcpy(date_s.month_str, $1);
+ date_s.month = 5; }
+ | MON_ADR { strcpy(date_s.month_str, $1);
+ date_s.month = 6; }
+ | MON_ADS { strcpy(date_s.month_str, $1);
+ date_s.month = 7; }
+ | MON_NSN { strcpy(date_s.month_str, $1);
+ date_s.month = 8; }
+ | MON_IYR { strcpy(date_s.month_str, $1);
+ date_s.month = 9; }
+ | MON_SVN { strcpy(date_s.month_str, $1);
+ date_s.month = 10; }
+ | MON_TMZ { strcpy(date_s.month_str, $1);
+ date_s.month = 11; }
+ | MON_AAV { strcpy(date_s.month_str, $1);
+ date_s.month = 12; }
+ | MON_ELL { strcpy(date_s.month_str, $1);
+ date_s.month = 13; }
+ ;
+
+month_fren : MON_VEND { strcpy(date_s.month_str, $1);
+ date_s.month = 1; }
+ | MON_BRUM { strcpy(date_s.month_str, $1);
+ date_s.month = 2; }
+ | MON_FRIM { strcpy(date_s.month_str, $1);
+ date_s.month = 3; }
+ | MON_NIVO { strcpy(date_s.month_str, $1);
+ date_s.month = 4; }
+ | MON_PLUV { strcpy(date_s.month_str, $1);
+ date_s.month = 5; }
+ | MON_VENT { strcpy(date_s.month_str, $1);
+ date_s.month = 6; }
+ | MON_GERM { strcpy(date_s.month_str, $1);
+ date_s.month = 7; }
+ | MON_FLOR { strcpy(date_s.month_str, $1);
+ date_s.month = 8; }
+ | MON_PRAI { strcpy(date_s.month_str, $1);
+ date_s.month = 9; }
+ | MON_MESS { strcpy(date_s.month_str, $1);
+ date_s.month = 10; }
+ | MON_THER { strcpy(date_s.month_str, $1);
+ date_s.month = 11; }
+ | MON_FRUC { strcpy(date_s.month_str, $1);
+ date_s.month = 12; }
+ | MON_COMP { strcpy(date_s.month_str, $1);
+ date_s.month = 13; }
+ ;
+
+year : NUMBER
+ { if (strlen($1) <= MAX_YEAR_LEN) {
+ strcpy(date_s.year_str, $1);
+ date_s.year = atoi($1);
+ date_s.year_type = YEAR_SINGLE;
+ }
+ else {
+ gedcom_date_error(_("Too many characters in year '%s'"),
+ $1);
+ }
+ }
+ ;
+
+year_greg : NUMBER
+ { if (strlen($1) <= MAX_YEAR_LEN) {
+ strcpy(date_s.year_str, $1);
+ date_s.year = atoi($1);
+ date_s.year_type = YEAR_SINGLE;
+ }
+ else {
+ gedcom_date_error(_("Too many characters in year '%s'"),
+ $1);
+ }
+ }
+ | NUMBER SLASH NUMBER
+ { if (strlen($1) + strlen($3) + 1 <= MAX_YEAR_LEN) {
+ sprintf(date_s.year_str, "%s/%s", $1, $3);
+ date_s.year = atoi($1) + 1;
+ date_s.year_type = YEAR_DOUBLE;
+ }
+ else {
+ gedcom_date_error(_("Too many characters in year '%s/%s'"),
+ $1, $3);
+ }
+
+ }
+ ;
+
+%%