4 /* WARNING: THIS PARSER RELIES HEAVILY ON SOME FEATURES OF BISON.
5 DON'T TRY TO USE IT WITH YACC, IT WON'T WORK...
8 /* Design of the parser:
10 In general, a GEDCOM file contains records, each consisting of a line
11 (which we'll call a section), hierarchically containing other lines
12 (subsections of the section).
14 This means that in general we have:
16 A 'record' is a 'section' (sect) containing 'subsections' (subs)
17 Each 'subsection' (sub) is again a specific 'section' (sect)
19 In parser notation, this means:
23 sect : <some prefix> subs <some suffix>
25 subs : <empty> | subs sub
27 sub : sect_a | sect_b | ...
29 This pattern is repeated throughout the parser for the different types of
33 Cardinality of the subsections:
34 -------------------------------
35 Note that in the above, the order of the subsections is of no importance.
36 Indeed, this is the case in the GEDCOM grammar. However, this also makes
37 it difficult to check whether there are not too many subsections of a
38 specific type, or whether a mandatory subsection is indeed there.
40 Suppose there is a section A that can contain 0 or 1 B section and
43 This can be expressed in parser notation as follows:
45 A : CC | BCC | CBC | CCB
47 So, cardinality is indeed expressable. However, as the number of subsection
48 types and the limits grow bigger (and even theoretically limitless), listing
49 all possible permutations becomes quickly unfeasible.
51 Much simpler is to say:
54 subs : <empty> | subs sub
57 and then check the cardinality in the semantic actions, which is the
58 solution chosen in the parser below, using the following macros:
61 Make a new context for the <parent> tag to count child tags in
63 - OCCUR2(<child>, <min>, <max>)
64 Express that the <child> tag should occur at least <min> times and
65 at most <max> tags within its parent
67 What this actually does is the following. It increments the counter
68 for that tag and then checks whether the maximum is exceeded. If so,
69 then a parser error is produced. The minimum is not actually checked
70 by this macro, but it makes the statements more declarative.
72 - OCCUR1(<child>, <min>)
73 Express that the <child> tag should occur at least <min> times within
74 its parent (no upper limit)
76 Actually, this only increments the counter for the tag, but it looks
77 very like the previous macro.
79 If the minimum is 0, it is not necessary to express this constraint.
81 - CHECKn(<child1>, ..., <childn>)
82 This closes the context for the parent tag and checks whether the
83 given <child> tags did effectively occur within the parent (i.e.
84 these are the tags that were mandatory).
86 Since the <min> values above are always 0 or 1 in GEDCOM, this is
87 sufficient. All sub-tags that declare a minimum of 1 in the OCCUR
88 macros should be listed in this macro here.
90 The macros CHECK0 to CHECK4 are defined like this (the first one
91 has no arguments and is only used to close the parent context; note
92 that this is necessary for correct functioning).
96 Only sections that have subsections need to use these macros. This can
97 be done like this (the OPEN and CHECK macros are used as mid-rule
98 actions around the subsections):
100 head_sect : OPEN DELIM TAG_HEAD
104 CLOSE { <semantic actions> }
110 head_sub : head_sour_sect { OCCUR2(SOUR, 1, 1) }
111 | head_dest_sect { OCCUR2(DEST, 0, 1) }
112 | head_date_sect { OCCUR2(DATE, 0, 1) }
118 - The syntax analysis doesn't handle the contents of the line values
119 or their encoding; this is done in the semantic analysis.
128 MECHANISM curr_mechanism=IMMED_FAIL;
130 /* These are defined at the bottom of the file */
131 void push_countarray();
132 void set_parenttag(char* tag);
133 char* get_parenttag();
134 void pop_countarray();
135 int count_tag(int tag);
136 int check_occurrence(int tag);
138 #define HANDLE_ERROR \
140 if (curr_mechanism == IMMED_FAIL) { \
143 else if (curr_mechanism == DEFER_FAIL) { \
146 else if (curr_mechanism == IGNORE_ERRORS) { \
150 #define OPEN(PARENTTAG) \
152 set_parenttag(#PARENTTAG); \
156 { if (!check_occurrence(TAG_##TAG)) { \
157 char* parenttag = get_parenttag(); \
158 gedcom_error("The tag '%s' is mandatory within '%s'", \
164 { pop_countarray(); \
168 #define CHECK1(TAG1) { CHK(TAG1); POP; }
169 #define CHECK2(TAG1,TAG2) \
170 { CHK(TAG1); CHK(TAG2); POP; }
171 #define CHECK3(TAG1,TAG2,TAG3) \
172 { CHK(TAG1); CHK(TAG2); CHK(TAG3); POP; }
173 #define CHECK4(TAG1,TAG2,TAG3,TAG4) \
174 { CHK(TAG1); CHK(TAG2); CHK(TAG3); CHK(TAG4); POP; }
175 #define OCCUR1(CHILDTAG, MIN) { count_tag(TAG_##CHILDTAG); }
176 #define OCCUR2(CHILDTAG, MIN, MAX) \
177 { int num = count_tag(TAG_##CHILDTAG); \
179 char* parenttag = get_parenttag(); \
180 gedcom_error("The tag '%s' can maximally occur %d " \
181 "time(s) within '%s'", \
182 #CHILDTAG, MAX, parenttag); \
186 #define INVALID_TAG(CHILDTAG) \
187 { char* parenttag = get_parenttag(); \
188 gedcom_error("The tag '%s' is not a valid tag within '%s'", \
189 CHILDTAG, parenttag); \
192 #define INVALID_TOP_TAG(CHILDTAG) \
193 { gedcom_error("The tag '%s' is not a valid top-level tag", \
207 %token <string> BADTOKEN
209 %token <string> CLOSE
210 %token <string> ESCAPE
211 %token <string> DELIM
212 %token <string> ANYCHAR
213 %token <string> POINTER
214 %token <string> USERTAG
215 %token <string> TAG_ABBR
216 %token <string> TAG_ADDR
217 %token <string> TAG_ADR1
218 %token <string> TAG_ADR2
219 %token <string> TAG_ADOP
220 %token <string> TAG_AFN
221 %token <string> TAG_AGE
222 %token <string> TAG_AGNC
223 %token <string> TAG_ALIA
224 %token <string> TAG_ANCE
225 %token <string> TAG_ANCI
226 %token <string> TAG_ANUL
227 %token <string> TAG_ASSO
228 %token <string> TAG_AUTH
229 %token <string> TAG_BAPL
230 %token <string> TAG_BAPM
231 %token <string> TAG_BARM
232 %token <string> TAG_BASM
233 %token <string> TAG_BIRT
234 %token <string> TAG_BLES
235 %token <string> TAG_BLOB
236 %token <string> TAG_BURI
237 %token <string> TAG_CALN
238 %token <string> TAG_CAST
239 %token <string> TAG_CAUS
240 %token <string> TAG_CENS
241 %token <string> TAG_CHAN
242 %token <string> TAG_CHAR
243 %token <string> TAG_CHIL
244 %token <string> TAG_CHR
245 %token <string> TAG_CHRA
246 %token <string> TAG_CITY
247 %token <string> TAG_CONC
248 %token <string> TAG_CONF
249 %token <string> TAG_CONL
250 %token <string> TAG_CONT
251 %token <string> TAG_COPR
252 %token <string> TAG_CORP
253 %token <string> TAG_CREM
254 %token <string> TAG_CTRY
255 %token <string> TAG_DATA
256 %token <string> TAG_DATE
257 %token <string> TAG_DEAT
258 %token <string> TAG_DESC
259 %token <string> TAG_DESI
260 %token <string> TAG_DEST
261 %token <string> TAG_DIV
262 %token <string> TAG_DIVF
263 %token <string> TAG_DSCR
264 %token <string> TAG_EDUC
265 %token <string> TAG_EMIG
266 %token <string> TAG_ENDL
267 %token <string> TAG_ENGA
268 %token <string> TAG_EVEN
269 %token <string> TAG_FAM
270 %token <string> TAG_FAMC
271 %token <string> TAG_FAMF
272 %token <string> TAG_FAMS
273 %token <string> TAG_FCOM
274 %token <string> TAG_FILE
275 %token <string> TAG_FORM
276 %token <string> TAG_GEDC
277 %token <string> TAG_GIVN
278 %token <string> TAG_GRAD
279 %token <string> TAG_HEAD
280 %token <string> TAG_HUSB
281 %token <string> TAG_IDNO
282 %token <string> TAG_IMMI
283 %token <string> TAG_INDI
284 %token <string> TAG_LANG
285 %token <string> TAG_LEGA
286 %token <string> TAG_MARB
287 %token <string> TAG_MARC
288 %token <string> TAG_MARL
289 %token <string> TAG_MARR
290 %token <string> TAG_MARS
291 %token <string> TAG_MEDI
292 %token <string> TAG_NAME
293 %token <string> TAG_NATI
294 %token <string> TAG_NATU
295 %token <string> TAG_NCHI
296 %token <string> TAG_NICK
297 %token <string> TAG_NMR
298 %token <string> TAG_NOTE
299 %token <string> TAG_NPFX
300 %token <string> TAG_NSFX
301 %token <string> TAG_OBJE
302 %token <string> TAG_OCCU
303 %token <string> TAG_ORDI
304 %token <string> TAG_ORDN
305 %token <string> TAG_PAGE
306 %token <string> TAG_PEDI
307 %token <string> TAG_PHON
308 %token <string> TAG_PLAC
309 %token <string> TAG_POST
310 %token <string> TAG_PROB
311 %token <string> TAG_PROP
312 %token <string> TAG_PUBL
313 %token <string> TAG_QUAY
314 %token <string> TAG_REFN
315 %token <string> TAG_RELA
316 %token <string> TAG_RELI
317 %token <string> TAG_REPO
318 %token <string> TAG_RESI
319 %token <string> TAG_RESN
320 %token <string> TAG_RETI
321 %token <string> TAG_RFN
322 %token <string> TAG_RIN
323 %token <string> TAG_ROLE
324 %token <string> TAG_SEX
325 %token <string> TAG_SLGC
326 %token <string> TAG_SLGS
327 %token <string> TAG_SOUR
328 %token <string> TAG_SPFX
329 %token <string> TAG_SSN
330 %token <string> TAG_STAE
331 %token <string> TAG_STAT
332 %token <string> TAG_SUBM
333 %token <string> TAG_SUBN
334 %token <string> TAG_SURN
335 %token <string> TAG_TEMP
336 %token <string> TAG_TEXT
337 %token <string> TAG_TIME
338 %token <string> TAG_TITL
339 %token <string> TAG_TRLR
340 %token <string> TAG_TYPE
341 %token <string> TAG_VERS
342 %token <string> TAG_WIFE
343 %token <string> TAG_WILL
345 %type <string> anystdtag
349 file : head_sect records trlr_sect
350 { if (fail == 1) YYABORT; }
353 records : /* empty */
368 /*********************************************************************/
370 /*********************************************************************/
371 head_sect : OPEN DELIM TAG_HEAD
374 { CHECK4(SOUR, SUBM, GEDC, CHAR) }
378 head_subs : /* empty */
382 head_sub : head_sour_sect { OCCUR2(SOUR, 1, 1) }
383 | head_dest_sect { OCCUR2(DEST, 0, 1) }
384 | head_date_sect { OCCUR2(DATE, 0, 1) }
385 | head_subm_sect { OCCUR2(SUBM, 1, 1) }
386 | head_subn_sect { OCCUR2(SUBN, 0, 1) }
387 | head_file_sect { OCCUR2(FILE, 0, 1) }
388 | head_copr_sect { OCCUR2(COPR, 0, 1) }
389 | head_gedc_sect { OCCUR2(GEDC, 1, 1) }
390 | head_char_sect { OCCUR2(CHAR, 1, 1) }
391 | head_lang_sect { OCCUR2(LANG, 0, 1) }
392 | head_plac_sect { OCCUR2(PLAC, 0, 1) }
393 | head_note_sect { OCCUR2(NOTE, 0, 1) }
398 head_sour_sect : OPEN DELIM TAG_SOUR DELIM line_item
406 head_sour_subs : /* empty */
407 | head_sour_subs head_sour_sub
410 head_sour_sub : head_sour_vers_sect { OCCUR2(VERS, 0, 1) }
411 | head_sour_name_sect { OCCUR2(NAME, 0, 1) }
412 | head_sour_corp_sect { OCCUR2(CORP, 0, 1) }
413 | head_sour_data_sect { OCCUR2(DATA, 0, 1) }
417 head_sour_vers_sect : OPEN DELIM TAG_VERS DELIM line_item
418 { OPEN(VERS)} no_std_subs { CHECK0 } CLOSE
421 head_sour_name_sect : OPEN DELIM TAG_NAME DELIM line_item
422 { OPEN(NAME) } no_std_subs { CHECK0 } CLOSE
425 head_sour_corp_sect : OPEN DELIM TAG_CORP DELIM line_item
433 head_sour_corp_subs : /* empty */
434 | head_sour_corp_subs head_sour_corp_sub
437 head_sour_corp_sub : addr_struc_sub /* 0:1 */
441 head_sour_data_sect : OPEN DELIM TAG_DATA DELIM line_item
449 head_sour_data_subs : /* empty */
450 | head_sour_data_subs head_sour_data_sub
453 head_sour_data_sub : head_sour_data_date_sect { OCCUR2(DATE, 0, 1) }
454 | head_sour_data_copr_sect { OCCUR2(COPR, 0, 1) }
458 head_sour_data_date_sect : OPEN DELIM TAG_DATE DELIM line_item
459 { OPEN(DATE) } no_std_subs { CHECK0 } CLOSE
462 head_sour_data_copr_sect : OPEN DELIM TAG_COPR DELIM line_item
463 { OPEN(COPR) } no_std_subs { CHECK0 } CLOSE
468 head_dest_sect : OPEN DELIM TAG_DEST DELIM line_item
469 { OPEN(DEST) } no_std_subs { CHECK0 } CLOSE
474 head_date_sect : OPEN DELIM TAG_DATE DELIM line_item
482 head_date_subs : /* empty */
483 | head_date_subs head_date_sub
486 head_date_sub : head_date_time_sect { OCCUR2(TIME, 0, 1) }
490 head_date_time_sect : OPEN DELIM TAG_TIME DELIM line_item
491 { OPEN(TIME) } no_std_subs { CHECK0 } CLOSE
496 head_subm_sect : OPEN DELIM TAG_SUBM DELIM POINTER
497 { OPEN(SUBM) } no_std_subs { CHECK0 } CLOSE
501 head_subn_sect : OPEN DELIM TAG_SUBN DELIM POINTER
502 { OPEN(SUBN) } no_std_subs { CHECK0 } CLOSE
506 head_file_sect : OPEN DELIM TAG_FILE DELIM line_item
507 { OPEN(FILE) } no_std_subs { CHECK0 } CLOSE
511 head_copr_sect : OPEN DELIM TAG_COPR DELIM line_item
512 { OPEN(COPR) } no_std_subs { CHECK0 } CLOSE
516 head_gedc_sect : OPEN DELIM TAG_GEDC
519 { CHECK2(VERS, FORM) }
524 head_gedc_subs : /* empty */
525 | head_gedc_subs head_gedc_sub
528 head_gedc_sub : head_gedc_vers_sect { OCCUR2(VERS, 1, 1) }
529 | head_gedc_form_sect { OCCUR2(FORM, 1, 1) }
532 head_gedc_vers_sect : OPEN DELIM TAG_VERS DELIM line_item
533 { OPEN(VERS) } no_std_subs { CHECK0 } CLOSE
536 head_gedc_form_sect : OPEN DELIM TAG_FORM DELIM line_item
537 { OPEN(FORM) } no_std_subs { CHECK0 } CLOSE
542 head_char_sect : OPEN DELIM TAG_CHAR DELIM line_item
550 head_char_subs : /* empty */
551 | head_char_subs head_char_sub
554 head_char_sub : head_char_vers_sect { OCCUR2(VERS, 0, 1) }
557 head_char_vers_sect : OPEN DELIM TAG_VERS DELIM line_item
558 { OPEN(VERS) } no_std_subs { CHECK0 } CLOSE
563 head_lang_sect : OPEN DELIM TAG_LANG DELIM line_item
564 { OPEN(LANG) } no_std_subs { CHECK0 } CLOSE
568 head_plac_sect : OPEN DELIM TAG_PLAC
576 head_plac_subs : /* empty */
577 | head_plac_subs head_plac_sub
580 head_plac_sub : head_plac_form_sect { OCCUR2(FORM, 1, 1) }
583 head_plac_form_sect : OPEN DELIM TAG_FORM DELIM line_item
584 { OPEN(FORM) } no_std_subs { CHECK0 } CLOSE
589 head_note_sect : OPEN DELIM TAG_NOTE DELIM line_item
597 head_note_subs : /* empty */
598 | head_note_subs head_note_sub
601 head_note_sub : continuation_sub /* 0:M */
605 /*********************************************************************/
607 /*********************************************************************/
608 trlr_sect : OPEN DELIM TAG_TRLR CLOSE { }
611 /*********************************************************************/
612 /**** Family record ****/
613 /*********************************************************************/
614 fam_rec : OPEN DELIM POINTER DELIM TAG_FAM
621 fam_subs : /* empty */
625 fam_sub : fam_event_struc_sub /* 0:M */
626 | fam_husb_sect { OCCUR2(HUSB, 0, 1) }
627 | fam_wife_sect { OCCUR2(WIFE, 0, 1) }
628 | fam_chil_sect /* 0:M */
629 | fam_nchi_sect { OCCUR2(NCHI, 0, 1) }
630 | fam_subm_sect /* 0:M */
631 | lds_spouse_seal_sub /* 0:M */
632 | source_cit_sub /* 0:M */
633 | multim_link_sub /* 0:M */
634 | note_struc_sub /* 0:M */
635 | ident_struc_sub /* 0:1 */
636 | change_date_sub /* 0:1 */
641 fam_husb_sect : OPEN DELIM TAG_HUSB DELIM POINTER
642 { OPEN(HUSB) } no_std_subs { CHECK0 } CLOSE
647 fam_wife_sect : OPEN DELIM TAG_WIFE DELIM POINTER
648 { OPEN(WIFE) } no_std_subs { CHECK0 } CLOSE
653 fam_chil_sect : OPEN DELIM TAG_CHIL DELIM POINTER
654 { OPEN(CHIL) } no_std_subs { CHECK0 } CLOSE
659 fam_nchi_sect : OPEN DELIM TAG_NCHI DELIM line_item
660 { OPEN(NCHI) } no_std_subs { CHECK0 } CLOSE
665 fam_subm_sect : OPEN DELIM TAG_SUBM DELIM POINTER
666 { OPEN(SUBM) } no_std_subs { CHECK0 } CLOSE
670 /*********************************************************************/
671 /**** Individual record ****/
672 /*********************************************************************/
673 indiv_rec : OPEN DELIM POINTER DELIM TAG_INDI
680 indi_subs : /* empty */
684 indi_sub : indi_resn_sect { OCCUR2(RESN, 0, 1) }
685 | pers_name_struc_sub /* 0:M */
686 | indi_sex_sect { OCCUR2(SEX, 0, 1) }
687 | indiv_even_struc_sub /* 0:M */
688 | indiv_attr_struc_sub /* 0:M */
689 | lds_indiv_ord_sub /* 0:M */
690 | chi_fam_link_sub /* 0:M */
691 | spou_fam_link_sub /* 0:M */
692 | indi_subm_sect /* 0:M */
693 | assoc_struc_sub /* 0:M */
694 | indi_alia_sect /* 0:M */
695 | indi_anci_sect /* 0:M */
696 | indi_desi_sect /* 0:M */
697 | source_cit_sub /* 0:M */
698 | multim_link_sub /* 0:M */
699 | note_struc_sub /* 0:M */
700 | indi_rfn_sect { OCCUR2(RFN, 0, 1) }
701 | indi_afn_sect /* 0:M */
702 | ident_struc_sub /* 0:1 */
703 | change_date_sub /* 0:1 */
708 indi_resn_sect : OPEN DELIM TAG_RESN DELIM line_item
709 { OPEN(RESN) } no_std_subs { CHECK0 } CLOSE { }
713 indi_sex_sect : OPEN DELIM TAG_SEX DELIM line_item
714 { OPEN(SEX) } no_std_subs { CHECK0 } CLOSE { }
718 indi_subm_sect : OPEN DELIM TAG_SUBM DELIM POINTER
719 { OPEN(SUBM) } no_std_subs { CHECK0 } CLOSE { }
723 indi_alia_sect : OPEN DELIM TAG_ALIA DELIM POINTER
724 { OPEN(ALIA) } no_std_subs { CHECK0 } CLOSE { }
728 indi_anci_sect : OPEN DELIM TAG_ANCI DELIM POINTER
729 { OPEN(ANCI) } no_std_subs { CHECK0 } CLOSE { }
733 indi_desi_sect : OPEN DELIM TAG_DESI DELIM POINTER
734 { OPEN(DESI) } no_std_subs { CHECK0 } CLOSE { }
738 indi_rfn_sect : OPEN DELIM TAG_RFN DELIM line_item
739 { OPEN(RFN) } no_std_subs { CHECK0 } CLOSE { }
743 indi_afn_sect : OPEN DELIM TAG_AFN DELIM line_item
744 { OPEN(AFN) } no_std_subs { CHECK0 } CLOSE { }
747 /*********************************************************************/
748 /**** Multimedia record ****/
749 /*********************************************************************/
750 multim_rec : OPEN DELIM POINTER DELIM TAG_OBJE
753 { CHECK2(FORM, BLOB) }
757 obje_subs : /* empty */
761 obje_sub : obje_form_sect { OCCUR2(FORM, 1, 1) }
762 | obje_titl_sect { OCCUR2(TITL, 0, 1) }
763 | note_struc_sub /* 0:M */
764 | obje_blob_sect { OCCUR2(BLOB, 1, 1) }
765 | obje_obje_sect { OCCUR2(OBJE, 0, 1) }
766 | ident_struc_sub /* 0:1 */
767 | change_date_sub /* 0:1 */
772 obje_form_sect : OPEN DELIM TAG_FORM DELIM line_item
773 { OPEN(FORM) } no_std_subs { CHECK0 } CLOSE { }
777 obje_titl_sect : OPEN DELIM TAG_TITL DELIM line_item
778 { OPEN(TITL) } no_std_subs { CHECK0 } CLOSE { }
782 obje_blob_sect : OPEN DELIM TAG_BLOB
789 obje_blob_subs : /* empty */
790 | obje_blob_subs obje_blob_sub
793 obje_blob_sub : obje_blob_cont_sect { OCCUR1(CONT, 1) }
797 obje_blob_cont_sect : OPEN DELIM TAG_CONT DELIM line_item
798 { OPEN(CONT) } no_std_subs { CHECK0 } CLOSE { }
802 obje_obje_sect : OPEN DELIM TAG_OBJE DELIM POINTER
803 { OPEN(OBJE) } no_std_subs { CHECK0 } CLOSE { }
806 /*********************************************************************/
807 /**** Note record ****/
808 /*********************************************************************/
809 note_rec : OPEN DELIM POINTER DELIM TAG_NOTE DELIM line_item
816 note_subs : /* empty */
820 note_sub : continuation_sub /* 0:M */
821 | source_cit_sub /* 0:M */
822 | ident_struc_sub /* 0:1 */
823 | change_date_sub /* 0:1 */
827 /*********************************************************************/
828 /**** Repository record ****/
829 /*********************************************************************/
830 repos_rec : OPEN DELIM POINTER DELIM TAG_REPO
837 repo_subs : /* empty */
841 repo_sub : repo_name_sect { OCCUR2(NAME, 0, 1) }
842 | addr_struc_sub /* 0:1 */
843 | note_struc_sub /* 0:M */
844 | ident_struc_sub /* 0:1 */
845 | change_date_sub /* 0:1 */
850 repo_name_sect : OPEN DELIM TAG_NAME DELIM line_item
851 { OPEN(NAME) } no_std_subs { CHECK0 } CLOSE {}
854 /*********************************************************************/
855 /**** Source record ****/
856 /*********************************************************************/
857 source_rec : OPEN DELIM POINTER DELIM TAG_SOUR
864 sour_subs : /* empty */
868 sour_sub : sour_data_sect { OCCUR2(DATA, 0, 1) }
869 | sour_auth_sect { OCCUR2(AUTH, 0, 1) }
870 | sour_titl_sect { OCCUR2(TITL, 0, 1) }
871 | sour_abbr_sect { OCCUR2(ABBR, 0, 1) }
872 | sour_publ_sect { OCCUR2(PUBL, 0, 1) }
873 | sour_text_sect { OCCUR2(TEXT, 0, 1) }
874 | source_repos_cit_sub /* 0:1 */
875 | multim_link_sub /* 0:M */
876 | note_struc_sub /* 0:M */
877 | ident_struc_sub /* 0:1 */
878 | change_date_sub /* 0:1 */
883 sour_data_sect : OPEN DELIM TAG_DATA
890 sour_data_subs : /* empty */
891 | sour_data_subs sour_data_sub
894 sour_data_sub : sour_data_even_sect /* 0:M */
895 | sour_data_agnc_sect { OCCUR2(AGNC, 0, 1) }
896 | note_struc_sub /* 0:M */
900 sour_data_even_sect : OPEN DELIM TAG_EVEN DELIM line_item
907 sour_data_even_subs : /* empty */
908 | sour_data_even_subs sour_data_even_sub
911 sour_data_even_sub : sour_data_even_date_sect { OCCUR2(DATE, 0, 1) }
912 | sour_data_even_plac_sect { OCCUR2(PLAC, 0, 1) }
916 sour_data_even_date_sect : OPEN DELIM TAG_DATE DELIM line_item
917 { OPEN(DATE) } no_std_subs { CHECK0 } CLOSE { }
920 sour_data_even_plac_sect : OPEN DELIM TAG_PLAC DELIM line_item
921 { OPEN(PLAC) } no_std_subs { CHECK0 } CLOSE { }
924 sour_data_agnc_sect : OPEN DELIM TAG_AGNC DELIM line_item
925 { OPEN(AGNC) } no_std_subs { CHECK0 } CLOSE { }
929 sour_auth_sect : OPEN DELIM TAG_AUTH DELIM line_item
936 sour_auth_subs : /* empty */
937 | sour_auth_subs sour_auth_sub
940 sour_auth_sub : continuation_sub /* 0:M */
945 sour_titl_sect : OPEN DELIM TAG_TITL DELIM line_item
952 sour_titl_subs : /* empty */
953 | sour_titl_subs sour_titl_sub
956 sour_titl_sub : continuation_sub /* 0:M */
961 sour_abbr_sect : OPEN DELIM TAG_ABBR DELIM line_item
962 { OPEN(ABBR) } no_std_subs { CHECK0 } CLOSE { }
966 sour_publ_sect : OPEN DELIM TAG_PUBL DELIM line_item
973 sour_publ_subs : /* empty */
974 | sour_publ_subs sour_publ_sub
977 sour_publ_sub : continuation_sub /* 0:M */
982 sour_text_sect : OPEN DELIM TAG_TEXT DELIM line_item
989 sour_text_subs : /* empty */
990 | sour_text_subs sour_text_sub
993 sour_text_sub : continuation_sub /* 0:M */
997 /*********************************************************************/
998 /**** Submission record ****/
999 /*********************************************************************/
1000 submis_rec : OPEN DELIM POINTER DELIM TAG_SUBN
1007 subn_subs : /* empty */
1008 | subn_subs subn_sub
1011 subn_sub : subn_subm_sect { OCCUR2(SUBM, 0, 1) }
1012 | subn_famf_sect { OCCUR2(FAMF, 0, 1) }
1013 | subn_temp_sect { OCCUR2(TEMP, 0, 1) }
1014 | subn_ance_sect { OCCUR2(ANCE, 0, 1) }
1015 | subn_desc_sect { OCCUR2(DESC, 0, 1) }
1016 | subn_ordi_sect { OCCUR2(ORDI, 0, 1) }
1017 | subn_rin_sect { OCCUR2(RIN, 0, 1) }
1022 subn_subm_sect : OPEN DELIM TAG_SUBM DELIM POINTER
1023 { OPEN(SUBM) } no_std_subs { CHECK0 } CLOSE { }
1027 subn_famf_sect : OPEN DELIM TAG_FAMF DELIM line_item
1028 { OPEN(FAMF) } no_std_subs { CHECK0 } CLOSE { }
1032 subn_temp_sect : OPEN DELIM TAG_TEMP DELIM line_item
1033 { OPEN(TEMP) } no_std_subs { CHECK0 } CLOSE { }
1037 subn_ance_sect : OPEN DELIM TAG_ANCE DELIM line_item
1038 { OPEN(ANCE) } no_std_subs { CHECK0 } CLOSE { }
1042 subn_desc_sect : OPEN DELIM TAG_DESC DELIM line_item
1043 { OPEN(DESC) } no_std_subs { CHECK0 } CLOSE { }
1047 subn_ordi_sect : OPEN DELIM TAG_ORDI DELIM line_item
1048 { OPEN(ORDI) } no_std_subs { CHECK0 } CLOSE { }
1052 subn_rin_sect : OPEN DELIM TAG_RIN DELIM line_item
1053 { OPEN(RIN) } no_std_subs { CHECK0 } CLOSE { }
1056 /*********************************************************************/
1057 /**** Submitter record ****/
1058 /*********************************************************************/
1059 submit_rec : OPEN DELIM POINTER DELIM TAG_SUBM
1066 subm_subs : /* empty */
1067 | subm_subs subm_sub
1070 subm_sub : subm_name_sect { OCCUR2(NAME, 0, 1) }
1071 | addr_struc_sub /* 0:1 */
1072 | multim_link_sub /* 0:M */
1073 | subm_lang_sect { OCCUR2(LANG, 0, 3) }
1074 | subm_rfn_sect { OCCUR2(RFN, 0, 1) }
1075 | subm_rin_sect { OCCUR2(RIN, 0, 1) }
1076 | change_date_sub /* 0:1 */
1081 subm_name_sect : OPEN DELIM TAG_NAME DELIM line_item
1082 { OPEN(NAME) } no_std_subs { CHECK0 } CLOSE { }
1086 subm_lang_sect : OPEN DELIM TAG_LANG DELIM line_item
1087 { OPEN(LANG) } no_std_subs { CHECK0 } CLOSE { }
1091 subm_rfn_sect : OPEN DELIM TAG_RFN DELIM line_item
1092 { OPEN(RFN) } no_std_subs { CHECK0 } CLOSE { }
1096 subm_rin_sect : OPEN DELIM TAG_RIN DELIM line_item
1097 { OPEN(RIN) } no_std_subs { CHECK0 } CLOSE { }
1100 /*********************************************************************/
1101 /**** Substructures ****/
1102 /*********************************************************************/
1104 /* ADDRESS STRUCTURE */
1105 addr_struc_sub : addr_sect { OCCUR2(ADDR, 0, 1) }
1106 | phon_sect { OCCUR2(PHON, 0, 3) }
1109 addr_sect : OPEN DELIM TAG_ADDR DELIM line_item
1116 addr_subs : /* empty */
1117 | addr_subs addr_sub
1120 addr_sub : addr_cont_sect /* 0:M */
1121 | addr_adr1_sect { OCCUR2(ADR1, 0, 1) }
1122 | addr_adr2_sect { OCCUR2(ADR2, 0, 1) }
1123 | addr_city_sect { OCCUR2(CITY, 0, 1) }
1124 | addr_stae_sect { OCCUR2(STAE, 0, 1) }
1125 | addr_post_sect { OCCUR2(POST, 0, 1) }
1126 | addr_ctry_sect { OCCUR2(CTRY, 0, 1) }
1130 addr_cont_sect : OPEN DELIM TAG_CONT DELIM line_item
1131 { OPEN(CONT) } no_std_subs { CHECK0 } CLOSE { }
1133 addr_adr1_sect : OPEN DELIM TAG_ADR1 DELIM line_item
1134 { OPEN(ADR1) } no_std_subs { CHECK0 } CLOSE { }
1136 addr_adr2_sect : OPEN DELIM TAG_ADR2 DELIM line_item
1137 { OPEN(ADR2) } no_std_subs { CHECK0 } CLOSE { }
1139 addr_city_sect : OPEN DELIM TAG_CITY DELIM line_item
1140 { OPEN(CITY) } no_std_subs { CHECK0 } CLOSE { }
1142 addr_stae_sect : OPEN DELIM TAG_STAE DELIM line_item
1143 { OPEN(STAE) } no_std_subs { CHECK0 } CLOSE { }
1145 addr_post_sect : OPEN DELIM TAG_POST DELIM line_item
1146 { OPEN(POST) } no_std_subs { CHECK0 } CLOSE { }
1148 addr_ctry_sect : OPEN DELIM TAG_CTRY DELIM line_item
1149 { OPEN(CTRY) } no_std_subs { CHECK0 } CLOSE { }
1152 phon_sect : OPEN DELIM TAG_PHON DELIM line_item
1153 { OPEN(PHON) } no_std_subs { CHECK0 } CLOSE { }
1156 /* ASSOCIATION STRUCTURE */
1157 assoc_struc_sub : asso_sect /* 0:M */
1160 asso_sect : OPEN DELIM TAG_ASSO DELIM POINTER
1163 { CHECK2(TYPE,RELA) }
1167 asso_subs : /* empty */
1168 | asso_type_sect { OCCUR2(TYPE, 1, 1) }
1169 | asso_rela_sect { OCCUR2(RELA, 1, 1) }
1175 asso_type_sect : OPEN DELIM TAG_TYPE DELIM line_item
1176 { OPEN(TYPE) } no_std_subs { CHECK0 } CLOSE { }
1179 asso_rela_sect : OPEN DELIM TAG_RELA DELIM line_item
1180 { OPEN(RELA) } no_std_subs { CHECK0 } CLOSE { }
1184 change_date_sub : change_date_chan_sect { OCCUR2(CHAN, 0, 1) }
1187 change_date_chan_sect : OPEN DELIM TAG_CHAN
1189 change_date_chan_subs
1194 change_date_chan_subs : /* empty */
1195 | change_date_chan_subs change_date_chan_sub
1198 change_date_chan_sub : change_date_date_sect { OCCUR2(DATE, 1, 1) }
1203 change_date_date_sect : OPEN DELIM TAG_DATE DELIM line_item
1205 change_date_date_subs
1210 change_date_date_subs : /* empty */
1211 | change_date_date_subs change_date_date_sub
1214 change_date_date_sub : change_date_date_time_sect { OCCUR2(TIME, 0, 1) }
1218 change_date_date_time_sect : OPEN DELIM TAG_TIME DELIM line_item
1219 { OPEN(TIME) } no_std_subs { CHECK0 } CLOSE { }
1222 /* CHILD TO FAMILY LINK */
1223 chi_fam_link_sub : famc_sect /* 0:M */
1226 famc_sect : OPEN DELIM TAG_FAMC DELIM POINTER
1233 famc_subs : /* empty */
1234 | famc_subs famc_sub
1237 famc_sub : famc_pedi_sect /* 0:M */
1242 famc_pedi_sect : OPEN DELIM TAG_PEDI DELIM line_item
1243 { OPEN(PEDI) } no_std_subs { CHECK0 } CLOSE { }
1246 /* CONTINUATION SUBSECTIONS */
1247 continuation_sub : cont_sect /* 0:M */
1248 | conc_sect /* 0:M */
1251 cont_sect : OPEN DELIM TAG_CONT DELIM line_item
1252 { OPEN(CONT) } no_std_subs { CHECK0 } CLOSE { }
1255 conc_sect : OPEN DELIM TAG_CONC DELIM line_item
1256 { OPEN(CONC) } no_std_subs { CHECK0 } CLOSE { }
1260 event_detail_sub : event_detail_type_sect { OCCUR2(TYPE, 0, 1) }
1261 | event_detail_date_sect { OCCUR2(DATE, 0, 1) }
1264 | event_detail_age_sect { OCCUR2(AGE, 0, 1) }
1265 | event_detail_agnc_sect { OCCUR2(AGNC, 0, 1) }
1266 | event_detail_caus_sect { OCCUR2(CAUS, 0, 1) }
1272 event_detail_type_sect : OPEN DELIM TAG_TYPE DELIM line_item
1273 { OPEN(TYPE) } no_std_subs { CHECK0 } CLOSE { }
1275 event_detail_date_sect : OPEN DELIM TAG_DATE DELIM line_item
1276 { OPEN(DATE) } no_std_subs { CHECK0 } CLOSE { }
1278 event_detail_age_sect : OPEN DELIM TAG_AGE DELIM line_item
1279 { OPEN(AGE) } no_std_subs { CHECK0 } CLOSE { }
1281 event_detail_agnc_sect : OPEN DELIM TAG_AGNC DELIM line_item
1282 { OPEN(AGNC) } no_std_subs { CHECK0 } CLOSE { }
1284 event_detail_caus_sect : OPEN DELIM TAG_CAUS DELIM line_item
1285 { OPEN(CAUS) } no_std_subs { CHECK0 } CLOSE { }
1288 /* FAMILY EVENT STRUCTURE */
1289 fam_event_struc_sub : fam_event_sect
1290 | fam_gen_even_sect /* 0:M */
1293 fam_event_sect : OPEN DELIM fam_event_tag opt_value fam_event_subs
1298 fam_event_tag : TAG_ANUL { OPEN(ANUL) }
1299 | TAG_CENS { OPEN(CENS) }
1300 | TAG_DIV { OPEN(DIV) }
1301 | TAG_DIVF { OPEN(DIVF) }
1302 | TAG_ENGA { OPEN(ENGA) }
1303 | TAG_MARR { OPEN(MARR) }
1304 | TAG_MARB { OPEN(MARB) }
1305 | TAG_MARC { OPEN(MARC) }
1306 | TAG_MARL { OPEN(MARL) }
1307 | TAG_MARS { OPEN(MARS) }
1310 fam_event_subs : /* empty */
1311 | fam_event_subs fam_event_sub
1314 fam_event_sub : event_detail_sub
1315 | fam_even_husb_sect { OCCUR2(HUSB, 0, 1) }
1316 | fam_even_wife_sect { OCCUR2(WIFE, 0, 1) }
1320 fam_even_husb_sect : OPEN DELIM TAG_HUSB
1327 fam_even_husb_subs : /* empty */
1328 | fam_even_husb_subs fam_even_husb_sub
1331 fam_even_husb_sub : fam_even_husb_age_sect { OCCUR2(AGE, 1, 1) }
1335 fam_even_husb_age_sect : OPEN DELIM TAG_AGE DELIM line_item
1336 { OPEN(AGE) } no_std_subs { CHECK0 } CLOSE { }
1339 fam_even_wife_sect : OPEN DELIM TAG_WIFE
1346 fam_gen_even_sect : OPEN DELIM TAG_EVEN
1353 fam_gen_even_subs : /* empty */
1354 | fam_gen_even_subs fam_gen_even_sub
1357 fam_gen_even_sub : event_detail_sub
1358 | fam_even_husb_sect { OCCUR2(HUSB, 0, 1) }
1359 | fam_even_wife_sect { OCCUR2(WIFE, 0, 1) }
1363 /* IDENTIFICATION STRUCTURE */
1364 ident_struc_sub : ident_refn_sect /* 0:M */
1365 | ident_rin_sect { OCCUR2(RIN, 0, 1) }
1368 ident_refn_sect : OPEN DELIM TAG_REFN DELIM line_item
1375 ident_refn_subs : /* empty */
1376 | ident_refn_subs ident_refn_sub
1379 ident_refn_sub : ident_refn_type_sect { OCCUR2(TYPE, 0, 1) }
1383 ident_refn_type_sect : OPEN DELIM TAG_TYPE DELIM line_item
1384 { OPEN(TYPE) } no_std_subs { CHECK0 } CLOSE { }
1387 ident_rin_sect : OPEN DELIM TAG_RIN DELIM line_item
1388 { OPEN(RIN) } no_std_subs { CHECK0 } CLOSE { }
1391 /* INDIVIDUAL ATTRIBUTE STRUCTURE */
1392 indiv_attr_struc_sub : indiv_cast_sect /* 0:M */
1393 | indiv_dscr_sect /* 0:M */
1394 | indiv_educ_sect /* 0:M */
1395 | indiv_idno_sect /* 0:M */
1396 | indiv_nati_sect /* 0:M */
1397 | indiv_nchi_sect /* 0:M */
1398 | indiv_nmr_sect /* 0:M */
1399 | indiv_occu_sect /* 0:M */
1400 | indiv_prop_sect /* 0:M */
1401 | indiv_reli_sect /* 0:M */
1402 | indiv_resi_sect /* 0:M */
1403 | indiv_ssn_sect /* 0:M */
1404 | indiv_titl_sect /* 0:M */
1407 indiv_cast_sect : OPEN DELIM TAG_CAST DELIM line_item
1409 indiv_attr_event_subs
1413 indiv_dscr_sect : OPEN DELIM TAG_DSCR DELIM line_item
1415 indiv_attr_event_subs
1419 indiv_educ_sect : OPEN DELIM TAG_EDUC DELIM line_item
1421 indiv_attr_event_subs
1425 indiv_idno_sect : OPEN DELIM TAG_IDNO DELIM line_item
1427 indiv_attr_event_subs
1431 indiv_nati_sect : OPEN DELIM TAG_NATI DELIM line_item
1433 indiv_attr_event_subs
1437 indiv_nchi_sect : OPEN DELIM TAG_NCHI DELIM line_item
1439 indiv_attr_event_subs
1443 indiv_nmr_sect : OPEN DELIM TAG_NMR DELIM line_item
1445 indiv_attr_event_subs
1449 indiv_occu_sect : OPEN DELIM TAG_OCCU DELIM line_item
1451 indiv_attr_event_subs
1455 indiv_prop_sect : OPEN DELIM TAG_PROP DELIM line_item
1457 indiv_attr_event_subs
1461 indiv_reli_sect : OPEN DELIM TAG_RELI DELIM line_item
1463 indiv_attr_event_subs
1467 indiv_resi_sect : OPEN DELIM TAG_RESI
1469 indiv_attr_event_subs
1473 indiv_ssn_sect : OPEN DELIM TAG_SSN DELIM line_item
1475 indiv_attr_event_subs
1479 indiv_titl_sect : OPEN DELIM TAG_TITL DELIM line_item
1481 indiv_attr_event_subs
1486 indiv_attr_event_subs : /* empty */
1487 | indiv_attr_event_subs indiv_attr_event_sub
1490 indiv_attr_event_sub : event_detail_sub
1494 /* INDIVIDUAL EVENT STRUCTURE */
1495 indiv_even_struc_sub : indiv_birt_sect
1497 | indiv_adop_sect /* 0:M */
1498 | indiv_even_sect /* 0:M */
1501 indiv_birt_sect : OPEN DELIM indiv_birt_tag opt_value indiv_birt_subs
1506 indiv_birt_tag : TAG_BIRT { OPEN(BIRT) }
1507 | TAG_CHR { OPEN(CHR) }
1510 indiv_birt_subs : /* empty */
1511 | indiv_birt_subs indiv_birt_sub
1514 indiv_birt_sub : event_detail_sub
1515 | indiv_birt_famc_sect { OCCUR2(FAMC,0, 1) }
1519 indiv_birt_famc_sect : OPEN DELIM TAG_FAMC DELIM POINTER
1520 { OPEN(FAMC) } no_std_subs { CHECK0 } CLOSE { }
1523 indiv_gen_sect : OPEN DELIM indiv_gen_tag opt_value indiv_gen_subs
1528 indiv_gen_tag : TAG_DEAT { OPEN(DEAT) }
1529 | TAG_BURI { OPEN(BURI) }
1530 | TAG_CREM { OPEN(CREM) }
1531 | TAG_BAPM { OPEN(BAPM) }
1532 | TAG_BARM { OPEN(BARM) }
1533 | TAG_BASM { OPEN(BASM) }
1534 | TAG_BLES { OPEN(BLES) }
1535 | TAG_CHRA { OPEN(CHRA) }
1536 | TAG_CONF { OPEN(CONF) }
1537 | TAG_FCOM { OPEN(FCOM) }
1538 | TAG_ORDN { OPEN(ORDN) }
1539 | TAG_NATU { OPEN(NATU) }
1540 | TAG_EMIG { OPEN(EMIG) }
1541 | TAG_IMMI { OPEN(IMMI) }
1542 | TAG_CENS { OPEN(CENS) }
1543 | TAG_PROB { OPEN(PROB) }
1544 | TAG_WILL { OPEN(WILL) }
1545 | TAG_GRAD { OPEN(GRAD) }
1546 | TAG_RETI { OPEN(RETI) }
1549 indiv_gen_subs : /* empty */
1550 | indiv_gen_subs indiv_gen_sub
1553 indiv_gen_sub : event_detail_sub
1557 indiv_adop_sect : OPEN DELIM TAG_ADOP opt_value
1564 indiv_adop_subs : /* empty */
1565 | indiv_adop_subs indiv_adop_sub
1568 indiv_adop_sub : event_detail_sub
1569 | indiv_adop_famc_sect { OCCUR2(FAMC,0, 1) }
1573 indiv_adop_famc_sect : OPEN DELIM TAG_FAMC DELIM POINTER
1575 indiv_adop_famc_subs
1580 indiv_adop_famc_subs : /* empty */
1581 | indiv_adop_famc_subs indiv_adop_famc_sub
1584 indiv_adop_famc_sub : indiv_adop_famc_adop_sect { OCCUR2(ADOP,0, 1) }
1588 indiv_adop_famc_adop_sect : OPEN DELIM TAG_ADOP DELIM line_item
1589 { OPEN(ADOP) } no_std_subs { CHECK0 } CLOSE { }
1592 indiv_even_sect : OPEN DELIM TAG_EVEN
1599 /* LDS INDIVIDUAL ORDINANCE */
1600 lds_indiv_ord_sub : lio_bapl_sect /* 0:M */
1601 | lio_slgc_sect /* 0:M */
1604 lio_bapl_sect : OPEN DELIM lio_bapl_tag lio_bapl_subs
1609 lio_bapl_tag : TAG_BAPL { OPEN(BAPL) }
1610 | TAG_CONL { OPEN(CONL) }
1611 | TAG_ENDL { OPEN(ENDL) }
1614 lio_bapl_subs : /* empty */
1615 | lio_bapl_subs lio_bapl_sub
1618 lio_bapl_sub : lio_bapl_stat_sect { OCCUR2(STAT, 0, 1) }
1619 | lio_bapl_date_sect { OCCUR2(DATE, 0, 1) }
1620 | lio_bapl_temp_sect { OCCUR2(TEMP, 0, 1) }
1621 | lio_bapl_plac_sect { OCCUR2(PLAC, 0, 1) }
1627 lio_bapl_stat_sect : OPEN DELIM TAG_STAT DELIM line_item
1628 { OPEN(STAT) } no_std_subs { CHECK0 } CLOSE { }
1630 lio_bapl_date_sect : OPEN DELIM TAG_DATE DELIM line_item
1631 { OPEN(DATE) } no_std_subs { CHECK0 } CLOSE { }
1633 lio_bapl_temp_sect : OPEN DELIM TAG_TEMP DELIM line_item
1634 { OPEN(TEMP) } no_std_subs { CHECK0 } CLOSE { }
1636 lio_bapl_plac_sect : OPEN DELIM TAG_PLAC DELIM line_item
1637 { OPEN(PLAC) } no_std_subs { CHECK0 } CLOSE { }
1640 lio_slgc_sect : OPEN DELIM TAG_SLGC
1647 lio_slgc_subs : /* empty */
1648 | lio_slgc_subs lio_slgc_sub
1651 lio_slgc_sub : lio_bapl_sub
1652 | lio_slgc_famc_sect { OCCUR2(FAMC, 1, 1) }
1655 lio_slgc_famc_sect : OPEN DELIM TAG_FAMC DELIM POINTER
1656 { OPEN(FAMC) } no_std_subs { CHECK0 } CLOSE { }
1659 /* LDS SPOUSE SEALING */
1660 lds_spouse_seal_sub : lss_slgs_sect
1663 lss_slgs_sect : OPEN DELIM TAG_SLGS
1670 lss_slgs_subs : /* empty */
1671 | lss_slgs_subs lss_slgs_sub
1674 lss_slgs_sub : lss_slgs_stat_sect { OCCUR2(STAT, 0, 1) }
1675 | lss_slgs_date_sect { OCCUR2(DATE, 0, 1) }
1676 | lss_slgs_temp_sect { OCCUR2(TEMP, 0, 1) }
1677 | lss_slgs_plac_sect { OCCUR2(PLAC, 0, 1) }
1683 lss_slgs_stat_sect : OPEN DELIM TAG_STAT DELIM line_item
1684 { OPEN(STAT) } no_std_subs { CHECK0 } CLOSE { }
1686 lss_slgs_date_sect : OPEN DELIM TAG_DATE DELIM line_item
1687 { OPEN(DATE) } no_std_subs { CHECK0 } CLOSE { }
1689 lss_slgs_temp_sect : OPEN DELIM TAG_TEMP DELIM line_item
1690 { OPEN(TEMP) } no_std_subs { CHECK0 } CLOSE { }
1692 lss_slgs_plac_sect : OPEN DELIM TAG_PLAC DELIM line_item
1693 { OPEN(PLAC) } no_std_subs { CHECK0 } CLOSE { }
1696 /* MULTIMEDIA LINK */
1697 multim_link_sub : multim_obje_link_sect
1698 | multim_obje_emb_sect
1701 multim_obje_link_sect : OPEN DELIM TAG_OBJE DELIM POINTER
1702 { OPEN(OBJE) } no_std_subs { CHECK0 } CLOSE { }
1705 multim_obje_emb_sect : OPEN DELIM TAG_OBJE
1707 multim_obje_emb_subs
1708 { CHECK2(FORM,FILE) }
1712 multim_obje_emb_subs : /* empty */
1713 | multim_obje_emb_subs multim_obje_emb_sub
1716 multim_obje_emb_sub : multim_obje_form_sect { OCCUR2(FORM, 1, 1) }
1717 | multim_obje_titl_sect { OCCUR2(TITL, 0, 1) }
1718 | multim_obje_file_sect { OCCUR2(FILE, 1, 1) }
1723 multim_obje_form_sect : OPEN DELIM TAG_FORM DELIM line_item
1724 { OPEN(FORM) } no_std_subs { CHECK0 } CLOSE { }
1726 multim_obje_titl_sect : OPEN DELIM TAG_TITL DELIM line_item
1727 { OPEN(TITL) } no_std_subs { CHECK0 } CLOSE { }
1729 multim_obje_file_sect : OPEN DELIM TAG_FILE DELIM line_item
1730 { OPEN(FILE) } no_std_subs { CHECK0 } CLOSE { }
1733 /* NOTE STRUCTURE */
1734 note_struc_sub : note_struc_link_sect /* 0:M */
1735 | note_struc_emb_sect /* 0:M */
1738 note_struc_link_sect : OPEN DELIM TAG_NOTE DELIM POINTER
1740 note_struc_link_subs
1745 note_struc_link_subs : /* empty */
1746 | note_struc_link_subs note_struc_link_sub
1749 note_struc_link_sub : source_cit_sub
1753 note_struc_emb_sect : OPEN DELIM TAG_NOTE opt_line_item
1760 note_struc_emb_subs : /* empty */
1761 | note_struc_emb_subs note_struc_emb_sub
1764 note_struc_emb_sub : continuation_sub
1769 /* PERSONAL NAME STRUCTURE */
1770 pers_name_struc_sub : pers_name_sect /* 0:M */
1773 pers_name_sect : OPEN DELIM TAG_NAME DELIM line_item
1780 pers_name_subs : /* empty */
1781 | pers_name_subs pers_name_sub
1784 pers_name_sub : pers_name_npfx_sect { OCCUR2(NPFX, 0, 1) }
1785 | pers_name_givn_sect { OCCUR2(GIVN, 0, 1) }
1786 | pers_name_nick_sect { OCCUR2(NICK, 0, 1) }
1787 | pers_name_spfx_sect { OCCUR2(SPFX, 0, 1) }
1788 | pers_name_surn_sect { OCCUR2(SURN, 0, 1) }
1789 | pers_name_nsfx_sect { OCCUR2(NSFX, 0, 1) }
1795 pers_name_npfx_sect : OPEN DELIM TAG_NPFX DELIM line_item
1796 { OPEN(NPFX) } no_std_subs { CHECK0 } CLOSE { }
1798 pers_name_givn_sect : OPEN DELIM TAG_GIVN DELIM line_item
1799 { OPEN(GIVN) } no_std_subs { CHECK0 } CLOSE { }
1801 pers_name_nick_sect : OPEN DELIM TAG_NICK DELIM line_item
1802 { OPEN(NICK) } no_std_subs { CHECK0 } CLOSE { }
1804 pers_name_spfx_sect : OPEN DELIM TAG_SPFX DELIM line_item
1805 { OPEN(SPFX) } no_std_subs { CHECK0 } CLOSE { }
1807 pers_name_surn_sect : OPEN DELIM TAG_SURN DELIM line_item
1808 { OPEN(SURN) } no_std_subs { CHECK0 } CLOSE { }
1810 pers_name_nsfx_sect : OPEN DELIM TAG_NSFX DELIM line_item
1811 { OPEN(NSFX) } no_std_subs { CHECK0 } CLOSE { }
1814 /* PLACE STRUCTURE */
1815 place_struc_sub : place_struc_plac_sect /* 0:M */
1818 place_struc_plac_sect : OPEN DELIM TAG_PLAC DELIM line_item
1820 place_struc_plac_subs
1825 place_struc_plac_subs : /* empty */
1826 | place_struc_plac_subs place_struc_plac_sub
1829 place_struc_plac_sub : place_plac_form_sect { OCCUR2(FORM, 0, 1) }
1835 place_plac_form_sect : OPEN DELIM TAG_FORM DELIM line_item
1836 { OPEN(FORM) } no_std_subs { CHECK0 } CLOSE { }
1839 /* SOURCE_CITATION */
1840 source_cit_sub : source_cit_link_sect /* 0:M */
1841 | source_cit_emb_sect /* 0:M */
1844 source_cit_link_sect : OPEN DELIM TAG_SOUR DELIM POINTER
1846 source_cit_link_subs
1851 source_cit_link_subs : /* empty */
1852 | source_cit_link_subs source_cit_link_sub
1855 source_cit_link_sub : source_cit_page_sect { OCCUR2(PAGE, 0, 1) }
1856 | source_cit_even_sect { OCCUR2(EVEN, 0, 1) }
1857 | source_cit_data_sect { OCCUR2(DATA, 0, 1) }
1858 | source_cit_quay_sect { OCCUR2(QUAY, 0, 1) }
1864 source_cit_page_sect : OPEN DELIM TAG_PAGE DELIM line_item
1865 { OPEN(PAGE) } no_std_subs { CHECK0 } CLOSE { }
1868 source_cit_even_sect : OPEN DELIM TAG_EVEN DELIM line_item
1870 source_cit_even_subs
1875 source_cit_even_subs : /* empty */
1876 | source_cit_even_subs source_cit_even_sub
1879 source_cit_even_sub : source_cit_even_role_sect { OCCUR2(ROLE, 0, 1) }
1883 source_cit_even_role_sect : OPEN DELIM TAG_ROLE DELIM line_item
1884 { OPEN(ROLE) } no_std_subs { CHECK0 } CLOSE { }
1887 source_cit_data_sect : OPEN DELIM TAG_DATA
1889 source_cit_data_subs
1894 source_cit_data_subs : /* empty */
1895 | source_cit_data_subs source_cit_data_sub
1898 source_cit_data_sub : source_cit_data_date_sect { OCCUR2(DATE, 0, 1) }
1899 | source_cit_text_sect /* 0:M */
1903 source_cit_data_date_sect : OPEN DELIM TAG_DATE DELIM line_item
1904 { OPEN(DATE) } no_std_subs { CHECK0 } CLOSE { }
1907 source_cit_text_sect : OPEN DELIM TAG_TEXT DELIM line_item
1909 source_cit_text_subs
1914 source_cit_text_subs : /* empty */
1915 | source_cit_text_subs source_cit_text_sub
1918 source_cit_text_sub : continuation_sub
1922 source_cit_quay_sect : OPEN DELIM TAG_QUAY DELIM line_item
1923 { OPEN(QUAY) } no_std_subs { CHECK0 } CLOSE { }
1926 source_cit_emb_sect : OPEN DELIM TAG_SOUR DELIM line_item
1933 source_cit_emb_subs : /* empty */
1934 | source_cit_emb_subs source_cit_emb_sub
1937 source_cit_emb_sub : continuation_sub
1938 | source_cit_text_sect /* 0:M */
1943 /* SOURCE REPOSITORY CITATION */
1944 source_repos_cit_sub : source_repos_repo_sect { OCCUR2(REPO, 0, 1) }
1947 source_repos_repo_sect : OPEN DELIM TAG_REPO DELIM POINTER
1949 source_repos_repo_subs
1954 source_repos_repo_subs : /* empty */
1955 | source_repos_repo_subs source_repos_repo_sub
1958 source_repos_repo_sub : note_struc_sub
1959 | caln_sect /* 0:M */
1963 caln_sect : OPEN DELIM TAG_CALN DELIM line_item
1970 caln_subs : /* empty */
1971 | caln_subs caln_sub
1974 caln_sub : caln_medi_sect { OCCUR2(MEDI, 0, 1) }
1978 caln_medi_sect : OPEN DELIM TAG_MEDI DELIM line_item
1979 { OPEN(MEDI) } no_std_subs { CHECK0 } CLOSE { }
1982 /* SPOUSE TO FAMILY LINK */
1983 spou_fam_link_sub : spou_fam_fams_sect /* 0:M */
1986 spou_fam_fams_sect : OPEN DELIM TAG_FAMS DELIM POINTER
1993 spou_fam_fams_subs : /* empty */
1994 | spou_fam_fams_subs spou_fam_fams_sub
1997 spou_fam_fams_sub : note_struc_sub
2001 /*********************************************************************/
2003 /*********************************************************************/
2005 no_std_subs : /* empty */
2006 | no_std_subs no_std_sub
2009 no_std_sub : user_sect /* 0:M */
2011 | error error_subs CLOSE { HANDLE_ERROR }
2014 no_std_rec : user_rec /* 0:M */
2016 | error error_subs CLOSE { HANDLE_ERROR }
2019 user_rec : OPEN DELIM opt_xref USERTAG
2020 { if ($4[0] != '_') {
2021 gedcom_error("Undefined tag (and not a valid user tag): %s",
2026 opt_value user_sects CLOSE { }
2029 user_sect : OPEN DELIM opt_xref USERTAG
2030 { if ($4[0] != '_') {
2031 gedcom_error("Undefined tag (and not a valid user tag): %s",
2036 opt_value user_sects CLOSE { }
2039 user_sects : /* empty */ { }
2040 | user_sects user_sect { }
2043 opt_xref : /* empty */ { }
2047 opt_value : /* empty */ { }
2048 | DELIM line_value { }
2051 line_value : POINTER { }
2055 opt_line_item : /* empty */ { }
2056 | DELIM line_item { }
2059 line_item : anychar { }
2061 | line_item anychar { }
2062 | line_item ESCAPE { }
2065 anychar : ANYCHAR { }
2069 error_subs : /* empty */
2070 | error_subs error_sect
2073 error_sect : OPEN DELIM opt_xref anytag opt_value error_subs CLOSE { }
2075 gen_sect : OPEN DELIM opt_xref anystdtag
2076 { INVALID_TAG($4); }
2077 opt_value opt_sects CLOSE
2081 gen_rec : OPEN DELIM opt_xref anystdtag
2082 { INVALID_TOP_TAG($4) }
2083 opt_value opt_sects CLOSE
2087 opt_sects : /* empty */ { }
2088 | opt_sects gen_sect { }
2091 anytag : USERTAG { }
2095 anystdtag : TAG_ABBR
2225 /* Functions that handle the counting of subtags */
2227 int* count_arrays[MAXGEDCOMLEVEL+1];
2228 char tag_stack[MAXGEDCOMLEVEL+1][MAXSTDTAGLENGTH+1];
2230 void push_countarray()
2233 if (count_level > MAXGEDCOMLEVEL) {
2234 gedcom_error("Internal error: count array overflow");
2238 count = (int *)calloc(YYNTOKENS, sizeof(int));
2239 if (count == NULL) { int *count = count_arrays[count_level];
2241 gedcom_error("Internal error: count array calloc error");
2245 count_arrays[count_level] = count;
2250 void set_parenttag(char* tag)
2252 strncpy(tag_stack[count_level], tag, MAXSTDTAGLENGTH+1);
2255 char* get_parenttag()
2257 return tag_stack[count_level];
2260 int count_tag(int tag)
2262 int *count = count_arrays[count_level];
2263 return ++count[tag - GEDCOMTAGOFFSET];
2266 int check_occurrence(int tag)
2268 int *count = count_arrays[count_level];
2269 return (count[tag - GEDCOMTAGOFFSET] > 0);
2272 void pop_countarray()
2275 if (count_level < 0) {
2276 gedcom_error("Internal error: count array underflow");
2280 count = count_arrays[count_level];
2282 count_arrays[count_level] = NULL;
2286 /* Enabling debug mode */
2288 void gedcom_enable_debug()
2295 /* Setting the error mechanism */
2297 void gedcom_set_error_handling(MECHANISM mechanism)
2299 curr_mechanism = mechanism;