2 Copyright (C) 2001 The Genes Development Team
3 This file is part of the Gedcom parser library.
4 Contributed by Peter Verthez <Peter.Verthez@advalvas.be>, 2001.
6 The Gedcom parser library is free software; you can redistribute it
7 and/or modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The Gedcom parser library is distributed in the hope that it will be
12 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the Gedcom parser library; if not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
24 /* WARNING: THIS PARSER RELIES HEAVILY ON SOME FEATURES OF BISON.
25 DON'T TRY TO USE IT WITH YACC, IT WON'T WORK...
28 /* Design of the parser:
30 In general, a GEDCOM file contains records, each consisting of a line
31 (which we'll call a section), hierarchically containing other lines
32 (subsections of the section).
34 This means that in general we have:
36 A 'record' is a 'section' (sect) containing 'subsections' (subs)
37 Each 'subsection' (sub) is again a specific 'section' (sect)
39 In parser notation, this means:
43 sect : <some prefix> subs <some suffix>
45 subs : <empty> | subs sub
47 sub : sect_a | sect_b | ...
49 This pattern is repeated throughout the parser for the different types of
53 Cardinality of the subsections:
54 -------------------------------
55 Note that in the above, the order of the subsections is of no importance.
56 Indeed, this is the case in the GEDCOM grammar. However, this also makes
57 it difficult to check whether there are not too many subsections of a
58 specific type, or whether a mandatory subsection is indeed there.
60 Suppose there is a section A that can contain 0 or 1 B section and
63 This can be expressed in parser notation as follows:
65 A : CC | BCC | CBC | CCB
67 So, cardinality is indeed expressable. However, as the number of subsection
68 types and the limits grow bigger (and even theoretically limitless), listing
69 all possible permutations becomes quickly unfeasible.
71 Much simpler is to say:
74 subs : <empty> | subs sub
77 and then check the cardinality in the semantic actions, which is the
78 solution chosen in the parser below, using the following macros:
81 Make a new context for the <parent> tag to count child tags in
83 - OCCUR2(<child>, <min>, <max>)
84 Express that the <child> tag should occur at least <min> times and
85 at most <max> tags within its parent
87 What this actually does is the following. It increments the counter
88 for that tag and then checks whether the maximum is exceeded. If so,
89 then a parser error is produced. The minimum is not actually checked
90 by this macro, but it makes the statements more declarative.
92 - OCCUR1(<child>, <min>)
93 Express that the <child> tag should occur at least <min> times within
94 its parent (no upper limit)
96 Actually, this only increments the counter for the tag, but it looks
97 very like the previous macro.
99 If the minimum is 0, it is not necessary to express this constraint.
101 - CHECKn(<child1>, ..., <childn>)
102 This closes the context for the parent tag and checks whether the
103 given <child> tags did effectively occur within the parent (i.e.
104 these are the tags that were mandatory).
106 Since the <min> values above are always 0 or 1 in GEDCOM, this is
107 sufficient. All sub-tags that declare a minimum of 1 in the OCCUR
108 macros should be listed in this macro here.
110 The macros CHECK0 to CHECK4 are defined like this (the first one
111 has no arguments and is only used to close the parent context; note
112 that this is necessary for correct functioning).
116 Only sections that have subsections need to use these macros. This can
117 be done like this (the OPEN and CHECK macros are used as mid-rule
118 actions around the subsections):
120 head_sect : OPEN DELIM TAG_HEAD
124 CLOSE { <semantic actions> }
130 head_sub : head_sour_sect { OCCUR2(SOUR, 1, 1) }
131 | head_dest_sect { OCCUR2(DEST, 0, 1) }
132 | head_date_sect { OCCUR2(DATE, 0, 1) }
138 - The syntax analysis doesn't handle the contents of the line values;
139 this is done in the semantic analysis.
144 #include "gedcom_internal.h"
145 #include "multilex.h"
146 #include "encoding.h"
147 #include "interface.h"
152 int compat_enabled = 1;
153 int gedcom_high_level_debug = 0;
154 int compatibility = 0;
155 Gedcom_err_mech error_mechanism = IMMED_FAIL;
156 Gedcom_val_struct val;
158 char line_item_buf[MAXGEDCLINELEN * UTF_FACTOR + 1];
159 char *line_item_buf_ptr;
165 /* These are defined at the bottom of the file */
166 void push_countarray();
167 void set_parenttag(char* tag);
168 char* get_parenttag();
169 void set_parentctxt(Gedcom_ctxt ctxt);
170 Gedcom_ctxt get_parentctxt();
171 void pop_countarray();
172 int count_tag(int tag);
173 int check_occurrence(int tag);
174 void set_compatibility(char* program);
175 int compat_mode(int flags);
177 #define CLEAR_BUFFER(BUF) \
178 memset(BUF, 0, sizeof(BUF));
180 #define HANDLE_ERROR \
181 { if (error_mechanism == IMMED_FAIL) { \
184 else if (error_mechanism == DEFER_FAIL) { \
187 else if (error_mechanism == IGNORE_ERRORS) { \
191 #define START(PARENTTAG,PARENTCTXT) \
193 set_parenttag(#PARENTTAG); \
194 set_parentctxt(PARENTCTXT); \
200 { if (!check_occurrence(TAG_##TAG)) { \
201 char* parenttag = get_parenttag(); \
202 gedcom_error(_("The tag '%s' is mandatory within '%s', but missing"),\
208 { pop_countarray(); \
212 #define CHECK1(TAG1) { CHK(TAG1); POP; }
213 #define CHECK2(TAG1,TAG2) \
214 { CHK(TAG1); CHK(TAG2); POP; }
215 #define CHECK3(TAG1,TAG2,TAG3) \
216 { CHK(TAG1); CHK(TAG2); CHK(TAG3); POP; }
217 #define CHECK4(TAG1,TAG2,TAG3,TAG4) \
218 { CHK(TAG1); CHK(TAG2); CHK(TAG3); CHK(TAG4); POP; }
219 #define OCCUR1(CHILDTAG, MIN) { count_tag(TAG_##CHILDTAG); }
220 #define OCCUR2(CHILDTAG, MIN, MAX) \
221 { int num = count_tag(TAG_##CHILDTAG); \
223 char* parenttag = get_parenttag(); \
224 gedcom_error(_("The tag '%s' can maximally occur %d time(s) within '%s'"), \
225 #CHILDTAG, MAX, parenttag); \
229 #define INVALID_TAG(CHILDTAG) \
230 { char* parenttag = get_parenttag(); \
231 gedcom_error(_("The tag '%s' is not a valid tag within '%s'"), \
232 CHILDTAG, parenttag); \
235 #define INVALID_TOP_TAG(CHILDTAG) \
236 { gedcom_error(_("The tag '%s' is not a valid top-level tag"), \
252 %token <string> BADTOKEN
254 %token <string> CLOSE
255 %token <string> ESCAPE
256 %token <string> DELIM
257 %token <string> ANYCHAR
258 %token <string> POINTER
259 %token <string> USERTAG
260 %token <string> TAG_ABBR
261 %token <string> TAG_ADDR
262 %token <string> TAG_ADR1
263 %token <string> TAG_ADR2
264 %token <string> TAG_ADOP
265 %token <string> TAG_AFN
266 %token <string> TAG_AGE
267 %token <string> TAG_AGNC
268 %token <string> TAG_ALIA
269 %token <string> TAG_ANCE
270 %token <string> TAG_ANCI
271 %token <string> TAG_ANUL
272 %token <string> TAG_ASSO
273 %token <string> TAG_AUTH
274 %token <string> TAG_BAPL
275 %token <string> TAG_BAPM
276 %token <string> TAG_BARM
277 %token <string> TAG_BASM
278 %token <string> TAG_BIRT
279 %token <string> TAG_BLES
280 %token <string> TAG_BLOB
281 %token <string> TAG_BURI
282 %token <string> TAG_CALN
283 %token <string> TAG_CAST
284 %token <string> TAG_CAUS
285 %token <string> TAG_CENS
286 %token <string> TAG_CHAN
287 %token <string> TAG_CHAR
288 %token <string> TAG_CHIL
289 %token <string> TAG_CHR
290 %token <string> TAG_CHRA
291 %token <string> TAG_CITY
292 %token <string> TAG_CONC
293 %token <string> TAG_CONF
294 %token <string> TAG_CONL
295 %token <string> TAG_CONT
296 %token <string> TAG_COPR
297 %token <string> TAG_CORP
298 %token <string> TAG_CREM
299 %token <string> TAG_CTRY
300 %token <string> TAG_DATA
301 %token <string> TAG_DATE
302 %token <string> TAG_DEAT
303 %token <string> TAG_DESC
304 %token <string> TAG_DESI
305 %token <string> TAG_DEST
306 %token <string> TAG_DIV
307 %token <string> TAG_DIVF
308 %token <string> TAG_DSCR
309 %token <string> TAG_EDUC
310 %token <string> TAG_EMIG
311 %token <string> TAG_ENDL
312 %token <string> TAG_ENGA
313 %token <string> TAG_EVEN
314 %token <string> TAG_FAM
315 %token <string> TAG_FAMC
316 %token <string> TAG_FAMF
317 %token <string> TAG_FAMS
318 %token <string> TAG_FCOM
319 %token <string> TAG_FILE
320 %token <string> TAG_FORM
321 %token <string> TAG_GEDC
322 %token <string> TAG_GIVN
323 %token <string> TAG_GRAD
324 %token <string> TAG_HEAD
325 %token <string> TAG_HUSB
326 %token <string> TAG_IDNO
327 %token <string> TAG_IMMI
328 %token <string> TAG_INDI
329 %token <string> TAG_LANG
330 %token <string> TAG_LEGA
331 %token <string> TAG_MARB
332 %token <string> TAG_MARC
333 %token <string> TAG_MARL
334 %token <string> TAG_MARR
335 %token <string> TAG_MARS
336 %token <string> TAG_MEDI
337 %token <string> TAG_NAME
338 %token <string> TAG_NATI
339 %token <string> TAG_NATU
340 %token <string> TAG_NCHI
341 %token <string> TAG_NICK
342 %token <string> TAG_NMR
343 %token <string> TAG_NOTE
344 %token <string> TAG_NPFX
345 %token <string> TAG_NSFX
346 %token <string> TAG_OBJE
347 %token <string> TAG_OCCU
348 %token <string> TAG_ORDI
349 %token <string> TAG_ORDN
350 %token <string> TAG_PAGE
351 %token <string> TAG_PEDI
352 %token <string> TAG_PHON
353 %token <string> TAG_PLAC
354 %token <string> TAG_POST
355 %token <string> TAG_PROB
356 %token <string> TAG_PROP
357 %token <string> TAG_PUBL
358 %token <string> TAG_QUAY
359 %token <string> TAG_REFN
360 %token <string> TAG_RELA
361 %token <string> TAG_RELI
362 %token <string> TAG_REPO
363 %token <string> TAG_RESI
364 %token <string> TAG_RESN
365 %token <string> TAG_RETI
366 %token <string> TAG_RFN
367 %token <string> TAG_RIN
368 %token <string> TAG_ROLE
369 %token <string> TAG_SEX
370 %token <string> TAG_SLGC
371 %token <string> TAG_SLGS
372 %token <string> TAG_SOUR
373 %token <string> TAG_SPFX
374 %token <string> TAG_SSN
375 %token <string> TAG_STAE
376 %token <string> TAG_STAT
377 %token <string> TAG_SUBM
378 %token <string> TAG_SUBN
379 %token <string> TAG_SURN
380 %token <string> TAG_TEMP
381 %token <string> TAG_TEXT
382 %token <string> TAG_TIME
383 %token <string> TAG_TITL
384 %token <string> TAG_TRLR
385 %token <string> TAG_TYPE
386 %token <string> TAG_VERS
387 %token <string> TAG_WIFE
388 %token <string> TAG_WILL
390 %type <string> anystdtag
391 %type <string> anytoptag
392 %type <string> line_item
393 %type <string> line_value
394 %type <string> mand_line_item
395 %type <string> mand_pointer
396 %type <string> note_line_item
397 %type <string> anychar
398 %type <string> opt_xref
399 %type <string> opt_value
400 %type <ctxt> head_sect
404 file : head_sect records trlr_sect
405 { if (fail == 1) YYABORT; }
408 records : /* empty */
423 /*********************************************************************/
425 /*********************************************************************/
426 head_sect : OPEN DELIM TAG_HEAD
427 { $<ctxt>$ = start_record(REC_HEAD, $1, NULL, $3);
428 START(HEAD, $<ctxt>$) }
430 { if (compat_mode(C_FTREE))
431 CHECK3(SOUR, GEDC, CHAR)
433 CHECK4(SOUR, SUBM, GEDC, CHAR)
436 { end_record(REC_HEAD, $<ctxt>4); }
439 head_subs : /* empty */
443 head_sub : head_sour_sect { OCCUR2(SOUR, 1, 1) }
444 | head_dest_sect { OCCUR2(DEST, 0, 1) }
445 | head_date_sect { OCCUR2(DATE, 0, 1) }
446 | head_subm_sect { OCCUR2(SUBM, 1, 1) }
447 | head_subn_sect { OCCUR2(SUBN, 0, 1) }
448 | head_file_sect { OCCUR2(FILE, 0, 1) }
449 | head_copr_sect { OCCUR2(COPR, 0, 1) }
450 | head_gedc_sect { OCCUR2(GEDC, 1, 1) }
451 | head_char_sect { OCCUR2(CHAR, 1, 1) }
452 | head_lang_sect { OCCUR2(LANG, 0, 1) }
453 | head_plac_sect { OCCUR2(PLAC, 0, 1) }
454 | head_note_sect { OCCUR2(NOTE, 0, 1) }
459 head_sour_sect : OPEN DELIM TAG_SOUR mand_line_item
460 { set_compatibility($4);
461 $<ctxt>$ = start_element(ELT_HEAD_SOUR, PARENT,
463 GEDCOM_MAKE_STRING($4));
464 START(SOUR, $<ctxt>$)
469 { end_element(ELT_HEAD_SOUR, PARENT, $<ctxt>5, NULL); }
472 head_sour_subs : /* empty */
473 | head_sour_subs head_sour_sub
476 head_sour_sub : head_sour_vers_sect { OCCUR2(VERS, 0, 1) }
477 | head_sour_name_sect { OCCUR2(NAME, 0, 1) }
478 | head_sour_corp_sect { OCCUR2(CORP, 0, 1) }
479 | head_sour_data_sect { OCCUR2(DATA, 0, 1) }
483 head_sour_vers_sect : OPEN DELIM TAG_VERS mand_line_item
484 { $<ctxt>$ = start_element(ELT_HEAD_SOUR_VERS, PARENT,
486 GEDCOM_MAKE_STRING($4));
487 START(VERS, $<ctxt>$)
492 { end_element(ELT_HEAD_SOUR_VERS,
493 PARENT, $<ctxt>5, NULL);
496 head_sour_name_sect : OPEN DELIM TAG_NAME mand_line_item
497 { $<ctxt>$ = start_element(ELT_HEAD_SOUR_NAME, PARENT,
499 GEDCOM_MAKE_STRING($4));
500 START(NAME, $<ctxt>$)
505 { end_element(ELT_HEAD_SOUR_NAME,
506 PARENT, $<ctxt>5, NULL);
509 head_sour_corp_sect : OPEN DELIM TAG_CORP mand_line_item
510 { $<ctxt>$ = start_element(ELT_HEAD_SOUR_CORP, PARENT,
512 GEDCOM_MAKE_STRING($4));
513 START(CORP, $<ctxt>$)
518 { end_element(ELT_HEAD_SOUR_CORP,
519 PARENT, $<ctxt>5, NULL);
523 head_sour_corp_subs : /* empty */
524 | head_sour_corp_subs head_sour_corp_sub
527 head_sour_corp_sub : addr_struc_sub /* 0:1 */
531 head_sour_data_sect : OPEN DELIM TAG_DATA mand_line_item
532 { $<ctxt>$ = start_element(ELT_HEAD_SOUR_DATA, PARENT,
534 GEDCOM_MAKE_STRING($4));
535 START(DATA, $<ctxt>$)
540 { end_element(ELT_HEAD_SOUR_DATA,
541 PARENT, $<ctxt>5, NULL);
545 head_sour_data_subs : /* empty */
546 | head_sour_data_subs head_sour_data_sub
549 head_sour_data_sub : head_sour_data_date_sect { OCCUR2(DATE, 0, 1) }
550 | head_sour_data_copr_sect { OCCUR2(COPR, 0, 1) }
554 head_sour_data_date_sect : OPEN DELIM TAG_DATE mand_line_item
555 { struct date_value dv = gedcom_parse_date($4);
556 $<ctxt>$ = start_element(ELT_HEAD_SOUR_DATA_DATE,
558 GEDCOM_MAKE_DATE(dv));
559 START(DATE, $<ctxt>$)
564 { end_element(ELT_HEAD_SOUR_DATA_DATE,
565 PARENT, $<ctxt>5, NULL);
568 head_sour_data_copr_sect : OPEN DELIM TAG_COPR mand_line_item
569 { $<ctxt>$ = start_element(ELT_HEAD_SOUR_DATA_COPR,
571 GEDCOM_MAKE_STRING($4));
572 START(COPR, $<ctxt>$)
577 { end_element(ELT_HEAD_SOUR_DATA_COPR,
578 PARENT, $<ctxt>5, NULL);
583 head_dest_sect : OPEN DELIM TAG_DEST mand_line_item
584 { $<ctxt>$ = start_element(ELT_HEAD_DEST,
586 GEDCOM_MAKE_STRING($4));
587 START(DEST, $<ctxt>$)
592 { end_element(ELT_HEAD_DEST,
593 PARENT, $<ctxt>5, NULL);
598 head_date_sect : OPEN DELIM TAG_DATE mand_line_item
599 { struct date_value dv = gedcom_parse_date($4);
600 $<ctxt>$ = start_element(ELT_HEAD_DATE,
602 GEDCOM_MAKE_DATE(dv));
603 START(DATE, $<ctxt>$)
608 { end_element(ELT_HEAD_DATE,
609 PARENT, $<ctxt>5, NULL);
613 head_date_subs : /* empty */
614 | head_date_subs head_date_sub
617 head_date_sub : head_date_time_sect { OCCUR2(TIME, 0, 1) }
621 head_date_time_sect : OPEN DELIM TAG_TIME mand_line_item
622 { $<ctxt>$ = start_element(ELT_HEAD_DATE_TIME,
624 GEDCOM_MAKE_STRING($4));
625 START(TIME, $<ctxt>$)
630 { end_element(ELT_HEAD_DATE_TIME,
631 PARENT, $<ctxt>5, NULL);
636 head_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
637 { $<ctxt>$ = start_element(ELT_HEAD_SUBM,
639 GEDCOM_MAKE_STRING($4));
640 START(SUBM, $<ctxt>$)
645 { end_element(ELT_HEAD_SUBM,
646 PARENT, $<ctxt>5, NULL);
650 head_subn_sect : OPEN DELIM TAG_SUBN mand_pointer
651 { $<ctxt>$ = start_element(ELT_HEAD_SUBN,
653 GEDCOM_MAKE_STRING($4));
654 START(SUBN, $<ctxt>$)
659 { end_element(ELT_HEAD_SUBN,
660 PARENT, $<ctxt>5, NULL);
664 head_file_sect : OPEN DELIM TAG_FILE mand_line_item
665 { $<ctxt>$ = start_element(ELT_HEAD_FILE,
667 GEDCOM_MAKE_STRING($4));
668 START(FILE, $<ctxt>$)
673 { end_element(ELT_HEAD_FILE, PARENT, $<ctxt>5, NULL);
677 head_copr_sect : OPEN DELIM TAG_COPR mand_line_item
678 { $<ctxt>$ = start_element(ELT_HEAD_COPR,
680 GEDCOM_MAKE_STRING($4));
681 START(COPR, $<ctxt>$)
686 { end_element(ELT_HEAD_COPR, PARENT, $<ctxt>5, NULL);
690 head_gedc_sect : OPEN DELIM TAG_GEDC
691 { $<ctxt>$ = start_element(ELT_HEAD_GEDC,
692 PARENT, $1, $3, NULL, NULL);
693 START(GEDC, $<ctxt>$)
696 { CHECK2(VERS, FORM) }
698 { end_element(ELT_HEAD_GEDC, PARENT, $<ctxt>4, NULL);
702 head_gedc_subs : /* empty */
703 | head_gedc_subs head_gedc_sub
706 head_gedc_sub : head_gedc_vers_sect { OCCUR2(VERS, 1, 1) }
707 | head_gedc_form_sect { OCCUR2(FORM, 1, 1) }
710 head_gedc_vers_sect : OPEN DELIM TAG_VERS mand_line_item
711 { $<ctxt>$ = start_element(ELT_HEAD_GEDC_VERS,
713 GEDCOM_MAKE_STRING($4));
714 START(VERS, $<ctxt>$)
719 { end_element(ELT_HEAD_GEDC_VERS,
720 PARENT, $<ctxt>5, NULL);
723 head_gedc_form_sect : OPEN DELIM TAG_FORM mand_line_item
724 { $<ctxt>$ = start_element(ELT_HEAD_GEDC_FORM,
726 GEDCOM_MAKE_STRING($4));
727 START(FORM, $<ctxt>$)
732 { end_element(ELT_HEAD_GEDC_FORM,
733 PARENT, $<ctxt>5, NULL);
738 head_char_sect : OPEN DELIM TAG_CHAR mand_line_item
739 { if (open_conv_to_internal($4) == 0) YYERROR;
740 $<ctxt>$ = start_element(ELT_HEAD_CHAR,
742 GEDCOM_MAKE_STRING($4));
743 START(CHAR, $<ctxt>$)
748 { end_element(ELT_HEAD_CHAR, PARENT, $<ctxt>5, NULL);
752 head_char_subs : /* empty */
753 | head_char_subs head_char_sub
756 head_char_sub : head_char_vers_sect { OCCUR2(VERS, 0, 1) }
759 head_char_vers_sect : OPEN DELIM TAG_VERS mand_line_item
760 { $<ctxt>$ = start_element(ELT_HEAD_CHAR_VERS,
762 GEDCOM_MAKE_STRING($4));
763 START(VERS, $<ctxt>$)
768 { end_element(ELT_HEAD_CHAR_VERS,
769 PARENT, $<ctxt>5, NULL);
774 head_lang_sect : OPEN DELIM TAG_LANG mand_line_item
775 { $<ctxt>$ = start_element(ELT_HEAD_LANG,
777 GEDCOM_MAKE_STRING($4));
778 START(LANG, $<ctxt>$)
783 { end_element(ELT_HEAD_LANG, PARENT, $<ctxt>5, NULL);
787 head_plac_sect : OPEN DELIM TAG_PLAC
788 { $<ctxt>$ = start_element(ELT_HEAD_PLAC,
789 PARENT, $1, $3, NULL, NULL);
790 START(PLAC, $<ctxt>$)
795 { end_element(ELT_HEAD_PLAC, PARENT, $<ctxt>4, NULL);
799 head_plac_subs : /* empty */
800 | head_plac_subs head_plac_sub
803 head_plac_sub : head_plac_form_sect { OCCUR2(FORM, 1, 1) }
806 head_plac_form_sect : OPEN DELIM TAG_FORM mand_line_item
807 { $<ctxt>$ = start_element(ELT_HEAD_PLAC_FORM,
809 GEDCOM_MAKE_STRING($4));
810 START(FORM, $<ctxt>$)
815 { end_element(ELT_HEAD_PLAC_FORM,
816 PARENT, $<ctxt>5, NULL);
821 head_note_sect : OPEN DELIM TAG_NOTE mand_line_item
822 { $<ctxt>$ = start_element(ELT_HEAD_NOTE,
824 GEDCOM_MAKE_STRING($4));
825 START(NOTE, $<ctxt>$)
830 { end_element(ELT_HEAD_NOTE, PARENT, $<ctxt>5, NULL);
834 head_note_subs : /* empty */
835 | head_note_subs head_note_sub
838 head_note_sub : continuation_sub /* 0:M */
842 /*********************************************************************/
844 /*********************************************************************/
845 /* Don't need callbacks here, there is no information... */
846 trlr_sect : OPEN DELIM TAG_TRLR CLOSE { }
849 /*********************************************************************/
850 /**** Family record ****/
851 /*********************************************************************/
852 fam_rec : OPEN DELIM POINTER DELIM TAG_FAM
853 { $<ctxt>$ = start_record(REC_FAM, $1, $3, $5);
854 START(FAM, $<ctxt>$) }
858 { end_record(REC_FAM, $<ctxt>6); }
861 fam_subs : /* empty */
865 fam_sub : fam_event_struc_sub /* 0:M */
866 | fam_husb_sect { OCCUR2(HUSB, 0, 1) }
867 | fam_wife_sect { OCCUR2(WIFE, 0, 1) }
868 | fam_chil_sect /* 0:M */
869 | fam_nchi_sect { OCCUR2(NCHI, 0, 1) }
870 | fam_subm_sect /* 0:M */
871 | lds_spouse_seal_sub /* 0:M */
872 | source_cit_sub /* 0:M */
873 | multim_link_sub /* 0:M */
874 | note_struc_sub /* 0:M */
875 | ident_struc_sub /* 0:1 */
876 | change_date_sub /* 0:1 */
881 fam_husb_sect : OPEN DELIM TAG_HUSB mand_pointer
882 { $<ctxt>$ = start_element(ELT_FAM_HUSB,
884 GEDCOM_MAKE_STRING($4));
885 START(HUSB, $<ctxt>$)
890 { end_element(ELT_FAM_HUSB, PARENT, $<ctxt>5, NULL);
895 fam_wife_sect : OPEN DELIM TAG_WIFE mand_pointer
896 { $<ctxt>$ = start_element(ELT_FAM_WIFE,
898 GEDCOM_MAKE_STRING($4));
899 START(WIFE, $<ctxt>$)
904 { end_element(ELT_FAM_WIFE, PARENT, $<ctxt>5, NULL);
909 fam_chil_sect : OPEN DELIM TAG_CHIL mand_pointer
910 { $<ctxt>$ = start_element(ELT_FAM_CHIL,
912 GEDCOM_MAKE_STRING($4));
913 START(CHIL, $<ctxt>$)
918 { end_element(ELT_FAM_CHIL, PARENT, $<ctxt>5, NULL);
923 fam_nchi_sect : OPEN DELIM TAG_NCHI mand_line_item
924 { $<ctxt>$ = start_element(ELT_FAM_NCHI,
926 GEDCOM_MAKE_STRING($4));
927 START(NCHI, $<ctxt>$)
932 { end_element(ELT_FAM_NCHI, PARENT, $<ctxt>5, NULL);
937 fam_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
938 { $<ctxt>$ = start_element(ELT_FAM_SUBM,
940 GEDCOM_MAKE_STRING($4));
941 START(SUBM, $<ctxt>$)
946 { end_element(ELT_FAM_SUBM, PARENT, $<ctxt>5, NULL);
950 /*********************************************************************/
951 /**** Individual record ****/
952 /*********************************************************************/
953 indiv_rec : OPEN DELIM POINTER DELIM TAG_INDI
954 { $<ctxt>$ = start_record(REC_INDI, $1, $3, $5);
955 START(INDI, $<ctxt>$) }
959 { end_record(REC_INDI, $<ctxt>6); }
962 indi_subs : /* empty */
966 indi_sub : indi_resn_sect { OCCUR2(RESN, 0, 1) }
967 | pers_name_struc_sub /* 0:M */
968 | indi_sex_sect { OCCUR2(SEX, 0, 1) }
969 | indiv_even_struc_sub /* 0:M */
970 | indiv_attr_struc_sub /* 0:M */
971 | lds_indiv_ord_sub /* 0:M */
972 | chi_fam_link_sub /* 0:M */
973 | spou_fam_link_sub /* 0:M */
974 | indi_subm_sect /* 0:M */
975 | assoc_struc_sub /* 0:M */
976 | indi_alia_sect /* 0:M */
977 | indi_anci_sect /* 0:M */
978 | indi_desi_sect /* 0:M */
979 | source_cit_sub /* 0:M */
980 | multim_link_sub /* 0:M */
981 | note_struc_sub /* 0:M */
982 | indi_rfn_sect { OCCUR2(RFN, 0, 1) }
983 | indi_afn_sect /* 0:M */
984 | ident_struc_sub /* 0:1 */
985 | change_date_sub /* 0:1 */
986 | ftree_addr_sect { if (!compat_mode(C_FTREE))
993 indi_resn_sect : OPEN DELIM TAG_RESN mand_line_item
994 { $<ctxt>$ = start_element(ELT_INDI_RESN,
996 GEDCOM_MAKE_STRING($4));
997 START(RESN, $<ctxt>$)
1002 { end_element(ELT_INDI_RESN, PARENT, $<ctxt>5, NULL);
1007 indi_sex_sect : OPEN DELIM TAG_SEX mand_line_item
1008 { $<ctxt>$ = start_element(ELT_INDI_SEX,
1010 GEDCOM_MAKE_STRING($4));
1011 START(SEX, $<ctxt>$)
1016 { end_element(ELT_INDI_SEX, PARENT, $<ctxt>5, NULL);
1021 indi_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
1022 { $<ctxt>$ = start_element(ELT_INDI_SUBM,
1024 GEDCOM_MAKE_STRING($4));
1025 START(SUBM, $<ctxt>$)
1030 { end_element(ELT_INDI_SUBM, PARENT, $<ctxt>5, NULL);
1035 indi_alia_sect : OPEN DELIM TAG_ALIA mand_pointer
1036 { $<ctxt>$ = start_element(ELT_INDI_ALIA,
1038 GEDCOM_MAKE_STRING($4));
1039 START(ALIA, $<ctxt>$)
1044 { end_element(ELT_INDI_ALIA, PARENT, $<ctxt>5, NULL);
1049 indi_anci_sect : OPEN DELIM TAG_ANCI mand_pointer
1050 { $<ctxt>$ = start_element(ELT_INDI_ANCI,
1052 GEDCOM_MAKE_STRING($4));
1053 START(ANCI, $<ctxt>$)
1058 { end_element(ELT_INDI_ANCI, PARENT, $<ctxt>5, NULL);
1063 indi_desi_sect : OPEN DELIM TAG_DESI mand_pointer
1064 { $<ctxt>$ = start_element(ELT_INDI_DESI,
1066 GEDCOM_MAKE_STRING($4));
1067 START(DESI, $<ctxt>$)
1072 { end_element(ELT_INDI_DESI, PARENT, $<ctxt>5, NULL);
1077 indi_rfn_sect : OPEN DELIM TAG_RFN mand_line_item
1078 { $<ctxt>$ = start_element(ELT_INDI_RFN,
1080 GEDCOM_MAKE_STRING($4));
1081 START(RFN, $<ctxt>$)
1086 { end_element(ELT_INDI_RFN, PARENT, $<ctxt>5, NULL);
1091 indi_afn_sect : OPEN DELIM TAG_AFN mand_line_item
1092 { $<ctxt>$ = start_element(ELT_INDI_AFN,
1094 GEDCOM_MAKE_STRING($4));
1095 START(AFN, $<ctxt>$)
1100 { end_element(ELT_INDI_AFN, PARENT, $<ctxt>5, NULL);
1104 /* INDI.ADDR (Only for 'ftree' compatibility) */
1105 ftree_addr_sect : OPEN DELIM TAG_ADDR opt_line_item
1106 { START(ADDR, NULL) } no_std_subs { CHECK0 } CLOSE { }
1108 /*********************************************************************/
1109 /**** Multimedia record ****/
1110 /*********************************************************************/
1111 multim_rec : OPEN DELIM POINTER DELIM TAG_OBJE
1112 { $<ctxt>$ = start_record(REC_OBJE, $1, $3, $5);
1113 START(OBJE, $<ctxt>$) }
1115 { CHECK2(FORM, BLOB) }
1117 { end_record(REC_OBJE, $<ctxt>6); }
1120 obje_subs : /* empty */
1121 | obje_subs obje_sub
1124 obje_sub : obje_form_sect { OCCUR2(FORM, 1, 1) }
1125 | obje_titl_sect { OCCUR2(TITL, 0, 1) }
1126 | note_struc_sub /* 0:M */
1127 | obje_blob_sect { OCCUR2(BLOB, 1, 1) }
1128 | obje_obje_sect { OCCUR2(OBJE, 0, 1) }
1129 | ident_struc_sub /* 0:1 */
1130 | change_date_sub /* 0:1 */
1135 obje_form_sect : OPEN DELIM TAG_FORM mand_line_item
1136 { $<ctxt>$ = start_element(ELT_OBJE_FORM,
1138 GEDCOM_MAKE_STRING($4));
1139 START(FORM, $<ctxt>$)
1144 { end_element(ELT_OBJE_FORM, PARENT, $<ctxt>5, NULL);
1149 obje_titl_sect : OPEN DELIM TAG_TITL mand_line_item
1150 { $<ctxt>$ = start_element(ELT_OBJE_TITL,
1152 GEDCOM_MAKE_STRING($4));
1153 START(TITL, $<ctxt>$)
1158 { end_element(ELT_OBJE_TITL, PARENT, $<ctxt>5, NULL);
1163 obje_blob_sect : OPEN DELIM TAG_BLOB
1164 { $<ctxt>$ = start_element(ELT_OBJE_BLOB,
1165 PARENT, $1, $3, NULL, NULL);
1166 START(BLOB, $<ctxt>$)
1171 { end_element(ELT_OBJE_BLOB, PARENT, $<ctxt>4, NULL);
1175 obje_blob_subs : /* empty */
1176 | obje_blob_subs obje_blob_sub
1179 obje_blob_sub : obje_blob_cont_sect { OCCUR1(CONT, 1) }
1183 obje_blob_cont_sect : OPEN DELIM TAG_CONT mand_line_item
1184 { $<ctxt>$ = start_element(ELT_OBJE_BLOB_CONT,
1186 GEDCOM_MAKE_STRING($4));
1187 START(CONT, $<ctxt>$)
1192 { end_element(ELT_OBJE_BLOB_CONT, PARENT,
1198 obje_obje_sect : OPEN DELIM TAG_OBJE mand_pointer
1199 { $<ctxt>$ = start_element(ELT_OBJE_OBJE,
1201 GEDCOM_MAKE_STRING($4));
1202 START(OBJE, $<ctxt>$)
1207 { end_element(ELT_OBJE_OBJE, PARENT, $<ctxt>5, NULL);
1211 /*********************************************************************/
1212 /**** Note record ****/
1213 /*********************************************************************/
1214 note_rec : OPEN DELIM POINTER DELIM TAG_NOTE note_line_item
1215 { $<ctxt>$ = start_record(REC_NOTE, $1, $3, $5);
1216 START(NOTE, $<ctxt>$) }
1220 { end_record(REC_NOTE, $<ctxt>6); }
1223 note_line_item : /* empty */
1224 { if (!compat_mode(C_FTREE)) {
1225 gedcom_error(_("Missing value")); YYERROR;
1229 { gedcom_debug_print("==Val: %s==", $2);
1233 note_subs : /* empty */
1234 | note_subs note_sub
1237 note_sub : continuation_sub /* 0:M */
1238 | source_cit_sub /* 0:M */
1239 | ident_struc_sub /* 0:1 */
1240 | change_date_sub /* 0:1 */
1244 /*********************************************************************/
1245 /**** Repository record ****/
1246 /*********************************************************************/
1247 repos_rec : OPEN DELIM POINTER DELIM TAG_REPO
1248 { $<ctxt>$ = start_record(REC_REPO, $1, $3, $5);
1249 START(REPO, $<ctxt>$) }
1253 { end_record(REC_REPO, $<ctxt>6); }
1256 repo_subs : /* empty */
1257 | repo_subs repo_sub
1260 repo_sub : repo_name_sect { OCCUR2(NAME, 0, 1) }
1261 | addr_struc_sub /* 0:1 */
1262 | note_struc_sub /* 0:M */
1263 | ident_struc_sub /* 0:1 */
1264 | change_date_sub /* 0:1 */
1269 repo_name_sect : OPEN DELIM TAG_NAME mand_line_item
1270 { $<ctxt>$ = start_element(ELT_REPO_NAME,
1272 GEDCOM_MAKE_STRING($4));
1273 START(NAME, $<ctxt>$)
1278 { end_element(ELT_REPO_NAME, PARENT, $<ctxt>5, NULL);
1282 /*********************************************************************/
1283 /**** Source record ****/
1284 /*********************************************************************/
1285 source_rec : OPEN DELIM POINTER DELIM TAG_SOUR
1286 { $<ctxt>$ = start_record(REC_SOUR, $1, $3, $5);
1287 START(SOUR, $<ctxt>$) }
1291 { end_record(REC_SOUR, $<ctxt>6); }
1294 sour_subs : /* empty */
1295 | sour_subs sour_sub
1298 sour_sub : sour_data_sect { OCCUR2(DATA, 0, 1) }
1299 | sour_auth_sect { OCCUR2(AUTH, 0, 1) }
1300 | sour_titl_sect { OCCUR2(TITL, 0, 1) }
1301 | sour_abbr_sect { OCCUR2(ABBR, 0, 1) }
1302 | sour_publ_sect { OCCUR2(PUBL, 0, 1) }
1303 | sour_text_sect { OCCUR2(TEXT, 0, 1) }
1304 | source_repos_cit_sub /* 0:1 */
1305 | multim_link_sub /* 0:M */
1306 | note_struc_sub /* 0:M */
1307 | ident_struc_sub /* 0:1 */
1308 | change_date_sub /* 0:1 */
1313 sour_data_sect : OPEN DELIM TAG_DATA
1314 { $<ctxt>$ = start_element(ELT_SOUR_DATA,
1315 PARENT, $1, $3, NULL, NULL);
1316 START(DATA, $<ctxt>$)
1321 { end_element(ELT_SOUR_DATA, PARENT, $<ctxt>4, NULL);
1325 sour_data_subs : /* empty */
1326 | sour_data_subs sour_data_sub
1329 sour_data_sub : sour_data_even_sect /* 0:M */
1330 | sour_data_agnc_sect { OCCUR2(AGNC, 0, 1) }
1331 | note_struc_sub /* 0:M */
1335 sour_data_even_sect : OPEN DELIM TAG_EVEN mand_line_item
1336 { $<ctxt>$ = start_element(ELT_SOUR_DATA_EVEN,
1338 GEDCOM_MAKE_STRING($4));
1339 START(EVEN, $<ctxt>$)
1344 { end_element(ELT_SOUR_DATA_EVEN, PARENT,
1349 sour_data_even_subs : /* empty */
1350 | sour_data_even_subs sour_data_even_sub
1353 sour_data_even_sub : sour_data_even_date_sect { OCCUR2(DATE, 0, 1) }
1354 | sour_data_even_plac_sect { OCCUR2(PLAC, 0, 1) }
1358 sour_data_even_date_sect : OPEN DELIM TAG_DATE mand_line_item
1359 { struct date_value dv = gedcom_parse_date($4);
1360 $<ctxt>$ = start_element(ELT_SOUR_DATA_EVEN_DATE,
1362 GEDCOM_MAKE_DATE(dv));
1363 START(DATE, $<ctxt>$)
1368 { end_element(ELT_SOUR_DATA_EVEN_DATE, PARENT,
1373 sour_data_even_plac_sect : OPEN DELIM TAG_PLAC mand_line_item
1374 { $<ctxt>$ = start_element(ELT_SOUR_DATA_EVEN_PLAC,
1376 GEDCOM_MAKE_STRING($4));
1377 START(PLAC, $<ctxt>$)
1382 { end_element(ELT_SOUR_DATA_EVEN_PLAC, PARENT,
1387 sour_data_agnc_sect : OPEN DELIM TAG_AGNC mand_line_item
1388 { $<ctxt>$ = start_element(ELT_SOUR_DATA_AGNC,
1390 GEDCOM_MAKE_STRING($4));
1391 START(AGNC, $<ctxt>$)
1396 { end_element(ELT_SOUR_DATA_AGNC, PARENT,
1402 sour_auth_sect : OPEN DELIM TAG_AUTH mand_line_item
1403 { $<ctxt>$ = start_element(ELT_SOUR_AUTH,
1405 GEDCOM_MAKE_STRING($4));
1406 START(AUTH, $<ctxt>$)
1411 { end_element(ELT_SOUR_AUTH, PARENT, $<ctxt>5, NULL);
1415 sour_auth_subs : /* empty */
1416 | sour_auth_subs sour_auth_sub
1419 sour_auth_sub : continuation_sub /* 0:M */
1424 sour_titl_sect : OPEN DELIM TAG_TITL mand_line_item
1425 { $<ctxt>$ = start_element(ELT_SOUR_TITL,
1427 GEDCOM_MAKE_STRING($4));
1428 START(TITL, $<ctxt>$)
1433 { end_element(ELT_SOUR_TITL, PARENT, $<ctxt>5, NULL);
1437 sour_titl_subs : /* empty */
1438 | sour_titl_subs sour_titl_sub
1441 sour_titl_sub : continuation_sub /* 0:M */
1446 sour_abbr_sect : OPEN DELIM TAG_ABBR mand_line_item
1447 { $<ctxt>$ = start_element(ELT_SOUR_ABBR,
1449 GEDCOM_MAKE_STRING($4));
1450 START(ABBR, $<ctxt>$)
1455 { end_element(ELT_SOUR_ABBR, PARENT, $<ctxt>5, NULL);
1460 sour_publ_sect : OPEN DELIM TAG_PUBL mand_line_item
1461 { $<ctxt>$ = start_element(ELT_SOUR_PUBL,
1463 GEDCOM_MAKE_STRING($4));
1464 START(PUBL, $<ctxt>$)
1469 { end_element(ELT_SOUR_PUBL, PARENT, $<ctxt>5, NULL);
1473 sour_publ_subs : /* empty */
1474 | sour_publ_subs sour_publ_sub
1477 sour_publ_sub : continuation_sub /* 0:M */
1482 sour_text_sect : OPEN DELIM TAG_TEXT mand_line_item
1483 { $<ctxt>$ = start_element(ELT_SOUR_TEXT,
1485 GEDCOM_MAKE_STRING($4));
1486 START(TEXT, $<ctxt>$)
1491 { end_element(ELT_SOUR_TEXT, PARENT, $<ctxt>5, NULL);
1495 sour_text_subs : /* empty */
1496 | sour_text_subs sour_text_sub
1499 sour_text_sub : continuation_sub /* 0:M */
1503 /*********************************************************************/
1504 /**** Submission record ****/
1505 /*********************************************************************/
1506 submis_rec : OPEN DELIM POINTER DELIM TAG_SUBN
1507 { $<ctxt>$ = start_record(REC_SUBN, $1, $3, $5);
1508 START(SUBN, $<ctxt>$) }
1512 { end_record(REC_SUBN, $<ctxt>6); }
1515 subn_subs : /* empty */
1516 | subn_subs subn_sub
1519 subn_sub : subn_subm_sect { OCCUR2(SUBM, 0, 1) }
1520 | subn_famf_sect { OCCUR2(FAMF, 0, 1) }
1521 | subn_temp_sect { OCCUR2(TEMP, 0, 1) }
1522 | subn_ance_sect { OCCUR2(ANCE, 0, 1) }
1523 | subn_desc_sect { OCCUR2(DESC, 0, 1) }
1524 | subn_ordi_sect { OCCUR2(ORDI, 0, 1) }
1525 | subn_rin_sect { OCCUR2(RIN, 0, 1) }
1530 subn_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
1531 { $<ctxt>$ = start_element(ELT_SUBN_SUBM,
1533 GEDCOM_MAKE_STRING($4));
1534 START(SUBM, $<ctxt>$)
1539 { end_element(ELT_SUBN_SUBM, PARENT, $<ctxt>5, NULL);
1544 subn_famf_sect : OPEN DELIM TAG_FAMF mand_line_item
1545 { $<ctxt>$ = start_element(ELT_SUBN_FAMF,
1547 GEDCOM_MAKE_STRING($4));
1548 START(FAMF, $<ctxt>$)
1553 { end_element(ELT_SUBN_FAMF, PARENT, $<ctxt>5, NULL);
1558 subn_temp_sect : OPEN DELIM TAG_TEMP mand_line_item
1559 { $<ctxt>$ = start_element(ELT_SUBN_TEMP,
1561 GEDCOM_MAKE_STRING($4));
1562 START(TEMP, $<ctxt>$)
1567 { end_element(ELT_SUBN_TEMP, PARENT, $<ctxt>5, NULL);
1572 subn_ance_sect : OPEN DELIM TAG_ANCE mand_line_item
1573 { $<ctxt>$ = start_element(ELT_SUBN_ANCE,
1575 GEDCOM_MAKE_STRING($4));
1576 START(ANCE, $<ctxt>$)
1581 { end_element(ELT_SUBN_ANCE, PARENT, $<ctxt>5, NULL);
1586 subn_desc_sect : OPEN DELIM TAG_DESC mand_line_item
1587 { $<ctxt>$ = start_element(ELT_SUBN_DESC,
1589 GEDCOM_MAKE_STRING($4));
1590 START(DESC, $<ctxt>$)
1595 { end_element(ELT_SUBN_DESC, PARENT, $<ctxt>5, NULL);
1600 subn_ordi_sect : OPEN DELIM TAG_ORDI mand_line_item
1601 { $<ctxt>$ = start_element(ELT_SUBN_ORDI,
1603 GEDCOM_MAKE_STRING($4));
1604 START(ORDI, $<ctxt>$)
1609 { end_element(ELT_SUBN_ORDI, PARENT, $<ctxt>5, NULL);
1614 subn_rin_sect : OPEN DELIM TAG_RIN mand_line_item
1615 { $<ctxt>$ = start_element(ELT_SUBN_RIN,
1617 GEDCOM_MAKE_STRING($4));
1618 START(RIN, $<ctxt>$)
1623 { end_element(ELT_SUBN_RIN, PARENT, $<ctxt>5, NULL);
1627 /*********************************************************************/
1628 /**** Submitter record ****/
1629 /*********************************************************************/
1630 submit_rec : OPEN DELIM POINTER DELIM TAG_SUBM
1631 { $<ctxt>$ = start_record(REC_SUBM, $1, $3, $5);
1632 START(SUBM, $<ctxt>$) }
1636 { end_record(REC_SUBM, $<ctxt>6); }
1639 subm_subs : /* empty */
1640 | subm_subs subm_sub
1643 subm_sub : subm_name_sect { OCCUR2(NAME, 0, 1) }
1644 | addr_struc_sub /* 0:1 */
1645 | multim_link_sub /* 0:M */
1646 | subm_lang_sect { OCCUR2(LANG, 0, 3) }
1647 | subm_rfn_sect { OCCUR2(RFN, 0, 1) }
1648 | subm_rin_sect { OCCUR2(RIN, 0, 1) }
1649 | change_date_sub /* 0:1 */
1654 subm_name_sect : OPEN DELIM TAG_NAME mand_line_item
1655 { $<ctxt>$ = start_element(ELT_SUBM_NAME,
1657 GEDCOM_MAKE_STRING($4));
1658 START(NAME, $<ctxt>$)
1663 { end_element(ELT_SUBM_NAME, PARENT, $<ctxt>5, NULL);
1668 subm_lang_sect : OPEN DELIM TAG_LANG mand_line_item
1669 { $<ctxt>$ = start_element(ELT_SUBM_LANG,
1671 GEDCOM_MAKE_STRING($4));
1672 START(LANG, $<ctxt>$)
1677 { end_element(ELT_SUBM_LANG, PARENT, $<ctxt>5, NULL);
1682 subm_rfn_sect : OPEN DELIM TAG_RFN mand_line_item
1683 { $<ctxt>$ = start_element(ELT_SUBM_RFN,
1685 GEDCOM_MAKE_STRING($4));
1686 START(RFN, $<ctxt>$)
1691 { end_element(ELT_SUBM_RFN, PARENT, $<ctxt>5, NULL);
1696 subm_rin_sect : OPEN DELIM TAG_RIN mand_line_item
1697 { $<ctxt>$ = start_element(ELT_SUBM_RIN,
1699 GEDCOM_MAKE_STRING($4));
1700 START(RIN, $<ctxt>$)
1705 { end_element(ELT_SUBM_RIN, PARENT, $<ctxt>5, NULL);
1709 /*********************************************************************/
1710 /**** Substructures ****/
1711 /*********************************************************************/
1713 /* ADDRESS STRUCTURE */
1714 addr_struc_sub : addr_sect { OCCUR2(ADDR, 0, 1) }
1715 | phon_sect { OCCUR2(PHON, 0, 3) }
1718 addr_sect : OPEN DELIM TAG_ADDR mand_line_item
1719 { $<ctxt>$ = start_element(ELT_SUB_ADDR,
1721 GEDCOM_MAKE_STRING($4));
1722 START(ADDR, $<ctxt>$)
1727 { end_element(ELT_SUB_ADDR, PARENT, $<ctxt>5, NULL);
1731 addr_subs : /* empty */
1732 | addr_subs addr_sub
1735 addr_sub : addr_cont_sect /* 0:M */
1736 | addr_adr1_sect { OCCUR2(ADR1, 0, 1) }
1737 | addr_adr2_sect { OCCUR2(ADR2, 0, 1) }
1738 | addr_city_sect { OCCUR2(CITY, 0, 1) }
1739 | addr_stae_sect { OCCUR2(STAE, 0, 1) }
1740 | addr_post_sect { OCCUR2(POST, 0, 1) }
1741 | addr_ctry_sect { OCCUR2(CTRY, 0, 1) }
1745 addr_cont_sect : OPEN DELIM TAG_CONT mand_line_item
1746 { $<ctxt>$ = start_element(ELT_SUB_ADDR_CONT,
1748 GEDCOM_MAKE_STRING($4));
1749 START(CONT, $<ctxt>$)
1754 { end_element(ELT_SUB_ADDR_CONT, PARENT, $<ctxt>5, NULL);
1757 addr_adr1_sect : OPEN DELIM TAG_ADR1 mand_line_item
1758 { $<ctxt>$ = start_element(ELT_SUB_ADDR_ADR1,
1760 GEDCOM_MAKE_STRING($4));
1761 START(ADR1, $<ctxt>$)
1766 { end_element(ELT_SUB_ADDR_ADR1, PARENT, $<ctxt>5, NULL);
1769 addr_adr2_sect : OPEN DELIM TAG_ADR2 mand_line_item
1770 { $<ctxt>$ = start_element(ELT_SUB_ADDR_ADR2,
1772 GEDCOM_MAKE_STRING($4));
1773 START(ADR2, $<ctxt>$)
1778 { end_element(ELT_SUB_ADDR_ADR2, PARENT, $<ctxt>5, NULL);
1781 addr_city_sect : OPEN DELIM TAG_CITY mand_line_item
1782 { $<ctxt>$ = start_element(ELT_SUB_ADDR_CITY,
1784 GEDCOM_MAKE_STRING($4));
1785 START(CITY, $<ctxt>$)
1790 { end_element(ELT_SUB_ADDR_CITY, PARENT, $<ctxt>5, NULL);
1793 addr_stae_sect : OPEN DELIM TAG_STAE mand_line_item
1794 { $<ctxt>$ = start_element(ELT_SUB_ADDR_STAE,
1796 GEDCOM_MAKE_STRING($4));
1797 START(STAE, $<ctxt>$)
1802 { end_element(ELT_SUB_ADDR_STAE, PARENT, $<ctxt>5, NULL);
1805 addr_post_sect : OPEN DELIM TAG_POST mand_line_item
1806 { $<ctxt>$ = start_element(ELT_SUB_ADDR_POST,
1808 GEDCOM_MAKE_STRING($4));
1809 START(POST, $<ctxt>$)
1814 { end_element(ELT_SUB_ADDR_POST, PARENT, $<ctxt>5, NULL);
1817 addr_ctry_sect : OPEN DELIM TAG_CTRY mand_line_item
1818 { $<ctxt>$ = start_element(ELT_SUB_ADDR_CTRY,
1820 GEDCOM_MAKE_STRING($4));
1821 START(CTRY, $<ctxt>$)
1826 { end_element(ELT_SUB_ADDR_CTRY, PARENT, $<ctxt>5, NULL);
1830 phon_sect : OPEN DELIM TAG_PHON mand_line_item
1831 { $<ctxt>$ = start_element(ELT_SUB_PHON,
1833 GEDCOM_MAKE_STRING($4));
1834 START(PHON, $<ctxt>$)
1839 { end_element(ELT_SUB_PHON, PARENT, $<ctxt>5, NULL);
1843 /* ASSOCIATION STRUCTURE */
1844 assoc_struc_sub : asso_sect /* 0:M */
1847 asso_sect : OPEN DELIM TAG_ASSO mand_pointer
1848 { START(ASSO, NULL) }
1850 { CHECK2(TYPE,RELA) }
1854 asso_subs : /* empty */
1855 | asso_type_sect { OCCUR2(TYPE, 1, 1) }
1856 | asso_rela_sect { OCCUR2(RELA, 1, 1) }
1862 asso_type_sect : OPEN DELIM TAG_TYPE mand_line_item
1863 { START(TYPE, NULL) } no_std_subs { CHECK0 } CLOSE { }
1866 asso_rela_sect : OPEN DELIM TAG_RELA mand_line_item
1867 { START(RELA, NULL) } no_std_subs { CHECK0 } CLOSE { }
1871 change_date_sub : change_date_chan_sect { OCCUR2(CHAN, 0, 1) }
1874 change_date_chan_sect : OPEN DELIM TAG_CHAN
1875 { START(CHAN, NULL) }
1876 change_date_chan_subs
1881 change_date_chan_subs : /* empty */
1882 | change_date_chan_subs change_date_chan_sub
1885 change_date_chan_sub : change_date_date_sect { OCCUR2(DATE, 1, 1) }
1890 change_date_date_sect : OPEN DELIM TAG_DATE mand_line_item
1891 { START(DATE, NULL) }
1892 change_date_date_subs
1897 change_date_date_subs : /* empty */
1898 | change_date_date_subs change_date_date_sub
1901 change_date_date_sub : change_date_date_time_sect { OCCUR2(TIME, 0, 1) }
1905 change_date_date_time_sect : OPEN DELIM TAG_TIME mand_line_item
1906 { START(TIME, NULL) } no_std_subs { CHECK0 } CLOSE { }
1909 /* CHILD TO FAMILY LINK */
1910 chi_fam_link_sub : famc_sect /* 0:M */
1913 famc_sect : OPEN DELIM TAG_FAMC mand_pointer
1914 { START(FAMC, NULL) }
1920 famc_subs : /* empty */
1921 | famc_subs famc_sub
1924 famc_sub : famc_pedi_sect /* 0:M */
1929 famc_pedi_sect : OPEN DELIM TAG_PEDI mand_line_item
1930 { START(PEDI, NULL) } no_std_subs { CHECK0 } CLOSE { }
1933 /* CONTINUATION SUBSECTIONS */
1934 continuation_sub : cont_sect /* 0:M */
1935 | conc_sect /* 0:M */
1938 cont_sect : OPEN DELIM TAG_CONT mand_line_item
1939 { START(CONT, NULL) } no_std_subs { CHECK0 } CLOSE { }
1942 conc_sect : OPEN DELIM TAG_CONC mand_line_item
1943 { START(CONC, NULL) } no_std_subs { CHECK0 } CLOSE { }
1947 event_detail_sub : event_detail_type_sect { OCCUR2(TYPE, 0, 1) }
1948 | event_detail_date_sect { OCCUR2(DATE, 0, 1) }
1951 | event_detail_age_sect { OCCUR2(AGE, 0, 1) }
1952 | event_detail_agnc_sect { OCCUR2(AGNC, 0, 1) }
1953 | event_detail_caus_sect { OCCUR2(CAUS, 0, 1) }
1959 event_detail_type_sect : OPEN DELIM TAG_TYPE mand_line_item
1960 { START(TYPE, NULL) } no_std_subs { CHECK0 } CLOSE { }
1962 event_detail_date_sect : OPEN DELIM TAG_DATE mand_line_item
1963 { START(DATE, NULL) } no_std_subs { CHECK0 } CLOSE { }
1965 event_detail_age_sect : OPEN DELIM TAG_AGE mand_line_item
1966 { START(AGE, NULL) } no_std_subs { CHECK0 } CLOSE { }
1968 event_detail_agnc_sect : OPEN DELIM TAG_AGNC mand_line_item
1969 { START(AGNC, NULL) } no_std_subs { CHECK0 } CLOSE { }
1971 event_detail_caus_sect : OPEN DELIM TAG_CAUS mand_line_item
1972 { START(CAUS, NULL) } no_std_subs { CHECK0 } CLOSE { }
1975 /* FAMILY EVENT STRUCTURE */
1976 fam_event_struc_sub : fam_event_sect
1977 | fam_gen_even_sect /* 0:M */
1980 fam_event_sect : OPEN DELIM fam_event_tag opt_value fam_event_subs
1985 fam_event_tag : TAG_ANUL { START(ANUL, NULL) }
1986 | TAG_CENS { START(CENS, NULL) }
1987 | TAG_DIV { START(DIV, NULL) }
1988 | TAG_DIVF { START(DIVF, NULL) }
1989 | TAG_ENGA { START(ENGA, NULL) }
1990 | TAG_MARR { START(MARR, NULL) }
1991 | TAG_MARB { START(MARB, NULL) }
1992 | TAG_MARC { START(MARC, NULL) }
1993 | TAG_MARL { START(MARL, NULL) }
1994 | TAG_MARS { START(MARS, NULL) }
1997 fam_event_subs : /* empty */
1998 | fam_event_subs fam_event_sub
2001 fam_event_sub : event_detail_sub
2002 | fam_even_husb_sect { OCCUR2(HUSB, 0, 1) }
2003 | fam_even_wife_sect { OCCUR2(WIFE, 0, 1) }
2007 fam_even_husb_sect : OPEN DELIM TAG_HUSB
2008 { START(HUSB, NULL) }
2014 fam_even_husb_subs : /* empty */
2015 | fam_even_husb_subs fam_even_husb_sub
2018 fam_even_husb_sub : fam_even_husb_age_sect { OCCUR2(AGE, 1, 1) }
2022 fam_even_husb_age_sect : OPEN DELIM TAG_AGE mand_line_item
2023 { START(AGE, NULL) } no_std_subs { CHECK0 } CLOSE { }
2026 fam_even_wife_sect : OPEN DELIM TAG_WIFE
2027 { START(HUSB, NULL) }
2033 fam_gen_even_sect : OPEN DELIM TAG_EVEN
2034 { START(EVEN, NULL) }
2040 fam_gen_even_subs : /* empty */
2041 | fam_gen_even_subs fam_gen_even_sub
2044 fam_gen_even_sub : event_detail_sub
2045 | fam_even_husb_sect { OCCUR2(HUSB, 0, 1) }
2046 | fam_even_wife_sect { OCCUR2(WIFE, 0, 1) }
2050 /* IDENTIFICATION STRUCTURE */
2051 ident_struc_sub : ident_refn_sect /* 0:M */
2052 | ident_rin_sect { OCCUR2(RIN, 0, 1) }
2055 ident_refn_sect : OPEN DELIM TAG_REFN mand_line_item
2056 { START(REFN, NULL) }
2062 ident_refn_subs : /* empty */
2063 | ident_refn_subs ident_refn_sub
2066 ident_refn_sub : ident_refn_type_sect { OCCUR2(TYPE, 0, 1) }
2070 ident_refn_type_sect : OPEN DELIM TAG_TYPE mand_line_item
2071 { START(TYPE, NULL) } no_std_subs { CHECK0 } CLOSE { }
2074 ident_rin_sect : OPEN DELIM TAG_RIN mand_line_item
2075 { START(RIN, NULL) } no_std_subs { CHECK0 } CLOSE { }
2078 /* INDIVIDUAL ATTRIBUTE STRUCTURE */
2079 indiv_attr_struc_sub : indiv_cast_sect /* 0:M */
2080 | indiv_dscr_sect /* 0:M */
2081 | indiv_educ_sect /* 0:M */
2082 | indiv_idno_sect /* 0:M */
2083 | indiv_nati_sect /* 0:M */
2084 | indiv_nchi_sect /* 0:M */
2085 | indiv_nmr_sect /* 0:M */
2086 | indiv_occu_sect /* 0:M */
2087 | indiv_prop_sect /* 0:M */
2088 | indiv_reli_sect /* 0:M */
2089 | indiv_resi_sect /* 0:M */
2090 | indiv_ssn_sect /* 0:M */
2091 | indiv_titl_sect /* 0:M */
2094 indiv_cast_sect : OPEN DELIM TAG_CAST mand_line_item
2095 { START(CAST, NULL) }
2096 indiv_attr_event_subs
2100 indiv_dscr_sect : OPEN DELIM TAG_DSCR mand_line_item
2101 { START(DSCR, NULL) }
2102 indiv_attr_event_subs
2106 indiv_educ_sect : OPEN DELIM TAG_EDUC mand_line_item
2107 { START(EDUC, NULL) }
2108 indiv_attr_event_subs
2112 indiv_idno_sect : OPEN DELIM TAG_IDNO mand_line_item
2113 { START(IDNO, NULL) }
2114 indiv_attr_event_subs
2118 indiv_nati_sect : OPEN DELIM TAG_NATI mand_line_item
2119 { START(NATI, NULL) }
2120 indiv_attr_event_subs
2124 indiv_nchi_sect : OPEN DELIM TAG_NCHI mand_line_item
2125 { START(NCHI, NULL) }
2126 indiv_attr_event_subs
2130 indiv_nmr_sect : OPEN DELIM TAG_NMR mand_line_item
2131 { START(NMR, NULL) }
2132 indiv_attr_event_subs
2136 indiv_occu_sect : OPEN DELIM TAG_OCCU mand_line_item
2137 { START(OCCU, NULL) }
2138 indiv_attr_event_subs
2142 indiv_prop_sect : OPEN DELIM TAG_PROP mand_line_item
2143 { START(PROP, NULL) }
2144 indiv_attr_event_subs
2148 indiv_reli_sect : OPEN DELIM TAG_RELI mand_line_item
2149 { START(RELI, NULL) }
2150 indiv_attr_event_subs
2154 indiv_resi_sect : OPEN DELIM TAG_RESI
2155 { START(RESI, NULL) }
2156 indiv_attr_event_subs
2160 indiv_ssn_sect : OPEN DELIM TAG_SSN mand_line_item
2161 { START(SSN, NULL) }
2162 indiv_attr_event_subs
2166 indiv_titl_sect : OPEN DELIM TAG_TITL mand_line_item
2167 { START(TITL, NULL) }
2168 indiv_attr_event_subs
2173 indiv_attr_event_subs : /* empty */
2174 | indiv_attr_event_subs indiv_attr_event_sub
2177 indiv_attr_event_sub : event_detail_sub
2181 /* INDIVIDUAL EVENT STRUCTURE */
2182 indiv_even_struc_sub : indiv_birt_sect
2184 | indiv_adop_sect /* 0:M */
2185 | indiv_even_sect /* 0:M */
2188 indiv_birt_sect : OPEN DELIM indiv_birt_tag opt_value indiv_birt_subs
2193 indiv_birt_tag : TAG_BIRT { START(BIRT, NULL) }
2194 | TAG_CHR { START(CHR, NULL) }
2197 indiv_birt_subs : /* empty */
2198 | indiv_birt_subs indiv_birt_sub
2201 indiv_birt_sub : event_detail_sub
2202 | indiv_birt_famc_sect { OCCUR2(FAMC,0, 1) }
2206 indiv_birt_famc_sect : OPEN DELIM TAG_FAMC mand_pointer
2207 { START(FAMC, NULL) } no_std_subs { CHECK0 } CLOSE { }
2210 indiv_gen_sect : OPEN DELIM indiv_gen_tag opt_value indiv_gen_subs
2215 indiv_gen_tag : TAG_DEAT { START(DEAT, NULL) }
2216 | TAG_BURI { START(BURI, NULL) }
2217 | TAG_CREM { START(CREM, NULL) }
2218 | TAG_BAPM { START(BAPM, NULL) }
2219 | TAG_BARM { START(BARM, NULL) }
2220 | TAG_BASM { START(BASM, NULL) }
2221 | TAG_BLES { START(BLES, NULL) }
2222 | TAG_CHRA { START(CHRA, NULL) }
2223 | TAG_CONF { START(CONF, NULL) }
2224 | TAG_FCOM { START(FCOM, NULL) }
2225 | TAG_ORDN { START(ORDN, NULL) }
2226 | TAG_NATU { START(NATU, NULL) }
2227 | TAG_EMIG { START(EMIG, NULL) }
2228 | TAG_IMMI { START(IMMI, NULL) }
2229 | TAG_CENS { START(CENS, NULL) }
2230 | TAG_PROB { START(PROB, NULL) }
2231 | TAG_WILL { START(WILL, NULL) }
2232 | TAG_GRAD { START(GRAD, NULL) }
2233 | TAG_RETI { START(RETI, NULL) }
2236 indiv_gen_subs : /* empty */
2237 | indiv_gen_subs indiv_gen_sub
2240 indiv_gen_sub : event_detail_sub
2244 indiv_adop_sect : OPEN DELIM TAG_ADOP opt_value
2245 { START(ADOP, NULL) }
2251 indiv_adop_subs : /* empty */
2252 | indiv_adop_subs indiv_adop_sub
2255 indiv_adop_sub : event_detail_sub
2256 | indiv_adop_famc_sect { OCCUR2(FAMC,0, 1) }
2260 indiv_adop_famc_sect : OPEN DELIM TAG_FAMC mand_pointer
2261 { START(FAMC, NULL) }
2262 indiv_adop_famc_subs
2267 indiv_adop_famc_subs : /* empty */
2268 | indiv_adop_famc_subs indiv_adop_famc_sub
2271 indiv_adop_famc_sub : indiv_adop_famc_adop_sect { OCCUR2(ADOP,0, 1) }
2275 indiv_adop_famc_adop_sect : OPEN DELIM TAG_ADOP mand_line_item
2276 { START(ADOP, NULL) } no_std_subs { CHECK0 } CLOSE { }
2279 indiv_even_sect : OPEN DELIM TAG_EVEN
2280 { START(EVEN, NULL) }
2286 /* LDS INDIVIDUAL ORDINANCE */
2287 lds_indiv_ord_sub : lio_bapl_sect /* 0:M */
2288 | lio_slgc_sect /* 0:M */
2291 lio_bapl_sect : OPEN DELIM lio_bapl_tag lio_bapl_subs
2296 lio_bapl_tag : TAG_BAPL { START(BAPL, NULL) }
2297 | TAG_CONL { START(CONL, NULL) }
2298 | TAG_ENDL { START(ENDL, NULL) }
2301 lio_bapl_subs : /* empty */
2302 | lio_bapl_subs lio_bapl_sub
2305 lio_bapl_sub : lio_bapl_stat_sect { OCCUR2(STAT, 0, 1) }
2306 | lio_bapl_date_sect { OCCUR2(DATE, 0, 1) }
2307 | lio_bapl_temp_sect { OCCUR2(TEMP, 0, 1) }
2308 | lio_bapl_plac_sect { OCCUR2(PLAC, 0, 1) }
2314 lio_bapl_stat_sect : OPEN DELIM TAG_STAT mand_line_item
2315 { START(STAT, NULL) } no_std_subs { CHECK0 } CLOSE { }
2317 lio_bapl_date_sect : OPEN DELIM TAG_DATE mand_line_item
2318 { START(DATE, NULL) } no_std_subs { CHECK0 } CLOSE { }
2320 lio_bapl_temp_sect : OPEN DELIM TAG_TEMP mand_line_item
2321 { START(TEMP, NULL) } no_std_subs { CHECK0 } CLOSE { }
2323 lio_bapl_plac_sect : OPEN DELIM TAG_PLAC mand_line_item
2324 { START(PLAC, NULL) } no_std_subs { CHECK0 } CLOSE { }
2327 lio_slgc_sect : OPEN DELIM TAG_SLGC
2328 { START(SLGC, NULL) }
2334 lio_slgc_subs : /* empty */
2335 | lio_slgc_subs lio_slgc_sub
2338 lio_slgc_sub : lio_bapl_sub
2339 | lio_slgc_famc_sect { OCCUR2(FAMC, 1, 1) }
2342 lio_slgc_famc_sect : OPEN DELIM TAG_FAMC mand_pointer
2343 { START(FAMC, NULL) } no_std_subs { CHECK0 } CLOSE { }
2346 /* LDS SPOUSE SEALING */
2347 lds_spouse_seal_sub : lss_slgs_sect
2350 lss_slgs_sect : OPEN DELIM TAG_SLGS
2351 { START(SLGS, NULL) }
2357 lss_slgs_subs : /* empty */
2358 | lss_slgs_subs lss_slgs_sub
2361 lss_slgs_sub : lss_slgs_stat_sect { OCCUR2(STAT, 0, 1) }
2362 | lss_slgs_date_sect { OCCUR2(DATE, 0, 1) }
2363 | lss_slgs_temp_sect { OCCUR2(TEMP, 0, 1) }
2364 | lss_slgs_plac_sect { OCCUR2(PLAC, 0, 1) }
2370 lss_slgs_stat_sect : OPEN DELIM TAG_STAT mand_line_item
2371 { START(STAT, NULL) } no_std_subs { CHECK0 } CLOSE { }
2373 lss_slgs_date_sect : OPEN DELIM TAG_DATE mand_line_item
2374 { START(DATE, NULL) } no_std_subs { CHECK0 } CLOSE { }
2376 lss_slgs_temp_sect : OPEN DELIM TAG_TEMP mand_line_item
2377 { START(TEMP, NULL) } no_std_subs { CHECK0 } CLOSE { }
2379 lss_slgs_plac_sect : OPEN DELIM TAG_PLAC mand_line_item
2380 { START(PLAC, NULL) } no_std_subs { CHECK0 } CLOSE { }
2383 /* MULTIMEDIA LINK */
2384 multim_link_sub : multim_obje_link_sect
2385 | multim_obje_emb_sect
2388 multim_obje_link_sect : OPEN DELIM TAG_OBJE DELIM POINTER
2389 { START(OBJE, NULL) } no_std_subs { CHECK0 } CLOSE { }
2392 multim_obje_emb_sect : OPEN DELIM TAG_OBJE
2393 { START(OBJE, NULL) }
2394 multim_obje_emb_subs
2395 { CHECK2(FORM,FILE) }
2399 multim_obje_emb_subs : /* empty */
2400 | multim_obje_emb_subs multim_obje_emb_sub
2403 multim_obje_emb_sub : multim_obje_form_sect { OCCUR2(FORM, 1, 1) }
2404 | multim_obje_titl_sect { OCCUR2(TITL, 0, 1) }
2405 | multim_obje_file_sect { OCCUR2(FILE, 1, 1) }
2410 multim_obje_form_sect : OPEN DELIM TAG_FORM mand_line_item
2411 { START(FORM, NULL) } no_std_subs { CHECK0 } CLOSE { }
2413 multim_obje_titl_sect : OPEN DELIM TAG_TITL mand_line_item
2414 { START(TITL, NULL) } no_std_subs { CHECK0 } CLOSE { }
2416 multim_obje_file_sect : OPEN DELIM TAG_FILE mand_line_item
2417 { START(FILE, NULL) } no_std_subs { CHECK0 } CLOSE { }
2420 /* NOTE STRUCTURE */
2421 note_struc_sub : note_struc_link_sect /* 0:M */
2422 | note_struc_emb_sect /* 0:M */
2425 note_struc_link_sect : OPEN DELIM TAG_NOTE DELIM POINTER
2426 { START(NOTE, NULL) }
2427 note_struc_link_subs
2432 note_struc_link_subs : /* empty */
2433 | note_struc_link_subs note_struc_link_sub
2436 note_struc_link_sub : source_cit_sub
2440 note_struc_emb_sect : OPEN DELIM TAG_NOTE opt_line_item
2441 { START(NOTE, NULL) }
2447 note_struc_emb_subs : /* empty */
2448 | note_struc_emb_subs note_struc_emb_sub
2451 note_struc_emb_sub : continuation_sub
2456 /* PERSONAL NAME STRUCTURE */
2457 pers_name_struc_sub : pers_name_sect /* 0:M */
2460 pers_name_sect : OPEN DELIM TAG_NAME mand_line_item
2461 { START(NAME, NULL) }
2467 pers_name_subs : /* empty */
2468 | pers_name_subs pers_name_sub
2471 pers_name_sub : pers_name_npfx_sect { OCCUR2(NPFX, 0, 1) }
2472 | pers_name_givn_sect { OCCUR2(GIVN, 0, 1) }
2473 | pers_name_nick_sect { OCCUR2(NICK, 0, 1) }
2474 | pers_name_spfx_sect { OCCUR2(SPFX, 0, 1) }
2475 | pers_name_surn_sect { OCCUR2(SURN, 0, 1) }
2476 | pers_name_nsfx_sect { OCCUR2(NSFX, 0, 1) }
2482 pers_name_npfx_sect : OPEN DELIM TAG_NPFX mand_line_item
2483 { START(NPFX, NULL) } no_std_subs { CHECK0 } CLOSE { }
2485 pers_name_givn_sect : OPEN DELIM TAG_GIVN mand_line_item
2486 { START(GIVN, NULL) } no_std_subs { CHECK0 } CLOSE { }
2488 pers_name_nick_sect : OPEN DELIM TAG_NICK mand_line_item
2489 { START(NICK, NULL) } no_std_subs { CHECK0 } CLOSE { }
2491 pers_name_spfx_sect : OPEN DELIM TAG_SPFX mand_line_item
2492 { START(SPFX, NULL) } no_std_subs { CHECK0 } CLOSE { }
2494 pers_name_surn_sect : OPEN DELIM TAG_SURN mand_line_item
2495 { START(SURN, NULL) } no_std_subs { CHECK0 } CLOSE { }
2497 pers_name_nsfx_sect : OPEN DELIM TAG_NSFX mand_line_item
2498 { START(NSFX, NULL) } no_std_subs { CHECK0 } CLOSE { }
2501 /* PLACE STRUCTURE */
2502 place_struc_sub : place_struc_plac_sect /* 0:M */
2505 place_struc_plac_sect : OPEN DELIM TAG_PLAC mand_line_item
2506 { START(PLAC, NULL) }
2507 place_struc_plac_subs
2512 place_struc_plac_subs : /* empty */
2513 | place_struc_plac_subs place_struc_plac_sub
2516 place_struc_plac_sub : place_plac_form_sect { OCCUR2(FORM, 0, 1) }
2522 place_plac_form_sect : OPEN DELIM TAG_FORM mand_line_item
2523 { START(FORM, NULL) } no_std_subs { CHECK0 } CLOSE { }
2526 /* SOURCE_CITATION */
2527 source_cit_sub : source_cit_link_sect /* 0:M */
2528 | source_cit_emb_sect /* 0:M */
2531 source_cit_link_sect : OPEN DELIM TAG_SOUR DELIM POINTER
2532 { START(SOUR, NULL) }
2533 source_cit_link_subs
2538 source_cit_link_subs : /* empty */
2539 | source_cit_link_subs source_cit_link_sub
2542 source_cit_link_sub : source_cit_page_sect { OCCUR2(PAGE, 0, 1) }
2543 | source_cit_even_sect { OCCUR2(EVEN, 0, 1) }
2544 | source_cit_data_sect { OCCUR2(DATA, 0, 1) }
2545 | source_cit_quay_sect { OCCUR2(QUAY, 0, 1) }
2551 source_cit_page_sect : OPEN DELIM TAG_PAGE mand_line_item
2552 { START(PAGE, NULL) } no_std_subs { CHECK0 } CLOSE { }
2555 source_cit_even_sect : OPEN DELIM TAG_EVEN mand_line_item
2556 { START(EVEN, NULL) }
2557 source_cit_even_subs
2562 source_cit_even_subs : /* empty */
2563 | source_cit_even_subs source_cit_even_sub
2566 source_cit_even_sub : source_cit_even_role_sect { OCCUR2(ROLE, 0, 1) }
2570 source_cit_even_role_sect : OPEN DELIM TAG_ROLE mand_line_item
2571 { START(ROLE, NULL) } no_std_subs { CHECK0 } CLOSE { }
2574 source_cit_data_sect : OPEN DELIM TAG_DATA
2575 { START(DATA, NULL) }
2576 source_cit_data_subs
2581 source_cit_data_subs : /* empty */
2582 | source_cit_data_subs source_cit_data_sub
2585 source_cit_data_sub : source_cit_data_date_sect { OCCUR2(DATE, 0, 1) }
2586 | source_cit_text_sect /* 0:M */
2590 source_cit_data_date_sect : OPEN DELIM TAG_DATE mand_line_item
2591 { START(DATE, NULL) } no_std_subs { CHECK0 } CLOSE { }
2594 source_cit_text_sect : OPEN DELIM TAG_TEXT mand_line_item
2595 { START(TEXT, NULL) }
2596 source_cit_text_subs
2601 source_cit_text_subs : /* empty */
2602 | source_cit_text_subs source_cit_text_sub
2605 source_cit_text_sub : continuation_sub
2609 source_cit_quay_sect : OPEN DELIM TAG_QUAY mand_line_item
2610 { START(QUAY, NULL) } no_std_subs { CHECK0 } CLOSE { }
2613 source_cit_emb_sect : OPEN DELIM TAG_SOUR mand_line_item
2614 { START(SOUR, NULL) }
2620 source_cit_emb_subs : /* empty */
2621 | source_cit_emb_subs source_cit_emb_sub
2624 source_cit_emb_sub : continuation_sub
2625 | source_cit_text_sect /* 0:M */
2630 /* SOURCE REPOSITORY CITATION */
2631 source_repos_cit_sub : source_repos_repo_sect { OCCUR2(REPO, 0, 1) }
2634 source_repos_repo_sect : OPEN DELIM TAG_REPO mand_pointer
2635 { START(REPO, NULL) }
2636 source_repos_repo_subs
2641 source_repos_repo_subs : /* empty */
2642 | source_repos_repo_subs source_repos_repo_sub
2645 source_repos_repo_sub : note_struc_sub
2646 | caln_sect /* 0:M */
2650 caln_sect : OPEN DELIM TAG_CALN mand_line_item
2651 { START(CALN, NULL) }
2657 caln_subs : /* empty */
2658 | caln_subs caln_sub
2661 caln_sub : caln_medi_sect { OCCUR2(MEDI, 0, 1) }
2665 caln_medi_sect : OPEN DELIM TAG_MEDI mand_line_item
2666 { START(MEDI, NULL) } no_std_subs { CHECK0 } CLOSE { }
2669 /* SPOUSE TO FAMILY LINK */
2670 spou_fam_link_sub : spou_fam_fams_sect /* 0:M */
2673 spou_fam_fams_sect : OPEN DELIM TAG_FAMS mand_pointer
2674 { START(FAMS, NULL) }
2680 spou_fam_fams_subs : /* empty */
2681 | spou_fam_fams_subs spou_fam_fams_sub
2684 spou_fam_fams_sub : note_struc_sub
2688 /*********************************************************************/
2689 /**** Special values ****/
2690 /*********************************************************************/
2692 /*********************************************************************/
2694 /*********************************************************************/
2696 no_std_subs : /* empty */
2697 | no_std_subs no_std_sub
2700 no_std_sub : user_sect /* 0:M */
2702 | error error_subs CLOSE { HANDLE_ERROR }
2705 no_std_rec : user_rec /* 0:M */
2707 | error error_subs CLOSE { HANDLE_ERROR }
2710 user_rec : OPEN DELIM opt_xref USERTAG
2711 { if ($4[0] != '_') {
2712 gedcom_error(_("Undefined tag (and not a valid user tag): %s"),
2718 { $<ctxt>$ = start_record(REC_USER, $1, $3, $4);
2724 { end_record(REC_USER, $<ctxt>7); }
2726 user_sect : OPEN DELIM opt_xref USERTAG
2727 { if ($4[0] != '_') {
2728 gedcom_error(_("Undefined tag (and not a valid user tag): %s"),
2734 { $<ctxt>$ = start_element(ELT_USER, PARENT, $1, $4, $6,
2735 GEDCOM_MAKE_STRING($6));
2736 START($4, $<ctxt>$);
2741 { end_element(ELT_USER, PARENT, $<ctxt>7, NULL);
2745 user_sects : /* empty */ { }
2746 | user_sects user_sect { }
2749 opt_xref : /* empty */ { $$ = NULL; }
2750 | POINTER DELIM { $$ = $1; }
2753 opt_value : /* empty */ { $$ = NULL; }
2754 | DELIM line_value { $$ = $2; }
2757 line_value : POINTER { $$ = $1; }
2758 | line_item { $$ = $1; }
2761 mand_pointer : /* empty */ { gedcom_error(_("Missing pointer")); YYERROR; }
2762 | DELIM POINTER { gedcom_debug_print("==Ptr: %s==", $2);
2766 mand_line_item : /* empty */ { gedcom_error(_("Missing value")); YYERROR; }
2767 | DELIM line_item { gedcom_debug_print("==Val: %s==", $2);
2771 opt_line_item : /* empty */ { }
2772 | DELIM line_item { }
2775 line_item : anychar { size_t i;
2776 CLEAR_BUFFER(line_item_buf);
2777 line_item_buf_ptr = line_item_buf;
2778 /* The following also takes care of '@@' */
2779 if (!strncmp($1, "@@", 3))
2780 *line_item_buf_ptr++ = '@';
2782 for (i=0; i < strlen($1); i++)
2783 *line_item_buf_ptr++ = $1[i];
2786 | ESCAPE { size_t i;
2787 CLEAR_BUFFER(line_item_buf);
2788 line_item_buf_ptr = line_item_buf;
2789 for (i=0; i < strlen($1); i++)
2790 *line_item_buf_ptr++ = $1[i];
2795 /* The following also takes care of '@@' */
2796 if (!strncmp($2, "@@", 3))
2797 *line_item_buf_ptr++ = '@';
2799 for (i=0; i < strlen($2); i++)
2800 *line_item_buf_ptr++ = $2[i];
2805 for (i=0; i < strlen($2); i++)
2806 *line_item_buf_ptr++ = $2[i];
2811 anychar : ANYCHAR { }
2815 error_subs : /* empty */
2816 | error_subs error_sect
2819 error_sect : OPEN DELIM opt_xref anytag opt_value error_subs CLOSE { }
2821 gen_sect : OPEN DELIM opt_xref anystdtag
2822 { INVALID_TAG($4); }
2823 opt_value opt_sects CLOSE
2827 gen_rec : gen_rec_top
2831 gen_rec_norm : OPEN DELIM opt_xref anystdtag
2832 { INVALID_TOP_TAG($4) }
2833 opt_value opt_sects CLOSE
2837 gen_rec_top : OPEN DELIM anytoptag
2838 { gedcom_error(_("Missing cross-reference")); YYERROR; }
2839 opt_value opt_sects CLOSE
2843 opt_sects : /* empty */ { }
2844 | opt_sects gen_sect { }
2847 anytag : USERTAG { }
2861 anystdtag : TAG_ABBR
2991 /* Functions that handle the counting of subtags */
2993 int* count_arrays[MAXGEDCLEVEL+1];
2994 char tag_stack[MAXGEDCLEVEL+1][MAXSTDTAGLEN+1];
2995 Gedcom_ctxt ctxt_stack[MAXGEDCLEVEL+1];
2997 void push_countarray()
3000 if (count_level > MAXGEDCLEVEL) {
3001 gedcom_error(_("Internal error: count array overflow"));
3005 count = (int *)calloc(YYNTOKENS, sizeof(int));
3006 if (count == NULL) {
3007 gedcom_error(_("Internal error: count array calloc error"));
3011 count_arrays[count_level] = count;
3016 void set_parenttag(char* tag)
3018 strncpy(tag_stack[count_level], tag, MAXSTDTAGLEN+1);
3021 void set_parentctxt(Gedcom_ctxt ctxt)
3023 ctxt_stack[count_level] = ctxt;
3026 char* get_parenttag()
3028 return tag_stack[count_level];
3031 Gedcom_ctxt get_parentctxt()
3033 return ctxt_stack[count_level];
3036 int count_tag(int tag)
3038 int *count = count_arrays[count_level];
3039 return ++count[tag - GEDCOMTAGOFFSET];
3042 int check_occurrence(int tag)
3044 int *count = count_arrays[count_level];
3045 return (count[tag - GEDCOMTAGOFFSET] > 0);
3048 void pop_countarray()
3051 if (count_level < 0) {
3052 gedcom_error(_("Internal error: count array underflow"));
3056 count = count_arrays[count_level];
3058 count_arrays[count_level] = NULL;
3062 /* Enabling debug mode */
3063 /* level 0: no debugging */
3064 /* level 1: only internal */
3065 /* level 2: also bison */
3068 void gedcom_set_debug_level(int level, FILE* f)
3073 trace_output = stderr;
3075 gedcom_high_level_debug = 1;
3084 int gedcom_debug_print(char* s, ...)
3087 if (gedcom_high_level_debug) {
3090 res = vfprintf(trace_output, s, ap);
3092 fprintf(trace_output, "\n");
3097 /* Setting the error mechanism */
3098 void gedcom_set_error_handling(Gedcom_err_mech mechanism)
3100 error_mechanism = mechanism;
3103 /* Compatibility handling */
3105 void gedcom_set_compat_handling(int enable_compat)
3107 compat_enabled = enable_compat;
3110 void set_compatibility(char* program)
3112 if (compat_enabled) {
3113 if (! strncmp(program, "ftree", 6)) {
3114 gedcom_warning(_("Enabling compatibility with 'ftree'"));
3115 compatibility = C_FTREE;
3123 int compat_mode(int compat_flags)
3125 return (compat_flags & compatibility);