From: Peter Verthez Date: Sun, 4 Nov 2001 13:35:58 +0000 (+0000) Subject: Compatibility mode implemented. X-Git-Url: https://git.dlugolecki.net.pl/?a=commitdiff_plain;h=cf91051d49e34888991303c62de71ab4f0bc6db1;p=gedcom-parse.git Compatibility mode implemented. --- diff --git a/gedcom.y b/gedcom.y index 54b323b..68b2f48 100644 --- a/gedcom.y +++ b/gedcom.y @@ -123,9 +123,17 @@ %{ #include "gedcom.h" -int count_level=0; -int fail=0; -MECHANISM curr_mechanism=IMMED_FAIL; +int count_level = 0; +int fail = 0; +int compat_enabled = 1; +int compatibility = 0; +MECHANISM curr_mechanism=IMMED_FAIL; +char string_buf[MAXGEDCLINELEN+1]; +char *string_buf_ptr; + +enum _COMPAT { + C_FTREE = 0x01 +}; /* These are defined at the bottom of the file */ void push_countarray(); @@ -134,6 +142,10 @@ char* get_parenttag(); void pop_countarray(); int count_tag(int tag); int check_occurrence(int tag); +void set_compatibility(char* program); +int compat_mode(int flags); + +#define CLEAR_BUFFER(BUF) { memset(BUF, 0, sizeof(BUF)); } #define HANDLE_ERROR \ { \ @@ -147,7 +159,7 @@ int check_occurrence(int tag); yyerrok; \ } \ } -#define OPEN(PARENTTAG) \ +#define START(PARENTTAG) \ { ++count_level; \ set_parenttag(#PARENTTAG); \ push_countarray(); \ @@ -202,7 +214,7 @@ int check_occurrence(int tag); } %token_table -%expect 299 +%expect 300 %token BADTOKEN %token OPEN @@ -344,6 +356,10 @@ int check_occurrence(int tag); %type anystdtag %type anytoptag +%type line_item +%type mand_line_item +%type note_line_item +%type anychar %% @@ -370,9 +386,15 @@ record : fam_rec /**** Header ****/ /*********************************************************************/ head_sect : OPEN DELIM TAG_HEAD - { OPEN(HEAD) } + { START(HEAD) } head_subs - { CHECK4(SOUR, SUBM, GEDC, CHAR) } + { if (compat_mode(C_FTREE)) { + CHECK3(SOUR, GEDC, CHAR); + } + else { + CHECK4(SOUR, SUBM, GEDC, CHAR); + } + } CLOSE { } ; @@ -397,11 +419,12 @@ head_sub : head_sour_sect { OCCUR2(SOUR, 1, 1) } /* HEAD.SOUR */ head_sour_sect : OPEN DELIM TAG_SOUR mand_line_item - { OPEN(SOUR) } + { set_compatibility($4); + START(SOUR) + } head_sour_subs { CHECK0 } CLOSE - { } ; head_sour_subs : /* empty */ @@ -416,15 +439,15 @@ head_sour_sub : head_sour_vers_sect { OCCUR2(VERS, 0, 1) } ; head_sour_vers_sect : OPEN DELIM TAG_VERS mand_line_item - { OPEN(VERS)} no_std_subs { CHECK0 } CLOSE + { START(VERS)} no_std_subs { CHECK0 } CLOSE { } ; head_sour_name_sect : OPEN DELIM TAG_NAME mand_line_item - { OPEN(NAME) } no_std_subs { CHECK0 } CLOSE + { START(NAME) } no_std_subs { CHECK0 } CLOSE { } ; head_sour_corp_sect : OPEN DELIM TAG_CORP mand_line_item - { OPEN(CORP) } + { START(CORP) } head_sour_corp_subs { CHECK0 } CLOSE @@ -440,7 +463,7 @@ head_sour_corp_sub : addr_struc_sub /* 0:1 */ ; head_sour_data_sect : OPEN DELIM TAG_DATA mand_line_item - { OPEN(DATA) } + { START(DATA) } head_sour_data_subs { CHECK0 } CLOSE @@ -457,23 +480,23 @@ head_sour_data_sub : head_sour_data_date_sect { OCCUR2(DATE, 0, 1) } ; head_sour_data_date_sect : OPEN DELIM TAG_DATE mand_line_item - { OPEN(DATE) } no_std_subs { CHECK0 } CLOSE + { START(DATE) } no_std_subs { CHECK0 } CLOSE { } ; head_sour_data_copr_sect : OPEN DELIM TAG_COPR mand_line_item - { OPEN(COPR) } no_std_subs { CHECK0 } CLOSE + { START(COPR) } no_std_subs { CHECK0 } CLOSE { } ; /* HEAD.DEST */ head_dest_sect : OPEN DELIM TAG_DEST mand_line_item - { OPEN(DEST) } no_std_subs { CHECK0 } CLOSE + { START(DEST) } no_std_subs { CHECK0 } CLOSE { } ; /* HEAD.DATE */ head_date_sect : OPEN DELIM TAG_DATE mand_line_item - { OPEN(DATE) } + { START(DATE) } head_date_subs { CHECK0 } CLOSE @@ -489,33 +512,33 @@ head_date_sub : head_date_time_sect { OCCUR2(TIME, 0, 1) } ; head_date_time_sect : OPEN DELIM TAG_TIME mand_line_item - { OPEN(TIME) } no_std_subs { CHECK0 } CLOSE + { START(TIME) } no_std_subs { CHECK0 } CLOSE { } ; /* HEAD.SUBM */ head_subm_sect : OPEN DELIM TAG_SUBM mand_pointer - { OPEN(SUBM) } no_std_subs { CHECK0 } CLOSE + { START(SUBM) } no_std_subs { CHECK0 } CLOSE { } ; /* HEAD.SUBN */ head_subn_sect : OPEN DELIM TAG_SUBN mand_pointer - { OPEN(SUBN) } no_std_subs { CHECK0 } CLOSE + { START(SUBN) } no_std_subs { CHECK0 } CLOSE { } ; /* HEAD.FILE */ head_file_sect : OPEN DELIM TAG_FILE mand_line_item - { OPEN(FILE) } no_std_subs { CHECK0 } CLOSE + { START(FILE) } no_std_subs { CHECK0 } CLOSE { } ; /* HEAD.COPR */ head_copr_sect : OPEN DELIM TAG_COPR mand_line_item - { OPEN(COPR) } no_std_subs { CHECK0 } CLOSE + { START(COPR) } no_std_subs { CHECK0 } CLOSE { } ; /* HEAD.GEDC */ head_gedc_sect : OPEN DELIM TAG_GEDC - { OPEN(GEDC) } + { START(GEDC) } head_gedc_subs { CHECK2(VERS, FORM) } CLOSE @@ -531,17 +554,17 @@ head_gedc_sub : head_gedc_vers_sect { OCCUR2(VERS, 1, 1) } | no_std_sub ; head_gedc_vers_sect : OPEN DELIM TAG_VERS mand_line_item - { OPEN(VERS) } no_std_subs { CHECK0 } CLOSE + { START(VERS) } no_std_subs { CHECK0 } CLOSE { } ; head_gedc_form_sect : OPEN DELIM TAG_FORM mand_line_item - { OPEN(FORM) } no_std_subs { CHECK0 } CLOSE + { START(FORM) } no_std_subs { CHECK0 } CLOSE { } ; /* HEAD.CHAR */ head_char_sect : OPEN DELIM TAG_CHAR mand_line_item - { OPEN(CHAR) } + { START(CHAR) } head_char_subs { CHECK0 } CLOSE @@ -556,18 +579,18 @@ head_char_sub : head_char_vers_sect { OCCUR2(VERS, 0, 1) } | no_std_sub ; head_char_vers_sect : OPEN DELIM TAG_VERS mand_line_item - { OPEN(VERS) } no_std_subs { CHECK0 } CLOSE + { START(VERS) } no_std_subs { CHECK0 } CLOSE { } ; /* HEAD.LANG */ head_lang_sect : OPEN DELIM TAG_LANG mand_line_item - { OPEN(LANG) } no_std_subs { CHECK0 } CLOSE + { START(LANG) } no_std_subs { CHECK0 } CLOSE { } ; /* HEAD.PLAC */ head_plac_sect : OPEN DELIM TAG_PLAC - { OPEN(PLAC) } + { START(PLAC) } head_plac_subs { CHECK1(FORM) } CLOSE @@ -582,13 +605,13 @@ head_plac_sub : head_plac_form_sect { OCCUR2(FORM, 1, 1) } | no_std_sub ; head_plac_form_sect : OPEN DELIM TAG_FORM mand_line_item - { OPEN(FORM) } no_std_subs { CHECK0 } CLOSE + { START(FORM) } no_std_subs { CHECK0 } CLOSE { } ; /* HEAD.NOTE */ head_note_sect : OPEN DELIM TAG_NOTE mand_line_item - { OPEN(NOTE) } + { START(NOTE) } head_note_subs { CHECK0 } CLOSE @@ -613,7 +636,7 @@ trlr_sect : OPEN DELIM TAG_TRLR CLOSE { } /**** Family record ****/ /*********************************************************************/ fam_rec : OPEN DELIM POINTER DELIM TAG_FAM - { OPEN(FAM) } + { START(FAM) } fam_subs { CHECK0 } CLOSE { } @@ -640,31 +663,31 @@ fam_sub : fam_event_struc_sub /* 0:M */ /* FAM.HUSB */ fam_husb_sect : OPEN DELIM TAG_HUSB mand_pointer - { OPEN(HUSB) } no_std_subs { CHECK0 } CLOSE + { START(HUSB) } no_std_subs { CHECK0 } CLOSE { } ; /* FAM.WIFE */ fam_wife_sect : OPEN DELIM TAG_WIFE mand_pointer - { OPEN(WIFE) } no_std_subs { CHECK0 } CLOSE + { START(WIFE) } no_std_subs { CHECK0 } CLOSE { } ; /* FAM.CHIL */ fam_chil_sect : OPEN DELIM TAG_CHIL mand_pointer - { OPEN(CHIL) } no_std_subs { CHECK0 } CLOSE + { START(CHIL) } no_std_subs { CHECK0 } CLOSE { } ; /* FAM.NCHI */ fam_nchi_sect : OPEN DELIM TAG_NCHI mand_line_item - { OPEN(NCHI) } no_std_subs { CHECK0 } CLOSE + { START(NCHI) } no_std_subs { CHECK0 } CLOSE { } ; /* FAM.SUBM */ fam_subm_sect : OPEN DELIM TAG_SUBM mand_pointer - { OPEN(SUBM) } no_std_subs { CHECK0 } CLOSE + { START(SUBM) } no_std_subs { CHECK0 } CLOSE { } ; @@ -672,7 +695,7 @@ fam_subm_sect : OPEN DELIM TAG_SUBM mand_pointer /**** Individual record ****/ /*********************************************************************/ indiv_rec : OPEN DELIM POINTER DELIM TAG_INDI - { OPEN(INDI) } + { START(INDI) } indi_subs { CHECK0 } CLOSE { } @@ -702,54 +725,61 @@ indi_sub : indi_resn_sect { OCCUR2(RESN, 0, 1) } | indi_afn_sect /* 0:M */ | ident_struc_sub /* 0:1 */ | change_date_sub /* 0:1 */ - | no_std_sub + | ftree_addr_sect { if (!compat_mode(C_FTREE)) + INVALID_TAG("ADDR"); + } + | no_std_sub ; /* INDI.RESN */ indi_resn_sect : OPEN DELIM TAG_RESN mand_line_item - { OPEN(RESN) } no_std_subs { CHECK0 } CLOSE { } + { START(RESN) } no_std_subs { CHECK0 } CLOSE { } ; /* INDI.SEX */ indi_sex_sect : OPEN DELIM TAG_SEX mand_line_item - { OPEN(SEX) } no_std_subs { CHECK0 } CLOSE { } + { START(SEX) } no_std_subs { CHECK0 } CLOSE { } ; /* INDI.SUBM */ indi_subm_sect : OPEN DELIM TAG_SUBM mand_pointer - { OPEN(SUBM) } no_std_subs { CHECK0 } CLOSE { } + { START(SUBM) } no_std_subs { CHECK0 } CLOSE { } ; /* INDI.ALIA */ indi_alia_sect : OPEN DELIM TAG_ALIA mand_pointer - { OPEN(ALIA) } no_std_subs { CHECK0 } CLOSE { } + { START(ALIA) } no_std_subs { CHECK0 } CLOSE { } ; /* INDI.ANCI */ indi_anci_sect : OPEN DELIM TAG_ANCI mand_pointer - { OPEN(ANCI) } no_std_subs { CHECK0 } CLOSE { } + { START(ANCI) } no_std_subs { CHECK0 } CLOSE { } ; /* INDI.DESI */ indi_desi_sect : OPEN DELIM TAG_DESI mand_pointer - { OPEN(DESI) } no_std_subs { CHECK0 } CLOSE { } + { START(DESI) } no_std_subs { CHECK0 } CLOSE { } ; /* INDI.RFN */ indi_rfn_sect : OPEN DELIM TAG_RFN mand_line_item - { OPEN(RFN) } no_std_subs { CHECK0 } CLOSE { } + { START(RFN) } no_std_subs { CHECK0 } CLOSE { } ; /* INDI.AFN */ indi_afn_sect : OPEN DELIM TAG_AFN mand_line_item - { OPEN(AFN) } no_std_subs { CHECK0 } CLOSE { } + { START(AFN) } no_std_subs { CHECK0 } CLOSE { } ; +/* INDI.ADDR (Only for 'ftree' compatibility) */ +ftree_addr_sect : OPEN DELIM TAG_ADDR opt_line_item + { START(ADDR) } no_std_subs { CHECK0 } CLOSE { } + /*********************************************************************/ /**** Multimedia record ****/ /*********************************************************************/ multim_rec : OPEN DELIM POINTER DELIM TAG_OBJE - { OPEN(OBJE) } + { START(OBJE) } obje_subs { CHECK2(FORM, BLOB) } CLOSE { } @@ -771,17 +801,17 @@ obje_sub : obje_form_sect { OCCUR2(FORM, 1, 1) } /* OBJE.FORM */ obje_form_sect : OPEN DELIM TAG_FORM mand_line_item - { OPEN(FORM) } no_std_subs { CHECK0 } CLOSE { } + { START(FORM) } no_std_subs { CHECK0 } CLOSE { } ; /* OBJE.TITL */ obje_titl_sect : OPEN DELIM TAG_TITL mand_line_item - { OPEN(TITL) } no_std_subs { CHECK0 } CLOSE { } + { START(TITL) } no_std_subs { CHECK0 } CLOSE { } ; /* OBJE.BLOB */ obje_blob_sect : OPEN DELIM TAG_BLOB - { OPEN(BLOB) } + { START(BLOB) } obje_blob_subs { CHECK1(CONT) } CLOSE { } @@ -796,24 +826,34 @@ obje_blob_sub : obje_blob_cont_sect { OCCUR1(CONT, 1) } ; obje_blob_cont_sect : OPEN DELIM TAG_CONT mand_line_item - { OPEN(CONT) } no_std_subs { CHECK0 } CLOSE { } + { START(CONT) } no_std_subs { CHECK0 } CLOSE { } ; /* OBJE.OBJE */ obje_obje_sect : OPEN DELIM TAG_OBJE mand_pointer - { OPEN(OBJE) } no_std_subs { CHECK0 } CLOSE { } + { START(OBJE) } no_std_subs { CHECK0 } CLOSE { } ; /*********************************************************************/ /**** Note record ****/ /*********************************************************************/ -note_rec : OPEN DELIM POINTER DELIM TAG_NOTE mand_line_item - { OPEN(NOTE) } +note_rec : OPEN DELIM POINTER DELIM TAG_NOTE note_line_item + { START(NOTE) } note_subs { CHECK0 } CLOSE { } ; +note_line_item : /* empty */ + { if (!compat_mode(C_FTREE)) { + gedcom_error("Missing value"); YYERROR; + } + } + | DELIM line_item + { gedcom_debug_print("==Val: %s==\n", $2); + $$ = $2; } + ; + note_subs : /* empty */ | note_subs note_sub ; @@ -829,7 +869,7 @@ note_sub : continuation_sub /* 0:M */ /**** Repository record ****/ /*********************************************************************/ repos_rec : OPEN DELIM POINTER DELIM TAG_REPO - { OPEN(REPO) } + { START(REPO) } repo_subs { CHECK0 } CLOSE { } @@ -849,14 +889,14 @@ repo_sub : repo_name_sect { OCCUR2(NAME, 0, 1) } /* REPO.NAME */ repo_name_sect : OPEN DELIM TAG_NAME mand_line_item - { OPEN(NAME) } no_std_subs { CHECK0 } CLOSE {} + { START(NAME) } no_std_subs { CHECK0 } CLOSE {} ; /*********************************************************************/ /**** Source record ****/ /*********************************************************************/ source_rec : OPEN DELIM POINTER DELIM TAG_SOUR - { OPEN(SOUR) } + { START(SOUR) } sour_subs { CHECK0 } CLOSE { } @@ -882,7 +922,7 @@ sour_sub : sour_data_sect { OCCUR2(DATA, 0, 1) } /* SOUR.DATA */ sour_data_sect : OPEN DELIM TAG_DATA - { OPEN(DATA) } + { START(DATA) } sour_data_subs { CHECK0 } CLOSE { } @@ -899,7 +939,7 @@ sour_data_sub : sour_data_even_sect /* 0:M */ ; sour_data_even_sect : OPEN DELIM TAG_EVEN mand_line_item - { OPEN(EVEN) } + { START(EVEN) } sour_data_even_subs { CHECK0 } CLOSE { } @@ -915,20 +955,20 @@ sour_data_even_sub : sour_data_even_date_sect { OCCUR2(DATE, 0, 1) } ; sour_data_even_date_sect : OPEN DELIM TAG_DATE mand_line_item - { OPEN(DATE) } no_std_subs { CHECK0 } CLOSE { } + { START(DATE) } no_std_subs { CHECK0 } CLOSE { } ; sour_data_even_plac_sect : OPEN DELIM TAG_PLAC mand_line_item - { OPEN(PLAC) } no_std_subs { CHECK0 } CLOSE { } + { START(PLAC) } no_std_subs { CHECK0 } CLOSE { } ; sour_data_agnc_sect : OPEN DELIM TAG_AGNC mand_line_item - { OPEN(AGNC) } no_std_subs { CHECK0 } CLOSE { } + { START(AGNC) } no_std_subs { CHECK0 } CLOSE { } ; /* SOUR.AUTH */ sour_auth_sect : OPEN DELIM TAG_AUTH mand_line_item - { OPEN(AUTH) } + { START(AUTH) } sour_auth_subs { CHECK0 } CLOSE { } @@ -944,7 +984,7 @@ sour_auth_sub : continuation_sub /* 0:M */ /* SOUR.TITL */ sour_titl_sect : OPEN DELIM TAG_TITL mand_line_item - { OPEN(TITL) } + { START(TITL) } sour_titl_subs { CHECK0 } CLOSE { } @@ -960,12 +1000,12 @@ sour_titl_sub : continuation_sub /* 0:M */ /* SOUR.ABBR */ sour_abbr_sect : OPEN DELIM TAG_ABBR mand_line_item - { OPEN(ABBR) } no_std_subs { CHECK0 } CLOSE { } + { START(ABBR) } no_std_subs { CHECK0 } CLOSE { } ; /* SOUR.PUBL */ sour_publ_sect : OPEN DELIM TAG_PUBL mand_line_item - { OPEN(PUBL) } + { START(PUBL) } sour_publ_subs { CHECK0 } CLOSE { } @@ -981,7 +1021,7 @@ sour_publ_sub : continuation_sub /* 0:M */ /* SOUR.TEXT */ sour_text_sect : OPEN DELIM TAG_TEXT mand_line_item - { OPEN(TEXT) } + { START(TEXT) } sour_text_subs { CHECK0 } CLOSE { } @@ -999,7 +1039,7 @@ sour_text_sub : continuation_sub /* 0:M */ /**** Submission record ****/ /*********************************************************************/ submis_rec : OPEN DELIM POINTER DELIM TAG_SUBN - { OPEN(SUBN) } + { START(SUBN) } subn_subs { CHECK0 } CLOSE { } @@ -1021,44 +1061,44 @@ subn_sub : subn_subm_sect { OCCUR2(SUBM, 0, 1) } /* SUBN.SUBM */ subn_subm_sect : OPEN DELIM TAG_SUBM mand_pointer - { OPEN(SUBM) } no_std_subs { CHECK0 } CLOSE { } + { START(SUBM) } no_std_subs { CHECK0 } CLOSE { } ; /* SUBN.FAMF */ subn_famf_sect : OPEN DELIM TAG_FAMF mand_line_item - { OPEN(FAMF) } no_std_subs { CHECK0 } CLOSE { } + { START(FAMF) } no_std_subs { CHECK0 } CLOSE { } ; /* SUBN.TEMP */ subn_temp_sect : OPEN DELIM TAG_TEMP mand_line_item - { OPEN(TEMP) } no_std_subs { CHECK0 } CLOSE { } + { START(TEMP) } no_std_subs { CHECK0 } CLOSE { } ; /* SUBN.ANCE */ subn_ance_sect : OPEN DELIM TAG_ANCE mand_line_item - { OPEN(ANCE) } no_std_subs { CHECK0 } CLOSE { } + { START(ANCE) } no_std_subs { CHECK0 } CLOSE { } ; /* SUBN.DESC */ subn_desc_sect : OPEN DELIM TAG_DESC mand_line_item - { OPEN(DESC) } no_std_subs { CHECK0 } CLOSE { } + { START(DESC) } no_std_subs { CHECK0 } CLOSE { } ; /* SUBN.ORDI */ subn_ordi_sect : OPEN DELIM TAG_ORDI mand_line_item - { OPEN(ORDI) } no_std_subs { CHECK0 } CLOSE { } + { START(ORDI) } no_std_subs { CHECK0 } CLOSE { } ; /* SUBN.RIN */ subn_rin_sect : OPEN DELIM TAG_RIN mand_line_item - { OPEN(RIN) } no_std_subs { CHECK0 } CLOSE { } + { START(RIN) } no_std_subs { CHECK0 } CLOSE { } ; /*********************************************************************/ /**** Submitter record ****/ /*********************************************************************/ submit_rec : OPEN DELIM POINTER DELIM TAG_SUBM - { OPEN(SUBM) } + { START(SUBM) } subm_subs { CHECK1(NAME) } CLOSE { } @@ -1080,22 +1120,22 @@ subm_sub : subm_name_sect { OCCUR2(NAME, 0, 1) } /* SUBM.NAME */ subm_name_sect : OPEN DELIM TAG_NAME mand_line_item - { OPEN(NAME) } no_std_subs { CHECK0 } CLOSE { } + { START(NAME) } no_std_subs { CHECK0 } CLOSE { } ; /* SUBM.LANG */ subm_lang_sect : OPEN DELIM TAG_LANG mand_line_item - { OPEN(LANG) } no_std_subs { CHECK0 } CLOSE { } + { START(LANG) } no_std_subs { CHECK0 } CLOSE { } ; /* SUBM.RFN */ subm_rfn_sect : OPEN DELIM TAG_RFN mand_line_item - { OPEN(RFN) } no_std_subs { CHECK0 } CLOSE { } + { START(RFN) } no_std_subs { CHECK0 } CLOSE { } ; /* SUBM.RIN */ subm_rin_sect : OPEN DELIM TAG_RIN mand_line_item - { OPEN(RIN) } no_std_subs { CHECK0 } CLOSE { } + { START(RIN) } no_std_subs { CHECK0 } CLOSE { } ; /*********************************************************************/ @@ -1108,7 +1148,7 @@ addr_struc_sub : addr_sect { OCCUR2(ADDR, 0, 1) } ; addr_sect : OPEN DELIM TAG_ADDR mand_line_item - { OPEN(ADDR) } + { START(ADDR) } addr_subs { CHECK0 } CLOSE { } @@ -1129,29 +1169,29 @@ addr_sub : addr_cont_sect /* 0:M */ ; addr_cont_sect : OPEN DELIM TAG_CONT mand_line_item - { OPEN(CONT) } no_std_subs { CHECK0 } CLOSE { } + { START(CONT) } no_std_subs { CHECK0 } CLOSE { } ; addr_adr1_sect : OPEN DELIM TAG_ADR1 mand_line_item - { OPEN(ADR1) } no_std_subs { CHECK0 } CLOSE { } + { START(ADR1) } no_std_subs { CHECK0 } CLOSE { } ; addr_adr2_sect : OPEN DELIM TAG_ADR2 mand_line_item - { OPEN(ADR2) } no_std_subs { CHECK0 } CLOSE { } + { START(ADR2) } no_std_subs { CHECK0 } CLOSE { } ; addr_city_sect : OPEN DELIM TAG_CITY mand_line_item - { OPEN(CITY) } no_std_subs { CHECK0 } CLOSE { } + { START(CITY) } no_std_subs { CHECK0 } CLOSE { } ; addr_stae_sect : OPEN DELIM TAG_STAE mand_line_item - { OPEN(STAE) } no_std_subs { CHECK0 } CLOSE { } + { START(STAE) } no_std_subs { CHECK0 } CLOSE { } ; addr_post_sect : OPEN DELIM TAG_POST mand_line_item - { OPEN(POST) } no_std_subs { CHECK0 } CLOSE { } + { START(POST) } no_std_subs { CHECK0 } CLOSE { } ; addr_ctry_sect : OPEN DELIM TAG_CTRY mand_line_item - { OPEN(CTRY) } no_std_subs { CHECK0 } CLOSE { } + { START(CTRY) } no_std_subs { CHECK0 } CLOSE { } ; phon_sect : OPEN DELIM TAG_PHON mand_line_item - { OPEN(PHON) } no_std_subs { CHECK0 } CLOSE { } + { START(PHON) } no_std_subs { CHECK0 } CLOSE { } ; /* ASSOCIATION STRUCTURE */ @@ -1159,7 +1199,7 @@ assoc_struc_sub : asso_sect /* 0:M */ ; asso_sect : OPEN DELIM TAG_ASSO mand_pointer - { OPEN(ASSO) } + { START(ASSO) } asso_subs { CHECK2(TYPE,RELA) } CLOSE { } @@ -1174,11 +1214,11 @@ asso_subs : /* empty */ ; asso_type_sect : OPEN DELIM TAG_TYPE mand_line_item - { OPEN(TYPE) } no_std_subs { CHECK0 } CLOSE { } + { START(TYPE) } no_std_subs { CHECK0 } CLOSE { } ; asso_rela_sect : OPEN DELIM TAG_RELA mand_line_item - { OPEN(RELA) } no_std_subs { CHECK0 } CLOSE { } + { START(RELA) } no_std_subs { CHECK0 } CLOSE { } ; /* CHANGE DATE */ @@ -1186,7 +1226,7 @@ change_date_sub : change_date_chan_sect { OCCUR2(CHAN, 0, 1) } ; change_date_chan_sect : OPEN DELIM TAG_CHAN - { OPEN(CHAN) } + { START(CHAN) } change_date_chan_subs { CHECK1(DATE) } CLOSE { } @@ -1202,7 +1242,7 @@ change_date_chan_sub : change_date_date_sect { OCCUR2(DATE, 1, 1) } ; change_date_date_sect : OPEN DELIM TAG_DATE mand_line_item - { OPEN(DATE) } + { START(DATE) } change_date_date_subs { CHECK0 } CLOSE { } @@ -1217,7 +1257,7 @@ change_date_date_sub : change_date_date_time_sect { OCCUR2(TIME, 0, 1) } ; change_date_date_time_sect : OPEN DELIM TAG_TIME mand_line_item - { OPEN(TIME) } no_std_subs { CHECK0 } CLOSE { } + { START(TIME) } no_std_subs { CHECK0 } CLOSE { } ; /* CHILD TO FAMILY LINK */ @@ -1225,7 +1265,7 @@ chi_fam_link_sub : famc_sect /* 0:M */ ; famc_sect : OPEN DELIM TAG_FAMC mand_pointer - { OPEN(FAMC) } + { START(FAMC) } famc_subs { CHECK0 } CLOSE { } @@ -1241,7 +1281,7 @@ famc_sub : famc_pedi_sect /* 0:M */ ; famc_pedi_sect : OPEN DELIM TAG_PEDI mand_line_item - { OPEN(PEDI) } no_std_subs { CHECK0 } CLOSE { } + { START(PEDI) } no_std_subs { CHECK0 } CLOSE { } ; /* CONTINUATION SUBSECTIONS */ @@ -1250,11 +1290,11 @@ continuation_sub : cont_sect /* 0:M */ ; cont_sect : OPEN DELIM TAG_CONT mand_line_item - { OPEN(CONT) } no_std_subs { CHECK0 } CLOSE { } + { START(CONT) } no_std_subs { CHECK0 } CLOSE { } ; conc_sect : OPEN DELIM TAG_CONC mand_line_item - { OPEN(CONC) } no_std_subs { CHECK0 } CLOSE { } + { START(CONC) } no_std_subs { CHECK0 } CLOSE { } ; /* EVENT DETAIL */ @@ -1271,19 +1311,19 @@ event_detail_sub : event_detail_type_sect { OCCUR2(TYPE, 0, 1) } ; event_detail_type_sect : OPEN DELIM TAG_TYPE mand_line_item - { OPEN(TYPE) } no_std_subs { CHECK0 } CLOSE { } + { START(TYPE) } no_std_subs { CHECK0 } CLOSE { } ; event_detail_date_sect : OPEN DELIM TAG_DATE mand_line_item - { OPEN(DATE) } no_std_subs { CHECK0 } CLOSE { } + { START(DATE) } no_std_subs { CHECK0 } CLOSE { } ; event_detail_age_sect : OPEN DELIM TAG_AGE mand_line_item - { OPEN(AGE) } no_std_subs { CHECK0 } CLOSE { } + { START(AGE) } no_std_subs { CHECK0 } CLOSE { } ; event_detail_agnc_sect : OPEN DELIM TAG_AGNC mand_line_item - { OPEN(AGNC) } no_std_subs { CHECK0 } CLOSE { } + { START(AGNC) } no_std_subs { CHECK0 } CLOSE { } ; event_detail_caus_sect : OPEN DELIM TAG_CAUS mand_line_item - { OPEN(CAUS) } no_std_subs { CHECK0 } CLOSE { } + { START(CAUS) } no_std_subs { CHECK0 } CLOSE { } ; /* FAMILY EVENT STRUCTURE */ @@ -1296,16 +1336,16 @@ fam_event_sect : OPEN DELIM fam_event_tag opt_value fam_event_subs CLOSE { } ; -fam_event_tag : TAG_ANUL { OPEN(ANUL) } - | TAG_CENS { OPEN(CENS) } - | TAG_DIV { OPEN(DIV) } - | TAG_DIVF { OPEN(DIVF) } - | TAG_ENGA { OPEN(ENGA) } - | TAG_MARR { OPEN(MARR) } - | TAG_MARB { OPEN(MARB) } - | TAG_MARC { OPEN(MARC) } - | TAG_MARL { OPEN(MARL) } - | TAG_MARS { OPEN(MARS) } +fam_event_tag : TAG_ANUL { START(ANUL) } + | TAG_CENS { START(CENS) } + | TAG_DIV { START(DIV) } + | TAG_DIVF { START(DIVF) } + | TAG_ENGA { START(ENGA) } + | TAG_MARR { START(MARR) } + | TAG_MARB { START(MARB) } + | TAG_MARC { START(MARC) } + | TAG_MARL { START(MARL) } + | TAG_MARS { START(MARS) } ; fam_event_subs : /* empty */ @@ -1319,7 +1359,7 @@ fam_event_sub : event_detail_sub ; fam_even_husb_sect : OPEN DELIM TAG_HUSB - { OPEN(HUSB) } + { START(HUSB) } fam_even_husb_subs { CHECK1(AGE) } CLOSE { } @@ -1334,18 +1374,18 @@ fam_even_husb_sub : fam_even_husb_age_sect { OCCUR2(AGE, 1, 1) } ; fam_even_husb_age_sect : OPEN DELIM TAG_AGE mand_line_item - { OPEN(AGE) } no_std_subs { CHECK0 } CLOSE { } + { START(AGE) } no_std_subs { CHECK0 } CLOSE { } ; fam_even_wife_sect : OPEN DELIM TAG_WIFE - { OPEN(HUSB) } + { START(HUSB) } fam_even_husb_subs { CHECK1(AGE) } CLOSE { } ; fam_gen_even_sect : OPEN DELIM TAG_EVEN - { OPEN(EVEN) } + { START(EVEN) } fam_gen_even_subs { CHECK0 } CLOSE { } @@ -1367,7 +1407,7 @@ ident_struc_sub : ident_refn_sect /* 0:M */ ; ident_refn_sect : OPEN DELIM TAG_REFN mand_line_item - { OPEN(REFN) } + { START(REFN) } ident_refn_subs { CHECK0 } CLOSE { } @@ -1382,11 +1422,11 @@ ident_refn_sub : ident_refn_type_sect { OCCUR2(TYPE, 0, 1) } ; ident_refn_type_sect : OPEN DELIM TAG_TYPE mand_line_item - { OPEN(TYPE) } no_std_subs { CHECK0 } CLOSE { } + { START(TYPE) } no_std_subs { CHECK0 } CLOSE { } ; ident_rin_sect : OPEN DELIM TAG_RIN mand_line_item - { OPEN(RIN) } no_std_subs { CHECK0 } CLOSE { } + { START(RIN) } no_std_subs { CHECK0 } CLOSE { } ; /* INDIVIDUAL ATTRIBUTE STRUCTURE */ @@ -1406,79 +1446,79 @@ indiv_attr_struc_sub : indiv_cast_sect /* 0:M */ ; indiv_cast_sect : OPEN DELIM TAG_CAST mand_line_item - { OPEN(CAST) } + { START(CAST) } indiv_attr_event_subs { CHECK0 } CLOSE { } ; indiv_dscr_sect : OPEN DELIM TAG_DSCR mand_line_item - { OPEN(DSCR) } + { START(DSCR) } indiv_attr_event_subs { CHECK0 } CLOSE { } ; indiv_educ_sect : OPEN DELIM TAG_EDUC mand_line_item - { OPEN(EDUC) } + { START(EDUC) } indiv_attr_event_subs { CHECK0 } CLOSE { } ; indiv_idno_sect : OPEN DELIM TAG_IDNO mand_line_item - { OPEN(IDNO) } + { START(IDNO) } indiv_attr_event_subs { CHECK0 } CLOSE { } ; indiv_nati_sect : OPEN DELIM TAG_NATI mand_line_item - { OPEN(NATI) } + { START(NATI) } indiv_attr_event_subs { CHECK0 } CLOSE { } ; indiv_nchi_sect : OPEN DELIM TAG_NCHI mand_line_item - { OPEN(NCHI) } + { START(NCHI) } indiv_attr_event_subs { CHECK0 } CLOSE { } ; indiv_nmr_sect : OPEN DELIM TAG_NMR mand_line_item - { OPEN(NMR) } + { START(NMR) } indiv_attr_event_subs { CHECK0 } CLOSE { } ; indiv_occu_sect : OPEN DELIM TAG_OCCU mand_line_item - { OPEN(OCCU) } + { START(OCCU) } indiv_attr_event_subs { CHECK0 } CLOSE { } ; indiv_prop_sect : OPEN DELIM TAG_PROP mand_line_item - { OPEN(PROP) } + { START(PROP) } indiv_attr_event_subs { CHECK0 } CLOSE { } ; indiv_reli_sect : OPEN DELIM TAG_RELI mand_line_item - { OPEN(RELI) } + { START(RELI) } indiv_attr_event_subs { CHECK0 } CLOSE { } ; indiv_resi_sect : OPEN DELIM TAG_RESI - { OPEN(RESI) } + { START(RESI) } indiv_attr_event_subs { CHECK0 } CLOSE { } ; indiv_ssn_sect : OPEN DELIM TAG_SSN mand_line_item - { OPEN(SSN) } + { START(SSN) } indiv_attr_event_subs { CHECK0 } CLOSE { } ; indiv_titl_sect : OPEN DELIM TAG_TITL mand_line_item - { OPEN(TITL) } + { START(TITL) } indiv_attr_event_subs { CHECK0 } CLOSE { } @@ -1504,8 +1544,8 @@ indiv_birt_sect : OPEN DELIM indiv_birt_tag opt_value indiv_birt_subs CLOSE { } ; -indiv_birt_tag : TAG_BIRT { OPEN(BIRT) } - | TAG_CHR { OPEN(CHR) } +indiv_birt_tag : TAG_BIRT { START(BIRT) } + | TAG_CHR { START(CHR) } ; indiv_birt_subs : /* empty */ @@ -1518,7 +1558,7 @@ indiv_birt_sub : event_detail_sub ; indiv_birt_famc_sect : OPEN DELIM TAG_FAMC mand_pointer - { OPEN(FAMC) } no_std_subs { CHECK0 } CLOSE { } + { START(FAMC) } no_std_subs { CHECK0 } CLOSE { } ; indiv_gen_sect : OPEN DELIM indiv_gen_tag opt_value indiv_gen_subs @@ -1526,25 +1566,25 @@ indiv_gen_sect : OPEN DELIM indiv_gen_tag opt_value indiv_gen_subs CLOSE { } ; -indiv_gen_tag : TAG_DEAT { OPEN(DEAT) } - | TAG_BURI { OPEN(BURI) } - | TAG_CREM { OPEN(CREM) } - | TAG_BAPM { OPEN(BAPM) } - | TAG_BARM { OPEN(BARM) } - | TAG_BASM { OPEN(BASM) } - | TAG_BLES { OPEN(BLES) } - | TAG_CHRA { OPEN(CHRA) } - | TAG_CONF { OPEN(CONF) } - | TAG_FCOM { OPEN(FCOM) } - | TAG_ORDN { OPEN(ORDN) } - | TAG_NATU { OPEN(NATU) } - | TAG_EMIG { OPEN(EMIG) } - | TAG_IMMI { OPEN(IMMI) } - | TAG_CENS { OPEN(CENS) } - | TAG_PROB { OPEN(PROB) } - | TAG_WILL { OPEN(WILL) } - | TAG_GRAD { OPEN(GRAD) } - | TAG_RETI { OPEN(RETI) } +indiv_gen_tag : TAG_DEAT { START(DEAT) } + | TAG_BURI { START(BURI) } + | TAG_CREM { START(CREM) } + | TAG_BAPM { START(BAPM) } + | TAG_BARM { START(BARM) } + | TAG_BASM { START(BASM) } + | TAG_BLES { START(BLES) } + | TAG_CHRA { START(CHRA) } + | TAG_CONF { START(CONF) } + | TAG_FCOM { START(FCOM) } + | TAG_ORDN { START(ORDN) } + | TAG_NATU { START(NATU) } + | TAG_EMIG { START(EMIG) } + | TAG_IMMI { START(IMMI) } + | TAG_CENS { START(CENS) } + | TAG_PROB { START(PROB) } + | TAG_WILL { START(WILL) } + | TAG_GRAD { START(GRAD) } + | TAG_RETI { START(RETI) } ; indiv_gen_subs : /* empty */ @@ -1556,7 +1596,7 @@ indiv_gen_sub : event_detail_sub ; indiv_adop_sect : OPEN DELIM TAG_ADOP opt_value - { OPEN(ADOP) } + { START(ADOP) } indiv_adop_subs { CHECK0 } CLOSE { } @@ -1572,7 +1612,7 @@ indiv_adop_sub : event_detail_sub ; indiv_adop_famc_sect : OPEN DELIM TAG_FAMC mand_pointer - { OPEN(FAMC) } + { START(FAMC) } indiv_adop_famc_subs { CHECK0 } CLOSE { } @@ -1587,11 +1627,11 @@ indiv_adop_famc_sub : indiv_adop_famc_adop_sect { OCCUR2(ADOP,0, 1) } ; indiv_adop_famc_adop_sect : OPEN DELIM TAG_ADOP mand_line_item - { OPEN(ADOP) } no_std_subs { CHECK0 } CLOSE { } + { START(ADOP) } no_std_subs { CHECK0 } CLOSE { } ; indiv_even_sect : OPEN DELIM TAG_EVEN - { OPEN(EVEN) } + { START(EVEN) } indiv_gen_subs { CHECK0 } CLOSE { } @@ -1607,9 +1647,9 @@ lio_bapl_sect : OPEN DELIM lio_bapl_tag lio_bapl_subs CLOSE { } ; -lio_bapl_tag : TAG_BAPL { OPEN(BAPL) } - | TAG_CONL { OPEN(CONL) } - | TAG_ENDL { OPEN(ENDL) } +lio_bapl_tag : TAG_BAPL { START(BAPL) } + | TAG_CONL { START(CONL) } + | TAG_ENDL { START(ENDL) } ; lio_bapl_subs : /* empty */ @@ -1626,20 +1666,20 @@ lio_bapl_sub : lio_bapl_stat_sect { OCCUR2(STAT, 0, 1) } ; lio_bapl_stat_sect : OPEN DELIM TAG_STAT mand_line_item - { OPEN(STAT) } no_std_subs { CHECK0 } CLOSE { } + { START(STAT) } no_std_subs { CHECK0 } CLOSE { } ; lio_bapl_date_sect : OPEN DELIM TAG_DATE mand_line_item - { OPEN(DATE) } no_std_subs { CHECK0 } CLOSE { } + { START(DATE) } no_std_subs { CHECK0 } CLOSE { } ; lio_bapl_temp_sect : OPEN DELIM TAG_TEMP mand_line_item - { OPEN(TEMP) } no_std_subs { CHECK0 } CLOSE { } + { START(TEMP) } no_std_subs { CHECK0 } CLOSE { } ; lio_bapl_plac_sect : OPEN DELIM TAG_PLAC mand_line_item - { OPEN(PLAC) } no_std_subs { CHECK0 } CLOSE { } + { START(PLAC) } no_std_subs { CHECK0 } CLOSE { } ; lio_slgc_sect : OPEN DELIM TAG_SLGC - { OPEN(SLGC) } + { START(SLGC) } lio_slgc_subs { CHECK1(FAMC) } CLOSE { } @@ -1654,7 +1694,7 @@ lio_slgc_sub : lio_bapl_sub ; lio_slgc_famc_sect : OPEN DELIM TAG_FAMC mand_pointer - { OPEN(FAMC) } no_std_subs { CHECK0 } CLOSE { } + { START(FAMC) } no_std_subs { CHECK0 } CLOSE { } ; /* LDS SPOUSE SEALING */ @@ -1662,7 +1702,7 @@ lds_spouse_seal_sub : lss_slgs_sect ; lss_slgs_sect : OPEN DELIM TAG_SLGS - { OPEN(SLGS) } + { START(SLGS) } lss_slgs_subs { CHECK0 } CLOSE { } @@ -1682,16 +1722,16 @@ lss_slgs_sub : lss_slgs_stat_sect { OCCUR2(STAT, 0, 1) } ; lss_slgs_stat_sect : OPEN DELIM TAG_STAT mand_line_item - { OPEN(STAT) } no_std_subs { CHECK0 } CLOSE { } + { START(STAT) } no_std_subs { CHECK0 } CLOSE { } ; lss_slgs_date_sect : OPEN DELIM TAG_DATE mand_line_item - { OPEN(DATE) } no_std_subs { CHECK0 } CLOSE { } + { START(DATE) } no_std_subs { CHECK0 } CLOSE { } ; lss_slgs_temp_sect : OPEN DELIM TAG_TEMP mand_line_item - { OPEN(TEMP) } no_std_subs { CHECK0 } CLOSE { } + { START(TEMP) } no_std_subs { CHECK0 } CLOSE { } ; lss_slgs_plac_sect : OPEN DELIM TAG_PLAC mand_line_item - { OPEN(PLAC) } no_std_subs { CHECK0 } CLOSE { } + { START(PLAC) } no_std_subs { CHECK0 } CLOSE { } ; /* MULTIMEDIA LINK */ @@ -1700,11 +1740,11 @@ multim_link_sub : multim_obje_link_sect ; multim_obje_link_sect : OPEN DELIM TAG_OBJE DELIM POINTER - { OPEN(OBJE) } no_std_subs { CHECK0 } CLOSE { } + { START(OBJE) } no_std_subs { CHECK0 } CLOSE { } ; multim_obje_emb_sect : OPEN DELIM TAG_OBJE - { OPEN(OBJE) } + { START(OBJE) } multim_obje_emb_subs { CHECK2(FORM,FILE) } CLOSE { } @@ -1722,13 +1762,13 @@ multim_obje_emb_sub : multim_obje_form_sect { OCCUR2(FORM, 1, 1) } ; multim_obje_form_sect : OPEN DELIM TAG_FORM mand_line_item - { OPEN(FORM) } no_std_subs { CHECK0 } CLOSE { } + { START(FORM) } no_std_subs { CHECK0 } CLOSE { } ; multim_obje_titl_sect : OPEN DELIM TAG_TITL mand_line_item - { OPEN(TITL) } no_std_subs { CHECK0 } CLOSE { } + { START(TITL) } no_std_subs { CHECK0 } CLOSE { } ; multim_obje_file_sect : OPEN DELIM TAG_FILE mand_line_item - { OPEN(FILE) } no_std_subs { CHECK0 } CLOSE { } + { START(FILE) } no_std_subs { CHECK0 } CLOSE { } ; /* NOTE STRUCTURE */ @@ -1737,7 +1777,7 @@ note_struc_sub : note_struc_link_sect /* 0:M */ ; note_struc_link_sect : OPEN DELIM TAG_NOTE DELIM POINTER - { OPEN(NOTE) } + { START(NOTE) } note_struc_link_subs { CHECK0 } CLOSE { } @@ -1752,7 +1792,7 @@ note_struc_link_sub : source_cit_sub ; note_struc_emb_sect : OPEN DELIM TAG_NOTE opt_line_item - { OPEN(NOTE) } + { START(NOTE) } note_struc_emb_subs { CHECK0 } CLOSE { } @@ -1772,7 +1812,7 @@ pers_name_struc_sub : pers_name_sect /* 0:M */ ; pers_name_sect : OPEN DELIM TAG_NAME mand_line_item - { OPEN(NAME) } + { START(NAME) } pers_name_subs { CHECK0 } CLOSE { } @@ -1794,22 +1834,22 @@ pers_name_sub : pers_name_npfx_sect { OCCUR2(NPFX, 0, 1) } ; pers_name_npfx_sect : OPEN DELIM TAG_NPFX mand_line_item - { OPEN(NPFX) } no_std_subs { CHECK0 } CLOSE { } + { START(NPFX) } no_std_subs { CHECK0 } CLOSE { } ; pers_name_givn_sect : OPEN DELIM TAG_GIVN mand_line_item - { OPEN(GIVN) } no_std_subs { CHECK0 } CLOSE { } + { START(GIVN) } no_std_subs { CHECK0 } CLOSE { } ; pers_name_nick_sect : OPEN DELIM TAG_NICK mand_line_item - { OPEN(NICK) } no_std_subs { CHECK0 } CLOSE { } + { START(NICK) } no_std_subs { CHECK0 } CLOSE { } ; pers_name_spfx_sect : OPEN DELIM TAG_SPFX mand_line_item - { OPEN(SPFX) } no_std_subs { CHECK0 } CLOSE { } + { START(SPFX) } no_std_subs { CHECK0 } CLOSE { } ; pers_name_surn_sect : OPEN DELIM TAG_SURN mand_line_item - { OPEN(SURN) } no_std_subs { CHECK0 } CLOSE { } + { START(SURN) } no_std_subs { CHECK0 } CLOSE { } ; pers_name_nsfx_sect : OPEN DELIM TAG_NSFX mand_line_item - { OPEN(NSFX) } no_std_subs { CHECK0 } CLOSE { } + { START(NSFX) } no_std_subs { CHECK0 } CLOSE { } ; /* PLACE STRUCTURE */ @@ -1817,7 +1857,7 @@ place_struc_sub : place_struc_plac_sect /* 0:M */ ; place_struc_plac_sect : OPEN DELIM TAG_PLAC mand_line_item - { OPEN(PLAC) } + { START(PLAC) } place_struc_plac_subs { CHECK0 } CLOSE { } @@ -1834,7 +1874,7 @@ place_struc_plac_sub : place_plac_form_sect { OCCUR2(FORM, 0, 1) } ; place_plac_form_sect : OPEN DELIM TAG_FORM mand_line_item - { OPEN(FORM) } no_std_subs { CHECK0 } CLOSE { } + { START(FORM) } no_std_subs { CHECK0 } CLOSE { } ; /* SOURCE_CITATION */ @@ -1843,7 +1883,7 @@ source_cit_sub : source_cit_link_sect /* 0:M */ ; source_cit_link_sect : OPEN DELIM TAG_SOUR DELIM POINTER - { OPEN(SOUR) } + { START(SOUR) } source_cit_link_subs { CHECK0 } CLOSE { } @@ -1863,11 +1903,11 @@ source_cit_link_sub : source_cit_page_sect { OCCUR2(PAGE, 0, 1) } ; source_cit_page_sect : OPEN DELIM TAG_PAGE mand_line_item - { OPEN(PAGE) } no_std_subs { CHECK0 } CLOSE { } + { START(PAGE) } no_std_subs { CHECK0 } CLOSE { } ; source_cit_even_sect : OPEN DELIM TAG_EVEN mand_line_item - { OPEN(EVEN) } + { START(EVEN) } source_cit_even_subs { CHECK0 } CLOSE { } @@ -1882,11 +1922,11 @@ source_cit_even_sub : source_cit_even_role_sect { OCCUR2(ROLE, 0, 1) } ; source_cit_even_role_sect : OPEN DELIM TAG_ROLE mand_line_item - { OPEN(ROLE) } no_std_subs { CHECK0 } CLOSE { } + { START(ROLE) } no_std_subs { CHECK0 } CLOSE { } ; source_cit_data_sect : OPEN DELIM TAG_DATA - { OPEN(DATA) } + { START(DATA) } source_cit_data_subs { CHECK0 } CLOSE { } @@ -1902,11 +1942,11 @@ source_cit_data_sub : source_cit_data_date_sect { OCCUR2(DATE, 0, 1) } ; source_cit_data_date_sect : OPEN DELIM TAG_DATE mand_line_item - { OPEN(DATE) } no_std_subs { CHECK0 } CLOSE { } + { START(DATE) } no_std_subs { CHECK0 } CLOSE { } ; source_cit_text_sect : OPEN DELIM TAG_TEXT mand_line_item - { OPEN(TEXT) } + { START(TEXT) } source_cit_text_subs { CHECK0 } CLOSE { } @@ -1921,11 +1961,11 @@ source_cit_text_sub : continuation_sub ; source_cit_quay_sect : OPEN DELIM TAG_QUAY mand_line_item - { OPEN(QUAY) } no_std_subs { CHECK0 } CLOSE { } + { START(QUAY) } no_std_subs { CHECK0 } CLOSE { } ; source_cit_emb_sect : OPEN DELIM TAG_SOUR mand_line_item - { OPEN(SOUR) } + { START(SOUR) } source_cit_emb_subs { CHECK0 } CLOSE { } @@ -1946,7 +1986,7 @@ source_repos_cit_sub : source_repos_repo_sect { OCCUR2(REPO, 0, 1) } ; source_repos_repo_sect : OPEN DELIM TAG_REPO mand_pointer - { OPEN(REPO) } + { START(REPO) } source_repos_repo_subs { CHECK0 } CLOSE { } @@ -1962,7 +2002,7 @@ source_repos_repo_sub : note_struc_sub ; caln_sect : OPEN DELIM TAG_CALN mand_line_item - { OPEN(CALN) } + { START(CALN) } caln_subs { CHECK0 } CLOSE { } @@ -1977,7 +2017,7 @@ caln_sub : caln_medi_sect { OCCUR2(MEDI, 0, 1) } ; caln_medi_sect : OPEN DELIM TAG_MEDI mand_line_item - { OPEN(MEDI) } no_std_subs { CHECK0 } CLOSE { } + { START(MEDI) } no_std_subs { CHECK0 } CLOSE { } ; /* SPOUSE TO FAMILY LINK */ @@ -1985,7 +2025,7 @@ spou_fam_link_sub : spou_fam_fams_sect /* 0:M */ ; spou_fam_fams_sect : OPEN DELIM TAG_FAMS mand_pointer - { OPEN(FAMS) } + { START(FAMS) } spou_fam_fams_subs { CHECK0 } CLOSE { } @@ -2058,17 +2098,40 @@ mand_pointer : /* empty */ { gedcom_error("Missing pointer"); YYERROR; } ; mand_line_item : /* empty */ { gedcom_error("Missing value"); YYERROR; } - | DELIM line_item { } + | DELIM line_item { gedcom_debug_print("==Val: %s==\n", $2); + $$ = $2; } ; opt_line_item : /* empty */ { } | DELIM line_item { } ; -line_item : anychar { } - | ESCAPE { } - | line_item anychar { } - | line_item ESCAPE { } +line_item : anychar { CLEAR_BUFFER(string_buf); + string_buf_ptr = string_buf; + /* The following also takes care of '@@' */ + *string_buf_ptr++ = $1[0]; + $$ = string_buf; + } + | ESCAPE { CLEAR_BUFFER(string_buf); + string_buf_ptr = string_buf; + /* For now, ignore escapes */ + $$ = string_buf; + } + | line_item anychar + { if (strlen(string_buf) >= MAXGEDCLINELEN) { + gedcom_error("Line too long"); + YYERROR; + } + else { + /* The following also takes care of '@@' */ + *string_buf_ptr++ = $2[0]; + $$ = string_buf; + } + } + | line_item ESCAPE + { /* For now, ignore escapes */ + $$ = string_buf; + } ; anychar : ANYCHAR { } @@ -2253,20 +2316,19 @@ anystdtag : TAG_ABBR /* Functions that handle the counting of subtags */ -int* count_arrays[MAXGEDCOMLEVEL+1]; -char tag_stack[MAXGEDCOMLEVEL+1][MAXSTDTAGLENGTH+1]; +int* count_arrays[MAXGEDCLEVEL+1]; +char tag_stack[MAXGEDCLEVEL+1][MAXSTDTAGLENGTH+1]; void push_countarray() { int *count = NULL; - if (count_level > MAXGEDCOMLEVEL) { + if (count_level > MAXGEDCLEVEL) { gedcom_error("Internal error: count array overflow"); exit(1); } else { count = (int *)calloc(YYNTOKENS, sizeof(int)); - if (count == NULL) { int *count = count_arrays[count_level]; - + if (count == NULL) { gedcom_error("Internal error: count array calloc error"); exit(1); } @@ -2313,7 +2375,6 @@ void pop_countarray() } /* Enabling debug mode */ - void gedcom_enable_debug() { #if YYDEBUG != 0 @@ -2322,9 +2383,33 @@ void gedcom_enable_debug() } /* Setting the error mechanism */ - void gedcom_set_error_handling(MECHANISM mechanism) { curr_mechanism = mechanism; } +/* Compatibility handling */ + +void gedcom_set_compat_handling(int enable_compat) +{ + compat_enabled = enable_compat; +} + +void set_compatibility(char* program) +{ + if (compat_enabled) { + gedcom_debug_print("==== Program: %s\n", program); + if (! strncmp(program, "ftree", 6)) { + gedcom_warning("Enabling compatibility with 'ftree'"); + compatibility = C_FTREE; + } + else { + compatibility = 0; + } + } +} + +int compat_mode(int compat_flags) +{ + return (compat_flags & compatibility); +}