X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=gedcom.y;h=d957ca079c76fb5036dd3122bf9ce1d8a692c602;hb=378e28008bafd5b6a1a73bb3c37761fc08520b10;hp=ffbbc7522b7882bc235ffdea561d2371d13aa953;hpb=d392d5f692337233acaf45d2a1a5158529440c16;p=gedcom-parse.git diff --git a/gedcom.y b/gedcom.y index ffbbc75..d957ca0 100644 --- a/gedcom.y +++ b/gedcom.y @@ -1,3 +1,12 @@ +/* This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + + (C) 2001 by The Genes Development Team + Original author: Peter Verthez (Peter.Verthez@advalvas.be) +*/ + /* $Id$ */ /* $Name$ */ @@ -115,97 +124,121 @@ /* General notes: - - The syntax analysis doesn't handle the contents of the line values - or their encoding; this is done in the semantic analysis. + - The syntax analysis doesn't handle the contents of the line values; + this is done in the semantic analysis. */ %{ -#include "gedcom.h" +#include "gedcom_internal.h" +#include "multilex.h" +#include "encoding.h" +#include "interface.h" + +int count_level = 0; +int fail = 0; +int compat_enabled = 1; +int gedcom_high_level_debug = 0; +int compatibility = 0; +Gedcom_err_mech error_mechanism = IMMED_FAIL; + +char line_item_buf[MAXGEDCLINELEN * UTF_FACTOR + 1]; +char *line_item_buf_ptr; -int count_level=0; -int fail=0; -MECHANISM curr_mechanism=IMMED_FAIL; +enum _COMPAT { + C_FTREE = 0x01 +}; /* These are defined at the bottom of the file */ void push_countarray(); void set_parenttag(char* tag); char* get_parenttag(); +void set_parentctxt(Gedcom_ctxt ctxt); +Gedcom_ctxt get_parentctxt(); 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 \ - { \ - if (curr_mechanism == IMMED_FAIL) { \ - YYABORT; \ - } \ - else if (curr_mechanism == DEFER_FAIL) { \ - yyerrok; fail = 1; \ - } \ - else if (curr_mechanism == IGNORE_ERRORS) { \ - yyerrok; \ - } \ +#define HANDLE_ERROR \ + { if (error_mechanism == IMMED_FAIL) { \ + YYABORT; \ + } \ + else if (error_mechanism == DEFER_FAIL) { \ + yyerrok; fail = 1; \ + } \ + else if (error_mechanism == IGNORE_ERRORS) { \ + yyerrok; \ + } \ } -#define OPEN(PARENTTAG) \ - { ++count_level; \ - set_parenttag(#PARENTTAG); \ - push_countarray(); \ +#define START(PARENTTAG,PARENTCTXT) \ + { ++count_level; \ + set_parenttag(#PARENTTAG); \ + set_parentctxt(PARENTCTXT); \ + push_countarray(); \ } -#define CHK(TAG) \ - { if (!check_occurrence(TAG_##TAG)) { \ - char* parenttag = get_parenttag(); \ - gedcom_error("The tag '%s' is mandatory within '%s'", \ - #TAG, parenttag); \ - HANDLE_ERROR; \ - } \ +#define PARENT \ + get_parentctxt() +#define CHK(TAG) \ + { if (!check_occurrence(TAG_##TAG)) { \ + char* parenttag = get_parenttag(); \ + gedcom_error("The tag '%s' is mandatory within '%s', but missing", \ + #TAG, parenttag); \ + HANDLE_ERROR; \ + } \ } -#define POP \ - { pop_countarray(); \ - --count_level; \ +#define POP \ + { pop_countarray(); \ + --count_level; \ } #define CHECK0 POP; #define CHECK1(TAG1) { CHK(TAG1); POP; } -#define CHECK2(TAG1,TAG2) \ +#define CHECK2(TAG1,TAG2) \ { CHK(TAG1); CHK(TAG2); POP; } -#define CHECK3(TAG1,TAG2,TAG3) \ +#define CHECK3(TAG1,TAG2,TAG3) \ { CHK(TAG1); CHK(TAG2); CHK(TAG3); POP; } -#define CHECK4(TAG1,TAG2,TAG3,TAG4) \ +#define CHECK4(TAG1,TAG2,TAG3,TAG4) \ { CHK(TAG1); CHK(TAG2); CHK(TAG3); CHK(TAG4); POP; } #define OCCUR1(CHILDTAG, MIN) { count_tag(TAG_##CHILDTAG); } -#define OCCUR2(CHILDTAG, MIN, MAX) \ - { int num = count_tag(TAG_##CHILDTAG); \ - if (num > MAX) { \ - char* parenttag = get_parenttag(); \ - gedcom_error("The tag '%s' can maximally occur %d " \ - "time(s) within '%s'", \ - #CHILDTAG, MAX, parenttag); \ - YYERROR; \ - } \ +#define OCCUR2(CHILDTAG, MIN, MAX) \ + { int num = count_tag(TAG_##CHILDTAG); \ + if (num > MAX) { \ + char* parenttag = get_parenttag(); \ + gedcom_error("The tag '%s' can maximally occur %d " \ + "time(s) within '%s'", \ + #CHILDTAG, MAX, parenttag); \ + HANDLE_ERROR; \ + } \ } -#define INVALID_TAG(CHILDTAG) \ - { char* parenttag = get_parenttag(); \ - gedcom_error("The tag '%s' is not a valid tag within '%s'", \ - CHILDTAG, parenttag); \ - YYERROR; \ +#define INVALID_TAG(CHILDTAG) \ + { char* parenttag = get_parenttag(); \ + gedcom_error("The tag '%s' is not a valid tag within '%s'", \ + CHILDTAG, parenttag); \ + HANDLE_ERROR; \ } -#define INVALID_TOP_TAG(CHILDTAG) \ - { gedcom_error("The tag '%s' is not a valid top-level tag", \ +#define INVALID_TOP_TAG(CHILDTAG) \ + { gedcom_error("The tag '%s' is not a valid top-level tag", \ CHILDTAG); \ - YYERROR; \ + HANDLE_ERROR; \ } %} %union { + int number; char *string; + Gedcom_ctxt ctxt; } %token_table -%expect 291 +%expect 300 %token BADTOKEN -%token OPEN +%token OPEN %token CLOSE %token ESCAPE %token DELIM @@ -343,6 +376,16 @@ int check_occurrence(int tag); %token TAG_WILL %type anystdtag +%type anytoptag +%type line_item +%type line_value +%type mand_line_item +%type mand_pointer +%type note_line_item +%type anychar +%type opt_xref +%type opt_value +%type head_sect %% @@ -369,10 +412,16 @@ record : fam_rec /**** Header ****/ /*********************************************************************/ head_sect : OPEN DELIM TAG_HEAD - { OPEN(HEAD) } + { $$ = start_record(REC_HEAD, $1, NULL, $3); + START(HEAD, $$) } head_subs - { CHECK4(SOUR, SUBM, GEDC, CHAR) } - CLOSE { } + { if (compat_mode(C_FTREE)) + CHECK3(SOUR, GEDC, CHAR) + else + CHECK4(SOUR, SUBM, GEDC, CHAR) + } + CLOSE + { end_record(REC_HEAD, $4); } ; head_subs : /* empty */ @@ -395,12 +444,16 @@ head_sub : head_sour_sect { OCCUR2(SOUR, 1, 1) } ; /* HEAD.SOUR */ -head_sour_sect : OPEN DELIM TAG_SOUR DELIM line_item - { OPEN(SOUR) } +head_sour_sect : OPEN DELIM TAG_SOUR mand_line_item + { set_compatibility($4); + $$ = start_element(ELT_HEAD_SOUR, PARENT, + $1, $3, $4, $4); + START(SOUR, $$) + } head_sour_subs { CHECK0 } CLOSE - { } + { end_element(ELT_HEAD_SOUR, PARENT, $5, NULL); } ; head_sour_subs : /* empty */ @@ -414,20 +467,41 @@ head_sour_sub : head_sour_vers_sect { OCCUR2(VERS, 0, 1) } | no_std_sub ; -head_sour_vers_sect : OPEN DELIM TAG_VERS DELIM line_item - { OPEN(VERS)} no_std_subs { CHECK0 } CLOSE - { } +head_sour_vers_sect : OPEN DELIM TAG_VERS mand_line_item + { $$ = start_element(ELT_HEAD_SOUR_VERS, PARENT, + $1, $3, $4, $4); + START(VERS, $$) + } + no_std_subs + { CHECK0 } + CLOSE + { end_element(ELT_HEAD_SOUR_VERS, + PARENT, $5, NULL); + } ; -head_sour_name_sect : OPEN DELIM TAG_NAME DELIM line_item - { OPEN(NAME) } no_std_subs { CHECK0 } CLOSE - { } +head_sour_name_sect : OPEN DELIM TAG_NAME mand_line_item + { $$ = start_element(ELT_HEAD_SOUR_NAME, PARENT, + $1, $3, $4, $4); + START(NAME, $$) + } + no_std_subs + { CHECK0 } + CLOSE + { end_element(ELT_HEAD_SOUR_NAME, + PARENT, $5, NULL); + } ; -head_sour_corp_sect : OPEN DELIM TAG_CORP DELIM line_item - { OPEN(CORP) } +head_sour_corp_sect : OPEN DELIM TAG_CORP mand_line_item + { $$ = start_element(ELT_HEAD_SOUR_CORP, PARENT, + $1, $3, $4, $4); + START(CORP, $$) + } head_sour_corp_subs { CHECK0 } CLOSE - { } + { end_element(ELT_HEAD_SOUR_CORP, + PARENT, $5, NULL); + } ; head_sour_corp_subs : /* empty */ @@ -438,12 +512,17 @@ head_sour_corp_sub : addr_struc_sub /* 0:1 */ | no_std_sub ; -head_sour_data_sect : OPEN DELIM TAG_DATA DELIM line_item - { OPEN(DATA) } +head_sour_data_sect : OPEN DELIM TAG_DATA mand_line_item + { $$ = start_element(ELT_HEAD_SOUR_DATA, PARENT, + $1, $3, $4, $4); + START(DATA, $$) + } head_sour_data_subs { CHECK0 } CLOSE - { } + { end_element(ELT_HEAD_SOUR_DATA, + PARENT, $5, NULL); + } ; head_sour_data_subs : /* empty */ @@ -455,28 +534,57 @@ head_sour_data_sub : head_sour_data_date_sect { OCCUR2(DATE, 0, 1) } | no_std_sub ; -head_sour_data_date_sect : OPEN DELIM TAG_DATE DELIM line_item - { OPEN(DATE) } no_std_subs { CHECK0 } CLOSE - { } +head_sour_data_date_sect : OPEN DELIM TAG_DATE mand_line_item + { $$ = start_element(ELT_HEAD_SOUR_DATA_DATE, + PARENT, $1, $3, $4, $4); + START(DATE, $$) + } + no_std_subs + { CHECK0 } + CLOSE + { end_element(ELT_HEAD_SOUR_DATA_DATE, + PARENT, $5, NULL); + } ; -head_sour_data_copr_sect : OPEN DELIM TAG_COPR DELIM line_item - { OPEN(COPR) } no_std_subs { CHECK0 } CLOSE - { } +head_sour_data_copr_sect : OPEN DELIM TAG_COPR mand_line_item + { $$ = start_element(ELT_HEAD_SOUR_DATA_COPR, + PARENT, $1, $3, $4, $4); + START(COPR, $$) + } + no_std_subs + { CHECK0 } + CLOSE + { end_element(ELT_HEAD_SOUR_DATA_COPR, + PARENT, $5, NULL); + } ; /* HEAD.DEST */ -head_dest_sect : OPEN DELIM TAG_DEST DELIM line_item - { OPEN(DEST) } no_std_subs { CHECK0 } CLOSE - { } +head_dest_sect : OPEN DELIM TAG_DEST mand_line_item + { $$ = start_element(ELT_HEAD_DEST, + PARENT, $1, $3, $4, $4); + START(DEST, $$) + } + no_std_subs + { CHECK0 } + CLOSE + { end_element(ELT_HEAD_DEST, + PARENT, $5, NULL); + } ; /* HEAD.DATE */ -head_date_sect : OPEN DELIM TAG_DATE DELIM line_item - { OPEN(DATE) } +head_date_sect : OPEN DELIM TAG_DATE mand_line_item + { $$ = start_element(ELT_HEAD_DATE, + PARENT, $1, $3, $4, $4); + START(DATE, $$) + } head_date_subs { CHECK0 } CLOSE - { } + { end_element(ELT_HEAD_DATE, + PARENT, $5, NULL); + } ; head_date_subs : /* empty */ @@ -487,38 +595,80 @@ head_date_sub : head_date_time_sect { OCCUR2(TIME, 0, 1) } | no_std_sub ; -head_date_time_sect : OPEN DELIM TAG_TIME DELIM line_item - { OPEN(TIME) } no_std_subs { CHECK0 } CLOSE - { } +head_date_time_sect : OPEN DELIM TAG_TIME mand_line_item + { $$ = start_element(ELT_HEAD_DATE_TIME, + PARENT, $1, $3, $4, $4); + START(TIME, $$) + } + no_std_subs + { CHECK0 } + CLOSE + { end_element(ELT_HEAD_DATE_TIME, + PARENT, $5, NULL); + } ; /* HEAD.SUBM */ -head_subm_sect : OPEN DELIM TAG_SUBM DELIM POINTER - { OPEN(SUBM) } no_std_subs { CHECK0 } CLOSE - { } +head_subm_sect : OPEN DELIM TAG_SUBM mand_pointer + { $$ = start_element(ELT_HEAD_SUBM, + PARENT, $1, $3, $4, $4); + START(SUBM, $$) + } + no_std_subs + { CHECK0 } + CLOSE + { end_element(ELT_HEAD_SUBM, + PARENT, $5, NULL); + } ; /* HEAD.SUBN */ -head_subn_sect : OPEN DELIM TAG_SUBN DELIM POINTER - { OPEN(SUBN) } no_std_subs { CHECK0 } CLOSE - { } +head_subn_sect : OPEN DELIM TAG_SUBN mand_pointer + { $$ = start_element(ELT_HEAD_SUBN, + PARENT, $1, $3, $4, $4); + START(SUBN, $$) + } + no_std_subs + { CHECK0 } + CLOSE + { end_element(ELT_HEAD_SUBN, + PARENT, $5, NULL); + } ; /* HEAD.FILE */ -head_file_sect : OPEN DELIM TAG_FILE DELIM line_item - { OPEN(FILE) } no_std_subs { CHECK0 } CLOSE - { } +head_file_sect : OPEN DELIM TAG_FILE mand_line_item + { $$ = start_element(ELT_HEAD_FILE, + PARENT, $1, $3, $4, $4); + START(FILE, $$) + } + no_std_subs + { CHECK0 } + CLOSE + { end_element(ELT_HEAD_FILE, PARENT, $5, NULL); + } ; /* HEAD.COPR */ -head_copr_sect : OPEN DELIM TAG_COPR DELIM line_item - { OPEN(COPR) } no_std_subs { CHECK0 } CLOSE - { } +head_copr_sect : OPEN DELIM TAG_COPR mand_line_item + { $$ = start_element(ELT_HEAD_COPR, + PARENT, $1, $3, $4, $4); + START(COPR, $$) + } + no_std_subs + { CHECK0 } + CLOSE + { end_element(ELT_HEAD_COPR, PARENT, $5, NULL); + } ; /* HEAD.GEDC */ head_gedc_sect : OPEN DELIM TAG_GEDC - { OPEN(GEDC) } + { $$ = start_element(ELT_HEAD_GEDC, + PARENT, $1, $3, NULL, NULL); + START(GEDC, $$) + } head_gedc_subs { CHECK2(VERS, FORM) } CLOSE - { } + { end_element(ELT_HEAD_GEDC, PARENT, $4, NULL); + } ; head_gedc_subs : /* empty */ @@ -529,22 +679,43 @@ head_gedc_sub : head_gedc_vers_sect { OCCUR2(VERS, 1, 1) } | head_gedc_form_sect { OCCUR2(FORM, 1, 1) } | no_std_sub ; -head_gedc_vers_sect : OPEN DELIM TAG_VERS DELIM line_item - { OPEN(VERS) } no_std_subs { CHECK0 } CLOSE - { } +head_gedc_vers_sect : OPEN DELIM TAG_VERS mand_line_item + { $$ = start_element(ELT_HEAD_GEDC_VERS, + PARENT, $1, $3, $4, $4); + START(VERS, $$) + } + no_std_subs + { CHECK0 } + CLOSE + { end_element(ELT_HEAD_GEDC_VERS, + PARENT, $5, NULL); + } ; -head_gedc_form_sect : OPEN DELIM TAG_FORM DELIM line_item - { OPEN(FORM) } no_std_subs { CHECK0 } CLOSE - { } +head_gedc_form_sect : OPEN DELIM TAG_FORM mand_line_item + { $$ = start_element(ELT_HEAD_GEDC_FORM, + PARENT, $1, $3, $4, $4); + START(FORM, $$) + } + no_std_subs + { CHECK0 } + CLOSE + { end_element(ELT_HEAD_GEDC_FORM, + PARENT, $5, NULL); + } ; /* HEAD.CHAR */ -head_char_sect : OPEN DELIM TAG_CHAR DELIM line_item - { OPEN(CHAR) } +head_char_sect : OPEN DELIM TAG_CHAR mand_line_item + { if (open_conv_to_internal($4) == 0) YYERROR; + $$ = start_element(ELT_HEAD_CHAR, + PARENT, $1, $3, $4, $4); + START(CHAR, $$) + } head_char_subs { CHECK0 } CLOSE - { } + { end_element(ELT_HEAD_CHAR, PARENT, $5, NULL); + } ; head_char_subs : /* empty */ @@ -554,23 +725,42 @@ head_char_subs : /* empty */ head_char_sub : head_char_vers_sect { OCCUR2(VERS, 0, 1) } | no_std_sub ; -head_char_vers_sect : OPEN DELIM TAG_VERS DELIM line_item - { OPEN(VERS) } no_std_subs { CHECK0 } CLOSE - { } +head_char_vers_sect : OPEN DELIM TAG_VERS mand_line_item + { $$ = start_element(ELT_HEAD_CHAR_VERS, + PARENT, $1, $3, $4, $4); + START(VERS, $$) + } + no_std_subs + { CHECK0 } + CLOSE + { end_element(ELT_HEAD_CHAR_VERS, + PARENT, $5, NULL); + } ; /* HEAD.LANG */ -head_lang_sect : OPEN DELIM TAG_LANG DELIM line_item - { OPEN(LANG) } no_std_subs { CHECK0 } CLOSE - { } +head_lang_sect : OPEN DELIM TAG_LANG mand_line_item + { $$ = start_element(ELT_HEAD_LANG, + PARENT, $1, $3, $4, $4); + START(LANG, $$) + } + no_std_subs + { CHECK0 } + CLOSE + { end_element(ELT_HEAD_LANG, PARENT, $5, NULL); + } ; /* HEAD.PLAC */ head_plac_sect : OPEN DELIM TAG_PLAC - { OPEN(PLAC) } + { $$ = start_element(ELT_HEAD_PLAC, + PARENT, $1, $3, NULL, NULL); + START(PLAC, $$) + } head_plac_subs { CHECK1(FORM) } CLOSE - { } + { end_element(ELT_HEAD_PLAC, PARENT, $4, NULL); + } ; head_plac_subs : /* empty */ @@ -580,18 +770,30 @@ head_plac_subs : /* empty */ head_plac_sub : head_plac_form_sect { OCCUR2(FORM, 1, 1) } | no_std_sub ; -head_plac_form_sect : OPEN DELIM TAG_FORM DELIM line_item - { OPEN(FORM) } no_std_subs { CHECK0 } CLOSE - { } +head_plac_form_sect : OPEN DELIM TAG_FORM mand_line_item + { $$ = start_element(ELT_HEAD_PLAC_FORM, + PARENT, $1, $3, $4, $4); + START(FORM, $$) + } + no_std_subs + { CHECK0 } + CLOSE + { end_element(ELT_HEAD_PLAC_FORM, + PARENT, $5, NULL); + } ; /* HEAD.NOTE */ -head_note_sect : OPEN DELIM TAG_NOTE DELIM line_item - { OPEN(NOTE) } +head_note_sect : OPEN DELIM TAG_NOTE mand_line_item + { $$ = start_element(ELT_HEAD_NOTE, + PARENT, $1, $3, $4, $4); + START(NOTE, $$) + } head_note_subs { CHECK0 } CLOSE - { } + { end_element(ELT_HEAD_NOTE, PARENT, $5, NULL); + } ; head_note_subs : /* empty */ @@ -605,6 +807,7 @@ head_note_sub : continuation_sub /* 0:M */ /*********************************************************************/ /**** Trailer ****/ /*********************************************************************/ +/* Don't need callbacks here, there is no information... */ trlr_sect : OPEN DELIM TAG_TRLR CLOSE { } ; @@ -612,10 +815,12 @@ trlr_sect : OPEN DELIM TAG_TRLR CLOSE { } /**** Family record ****/ /*********************************************************************/ fam_rec : OPEN DELIM POINTER DELIM TAG_FAM - { OPEN(FAM) } + { $$ = start_record(REC_FAM, $1, $3, $5); + START(FAM, $$) } fam_subs { CHECK0 } - CLOSE { } + CLOSE + { end_record(REC_FAM, $6); } ; fam_subs : /* empty */ @@ -638,32 +843,32 @@ fam_sub : fam_event_struc_sub /* 0:M */ ; /* FAM.HUSB */ -fam_husb_sect : OPEN DELIM TAG_HUSB DELIM POINTER - { OPEN(HUSB) } no_std_subs { CHECK0 } CLOSE +fam_husb_sect : OPEN DELIM TAG_HUSB mand_pointer + { START(HUSB, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* FAM.WIFE */ -fam_wife_sect : OPEN DELIM TAG_WIFE DELIM POINTER - { OPEN(WIFE) } no_std_subs { CHECK0 } CLOSE +fam_wife_sect : OPEN DELIM TAG_WIFE mand_pointer + { START(WIFE, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* FAM.CHIL */ -fam_chil_sect : OPEN DELIM TAG_CHIL DELIM POINTER - { OPEN(CHIL) } no_std_subs { CHECK0 } CLOSE +fam_chil_sect : OPEN DELIM TAG_CHIL mand_pointer + { START(CHIL, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* FAM.NCHI */ -fam_nchi_sect : OPEN DELIM TAG_NCHI DELIM line_item - { OPEN(NCHI) } no_std_subs { CHECK0 } CLOSE +fam_nchi_sect : OPEN DELIM TAG_NCHI mand_line_item + { START(NCHI, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* FAM.SUBM */ -fam_subm_sect : OPEN DELIM TAG_SUBM DELIM POINTER - { OPEN(SUBM) } no_std_subs { CHECK0 } CLOSE +fam_subm_sect : OPEN DELIM TAG_SUBM mand_pointer + { START(SUBM, NULL) } no_std_subs { CHECK0 } CLOSE { } ; @@ -671,10 +876,12 @@ fam_subm_sect : OPEN DELIM TAG_SUBM DELIM POINTER /**** Individual record ****/ /*********************************************************************/ indiv_rec : OPEN DELIM POINTER DELIM TAG_INDI - { OPEN(INDI) } + { $$ = start_record(REC_INDI, $1, $3, $5); + START(INDI, $$) } indi_subs { CHECK0 } - CLOSE { } + CLOSE + { end_record(REC_INDI, $6); } ; indi_subs : /* empty */ @@ -701,57 +908,66 @@ 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 DELIM line_item - { OPEN(RESN) } no_std_subs { CHECK0 } CLOSE { } +indi_resn_sect : OPEN DELIM TAG_RESN mand_line_item + { START(RESN, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* INDI.SEX */ -indi_sex_sect : OPEN DELIM TAG_SEX DELIM line_item - { OPEN(SEX) } no_std_subs { CHECK0 } CLOSE { } +indi_sex_sect : OPEN DELIM TAG_SEX mand_line_item + { START(SEX, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* INDI.SUBM */ -indi_subm_sect : OPEN DELIM TAG_SUBM DELIM POINTER - { OPEN(SUBM) } no_std_subs { CHECK0 } CLOSE { } +indi_subm_sect : OPEN DELIM TAG_SUBM mand_pointer + { START(SUBM, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* INDI.ALIA */ -indi_alia_sect : OPEN DELIM TAG_ALIA DELIM POINTER - { OPEN(ALIA) } no_std_subs { CHECK0 } CLOSE { } +indi_alia_sect : OPEN DELIM TAG_ALIA mand_pointer + { START(ALIA, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* INDI.ANCI */ -indi_anci_sect : OPEN DELIM TAG_ANCI DELIM POINTER - { OPEN(ANCI) } no_std_subs { CHECK0 } CLOSE { } +indi_anci_sect : OPEN DELIM TAG_ANCI mand_pointer + { START(ANCI, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* INDI.DESI */ -indi_desi_sect : OPEN DELIM TAG_DESI DELIM POINTER - { OPEN(DESI) } no_std_subs { CHECK0 } CLOSE { } +indi_desi_sect : OPEN DELIM TAG_DESI mand_pointer + { START(DESI, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* INDI.RFN */ -indi_rfn_sect : OPEN DELIM TAG_RFN DELIM line_item - { OPEN(RFN) } no_std_subs { CHECK0 } CLOSE { } +indi_rfn_sect : OPEN DELIM TAG_RFN mand_line_item + { START(RFN, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* INDI.AFN */ -indi_afn_sect : OPEN DELIM TAG_AFN DELIM line_item - { OPEN(AFN) } no_std_subs { CHECK0 } CLOSE { } +indi_afn_sect : OPEN DELIM TAG_AFN mand_line_item + { START(AFN, NULL) } no_std_subs { CHECK0 } CLOSE { } ; +/* INDI.ADDR (Only for 'ftree' compatibility) */ +ftree_addr_sect : OPEN DELIM TAG_ADDR opt_line_item + { START(ADDR, NULL) } no_std_subs { CHECK0 } CLOSE { } + /*********************************************************************/ /**** Multimedia record ****/ /*********************************************************************/ multim_rec : OPEN DELIM POINTER DELIM TAG_OBJE - { OPEN(OBJE) } + { $$ = start_record(REC_OBJE, $1, $3, $5); + START(OBJE, $$) } obje_subs { CHECK2(FORM, BLOB) } - CLOSE { } + CLOSE + { end_record(REC_OBJE, $6); } ; obje_subs : /* empty */ @@ -769,18 +985,18 @@ obje_sub : obje_form_sect { OCCUR2(FORM, 1, 1) } ; /* OBJE.FORM */ -obje_form_sect : OPEN DELIM TAG_FORM DELIM line_item - { OPEN(FORM) } no_std_subs { CHECK0 } CLOSE { } +obje_form_sect : OPEN DELIM TAG_FORM mand_line_item + { START(FORM, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* OBJE.TITL */ -obje_titl_sect : OPEN DELIM TAG_TITL DELIM line_item - { OPEN(TITL) } no_std_subs { CHECK0 } CLOSE { } +obje_titl_sect : OPEN DELIM TAG_TITL mand_line_item + { START(TITL, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* OBJE.BLOB */ obje_blob_sect : OPEN DELIM TAG_BLOB - { OPEN(BLOB) } + { START(BLOB, NULL) } obje_blob_subs { CHECK1(CONT) } CLOSE { } @@ -794,25 +1010,37 @@ obje_blob_sub : obje_blob_cont_sect { OCCUR1(CONT, 1) } | no_std_sub ; -obje_blob_cont_sect : OPEN DELIM TAG_CONT DELIM line_item - { OPEN(CONT) } no_std_subs { CHECK0 } CLOSE { } +obje_blob_cont_sect : OPEN DELIM TAG_CONT mand_line_item + { START(CONT, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* OBJE.OBJE */ -obje_obje_sect : OPEN DELIM TAG_OBJE DELIM POINTER - { OPEN(OBJE) } no_std_subs { CHECK0 } CLOSE { } +obje_obje_sect : OPEN DELIM TAG_OBJE mand_pointer + { START(OBJE, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /*********************************************************************/ /**** Note record ****/ /*********************************************************************/ -note_rec : OPEN DELIM POINTER DELIM TAG_NOTE DELIM line_item - { OPEN(NOTE) } +note_rec : OPEN DELIM POINTER DELIM TAG_NOTE note_line_item + { $$ = start_record(REC_NOTE, $1, $3, $5); + START(NOTE, $$) } note_subs { CHECK0 } - CLOSE { } + CLOSE + { end_record(REC_NOTE, $6); } ; +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 ; @@ -828,10 +1056,12 @@ note_sub : continuation_sub /* 0:M */ /**** Repository record ****/ /*********************************************************************/ repos_rec : OPEN DELIM POINTER DELIM TAG_REPO - { OPEN(REPO) } + { $$ = start_record(REC_REPO, $1, $3, $5); + START(REPO, $$) } repo_subs { CHECK0 } - CLOSE { } + CLOSE + { end_record(REC_REPO, $6); } ; repo_subs : /* empty */ @@ -847,18 +1077,20 @@ repo_sub : repo_name_sect { OCCUR2(NAME, 0, 1) } ; /* REPO.NAME */ -repo_name_sect : OPEN DELIM TAG_NAME DELIM line_item - { OPEN(NAME) } no_std_subs { CHECK0 } CLOSE {} +repo_name_sect : OPEN DELIM TAG_NAME mand_line_item + { START(NAME, NULL) } no_std_subs { CHECK0 } CLOSE {} ; /*********************************************************************/ /**** Source record ****/ /*********************************************************************/ source_rec : OPEN DELIM POINTER DELIM TAG_SOUR - { OPEN(SOUR) } + { $$ = start_record(REC_SOUR, $1, $3, $5); + START(SOUR, $$) } sour_subs { CHECK0 } - CLOSE { } + CLOSE + { end_record(REC_SOUR, $6); } ; sour_subs : /* empty */ @@ -881,7 +1113,7 @@ sour_sub : sour_data_sect { OCCUR2(DATA, 0, 1) } /* SOUR.DATA */ sour_data_sect : OPEN DELIM TAG_DATA - { OPEN(DATA) } + { START(DATA, NULL) } sour_data_subs { CHECK0 } CLOSE { } @@ -897,8 +1129,8 @@ sour_data_sub : sour_data_even_sect /* 0:M */ | no_std_sub ; -sour_data_even_sect : OPEN DELIM TAG_EVEN DELIM line_item - { OPEN(EVEN) } +sour_data_even_sect : OPEN DELIM TAG_EVEN mand_line_item + { START(EVEN, NULL) } sour_data_even_subs { CHECK0 } CLOSE { } @@ -913,21 +1145,21 @@ sour_data_even_sub : sour_data_even_date_sect { OCCUR2(DATE, 0, 1) } | no_std_sub ; -sour_data_even_date_sect : OPEN DELIM TAG_DATE DELIM line_item - { OPEN(DATE) } no_std_subs { CHECK0 } CLOSE { } +sour_data_even_date_sect : OPEN DELIM TAG_DATE mand_line_item + { START(DATE, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -sour_data_even_plac_sect : OPEN DELIM TAG_PLAC DELIM line_item - { OPEN(PLAC) } no_std_subs { CHECK0 } CLOSE { } +sour_data_even_plac_sect : OPEN DELIM TAG_PLAC mand_line_item + { START(PLAC, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -sour_data_agnc_sect : OPEN DELIM TAG_AGNC DELIM line_item - { OPEN(AGNC) } no_std_subs { CHECK0 } CLOSE { } +sour_data_agnc_sect : OPEN DELIM TAG_AGNC mand_line_item + { START(AGNC, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* SOUR.AUTH */ -sour_auth_sect : OPEN DELIM TAG_AUTH DELIM line_item - { OPEN(AUTH) } +sour_auth_sect : OPEN DELIM TAG_AUTH mand_line_item + { START(AUTH, NULL) } sour_auth_subs { CHECK0 } CLOSE { } @@ -942,8 +1174,8 @@ sour_auth_sub : continuation_sub /* 0:M */ ; /* SOUR.TITL */ -sour_titl_sect : OPEN DELIM TAG_TITL DELIM line_item - { OPEN(TITL) } +sour_titl_sect : OPEN DELIM TAG_TITL mand_line_item + { START(TITL, NULL) } sour_titl_subs { CHECK0 } CLOSE { } @@ -958,13 +1190,13 @@ sour_titl_sub : continuation_sub /* 0:M */ ; /* SOUR.ABBR */ -sour_abbr_sect : OPEN DELIM TAG_ABBR DELIM line_item - { OPEN(ABBR) } no_std_subs { CHECK0 } CLOSE { } +sour_abbr_sect : OPEN DELIM TAG_ABBR mand_line_item + { START(ABBR, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* SOUR.PUBL */ -sour_publ_sect : OPEN DELIM TAG_PUBL DELIM line_item - { OPEN(PUBL) } +sour_publ_sect : OPEN DELIM TAG_PUBL mand_line_item + { START(PUBL, NULL) } sour_publ_subs { CHECK0 } CLOSE { } @@ -979,8 +1211,8 @@ sour_publ_sub : continuation_sub /* 0:M */ ; /* SOUR.TEXT */ -sour_text_sect : OPEN DELIM TAG_TEXT DELIM line_item - { OPEN(TEXT) } +sour_text_sect : OPEN DELIM TAG_TEXT mand_line_item + { START(TEXT, NULL) } sour_text_subs { CHECK0 } CLOSE { } @@ -998,10 +1230,12 @@ sour_text_sub : continuation_sub /* 0:M */ /**** Submission record ****/ /*********************************************************************/ submis_rec : OPEN DELIM POINTER DELIM TAG_SUBN - { OPEN(SUBN) } + { $$ = start_record(REC_SUBN, $1, $3, $5); + START(SUBN, $$) } subn_subs { CHECK0 } - CLOSE { } + CLOSE + { end_record(REC_SUBN, $6); } ; subn_subs : /* empty */ @@ -1019,48 +1253,50 @@ subn_sub : subn_subm_sect { OCCUR2(SUBM, 0, 1) } ; /* SUBN.SUBM */ -subn_subm_sect : OPEN DELIM TAG_SUBM DELIM POINTER - { OPEN(SUBM) } no_std_subs { CHECK0 } CLOSE { } +subn_subm_sect : OPEN DELIM TAG_SUBM mand_pointer + { START(SUBM, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* SUBN.FAMF */ -subn_famf_sect : OPEN DELIM TAG_FAMF DELIM line_item - { OPEN(FAMF) } no_std_subs { CHECK0 } CLOSE { } +subn_famf_sect : OPEN DELIM TAG_FAMF mand_line_item + { START(FAMF, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* SUBN.TEMP */ -subn_temp_sect : OPEN DELIM TAG_TEMP DELIM line_item - { OPEN(TEMP) } no_std_subs { CHECK0 } CLOSE { } +subn_temp_sect : OPEN DELIM TAG_TEMP mand_line_item + { START(TEMP, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* SUBN.ANCE */ -subn_ance_sect : OPEN DELIM TAG_ANCE DELIM line_item - { OPEN(ANCE) } no_std_subs { CHECK0 } CLOSE { } +subn_ance_sect : OPEN DELIM TAG_ANCE mand_line_item + { START(ANCE, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* SUBN.DESC */ -subn_desc_sect : OPEN DELIM TAG_DESC DELIM line_item - { OPEN(DESC) } no_std_subs { CHECK0 } CLOSE { } +subn_desc_sect : OPEN DELIM TAG_DESC mand_line_item + { START(DESC, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* SUBN.ORDI */ -subn_ordi_sect : OPEN DELIM TAG_ORDI DELIM line_item - { OPEN(ORDI) } no_std_subs { CHECK0 } CLOSE { } +subn_ordi_sect : OPEN DELIM TAG_ORDI mand_line_item + { START(ORDI, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* SUBN.RIN */ -subn_rin_sect : OPEN DELIM TAG_RIN DELIM line_item - { OPEN(RIN) } no_std_subs { CHECK0 } CLOSE { } +subn_rin_sect : OPEN DELIM TAG_RIN mand_line_item + { START(RIN, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /*********************************************************************/ /**** Submitter record ****/ /*********************************************************************/ submit_rec : OPEN DELIM POINTER DELIM TAG_SUBM - { OPEN(SUBM) } + { $$ = start_record(REC_SUBM, $1, $3, $5); + START(SUBM, $$) } subm_subs { CHECK1(NAME) } - CLOSE { } + CLOSE + { end_record(REC_SUBM, $6); } ; subm_subs : /* empty */ @@ -1078,23 +1314,23 @@ subm_sub : subm_name_sect { OCCUR2(NAME, 0, 1) } ; /* SUBM.NAME */ -subm_name_sect : OPEN DELIM TAG_NAME DELIM line_item - { OPEN(NAME) } no_std_subs { CHECK0 } CLOSE { } +subm_name_sect : OPEN DELIM TAG_NAME mand_line_item + { START(NAME, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* SUBM.LANG */ -subm_lang_sect : OPEN DELIM TAG_LANG DELIM line_item - { OPEN(LANG) } no_std_subs { CHECK0 } CLOSE { } +subm_lang_sect : OPEN DELIM TAG_LANG mand_line_item + { START(LANG, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* SUBM.RFN */ -subm_rfn_sect : OPEN DELIM TAG_RFN DELIM line_item - { OPEN(RFN) } no_std_subs { CHECK0 } CLOSE { } +subm_rfn_sect : OPEN DELIM TAG_RFN mand_line_item + { START(RFN, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* SUBM.RIN */ -subm_rin_sect : OPEN DELIM TAG_RIN DELIM line_item - { OPEN(RIN) } no_std_subs { CHECK0 } CLOSE { } +subm_rin_sect : OPEN DELIM TAG_RIN mand_line_item + { START(RIN, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /*********************************************************************/ @@ -1106,8 +1342,8 @@ addr_struc_sub : addr_sect { OCCUR2(ADDR, 0, 1) } | phon_sect { OCCUR2(PHON, 0, 3) } ; -addr_sect : OPEN DELIM TAG_ADDR DELIM line_item - { OPEN(ADDR) } +addr_sect : OPEN DELIM TAG_ADDR mand_line_item + { START(ADDR, NULL) } addr_subs { CHECK0 } CLOSE { } @@ -1127,38 +1363,38 @@ addr_sub : addr_cont_sect /* 0:M */ | no_std_sub ; -addr_cont_sect : OPEN DELIM TAG_CONT DELIM line_item - { OPEN(CONT) } no_std_subs { CHECK0 } CLOSE { } +addr_cont_sect : OPEN DELIM TAG_CONT mand_line_item + { START(CONT, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -addr_adr1_sect : OPEN DELIM TAG_ADR1 DELIM line_item - { OPEN(ADR1) } no_std_subs { CHECK0 } CLOSE { } +addr_adr1_sect : OPEN DELIM TAG_ADR1 mand_line_item + { START(ADR1, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -addr_adr2_sect : OPEN DELIM TAG_ADR2 DELIM line_item - { OPEN(ADR2) } no_std_subs { CHECK0 } CLOSE { } +addr_adr2_sect : OPEN DELIM TAG_ADR2 mand_line_item + { START(ADR2, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -addr_city_sect : OPEN DELIM TAG_CITY DELIM line_item - { OPEN(CITY) } no_std_subs { CHECK0 } CLOSE { } +addr_city_sect : OPEN DELIM TAG_CITY mand_line_item + { START(CITY, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -addr_stae_sect : OPEN DELIM TAG_STAE DELIM line_item - { OPEN(STAE) } no_std_subs { CHECK0 } CLOSE { } +addr_stae_sect : OPEN DELIM TAG_STAE mand_line_item + { START(STAE, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -addr_post_sect : OPEN DELIM TAG_POST DELIM line_item - { OPEN(POST) } no_std_subs { CHECK0 } CLOSE { } +addr_post_sect : OPEN DELIM TAG_POST mand_line_item + { START(POST, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -addr_ctry_sect : OPEN DELIM TAG_CTRY DELIM line_item - { OPEN(CTRY) } no_std_subs { CHECK0 } CLOSE { } +addr_ctry_sect : OPEN DELIM TAG_CTRY mand_line_item + { START(CTRY, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -phon_sect : OPEN DELIM TAG_PHON DELIM line_item - { OPEN(PHON) } no_std_subs { CHECK0 } CLOSE { } +phon_sect : OPEN DELIM TAG_PHON mand_line_item + { START(PHON, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* ASSOCIATION STRUCTURE */ assoc_struc_sub : asso_sect /* 0:M */ ; -asso_sect : OPEN DELIM TAG_ASSO DELIM POINTER - { OPEN(ASSO) } +asso_sect : OPEN DELIM TAG_ASSO mand_pointer + { START(ASSO, NULL) } asso_subs { CHECK2(TYPE,RELA) } CLOSE { } @@ -1172,12 +1408,12 @@ asso_subs : /* empty */ | no_std_sub ; -asso_type_sect : OPEN DELIM TAG_TYPE DELIM line_item - { OPEN(TYPE) } no_std_subs { CHECK0 } CLOSE { } +asso_type_sect : OPEN DELIM TAG_TYPE mand_line_item + { START(TYPE, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -asso_rela_sect : OPEN DELIM TAG_RELA DELIM line_item - { OPEN(RELA) } no_std_subs { CHECK0 } CLOSE { } +asso_rela_sect : OPEN DELIM TAG_RELA mand_line_item + { START(RELA, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* CHANGE DATE */ @@ -1185,7 +1421,7 @@ change_date_sub : change_date_chan_sect { OCCUR2(CHAN, 0, 1) } ; change_date_chan_sect : OPEN DELIM TAG_CHAN - { OPEN(CHAN) } + { START(CHAN, NULL) } change_date_chan_subs { CHECK1(DATE) } CLOSE { } @@ -1200,8 +1436,8 @@ change_date_chan_sub : change_date_date_sect { OCCUR2(DATE, 1, 1) } | no_std_sub ; -change_date_date_sect : OPEN DELIM TAG_DATE DELIM line_item - { OPEN(DATE) } +change_date_date_sect : OPEN DELIM TAG_DATE mand_line_item + { START(DATE, NULL) } change_date_date_subs { CHECK0 } CLOSE { } @@ -1215,16 +1451,16 @@ change_date_date_sub : change_date_date_time_sect { OCCUR2(TIME, 0, 1) } | no_std_sub ; -change_date_date_time_sect : OPEN DELIM TAG_TIME DELIM line_item - { OPEN(TIME) } no_std_subs { CHECK0 } CLOSE { } +change_date_date_time_sect : OPEN DELIM TAG_TIME mand_line_item + { START(TIME, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* CHILD TO FAMILY LINK */ chi_fam_link_sub : famc_sect /* 0:M */ ; -famc_sect : OPEN DELIM TAG_FAMC DELIM POINTER - { OPEN(FAMC) } +famc_sect : OPEN DELIM TAG_FAMC mand_pointer + { START(FAMC, NULL) } famc_subs { CHECK0 } CLOSE { } @@ -1239,8 +1475,8 @@ famc_sub : famc_pedi_sect /* 0:M */ | no_std_sub ; -famc_pedi_sect : OPEN DELIM TAG_PEDI DELIM line_item - { OPEN(PEDI) } no_std_subs { CHECK0 } CLOSE { } +famc_pedi_sect : OPEN DELIM TAG_PEDI mand_line_item + { START(PEDI, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* CONTINUATION SUBSECTIONS */ @@ -1248,12 +1484,12 @@ continuation_sub : cont_sect /* 0:M */ | conc_sect /* 0:M */ ; -cont_sect : OPEN DELIM TAG_CONT DELIM line_item - { OPEN(CONT) } no_std_subs { CHECK0 } CLOSE { } +cont_sect : OPEN DELIM TAG_CONT mand_line_item + { START(CONT, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -conc_sect : OPEN DELIM TAG_CONC DELIM line_item - { OPEN(CONC) } no_std_subs { CHECK0 } CLOSE { } +conc_sect : OPEN DELIM TAG_CONC mand_line_item + { START(CONC, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* EVENT DETAIL */ @@ -1269,20 +1505,20 @@ event_detail_sub : event_detail_type_sect { OCCUR2(TYPE, 0, 1) } | note_struc_sub ; -event_detail_type_sect : OPEN DELIM TAG_TYPE DELIM line_item - { OPEN(TYPE) } no_std_subs { CHECK0 } CLOSE { } +event_detail_type_sect : OPEN DELIM TAG_TYPE mand_line_item + { START(TYPE, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -event_detail_date_sect : OPEN DELIM TAG_DATE DELIM line_item - { OPEN(DATE) } no_std_subs { CHECK0 } CLOSE { } +event_detail_date_sect : OPEN DELIM TAG_DATE mand_line_item + { START(DATE, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -event_detail_age_sect : OPEN DELIM TAG_AGE DELIM line_item - { OPEN(AGE) } no_std_subs { CHECK0 } CLOSE { } +event_detail_age_sect : OPEN DELIM TAG_AGE mand_line_item + { START(AGE, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -event_detail_agnc_sect : OPEN DELIM TAG_AGNC DELIM line_item - { OPEN(AGNC) } no_std_subs { CHECK0 } CLOSE { } +event_detail_agnc_sect : OPEN DELIM TAG_AGNC mand_line_item + { START(AGNC, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -event_detail_caus_sect : OPEN DELIM TAG_CAUS DELIM line_item - { OPEN(CAUS) } no_std_subs { CHECK0 } CLOSE { } +event_detail_caus_sect : OPEN DELIM TAG_CAUS mand_line_item + { START(CAUS, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* FAMILY EVENT STRUCTURE */ @@ -1295,16 +1531,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, NULL) } + | TAG_CENS { START(CENS, NULL) } + | TAG_DIV { START(DIV, NULL) } + | TAG_DIVF { START(DIVF, NULL) } + | TAG_ENGA { START(ENGA, NULL) } + | TAG_MARR { START(MARR, NULL) } + | TAG_MARB { START(MARB, NULL) } + | TAG_MARC { START(MARC, NULL) } + | TAG_MARL { START(MARL, NULL) } + | TAG_MARS { START(MARS, NULL) } ; fam_event_subs : /* empty */ @@ -1318,7 +1554,7 @@ fam_event_sub : event_detail_sub ; fam_even_husb_sect : OPEN DELIM TAG_HUSB - { OPEN(HUSB) } + { START(HUSB, NULL) } fam_even_husb_subs { CHECK1(AGE) } CLOSE { } @@ -1332,19 +1568,19 @@ fam_even_husb_sub : fam_even_husb_age_sect { OCCUR2(AGE, 1, 1) } | no_std_sub ; -fam_even_husb_age_sect : OPEN DELIM TAG_AGE DELIM line_item - { OPEN(AGE) } no_std_subs { CHECK0 } CLOSE { } +fam_even_husb_age_sect : OPEN DELIM TAG_AGE mand_line_item + { START(AGE, NULL) } no_std_subs { CHECK0 } CLOSE { } ; fam_even_wife_sect : OPEN DELIM TAG_WIFE - { OPEN(HUSB) } + { START(HUSB, NULL) } fam_even_husb_subs { CHECK1(AGE) } CLOSE { } ; fam_gen_even_sect : OPEN DELIM TAG_EVEN - { OPEN(EVEN) } + { START(EVEN, NULL) } fam_gen_even_subs { CHECK0 } CLOSE { } @@ -1365,8 +1601,8 @@ ident_struc_sub : ident_refn_sect /* 0:M */ | ident_rin_sect { OCCUR2(RIN, 0, 1) } ; -ident_refn_sect : OPEN DELIM TAG_REFN DELIM line_item - { OPEN(REFN) } +ident_refn_sect : OPEN DELIM TAG_REFN mand_line_item + { START(REFN, NULL) } ident_refn_subs { CHECK0 } CLOSE { } @@ -1380,12 +1616,12 @@ ident_refn_sub : ident_refn_type_sect { OCCUR2(TYPE, 0, 1) } | no_std_sub ; -ident_refn_type_sect : OPEN DELIM TAG_TYPE DELIM line_item - { OPEN(TYPE) } no_std_subs { CHECK0 } CLOSE { } +ident_refn_type_sect : OPEN DELIM TAG_TYPE mand_line_item + { START(TYPE, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -ident_rin_sect : OPEN DELIM TAG_RIN DELIM line_item - { OPEN(RIN) } no_std_subs { CHECK0 } CLOSE { } +ident_rin_sect : OPEN DELIM TAG_RIN mand_line_item + { START(RIN, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* INDIVIDUAL ATTRIBUTE STRUCTURE */ @@ -1404,80 +1640,80 @@ indiv_attr_struc_sub : indiv_cast_sect /* 0:M */ | indiv_titl_sect /* 0:M */ ; -indiv_cast_sect : OPEN DELIM TAG_CAST DELIM line_item - { OPEN(CAST) } +indiv_cast_sect : OPEN DELIM TAG_CAST mand_line_item + { START(CAST, NULL) } indiv_attr_event_subs { CHECK0 } CLOSE { } ; -indiv_dscr_sect : OPEN DELIM TAG_DSCR DELIM line_item - { OPEN(DSCR) } +indiv_dscr_sect : OPEN DELIM TAG_DSCR mand_line_item + { START(DSCR, NULL) } indiv_attr_event_subs { CHECK0 } CLOSE { } ; -indiv_educ_sect : OPEN DELIM TAG_EDUC DELIM line_item - { OPEN(EDUC) } +indiv_educ_sect : OPEN DELIM TAG_EDUC mand_line_item + { START(EDUC, NULL) } indiv_attr_event_subs { CHECK0 } CLOSE { } ; -indiv_idno_sect : OPEN DELIM TAG_IDNO DELIM line_item - { OPEN(IDNO) } +indiv_idno_sect : OPEN DELIM TAG_IDNO mand_line_item + { START(IDNO, NULL) } indiv_attr_event_subs { CHECK0 } CLOSE { } ; -indiv_nati_sect : OPEN DELIM TAG_NATI DELIM line_item - { OPEN(NATI) } +indiv_nati_sect : OPEN DELIM TAG_NATI mand_line_item + { START(NATI, NULL) } indiv_attr_event_subs { CHECK0 } CLOSE { } ; -indiv_nchi_sect : OPEN DELIM TAG_NCHI DELIM line_item - { OPEN(NCHI) } +indiv_nchi_sect : OPEN DELIM TAG_NCHI mand_line_item + { START(NCHI, NULL) } indiv_attr_event_subs { CHECK0 } CLOSE { } ; -indiv_nmr_sect : OPEN DELIM TAG_NMR DELIM line_item - { OPEN(NMR) } +indiv_nmr_sect : OPEN DELIM TAG_NMR mand_line_item + { START(NMR, NULL) } indiv_attr_event_subs { CHECK0 } CLOSE { } ; -indiv_occu_sect : OPEN DELIM TAG_OCCU DELIM line_item - { OPEN(OCCU) } +indiv_occu_sect : OPEN DELIM TAG_OCCU mand_line_item + { START(OCCU, NULL) } indiv_attr_event_subs { CHECK0 } CLOSE { } ; -indiv_prop_sect : OPEN DELIM TAG_PROP DELIM line_item - { OPEN(PROP) } +indiv_prop_sect : OPEN DELIM TAG_PROP mand_line_item + { START(PROP, NULL) } indiv_attr_event_subs { CHECK0 } CLOSE { } ; -indiv_reli_sect : OPEN DELIM TAG_RELI DELIM line_item - { OPEN(RELI) } +indiv_reli_sect : OPEN DELIM TAG_RELI mand_line_item + { START(RELI, NULL) } indiv_attr_event_subs { CHECK0 } CLOSE { } ; indiv_resi_sect : OPEN DELIM TAG_RESI - { OPEN(RESI) } + { START(RESI, NULL) } indiv_attr_event_subs { CHECK0 } CLOSE { } ; -indiv_ssn_sect : OPEN DELIM TAG_SSN DELIM line_item - { OPEN(SSN) } +indiv_ssn_sect : OPEN DELIM TAG_SSN mand_line_item + { START(SSN, NULL) } indiv_attr_event_subs { CHECK0 } CLOSE { } ; -indiv_titl_sect : OPEN DELIM TAG_TITL DELIM line_item - { OPEN(TITL) } +indiv_titl_sect : OPEN DELIM TAG_TITL mand_line_item + { START(TITL, NULL) } indiv_attr_event_subs { CHECK0 } CLOSE { } @@ -1503,8 +1739,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, NULL) } + | TAG_CHR { START(CHR, NULL) } ; indiv_birt_subs : /* empty */ @@ -1516,8 +1752,8 @@ indiv_birt_sub : event_detail_sub | no_std_sub ; -indiv_birt_famc_sect : OPEN DELIM TAG_FAMC DELIM POINTER - { OPEN(FAMC) } no_std_subs { CHECK0 } CLOSE { } +indiv_birt_famc_sect : OPEN DELIM TAG_FAMC mand_pointer + { START(FAMC, NULL) } no_std_subs { CHECK0 } CLOSE { } ; indiv_gen_sect : OPEN DELIM indiv_gen_tag opt_value indiv_gen_subs @@ -1525,25 +1761,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, NULL) } + | TAG_BURI { START(BURI, NULL) } + | TAG_CREM { START(CREM, NULL) } + | TAG_BAPM { START(BAPM, NULL) } + | TAG_BARM { START(BARM, NULL) } + | TAG_BASM { START(BASM, NULL) } + | TAG_BLES { START(BLES, NULL) } + | TAG_CHRA { START(CHRA, NULL) } + | TAG_CONF { START(CONF, NULL) } + | TAG_FCOM { START(FCOM, NULL) } + | TAG_ORDN { START(ORDN, NULL) } + | TAG_NATU { START(NATU, NULL) } + | TAG_EMIG { START(EMIG, NULL) } + | TAG_IMMI { START(IMMI, NULL) } + | TAG_CENS { START(CENS, NULL) } + | TAG_PROB { START(PROB, NULL) } + | TAG_WILL { START(WILL, NULL) } + | TAG_GRAD { START(GRAD, NULL) } + | TAG_RETI { START(RETI, NULL) } ; indiv_gen_subs : /* empty */ @@ -1555,7 +1791,7 @@ indiv_gen_sub : event_detail_sub ; indiv_adop_sect : OPEN DELIM TAG_ADOP opt_value - { OPEN(ADOP) } + { START(ADOP, NULL) } indiv_adop_subs { CHECK0 } CLOSE { } @@ -1570,8 +1806,8 @@ indiv_adop_sub : event_detail_sub | no_std_sub ; -indiv_adop_famc_sect : OPEN DELIM TAG_FAMC DELIM POINTER - { OPEN(FAMC) } +indiv_adop_famc_sect : OPEN DELIM TAG_FAMC mand_pointer + { START(FAMC, NULL) } indiv_adop_famc_subs { CHECK0 } CLOSE { } @@ -1585,12 +1821,12 @@ indiv_adop_famc_sub : indiv_adop_famc_adop_sect { OCCUR2(ADOP,0, 1) } | no_std_sub ; -indiv_adop_famc_adop_sect : OPEN DELIM TAG_ADOP DELIM line_item - { OPEN(ADOP) } no_std_subs { CHECK0 } CLOSE { } +indiv_adop_famc_adop_sect : OPEN DELIM TAG_ADOP mand_line_item + { START(ADOP, NULL) } no_std_subs { CHECK0 } CLOSE { } ; indiv_even_sect : OPEN DELIM TAG_EVEN - { OPEN(EVEN) } + { START(EVEN, NULL) } indiv_gen_subs { CHECK0 } CLOSE { } @@ -1606,9 +1842,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, NULL) } + | TAG_CONL { START(CONL, NULL) } + | TAG_ENDL { START(ENDL, NULL) } ; lio_bapl_subs : /* empty */ @@ -1624,21 +1860,21 @@ lio_bapl_sub : lio_bapl_stat_sect { OCCUR2(STAT, 0, 1) } | no_std_sub ; -lio_bapl_stat_sect : OPEN DELIM TAG_STAT DELIM line_item - { OPEN(STAT) } no_std_subs { CHECK0 } CLOSE { } +lio_bapl_stat_sect : OPEN DELIM TAG_STAT mand_line_item + { START(STAT, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -lio_bapl_date_sect : OPEN DELIM TAG_DATE DELIM line_item - { OPEN(DATE) } no_std_subs { CHECK0 } CLOSE { } +lio_bapl_date_sect : OPEN DELIM TAG_DATE mand_line_item + { START(DATE, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -lio_bapl_temp_sect : OPEN DELIM TAG_TEMP DELIM line_item - { OPEN(TEMP) } no_std_subs { CHECK0 } CLOSE { } +lio_bapl_temp_sect : OPEN DELIM TAG_TEMP mand_line_item + { START(TEMP, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -lio_bapl_plac_sect : OPEN DELIM TAG_PLAC DELIM line_item - { OPEN(PLAC) } no_std_subs { CHECK0 } CLOSE { } +lio_bapl_plac_sect : OPEN DELIM TAG_PLAC mand_line_item + { START(PLAC, NULL) } no_std_subs { CHECK0 } CLOSE { } ; lio_slgc_sect : OPEN DELIM TAG_SLGC - { OPEN(SLGC) } + { START(SLGC, NULL) } lio_slgc_subs { CHECK1(FAMC) } CLOSE { } @@ -1652,8 +1888,8 @@ lio_slgc_sub : lio_bapl_sub | lio_slgc_famc_sect { OCCUR2(FAMC, 1, 1) } ; -lio_slgc_famc_sect : OPEN DELIM TAG_FAMC DELIM POINTER - { OPEN(FAMC) } no_std_subs { CHECK0 } CLOSE { } +lio_slgc_famc_sect : OPEN DELIM TAG_FAMC mand_pointer + { START(FAMC, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* LDS SPOUSE SEALING */ @@ -1661,7 +1897,7 @@ lds_spouse_seal_sub : lss_slgs_sect ; lss_slgs_sect : OPEN DELIM TAG_SLGS - { OPEN(SLGS) } + { START(SLGS, NULL) } lss_slgs_subs { CHECK0 } CLOSE { } @@ -1680,17 +1916,17 @@ lss_slgs_sub : lss_slgs_stat_sect { OCCUR2(STAT, 0, 1) } | no_std_sub ; -lss_slgs_stat_sect : OPEN DELIM TAG_STAT DELIM line_item - { OPEN(STAT) } no_std_subs { CHECK0 } CLOSE { } +lss_slgs_stat_sect : OPEN DELIM TAG_STAT mand_line_item + { START(STAT, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -lss_slgs_date_sect : OPEN DELIM TAG_DATE DELIM line_item - { OPEN(DATE) } no_std_subs { CHECK0 } CLOSE { } +lss_slgs_date_sect : OPEN DELIM TAG_DATE mand_line_item + { START(DATE, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -lss_slgs_temp_sect : OPEN DELIM TAG_TEMP DELIM line_item - { OPEN(TEMP) } no_std_subs { CHECK0 } CLOSE { } +lss_slgs_temp_sect : OPEN DELIM TAG_TEMP mand_line_item + { START(TEMP, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -lss_slgs_plac_sect : OPEN DELIM TAG_PLAC DELIM line_item - { OPEN(PLAC) } no_std_subs { CHECK0 } CLOSE { } +lss_slgs_plac_sect : OPEN DELIM TAG_PLAC mand_line_item + { START(PLAC, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* MULTIMEDIA LINK */ @@ -1699,11 +1935,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, NULL) } no_std_subs { CHECK0 } CLOSE { } ; multim_obje_emb_sect : OPEN DELIM TAG_OBJE - { OPEN(OBJE) } + { START(OBJE, NULL) } multim_obje_emb_subs { CHECK2(FORM,FILE) } CLOSE { } @@ -1720,14 +1956,14 @@ multim_obje_emb_sub : multim_obje_form_sect { OCCUR2(FORM, 1, 1) } | no_std_sub ; -multim_obje_form_sect : OPEN DELIM TAG_FORM DELIM line_item - { OPEN(FORM) } no_std_subs { CHECK0 } CLOSE { } +multim_obje_form_sect : OPEN DELIM TAG_FORM mand_line_item + { START(FORM, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -multim_obje_titl_sect : OPEN DELIM TAG_TITL DELIM line_item - { OPEN(TITL) } no_std_subs { CHECK0 } CLOSE { } +multim_obje_titl_sect : OPEN DELIM TAG_TITL mand_line_item + { START(TITL, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -multim_obje_file_sect : OPEN DELIM TAG_FILE DELIM line_item - { OPEN(FILE) } no_std_subs { CHECK0 } CLOSE { } +multim_obje_file_sect : OPEN DELIM TAG_FILE mand_line_item + { START(FILE, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* NOTE STRUCTURE */ @@ -1736,7 +1972,7 @@ note_struc_sub : note_struc_link_sect /* 0:M */ ; note_struc_link_sect : OPEN DELIM TAG_NOTE DELIM POINTER - { OPEN(NOTE) } + { START(NOTE, NULL) } note_struc_link_subs { CHECK0 } CLOSE { } @@ -1751,7 +1987,7 @@ note_struc_link_sub : source_cit_sub ; note_struc_emb_sect : OPEN DELIM TAG_NOTE opt_line_item - { OPEN(NOTE) } + { START(NOTE, NULL) } note_struc_emb_subs { CHECK0 } CLOSE { } @@ -1770,8 +2006,8 @@ note_struc_emb_sub : continuation_sub pers_name_struc_sub : pers_name_sect /* 0:M */ ; -pers_name_sect : OPEN DELIM TAG_NAME DELIM line_item - { OPEN(NAME) } +pers_name_sect : OPEN DELIM TAG_NAME mand_line_item + { START(NAME, NULL) } pers_name_subs { CHECK0 } CLOSE { } @@ -1792,31 +2028,31 @@ pers_name_sub : pers_name_npfx_sect { OCCUR2(NPFX, 0, 1) } | no_std_sub ; -pers_name_npfx_sect : OPEN DELIM TAG_NPFX DELIM line_item - { OPEN(NPFX) } no_std_subs { CHECK0 } CLOSE { } +pers_name_npfx_sect : OPEN DELIM TAG_NPFX mand_line_item + { START(NPFX, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -pers_name_givn_sect : OPEN DELIM TAG_GIVN DELIM line_item - { OPEN(GIVN) } no_std_subs { CHECK0 } CLOSE { } +pers_name_givn_sect : OPEN DELIM TAG_GIVN mand_line_item + { START(GIVN, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -pers_name_nick_sect : OPEN DELIM TAG_NICK DELIM line_item - { OPEN(NICK) } no_std_subs { CHECK0 } CLOSE { } +pers_name_nick_sect : OPEN DELIM TAG_NICK mand_line_item + { START(NICK, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -pers_name_spfx_sect : OPEN DELIM TAG_SPFX DELIM line_item - { OPEN(SPFX) } no_std_subs { CHECK0 } CLOSE { } +pers_name_spfx_sect : OPEN DELIM TAG_SPFX mand_line_item + { START(SPFX, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -pers_name_surn_sect : OPEN DELIM TAG_SURN DELIM line_item - { OPEN(SURN) } no_std_subs { CHECK0 } CLOSE { } +pers_name_surn_sect : OPEN DELIM TAG_SURN mand_line_item + { START(SURN, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -pers_name_nsfx_sect : OPEN DELIM TAG_NSFX DELIM line_item - { OPEN(NSFX) } no_std_subs { CHECK0 } CLOSE { } +pers_name_nsfx_sect : OPEN DELIM TAG_NSFX mand_line_item + { START(NSFX, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* PLACE STRUCTURE */ place_struc_sub : place_struc_plac_sect /* 0:M */ ; -place_struc_plac_sect : OPEN DELIM TAG_PLAC DELIM line_item - { OPEN(PLAC) } +place_struc_plac_sect : OPEN DELIM TAG_PLAC mand_line_item + { START(PLAC, NULL) } place_struc_plac_subs { CHECK0 } CLOSE { } @@ -1832,8 +2068,8 @@ place_struc_plac_sub : place_plac_form_sect { OCCUR2(FORM, 0, 1) } | no_std_sub ; -place_plac_form_sect : OPEN DELIM TAG_FORM DELIM line_item - { OPEN(FORM) } no_std_subs { CHECK0 } CLOSE { } +place_plac_form_sect : OPEN DELIM TAG_FORM mand_line_item + { START(FORM, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* SOURCE_CITATION */ @@ -1842,7 +2078,7 @@ source_cit_sub : source_cit_link_sect /* 0:M */ ; source_cit_link_sect : OPEN DELIM TAG_SOUR DELIM POINTER - { OPEN(SOUR) } + { START(SOUR, NULL) } source_cit_link_subs { CHECK0 } CLOSE { } @@ -1861,12 +2097,12 @@ source_cit_link_sub : source_cit_page_sect { OCCUR2(PAGE, 0, 1) } | no_std_sub ; -source_cit_page_sect : OPEN DELIM TAG_PAGE DELIM line_item - { OPEN(PAGE) } no_std_subs { CHECK0 } CLOSE { } +source_cit_page_sect : OPEN DELIM TAG_PAGE mand_line_item + { START(PAGE, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -source_cit_even_sect : OPEN DELIM TAG_EVEN DELIM line_item - { OPEN(EVEN) } +source_cit_even_sect : OPEN DELIM TAG_EVEN mand_line_item + { START(EVEN, NULL) } source_cit_even_subs { CHECK0 } CLOSE { } @@ -1880,12 +2116,12 @@ source_cit_even_sub : source_cit_even_role_sect { OCCUR2(ROLE, 0, 1) } | no_std_sub ; -source_cit_even_role_sect : OPEN DELIM TAG_ROLE DELIM line_item - { OPEN(ROLE) } no_std_subs { CHECK0 } CLOSE { } +source_cit_even_role_sect : OPEN DELIM TAG_ROLE mand_line_item + { START(ROLE, NULL) } no_std_subs { CHECK0 } CLOSE { } ; source_cit_data_sect : OPEN DELIM TAG_DATA - { OPEN(DATA) } + { START(DATA, NULL) } source_cit_data_subs { CHECK0 } CLOSE { } @@ -1900,12 +2136,12 @@ source_cit_data_sub : source_cit_data_date_sect { OCCUR2(DATE, 0, 1) } | no_std_sub ; -source_cit_data_date_sect : OPEN DELIM TAG_DATE DELIM line_item - { OPEN(DATE) } no_std_subs { CHECK0 } CLOSE { } +source_cit_data_date_sect : OPEN DELIM TAG_DATE mand_line_item + { START(DATE, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -source_cit_text_sect : OPEN DELIM TAG_TEXT DELIM line_item - { OPEN(TEXT) } +source_cit_text_sect : OPEN DELIM TAG_TEXT mand_line_item + { START(TEXT, NULL) } source_cit_text_subs { CHECK0 } CLOSE { } @@ -1919,12 +2155,12 @@ source_cit_text_sub : continuation_sub | no_std_sub ; -source_cit_quay_sect : OPEN DELIM TAG_QUAY DELIM line_item - { OPEN(QUAY) } no_std_subs { CHECK0 } CLOSE { } +source_cit_quay_sect : OPEN DELIM TAG_QUAY mand_line_item + { START(QUAY, NULL) } no_std_subs { CHECK0 } CLOSE { } ; -source_cit_emb_sect : OPEN DELIM TAG_SOUR DELIM line_item - { OPEN(SOUR) } +source_cit_emb_sect : OPEN DELIM TAG_SOUR mand_line_item + { START(SOUR, NULL) } source_cit_emb_subs { CHECK0 } CLOSE { } @@ -1944,8 +2180,8 @@ source_cit_emb_sub : continuation_sub source_repos_cit_sub : source_repos_repo_sect { OCCUR2(REPO, 0, 1) } ; -source_repos_repo_sect : OPEN DELIM TAG_REPO DELIM POINTER - { OPEN(REPO) } +source_repos_repo_sect : OPEN DELIM TAG_REPO mand_pointer + { START(REPO, NULL) } source_repos_repo_subs { CHECK0 } CLOSE { } @@ -1960,8 +2196,8 @@ source_repos_repo_sub : note_struc_sub | no_std_sub ; -caln_sect : OPEN DELIM TAG_CALN DELIM line_item - { OPEN(CALN) } +caln_sect : OPEN DELIM TAG_CALN mand_line_item + { START(CALN, NULL) } caln_subs { CHECK0 } CLOSE { } @@ -1975,16 +2211,16 @@ caln_sub : caln_medi_sect { OCCUR2(MEDI, 0, 1) } | no_std_sub ; -caln_medi_sect : OPEN DELIM TAG_MEDI DELIM line_item - { OPEN(MEDI) } no_std_subs { CHECK0 } CLOSE { } +caln_medi_sect : OPEN DELIM TAG_MEDI mand_line_item + { START(MEDI, NULL) } no_std_subs { CHECK0 } CLOSE { } ; /* SPOUSE TO FAMILY LINK */ spou_fam_link_sub : spou_fam_fams_sect /* 0:M */ ; -spou_fam_fams_sect : OPEN DELIM TAG_FAMS DELIM POINTER - { OPEN(FAMS) } +spou_fam_fams_sect : OPEN DELIM TAG_FAMS mand_pointer + { START(FAMS, NULL) } spou_fam_fams_subs { CHECK0 } CLOSE { } @@ -2023,9 +2259,15 @@ user_rec : OPEN DELIM opt_xref USERTAG YYERROR; } } - opt_value user_sects CLOSE { } + opt_value + { $$ = start_record(REC_USER, $1, $3, $4); + START($4, $$) + } + user_sects + { CHECK0 } + CLOSE + { end_record(REC_USER, $7); } ; - user_sect : OPEN DELIM opt_xref USERTAG { if ($4[0] != '_') { gedcom_error("Undefined tag (and not a valid user tag): %s", @@ -2033,33 +2275,77 @@ user_sect : OPEN DELIM opt_xref USERTAG YYERROR; } } - opt_value user_sects CLOSE { } + opt_value + { $$ = start_element(ELT_USER, PARENT, $1, $4, $6, $6); + START($4, $$); + } + user_sects + { CHECK0 } + CLOSE + { end_element(ELT_USER, PARENT, $7, NULL); + } ; user_sects : /* empty */ { } | user_sects user_sect { } ; -opt_xref : /* empty */ { } - | POINTER DELIM { } +opt_xref : /* empty */ { $$ = NULL; } + | POINTER DELIM { $$ = $1; } ; -opt_value : /* empty */ { } - | DELIM line_value { } +opt_value : /* empty */ { $$ = NULL; } + | DELIM line_value { $$ = $2; } ; -line_value : POINTER { } - | line_item { } +line_value : POINTER { $$ = $1; } + | line_item { $$ = $1; } ; +mand_pointer : /* empty */ { gedcom_error("Missing pointer"); YYERROR; } + | DELIM POINTER { gedcom_debug_print("==Ptr: %s==\n", $2); + $$ = $2; } + ; + +mand_line_item : /* empty */ { gedcom_error("Missing value"); YYERROR; } + | 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 { size_t i; + CLEAR_BUFFER(line_item_buf); + line_item_buf_ptr = line_item_buf; + /* The following also takes care of '@@' */ + if (!strncmp($1, "@@", 3)) + *line_item_buf_ptr++ = '@'; + else + for (i=0; i < strlen($1); i++) + *line_item_buf_ptr++ = $1[i]; + $$ = line_item_buf; + } + | ESCAPE { CLEAR_BUFFER(line_item_buf); + line_item_buf_ptr = line_item_buf; + /* For now, ignore escapes */ + $$ = line_item_buf; + } + | line_item anychar + { size_t i; + /* The following also takes care of '@@' */ + if (!strncmp($2, "@@", 3)) + *line_item_buf_ptr++ = '@'; + else + for (i=0; i < strlen($2); i++) + *line_item_buf_ptr++ = $2[i]; + $$ = line_item_buf; + } + | line_item ESCAPE + { /* For now, ignore escapes */ + $$ = line_item_buf; + } ; anychar : ANYCHAR { } @@ -2078,10 +2364,20 @@ gen_sect : OPEN DELIM opt_xref anystdtag { } ; -gen_rec : OPEN DELIM opt_xref anystdtag - { INVALID_TOP_TAG($4) } +gen_rec : gen_rec_top + | gen_rec_norm + ; + +gen_rec_norm : OPEN DELIM opt_xref anystdtag + { INVALID_TOP_TAG($4) } + opt_value opt_sects CLOSE + { } + ; + +gen_rec_top : OPEN DELIM anytoptag + { gedcom_error("Missing cross-reference"); YYERROR; } opt_value opt_sects CLOSE - { } + { } ; opt_sects : /* empty */ { } @@ -2092,6 +2388,16 @@ anytag : USERTAG { } | anystdtag { } ; +anytoptag : TAG_FAM + | TAG_INDI + | TAG_OBJE + | TAG_NOTE + | TAG_REPO + | TAG_SOUR + | TAG_SUBN + | TAG_SUBM + ; + anystdtag : TAG_ABBR | TAG_ADDR | TAG_ADR1 @@ -2224,20 +2530,20 @@ 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][MAXSTDTAGLEN+1]; +Gedcom_ctxt ctxt_stack[MAXGEDCLEVEL+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); } @@ -2249,7 +2555,12 @@ void push_countarray() void set_parenttag(char* tag) { - strncpy(tag_stack[count_level], tag, MAXSTDTAGLENGTH+1); + strncpy(tag_stack[count_level], tag, MAXSTDTAGLEN+1); +} + +void set_parentctxt(Gedcom_ctxt ctxt) +{ + ctxt_stack[count_level] = ctxt; } char* get_parenttag() @@ -2257,6 +2568,11 @@ char* get_parenttag() return tag_stack[count_level]; } +Gedcom_ctxt get_parentctxt() +{ + return ctxt_stack[count_level]; +} + int count_tag(int tag) { int *count = count_arrays[count_level]; @@ -2284,18 +2600,68 @@ void pop_countarray() } /* Enabling debug mode */ +/* level 0: no debugging */ +/* level 1: only internal */ +/* level 2: also bison */ +FILE* trace_output; -void gedcom_enable_debug() +void gedcom_set_debug_level(int level, FILE* f) { + if (f != NULL) + trace_output = f; + else + trace_output = stderr; + if (level > 0) { + gedcom_high_level_debug = 1; + } + if (level > 1) { #if YYDEBUG != 0 - gedcom_debug = 1; + gedcom_debug = 1; #endif + } +} + +int gedcom_debug_print(char* s, ...) +{ + int res; + if (gedcom_high_level_debug) { + va_list ap; + va_start(ap, s); + res = vfprintf(trace_output, s, ap); + va_end(ap); + } + return(res); } /* Setting the error mechanism */ +void gedcom_set_error_handling(Gedcom_err_mech mechanism) +{ + error_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; + } + } +} -void gedcom_set_error_handling(MECHANISM mechanism) +int compat_mode(int compat_flags) { - curr_mechanism = mechanism; + return (compat_flags & compatibility); }