%type <string> anystdtag
%type <string> anytoptag
%type <string> line_item
+%type <string> line_value
%type <string> mand_line_item
+%type <string> mand_pointer
%type <string> note_line_item
%type <string> anychar
+%type <string> opt_xref
+%type <string> opt_value
%type <ctxt> head_sect
%%
/**** Header ****/
/*********************************************************************/
head_sect : OPEN DELIM TAG_HEAD
- { $<ctxt>$ = start_record(REC_HEAD, NULL);
+ { $<ctxt>$ = start_record(REC_HEAD, $1, NULL, $3);
START(HEAD, $<ctxt>$) }
head_subs
{ if (compat_mode(C_FTREE))
head_sour_subs
{ CHECK0 }
CLOSE
- { end_element(PARENT, $<ctxt>5); }
+ { end_element(ELT_HEAD_SOUR, PARENT, $<ctxt>5, NULL); }
;
head_sour_subs : /* empty */
no_std_subs
{ CHECK0 }
CLOSE
- { end_element(PARENT, $<ctxt>5); }
+ { end_element(ELT_HEAD_SOUR_VERS,
+ PARENT, $<ctxt>5, NULL);
+ }
;
head_sour_name_sect : OPEN DELIM TAG_NAME mand_line_item
- { START(NAME, NULL) } no_std_subs { CHECK0 } CLOSE
- { gedcom_debug_print("===Source name: '%s'\n", $4);
+ { $<ctxt>$ = start_element(ELT_HEAD_SOUR_NAME, PARENT,
+ $1, $3, $4, $4);
+ START(NAME, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_HEAD_SOUR_NAME,
+ PARENT, $<ctxt>5, NULL);
}
;
head_sour_corp_sect : OPEN DELIM TAG_CORP mand_line_item
- { gedcom_debug_print("===Source corp name: '%s'\n", $4);
- START(CORP, NULL) }
+ { $<ctxt>$ = start_element(ELT_HEAD_SOUR_CORP, PARENT,
+ $1, $3, $4, $4);
+ START(CORP, $<ctxt>$)
+ }
head_sour_corp_subs
{ CHECK0 }
CLOSE
- { }
+ { end_element(ELT_HEAD_SOUR_CORP,
+ PARENT, $<ctxt>5, NULL);
+ }
;
head_sour_corp_subs : /* empty */
;
head_sour_data_sect : OPEN DELIM TAG_DATA mand_line_item
- { START(DATA, NULL) }
+ { $<ctxt>$ = start_element(ELT_HEAD_SOUR_DATA, PARENT,
+ $1, $3, $4, $4);
+ START(DATA, $<ctxt>$)
+ }
head_sour_data_subs
{ CHECK0 }
CLOSE
- { }
+ { end_element(ELT_HEAD_SOUR_DATA,
+ PARENT, $<ctxt>5, NULL);
+ }
;
head_sour_data_subs : /* empty */
;
head_sour_data_date_sect : OPEN DELIM TAG_DATE mand_line_item
- { START(DATE, NULL) } no_std_subs { CHECK0 } CLOSE
- { }
+ { $<ctxt>$ = start_element(ELT_HEAD_SOUR_DATA_DATE,
+ PARENT, $1, $3, $4, $4);
+ START(DATE, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_HEAD_SOUR_DATA_DATE,
+ PARENT, $<ctxt>5, NULL);
+ }
;
head_sour_data_copr_sect : OPEN DELIM TAG_COPR mand_line_item
- { START(COPR, NULL) } no_std_subs { CHECK0 } CLOSE
- { }
+ { $<ctxt>$ = start_element(ELT_HEAD_SOUR_DATA_COPR,
+ PARENT, $1, $3, $4, $4);
+ START(COPR, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_HEAD_SOUR_DATA_COPR,
+ PARENT, $<ctxt>5, NULL);
+ }
;
/* HEAD.DEST */
head_dest_sect : OPEN DELIM TAG_DEST mand_line_item
- { START(DEST, NULL) } no_std_subs { CHECK0 } CLOSE
- { }
+ { $<ctxt>$ = start_element(ELT_HEAD_DEST,
+ PARENT, $1, $3, $4, $4);
+ START(DEST, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_HEAD_DEST,
+ PARENT, $<ctxt>5, NULL);
+ }
;
/* HEAD.DATE */
head_date_sect : OPEN DELIM TAG_DATE mand_line_item
- { START(DATE, NULL) }
+ { $<ctxt>$ = start_element(ELT_HEAD_DATE,
+ PARENT, $1, $3, $4, $4);
+ START(DATE, $<ctxt>$)
+ }
head_date_subs
{ CHECK0 }
CLOSE
- { }
+ { end_element(ELT_HEAD_DATE,
+ PARENT, $<ctxt>5, NULL);
+ }
;
head_date_subs : /* empty */
;
head_date_time_sect : OPEN DELIM TAG_TIME mand_line_item
- { START(TIME, NULL) } no_std_subs { CHECK0 } CLOSE
- { }
+ { $<ctxt>$ = start_element(ELT_HEAD_DATE_TIME,
+ PARENT, $1, $3, $4, $4);
+ START(TIME, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_HEAD_DATE_TIME,
+ PARENT, $<ctxt>5, NULL);
+ }
;
/* HEAD.SUBM */
head_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
- { START(SUBM, NULL) } no_std_subs { CHECK0 } CLOSE
- { }
+ { $<ctxt>$ = start_element(ELT_HEAD_SUBM,
+ PARENT, $1, $3, $4, $4);
+ START(SUBM, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_HEAD_SUBM,
+ PARENT, $<ctxt>5, NULL);
+ }
;
/* HEAD.SUBN */
head_subn_sect : OPEN DELIM TAG_SUBN mand_pointer
- { START(SUBN, NULL) } no_std_subs { CHECK0 } CLOSE
- { }
+ { $<ctxt>$ = start_element(ELT_HEAD_SUBN,
+ PARENT, $1, $3, $4, $4);
+ START(SUBN, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_HEAD_SUBN,
+ PARENT, $<ctxt>5, NULL);
+ }
;
/* HEAD.FILE */
head_file_sect : OPEN DELIM TAG_FILE mand_line_item
- { START(FILE, NULL) } no_std_subs { CHECK0 } CLOSE
- { }
+ { $<ctxt>$ = start_element(ELT_HEAD_FILE,
+ PARENT, $1, $3, $4, $4);
+ START(FILE, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_HEAD_FILE, PARENT, $<ctxt>5, NULL);
+ }
;
/* HEAD.COPR */
head_copr_sect : OPEN DELIM TAG_COPR mand_line_item
- { START(COPR, NULL) } no_std_subs { CHECK0 } CLOSE
- { }
+ { $<ctxt>$ = start_element(ELT_HEAD_COPR,
+ PARENT, $1, $3, $4, $4);
+ START(COPR, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_HEAD_COPR, PARENT, $<ctxt>5, NULL);
+ }
;
/* HEAD.GEDC */
head_gedc_sect : OPEN DELIM TAG_GEDC
- { START(GEDC, NULL) }
+ { $<ctxt>$ = start_element(ELT_HEAD_GEDC,
+ PARENT, $1, $3, NULL, NULL);
+ START(GEDC, $<ctxt>$)
+ }
head_gedc_subs
{ CHECK2(VERS, FORM) }
CLOSE
- { }
+ { end_element(ELT_HEAD_GEDC, PARENT, $<ctxt>4, NULL);
+ }
;
head_gedc_subs : /* empty */
| no_std_sub
;
head_gedc_vers_sect : OPEN DELIM TAG_VERS mand_line_item
- { START(VERS, NULL) } no_std_subs { CHECK0 } CLOSE
- { }
+ { $<ctxt>$ = start_element(ELT_HEAD_GEDC_VERS,
+ PARENT, $1, $3, $4, $4);
+ START(VERS, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_HEAD_GEDC_VERS,
+ PARENT, $<ctxt>5, NULL);
+ }
;
head_gedc_form_sect : OPEN DELIM TAG_FORM mand_line_item
- { START(FORM, NULL) } no_std_subs { CHECK0 } CLOSE
- { }
+ { $<ctxt>$ = start_element(ELT_HEAD_GEDC_FORM,
+ PARENT, $1, $3, $4, $4);
+ START(FORM, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_HEAD_GEDC_FORM,
+ PARENT, $<ctxt>5, NULL);
+ }
;
/* HEAD.CHAR */
head_char_sect : OPEN DELIM TAG_CHAR mand_line_item
{ if (open_conv_to_internal($4) == 0) YYERROR;
- START(CHAR, NULL) }
+ $<ctxt>$ = start_element(ELT_HEAD_CHAR,
+ PARENT, $1, $3, $4, $4);
+ START(CHAR, $<ctxt>$)
+ }
head_char_subs
{ CHECK0 }
CLOSE
- { }
+ { end_element(ELT_HEAD_CHAR, PARENT, $<ctxt>5, NULL);
+ }
;
head_char_subs : /* empty */
| no_std_sub
;
head_char_vers_sect : OPEN DELIM TAG_VERS mand_line_item
- { START(VERS, NULL) } no_std_subs { CHECK0 } CLOSE
- { }
+ { $<ctxt>$ = start_element(ELT_HEAD_CHAR_VERS,
+ PARENT, $1, $3, $4, $4);
+ START(VERS, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_HEAD_CHAR_VERS,
+ PARENT, $<ctxt>5, NULL);
+ }
;
/* HEAD.LANG */
head_lang_sect : OPEN DELIM TAG_LANG mand_line_item
- { START(LANG, NULL) } no_std_subs { CHECK0 } CLOSE
- { }
+ { $<ctxt>$ = start_element(ELT_HEAD_LANG,
+ PARENT, $1, $3, $4, $4);
+ START(LANG, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_HEAD_LANG, PARENT, $<ctxt>5, NULL);
+ }
;
/* HEAD.PLAC */
head_plac_sect : OPEN DELIM TAG_PLAC
- { START(PLAC, NULL) }
+ { $<ctxt>$ = start_element(ELT_HEAD_PLAC,
+ PARENT, $1, $3, NULL, NULL);
+ START(PLAC, $<ctxt>$)
+ }
head_plac_subs
{ CHECK1(FORM) }
CLOSE
- { }
+ { end_element(ELT_HEAD_PLAC, PARENT, $<ctxt>4, NULL);
+ }
;
head_plac_subs : /* empty */
| no_std_sub
;
head_plac_form_sect : OPEN DELIM TAG_FORM mand_line_item
- { START(FORM, NULL) } no_std_subs { CHECK0 } CLOSE
- { }
+ { $<ctxt>$ = start_element(ELT_HEAD_PLAC_FORM,
+ PARENT, $1, $3, $4, $4);
+ START(FORM, $<ctxt>$)
+ }
+ no_std_subs
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_HEAD_PLAC_FORM,
+ PARENT, $<ctxt>5, NULL);
+ }
;
/* HEAD.NOTE */
head_note_sect : OPEN DELIM TAG_NOTE mand_line_item
- { START(NOTE, NULL) }
+ { $<ctxt>$ = start_element(ELT_HEAD_NOTE,
+ PARENT, $1, $3, $4, $4);
+ START(NOTE, $<ctxt>$)
+ }
head_note_subs
{ CHECK0 }
CLOSE
- { }
+ { end_element(ELT_HEAD_NOTE, PARENT, $<ctxt>5, NULL);
+ }
;
head_note_subs : /* empty */
/*********************************************************************/
/**** Trailer ****/
/*********************************************************************/
+/* Don't need callbacks here, there is no information... */
trlr_sect : OPEN DELIM TAG_TRLR CLOSE { }
;
/**** Family record ****/
/*********************************************************************/
fam_rec : OPEN DELIM POINTER DELIM TAG_FAM
- { $<ctxt>$ = start_record(REC_FAM, $3);
+ { $<ctxt>$ = start_record(REC_FAM, $1, $3, $5);
START(FAM, $<ctxt>$) }
fam_subs
{ CHECK0 }
/**** Individual record ****/
/*********************************************************************/
indiv_rec : OPEN DELIM POINTER DELIM TAG_INDI
- { START(INDI, NULL) }
+ { $<ctxt>$ = start_record(REC_INDI, $1, $3, $5);
+ START(INDI, $<ctxt>$) }
indi_subs
{ CHECK0 }
- CLOSE { }
+ CLOSE
+ { end_record(REC_INDI, $<ctxt>6); }
;
indi_subs : /* empty */
/**** Multimedia record ****/
/*********************************************************************/
multim_rec : OPEN DELIM POINTER DELIM TAG_OBJE
- { START(OBJE, NULL) }
+ { $<ctxt>$ = start_record(REC_OBJE, $1, $3, $5);
+ START(OBJE, $<ctxt>$) }
obje_subs
{ CHECK2(FORM, BLOB) }
- CLOSE { }
+ CLOSE
+ { end_record(REC_OBJE, $<ctxt>6); }
;
obje_subs : /* empty */
/**** Note record ****/
/*********************************************************************/
note_rec : OPEN DELIM POINTER DELIM TAG_NOTE note_line_item
- { START(NOTE, NULL) }
+ { $<ctxt>$ = start_record(REC_NOTE, $1, $3, $5);
+ START(NOTE, $<ctxt>$) }
note_subs
{ CHECK0 }
- CLOSE { }
+ CLOSE
+ { end_record(REC_NOTE, $<ctxt>6); }
;
note_line_item : /* empty */
/**** Repository record ****/
/*********************************************************************/
repos_rec : OPEN DELIM POINTER DELIM TAG_REPO
- { START(REPO, NULL) }
+ { $<ctxt>$ = start_record(REC_REPO, $1, $3, $5);
+ START(REPO, $<ctxt>$) }
repo_subs
{ CHECK0 }
- CLOSE { }
+ CLOSE
+ { end_record(REC_REPO, $<ctxt>6); }
;
repo_subs : /* empty */
/**** Source record ****/
/*********************************************************************/
source_rec : OPEN DELIM POINTER DELIM TAG_SOUR
- { START(SOUR, NULL) }
+ { $<ctxt>$ = start_record(REC_SOUR, $1, $3, $5);
+ START(SOUR, $<ctxt>$) }
sour_subs
{ CHECK0 }
- CLOSE { }
+ CLOSE
+ { end_record(REC_SOUR, $<ctxt>6); }
;
sour_subs : /* empty */
/**** Submission record ****/
/*********************************************************************/
submis_rec : OPEN DELIM POINTER DELIM TAG_SUBN
- { START(SUBN, NULL) }
+ { $<ctxt>$ = start_record(REC_SUBN, $1, $3, $5);
+ START(SUBN, $<ctxt>$) }
subn_subs
{ CHECK0 }
- CLOSE { }
+ CLOSE
+ { end_record(REC_SUBN, $<ctxt>6); }
;
subn_subs : /* empty */
/**** Submitter record ****/
/*********************************************************************/
submit_rec : OPEN DELIM POINTER DELIM TAG_SUBM
- { START(SUBM, NULL) }
+ { $<ctxt>$ = start_record(REC_SUBM, $1, $3, $5);
+ START(SUBM, $<ctxt>$) }
subm_subs
{ CHECK1(NAME) }
- CLOSE { }
+ CLOSE
+ { end_record(REC_SUBM, $<ctxt>6); }
;
subm_subs : /* empty */
YYERROR;
}
}
- opt_value user_sects CLOSE { }
+ opt_value
+ { $<ctxt>$ = start_record(REC_USER, $1, $3, $4);
+ START($4, $<ctxt>$)
+ }
+ user_sects
+ { CHECK0 }
+ CLOSE
+ { end_record(REC_USER, $<ctxt>7); }
;
-
user_sect : OPEN DELIM opt_xref USERTAG
{ if ($4[0] != '_') {
gedcom_error("Undefined tag (and not a valid user tag): %s",
YYERROR;
}
}
- opt_value user_sects CLOSE { }
+ opt_value
+ { $<ctxt>$ = start_element(ELT_USER, PARENT, $1, $4, $6, $6);
+ START($4, $<ctxt>$);
+ }
+ user_sects
+ { CHECK0 }
+ CLOSE
+ { end_element(ELT_USER, PARENT, $<ctxt>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 { }
+ | DELIM POINTER { gedcom_debug_print("==Ptr: %s==\n", $2);
+ $$ = $2; }
;
mand_line_item : /* empty */ { gedcom_error("Missing value"); YYERROR; }