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.
127 MECHANISM curr_mechanism=FAIL_PARSE;
129 /* These are defined at the bottom of the file */
130 void push_countarray();
131 void set_parenttag(char* tag);
132 char* get_parenttag();
133 void pop_countarray();
134 int count_tag(int tag);
135 int check_occurrence(int tag);
137 #define OPEN(PARENTTAG) \
139 set_parenttag(#PARENTTAG); \
143 { if (!check_occurrence(TAG_##TAG)) { \
144 char* parenttag = get_parenttag(); \
145 gedcom_error("The tag '%s' is mandatory within '%s'", \
151 { pop_countarray(); \
155 #define CHECK1(TAG1) { CHK(TAG1); POP; }
156 #define CHECK2(TAG1,TAG2) \
157 { CHK(TAG1); CHK(TAG2); POP; }
158 #define CHECK3(TAG1,TAG2,TAG3) \
159 { CHK(TAG1); CHK(TAG2); CHK(TAG3); POP; }
160 #define CHECK4(TAG1,TAG2,TAG3,TAG4) \
161 { CHK(TAG1); CHK(TAG2); CHK(TAG3); CHK(TAG4); POP; }
162 #define OCCUR1(CHILDTAG, MIN) { count_tag(TAG_##CHILDTAG); }
163 #define OCCUR2(CHILDTAG, MIN, MAX) \
164 { int num = count_tag(TAG_##CHILDTAG); \
166 char* parenttag = get_parenttag(); \
167 gedcom_error("The tag '%s' can maximally occur %d " \
168 "time(s) within '%s'", \
169 #CHILDTAG, MAX, parenttag); \
173 #define INVALID_TAG(CHILDTAG) \
174 { char* parenttag = get_parenttag(); \
175 gedcom_error("The tag '%s' is not a valid tag within '%s'", \
176 CHILDTAG, parenttag); \
179 #define INVALID_TOP_TAG(CHILDTAG) \
180 { gedcom_error("The tag '%s' is not a valid top-level tag", \
193 %token <string> BADTOKEN
195 %token <string> CLOSE
196 %token <string> ESCAPE
197 %token <string> DELIM
198 %token <string> ANYCHAR
199 %token <string> POINTER
200 %token <string> USERTAG
201 %token <string> TAG_ABBR
202 %token <string> TAG_ADDR
203 %token <string> TAG_ADR1
204 %token <string> TAG_ADR2
205 %token <string> TAG_ADOP
206 %token <string> TAG_AFN
207 %token <string> TAG_AGE
208 %token <string> TAG_AGNC
209 %token <string> TAG_ALIA
210 %token <string> TAG_ANCE
211 %token <string> TAG_ANCI
212 %token <string> TAG_ANUL
213 %token <string> TAG_ASSO
214 %token <string> TAG_AUTH
215 %token <string> TAG_BAPL
216 %token <string> TAG_BAPM
217 %token <string> TAG_BARM
218 %token <string> TAG_BASM
219 %token <string> TAG_BIRT
220 %token <string> TAG_BLES
221 %token <string> TAG_BLOB
222 %token <string> TAG_BURI
223 %token <string> TAG_CALN
224 %token <string> TAG_CAST
225 %token <string> TAG_CAUS
226 %token <string> TAG_CENS
227 %token <string> TAG_CHAN
228 %token <string> TAG_CHAR
229 %token <string> TAG_CHIL
230 %token <string> TAG_CHR
231 %token <string> TAG_CHRA
232 %token <string> TAG_CITY
233 %token <string> TAG_CONC
234 %token <string> TAG_CONF
235 %token <string> TAG_CONL
236 %token <string> TAG_CONT
237 %token <string> TAG_COPR
238 %token <string> TAG_CORP
239 %token <string> TAG_CREM
240 %token <string> TAG_CTRY
241 %token <string> TAG_DATA
242 %token <string> TAG_DATE
243 %token <string> TAG_DEAT
244 %token <string> TAG_DESC
245 %token <string> TAG_DESI
246 %token <string> TAG_DEST
247 %token <string> TAG_DIV
248 %token <string> TAG_DIVF
249 %token <string> TAG_DSCR
250 %token <string> TAG_EDUC
251 %token <string> TAG_EMIG
252 %token <string> TAG_ENDL
253 %token <string> TAG_ENGA
254 %token <string> TAG_EVEN
255 %token <string> TAG_FAM
256 %token <string> TAG_FAMC
257 %token <string> TAG_FAMF
258 %token <string> TAG_FAMS
259 %token <string> TAG_FCOM
260 %token <string> TAG_FILE
261 %token <string> TAG_FORM
262 %token <string> TAG_GEDC
263 %token <string> TAG_GIVN
264 %token <string> TAG_GRAD
265 %token <string> TAG_HEAD
266 %token <string> TAG_HUSB
267 %token <string> TAG_IDNO
268 %token <string> TAG_IMMI
269 %token <string> TAG_INDI
270 %token <string> TAG_LANG
271 %token <string> TAG_LEGA
272 %token <string> TAG_MARB
273 %token <string> TAG_MARC
274 %token <string> TAG_MARL
275 %token <string> TAG_MARR
276 %token <string> TAG_MARS
277 %token <string> TAG_MEDI
278 %token <string> TAG_NAME
279 %token <string> TAG_NATI
280 %token <string> TAG_NATU
281 %token <string> TAG_NCHI
282 %token <string> TAG_NICK
283 %token <string> TAG_NMR
284 %token <string> TAG_NOTE
285 %token <string> TAG_NPFX
286 %token <string> TAG_NSFX
287 %token <string> TAG_OBJE
288 %token <string> TAG_OCCU
289 %token <string> TAG_ORDI
290 %token <string> TAG_ORDN
291 %token <string> TAG_PAGE
292 %token <string> TAG_PEDI
293 %token <string> TAG_PHON
294 %token <string> TAG_PLAC
295 %token <string> TAG_POST
296 %token <string> TAG_PROB
297 %token <string> TAG_PROP
298 %token <string> TAG_PUBL
299 %token <string> TAG_QUAY
300 %token <string> TAG_REFN
301 %token <string> TAG_RELA
302 %token <string> TAG_RELI
303 %token <string> TAG_REPO
304 %token <string> TAG_RESI
305 %token <string> TAG_RESN
306 %token <string> TAG_RETI
307 %token <string> TAG_RFN
308 %token <string> TAG_RIN
309 %token <string> TAG_ROLE
310 %token <string> TAG_SEX
311 %token <string> TAG_SLGC
312 %token <string> TAG_SLGS
313 %token <string> TAG_SOUR
314 %token <string> TAG_SPFX
315 %token <string> TAG_SSN
316 %token <string> TAG_STAE
317 %token <string> TAG_STAT
318 %token <string> TAG_SUBM
319 %token <string> TAG_SUBN
320 %token <string> TAG_SURN
321 %token <string> TAG_TEMP
322 %token <string> TAG_TEXT
323 %token <string> TAG_TIME
324 %token <string> TAG_TITL
325 %token <string> TAG_TRLR
326 %token <string> TAG_TYPE
327 %token <string> TAG_VERS
328 %token <string> TAG_WIFE
329 %token <string> TAG_WILL
332 %type <string> anytag
337 file : head_sect records trlr_sect { }
340 records : /* empty */
352 | user_sect /* 0:M */
355 /*********************************************************************/
357 /*********************************************************************/
358 head_sect : OPEN DELIM TAG_HEAD
361 { CHECK4(SOUR, SUBM, GEDC, CHAR) }
365 head_subs : /* empty */
369 head_sub : head_sour_sect { OCCUR2(SOUR, 1, 1) }
370 | head_dest_sect { OCCUR2(DEST, 0, 1) }
371 | head_date_sect { OCCUR2(DATE, 0, 1) }
372 | head_subm_sect { OCCUR2(SUBM, 1, 1) }
373 | head_subn_sect { OCCUR2(SUBN, 0, 1) }
374 | head_file_sect { OCCUR2(FILE, 0, 1) }
375 | head_copr_sect { OCCUR2(COPR, 0, 1) }
376 | head_gedc_sect { OCCUR2(GEDC, 1, 1) }
377 | head_char_sect { OCCUR2(CHAR, 1, 1) }
378 | head_lang_sect { OCCUR2(LANG, 0, 1) }
379 | head_plac_sect { OCCUR2(PLAC, 0, 1) }
380 | head_note_sect { OCCUR2(NOTE, 0, 1) }
381 | user_sect /* 0:M */
385 head_sour_sect : OPEN DELIM TAG_SOUR DELIM line_item
393 head_sour_subs : /* empty */
394 | head_sour_subs head_sour_sub
397 head_sour_sub : head_sour_vers_sect { OCCUR2(VERS, 0, 1) }
398 | head_sour_name_sect { OCCUR2(NAME, 0, 1) }
399 | head_sour_corp_sect { OCCUR2(CORP, 0, 1) }
400 | head_sour_data_sect { OCCUR2(DATA, 0, 1) }
402 head_sour_vers_sect : OPEN DELIM TAG_VERS DELIM line_item CLOSE
405 head_sour_name_sect : OPEN DELIM TAG_NAME DELIM line_item CLOSE
408 head_sour_corp_sect : OPEN DELIM TAG_CORP DELIM line_item
416 head_sour_corp_subs : /* empty */
417 | head_sour_corp_subs head_sour_corp_sub
420 head_sour_corp_sub : addr_struc_sub /* 0:1 */
423 head_sour_data_sect : OPEN DELIM TAG_DATA DELIM line_item
431 head_sour_data_subs : /* empty */
432 | head_sour_data_subs head_sour_data_sub
435 head_sour_data_sub : head_sour_data_date_sect { OCCUR2(DATE, 0, 1) }
436 | head_sour_data_copr_sect { OCCUR2(COPR, 0, 1) }
439 head_sour_data_date_sect : OPEN DELIM TAG_DATE DELIM line_item CLOSE
442 head_sour_data_copr_sect : OPEN DELIM TAG_COPR DELIM line_item CLOSE
447 head_dest_sect : OPEN DELIM TAG_DEST DELIM line_item CLOSE
452 head_date_sect : OPEN DELIM TAG_DATE DELIM line_item
460 head_date_subs : /* empty */
461 | head_date_subs head_date_sub
464 head_date_sub : head_date_time_sect { OCCUR2(TIME, 0, 1) }
467 head_date_time_sect : OPEN DELIM TAG_TIME DELIM line_item CLOSE
472 head_subm_sect : OPEN DELIM TAG_SUBM DELIM POINTER CLOSE
476 head_subn_sect : OPEN DELIM TAG_SUBN DELIM POINTER CLOSE
480 head_file_sect : OPEN DELIM TAG_FILE DELIM line_item CLOSE
484 head_copr_sect : OPEN DELIM TAG_COPR DELIM line_item CLOSE
488 head_gedc_sect : OPEN DELIM TAG_GEDC
491 { CHECK2(VERS, FORM) }
496 head_gedc_subs : /* empty */
497 | head_gedc_subs head_gedc_sub
500 head_gedc_sub : head_gedc_vers_sect { OCCUR2(VERS, 1, 1) }
501 | head_gedc_form_sect { OCCUR2(FORM, 1, 1) }
503 head_gedc_vers_sect : OPEN DELIM TAG_VERS DELIM line_item CLOSE
506 head_gedc_form_sect : OPEN DELIM TAG_FORM DELIM line_item CLOSE
511 head_char_sect : OPEN DELIM TAG_CHAR DELIM line_item
519 head_char_subs : /* empty */
520 | head_char_subs head_char_sub
523 head_char_sub : head_char_vers_sect { OCCUR2(VERS, 0, 1) }
525 head_char_vers_sect : OPEN DELIM TAG_VERS DELIM line_item CLOSE
530 head_lang_sect : OPEN DELIM TAG_LANG DELIM line_item CLOSE
534 head_plac_sect : OPEN DELIM TAG_PLAC
542 head_plac_subs : /* empty */
543 | head_plac_subs head_plac_sub
546 head_plac_sub : head_plac_form_sect { OCCUR2(FORM, 1, 1) }
548 head_plac_form_sect : OPEN DELIM TAG_FORM DELIM line_item CLOSE
553 head_note_sect : OPEN DELIM TAG_NOTE DELIM line_item
561 head_note_subs : /* empty */
562 | head_note_subs head_note_sub
565 head_note_sub : continuation_sub /* 0:M */
568 /*********************************************************************/
570 /*********************************************************************/
571 trlr_sect : OPEN DELIM TAG_TRLR CLOSE { }
574 /*********************************************************************/
575 /**** Family record ****/
576 /*********************************************************************/
577 fam_rec : OPEN DELIM POINTER DELIM TAG_FAM
584 fam_subs : /* empty */
588 fam_sub : fam_event_struc_sub /* 0:M */
589 | fam_husb_sect { OCCUR2(HUSB, 0, 1) }
590 | fam_wife_sect { OCCUR2(WIFE, 0, 1) }
591 | fam_chil_sect /* 0:M */
592 | fam_nchi_sect { OCCUR2(NCHI, 0, 1) }
593 | fam_subm_sect /* 0:M */
594 | lds_spouse_seal_sub /* 0:M */
595 | source_cit_sub /* 0:M */
596 | multim_link_sub /* 0:M */
597 | note_struc_sub /* 0:M */
598 | ident_struc_sub /* 0:1 */
599 | change_date_sub /* 0:1 */
600 | user_sect /* 0:M */
604 fam_husb_sect : OPEN DELIM TAG_HUSB DELIM POINTER CLOSE
609 fam_wife_sect : OPEN DELIM TAG_WIFE DELIM POINTER CLOSE
614 fam_chil_sect : OPEN DELIM TAG_CHIL DELIM POINTER CLOSE
619 fam_nchi_sect : OPEN DELIM TAG_NCHI DELIM line_item CLOSE
624 fam_subm_sect : OPEN DELIM TAG_SUBM DELIM POINTER CLOSE
628 /*********************************************************************/
629 /**** Individual record ****/
630 /*********************************************************************/
631 indiv_rec : OPEN DELIM POINTER DELIM TAG_INDI
638 indi_subs : /* empty */
642 indi_sub : indi_resn_sect { OCCUR2(RESN, 0, 1) }
643 | pers_name_struc_sub /* 0:M */
644 | indi_sex_sect { OCCUR2(SEX, 0, 1) }
645 | indiv_even_struc_sub /* 0:M */
646 | indiv_attr_struc_sub /* 0:M */
647 | lds_indiv_ord_sub /* 0:M */
648 | chi_fam_link_sub /* 0:M */
649 | spou_fam_link_sub /* 0:M */
650 | indi_subm_sect /* 0:M */
651 | assoc_struc_sub /* 0:M */
652 | indi_alia_sect /* 0:M */
653 | indi_anci_sect /* 0:M */
654 | indi_desi_sect /* 0:M */
655 | source_cit_sub /* 0:M */
656 | multim_link_sub /* 0:M */
657 | note_struc_sub /* 0:M */
658 | indi_rfn_sect { OCCUR2(RFN, 0, 1) }
659 | indi_afn_sect /* 0:M */
660 | ident_struc_sub /* 0:1 */
661 | change_date_sub /* 0:1 */
662 | user_sect /* 0:M */
666 indi_resn_sect : OPEN DELIM TAG_RESN DELIM line_item CLOSE { }
670 indi_sex_sect : OPEN DELIM TAG_SEX DELIM line_item CLOSE { }
674 indi_subm_sect : OPEN DELIM TAG_SUBM DELIM POINTER CLOSE { }
678 indi_alia_sect : OPEN DELIM TAG_ALIA DELIM POINTER CLOSE { }
682 indi_anci_sect : OPEN DELIM TAG_ANCI DELIM POINTER CLOSE { }
686 indi_desi_sect : OPEN DELIM TAG_DESI DELIM POINTER CLOSE { }
690 indi_rfn_sect : OPEN DELIM TAG_RFN DELIM line_item CLOSE { }
694 indi_afn_sect : OPEN DELIM TAG_AFN DELIM line_item CLOSE { }
697 /*********************************************************************/
698 /**** Multimedia record ****/
699 /*********************************************************************/
700 multim_rec : OPEN DELIM POINTER DELIM TAG_OBJE
703 { CHECK2(FORM, BLOB) }
707 obje_subs : /* empty */
711 obje_sub : obje_form_sect { OCCUR2(FORM, 1, 1) }
712 | obje_titl_sect { OCCUR2(TITL, 0, 1) }
713 | note_struc_sub /* 0:M */
714 | obje_blob_sect { OCCUR2(BLOB, 1, 1) }
715 | obje_obje_sect { OCCUR2(OBJE, 0, 1) }
716 | ident_struc_sub /* 0:1 */
717 | change_date_sub /* 0:1 */
718 | user_sect /* 0:M */
722 obje_form_sect : OPEN DELIM TAG_FORM DELIM line_item CLOSE { }
726 obje_titl_sect : OPEN DELIM TAG_TITL DELIM line_item CLOSE { }
730 obje_blob_sect : OPEN DELIM TAG_BLOB
737 obje_blob_subs : /* empty */
738 | obje_blob_subs obje_blob_sub
741 obje_blob_sub : obje_blob_cont_sect { OCCUR1(CONT, 1) }
744 obje_blob_cont_sect : OPEN DELIM TAG_CONT DELIM line_item CLOSE { }
748 obje_obje_sect : OPEN DELIM TAG_OBJE DELIM POINTER CLOSE { }
751 /*********************************************************************/
752 /**** Note record ****/
753 /*********************************************************************/
754 note_rec : OPEN DELIM POINTER DELIM TAG_NOTE DELIM line_item
761 note_subs : /* empty */
765 note_sub : continuation_sub /* 0:M */
766 | source_cit_sub /* 0:M */
767 | ident_struc_sub /* 0:1 */
768 | change_date_sub /* 0:1 */
769 | user_sect /* 0:M */
772 /*********************************************************************/
773 /**** Repository record ****/
774 /*********************************************************************/
775 repos_rec : OPEN DELIM POINTER DELIM TAG_REPO
782 repo_subs : /* empty */
786 repo_sub : repo_name_sect { OCCUR2(NAME, 0, 1) }
787 | addr_struc_sub /* 0:1 */
788 | note_struc_sub /* 0:M */
789 | ident_struc_sub /* 0:1 */
790 | change_date_sub /* 0:1 */
791 | user_sect /* 0:M */
795 repo_name_sect : OPEN DELIM TAG_NAME DELIM line_item CLOSE {}
798 /*********************************************************************/
799 /**** Source record ****/
800 /*********************************************************************/
801 source_rec : OPEN DELIM POINTER DELIM TAG_SOUR
808 sour_subs : /* empty */
812 sour_sub : sour_data_sect { OCCUR2(DATA, 0, 1) }
813 | sour_auth_sect { OCCUR2(AUTH, 0, 1) }
814 | sour_titl_sect { OCCUR2(TITL, 0, 1) }
815 | sour_abbr_sect { OCCUR2(ABBR, 0, 1) }
816 | sour_publ_sect { OCCUR2(PUBL, 0, 1) }
817 | sour_text_sect { OCCUR2(TEXT, 0, 1) }
818 | source_repos_cit_sub /* 0:1 */
819 | multim_link_sub /* 0:M */
820 | note_struc_sub /* 0:M */
821 | ident_struc_sub /* 0:1 */
822 | change_date_sub /* 0:1 */
823 | user_sect /* 0:M */
827 sour_data_sect : OPEN DELIM TAG_DATA
834 sour_data_subs : /* empty */
835 | sour_data_subs sour_data_sub
838 sour_data_sub : sour_data_even_sect /* 0:M */
839 | sour_data_agnc_sect { OCCUR2(AGNC, 0, 1) }
840 | note_struc_sub /* 0:M */
843 sour_data_even_sect : OPEN DELIM TAG_EVEN DELIM line_item
850 sour_data_even_subs : /* empty */
851 | sour_data_even_subs sour_data_even_sub
854 sour_data_even_sub : sour_data_even_date_sect { OCCUR2(DATE, 0, 1) }
855 | sour_data_even_plac_sect { OCCUR2(PLAC, 0, 1) }
858 sour_data_even_date_sect : OPEN DELIM TAG_DATE DELIM line_item CLOSE { }
861 sour_data_even_plac_sect : OPEN DELIM TAG_PLAC DELIM line_item CLOSE { }
864 sour_data_agnc_sect : OPEN DELIM TAG_AGNC DELIM line_item CLOSE { }
868 sour_auth_sect : OPEN DELIM TAG_AUTH DELIM line_item
875 sour_auth_subs : /* empty */
876 | sour_auth_subs sour_auth_sub
879 sour_auth_sub : continuation_sub /* 0:M */
883 sour_titl_sect : OPEN DELIM TAG_TITL DELIM line_item
890 sour_titl_subs : /* empty */
891 | sour_titl_subs sour_titl_sub
894 sour_titl_sub : continuation_sub /* 0:M */
898 sour_abbr_sect : OPEN DELIM TAG_ABBR DELIM line_item CLOSE { }
902 sour_publ_sect : OPEN DELIM TAG_PUBL DELIM line_item
909 sour_publ_subs : /* empty */
910 | sour_publ_subs sour_publ_sub
913 sour_publ_sub : continuation_sub /* 0:M */
917 sour_text_sect : OPEN DELIM TAG_TEXT DELIM line_item
924 sour_text_subs : /* empty */
925 | sour_text_subs sour_text_sub
928 sour_text_sub : continuation_sub /* 0:M */
931 /*********************************************************************/
932 /**** Submission record ****/
933 /*********************************************************************/
934 submis_rec : OPEN DELIM POINTER DELIM TAG_SUBN
941 subn_subs : /* empty */
945 subn_sub : subn_subm_sect { OCCUR2(SUBM, 0, 1) }
946 | subn_famf_sect { OCCUR2(FAMF, 0, 1) }
947 | subn_temp_sect { OCCUR2(TEMP, 0, 1) }
948 | subn_ance_sect { OCCUR2(ANCE, 0, 1) }
949 | subn_desc_sect { OCCUR2(DESC, 0, 1) }
950 | subn_ordi_sect { OCCUR2(ORDI, 0, 1) }
951 | subn_rin_sect { OCCUR2(RIN, 0, 1) }
952 | user_sect /* 0:M */
956 subn_subm_sect : OPEN DELIM TAG_SUBM DELIM POINTER CLOSE { }
960 subn_famf_sect : OPEN DELIM TAG_FAMF DELIM line_item CLOSE { }
964 subn_temp_sect : OPEN DELIM TAG_TEMP DELIM line_item CLOSE { }
968 subn_ance_sect : OPEN DELIM TAG_ANCE DELIM line_item CLOSE { }
972 subn_desc_sect : OPEN DELIM TAG_DESC DELIM line_item CLOSE { }
976 subn_ordi_sect : OPEN DELIM TAG_ORDI DELIM line_item CLOSE { }
980 subn_rin_sect : OPEN DELIM TAG_RIN DELIM line_item CLOSE { }
983 /*********************************************************************/
984 /**** Submitter record ****/
985 /*********************************************************************/
986 submit_rec : OPEN DELIM POINTER DELIM TAG_SUBM
993 subm_subs : /* empty */
997 subm_sub : subm_name_sect { OCCUR2(NAME, 0, 1) }
998 | addr_struc_sub /* 0:1 */
999 | multim_link_sub /* 0:M */
1000 | subm_lang_sect { OCCUR2(LANG, 0, 3) }
1001 | subm_rfn_sect { OCCUR2(RFN, 0, 1) }
1002 | subm_rin_sect { OCCUR2(RIN, 0, 1) }
1003 | change_date_sub /* 0:1 */
1004 | user_sect /* 0:M */
1008 subm_name_sect : OPEN DELIM TAG_NAME DELIM line_item CLOSE { }
1012 subm_lang_sect : OPEN DELIM TAG_LANG DELIM line_item CLOSE { }
1016 subm_rfn_sect : OPEN DELIM TAG_RFN DELIM line_item CLOSE { }
1020 subm_rin_sect : OPEN DELIM TAG_RIN DELIM line_item CLOSE { }
1023 /*********************************************************************/
1024 /**** Substructures ****/
1025 /*********************************************************************/
1027 /* ADDRESS STRUCTURE */
1028 addr_struc_sub : addr_sect { OCCUR2(ADDR, 0, 1) }
1029 | phon_sect { OCCUR2(PHON, 0, 3) }
1032 addr_sect : OPEN DELIM TAG_ADDR DELIM line_item
1039 addr_subs : /* empty */
1040 | addr_subs addr_sub
1043 addr_sub : addr_cont_sect /* 0:M */
1044 | addr_adr1_sect { OCCUR2(ADR1, 0, 1) }
1045 | addr_adr2_sect { OCCUR2(ADR2, 0, 1) }
1046 | addr_city_sect { OCCUR2(CITY, 0, 1) }
1047 | addr_stae_sect { OCCUR2(STAE, 0, 1) }
1048 | addr_post_sect { OCCUR2(POST, 0, 1) }
1049 | addr_ctry_sect { OCCUR2(CTRY, 0, 1) }
1052 addr_cont_sect : OPEN DELIM TAG_CONT DELIM line_item CLOSE { }
1054 addr_adr1_sect : OPEN DELIM TAG_ADR1 DELIM line_item CLOSE { }
1056 addr_adr2_sect : OPEN DELIM TAG_ADR2 DELIM line_item CLOSE { }
1058 addr_city_sect : OPEN DELIM TAG_CITY DELIM line_item CLOSE { }
1060 addr_stae_sect : OPEN DELIM TAG_STAE DELIM line_item CLOSE { }
1062 addr_post_sect : OPEN DELIM TAG_POST DELIM line_item CLOSE { }
1064 addr_ctry_sect : OPEN DELIM TAG_CTRY DELIM line_item CLOSE { }
1067 phon_sect : OPEN DELIM TAG_PHON DELIM line_item CLOSE { }
1070 /* ASSOCIATION STRUCTURE */
1071 assoc_struc_sub : asso_sect /* 0:M */
1074 asso_sect : OPEN DELIM TAG_ASSO DELIM POINTER
1077 { CHECK2(TYPE,RELA) }
1081 asso_subs : /* empty */
1082 | asso_type_sect { OCCUR2(TYPE, 1, 1) }
1083 | asso_rela_sect { OCCUR2(RELA, 1, 1) }
1088 asso_type_sect : OPEN DELIM TAG_TYPE DELIM line_item CLOSE { }
1091 asso_rela_sect : OPEN DELIM TAG_RELA DELIM line_item CLOSE { }
1095 change_date_sub : change_date_chan_sect { OCCUR2(CHAN, 0, 1) }
1098 change_date_chan_sect : OPEN DELIM TAG_CHAN
1100 change_date_chan_subs
1105 change_date_chan_subs : /* empty */
1106 | change_date_chan_subs change_date_chan_sub
1109 change_date_chan_sub : change_date_date_sect { OCCUR2(DATE, 1, 1) }
1113 change_date_date_sect : OPEN DELIM TAG_DATE DELIM line_item
1115 change_date_date_subs
1120 change_date_date_subs : /* empty */
1121 | change_date_date_subs change_date_date_sub
1124 change_date_date_sub : change_date_date_time_sect { OCCUR2(TIME, 0, 1) }
1127 change_date_date_time_sect : OPEN DELIM TAG_TIME DELIM line_item CLOSE { }
1130 /* CHILD TO FAMILY LINK */
1131 chi_fam_link_sub : famc_sect /* 0:M */
1134 famc_sect : OPEN DELIM TAG_FAMC DELIM POINTER
1141 famc_subs : /* empty */
1142 | famc_subs famc_sub
1145 famc_sub : famc_pedi_sect /* 0:M */
1149 famc_pedi_sect : OPEN DELIM TAG_PEDI DELIM line_item CLOSE { }
1152 /* CONTINUATION SUBSECTIONS */
1153 continuation_sub : cont_sect /* 0:M */
1154 | conc_sect /* 0:M */
1157 cont_sect : OPEN DELIM TAG_CONT DELIM line_item CLOSE { }
1160 conc_sect : OPEN DELIM TAG_CONC DELIM line_item CLOSE { }
1164 event_detail_sub : event_detail_type_sect { OCCUR2(TYPE, 0, 1) }
1165 | event_detail_date_sect { OCCUR2(DATE, 0, 1) }
1168 | event_detail_age_sect { OCCUR2(AGE, 0, 1) }
1169 | event_detail_agnc_sect { OCCUR2(AGNC, 0, 1) }
1170 | event_detail_caus_sect { OCCUR2(CAUS, 0, 1) }
1176 event_detail_type_sect : OPEN DELIM TAG_TYPE DELIM line_item CLOSE { }
1178 event_detail_date_sect : OPEN DELIM TAG_DATE DELIM line_item CLOSE { }
1180 event_detail_age_sect : OPEN DELIM TAG_AGE DELIM line_item CLOSE { }
1182 event_detail_agnc_sect : OPEN DELIM TAG_AGNC DELIM line_item CLOSE { }
1184 event_detail_caus_sect : OPEN DELIM TAG_CAUS DELIM line_item CLOSE { }
1187 /* FAMILY EVENT STRUCTURE */
1188 fam_event_struc_sub : fam_event_sect
1189 | fam_gen_even_sect /* 0:M */
1192 fam_event_sect : OPEN DELIM fam_event_tag opt_value fam_event_subs
1197 fam_event_tag : TAG_ANUL { OPEN(ANUL) }
1198 | TAG_CENS { OPEN(CENS) }
1199 | TAG_DIV { OPEN(DIV) }
1200 | TAG_DIVF { OPEN(DIVF) }
1201 | TAG_ENGA { OPEN(ENGA) }
1202 | TAG_MARR { OPEN(MARR) }
1203 | TAG_MARB { OPEN(MARB) }
1204 | TAG_MARC { OPEN(MARC) }
1205 | TAG_MARL { OPEN(MARL) }
1206 | TAG_MARS { OPEN(MARS) }
1209 fam_event_subs : /* empty */
1210 | fam_event_subs fam_event_sub
1213 fam_event_sub : event_detail_sub
1214 | fam_even_husb_sect { OCCUR2(HUSB, 0, 1) }
1215 | fam_even_wife_sect { OCCUR2(WIFE, 0, 1) }
1218 fam_even_husb_sect : OPEN DELIM TAG_HUSB
1225 fam_even_husb_subs : /* empty */
1226 | fam_even_husb_subs fam_even_husb_sub
1229 fam_even_husb_sub : fam_even_husb_age_sect { OCCUR2(AGE, 1, 1) }
1232 fam_even_husb_age_sect : OPEN DELIM TAG_AGE DELIM line_item CLOSE { }
1235 fam_even_wife_sect : OPEN DELIM TAG_WIFE
1242 fam_gen_even_sect : OPEN DELIM TAG_EVEN
1249 fam_gen_even_subs : /* empty */
1250 | fam_gen_even_subs fam_gen_even_sub
1253 fam_gen_even_sub : event_detail_sub
1254 | fam_even_husb_sect { OCCUR2(HUSB, 0, 1) }
1255 | fam_even_wife_sect { OCCUR2(WIFE, 0, 1) }
1258 /* IDENTIFICATION STRUCTURE */
1259 ident_struc_sub : ident_refn_sect /* 0:M */
1260 | ident_rin_sect { OCCUR2(RIN, 0, 1) }
1263 ident_refn_sect : OPEN DELIM TAG_REFN DELIM line_item
1270 ident_refn_subs : /* empty */
1271 | ident_refn_subs ident_refn_sub
1274 ident_refn_sub : ident_refn_type_sect { OCCUR2(TYPE, 0, 1) }
1277 ident_refn_type_sect : OPEN DELIM TAG_TYPE DELIM line_item CLOSE { }
1280 ident_rin_sect : OPEN DELIM TAG_RIN DELIM line_item CLOSE { }
1283 /* INDIVIDUAL ATTRIBUTE STRUCTURE */
1284 indiv_attr_struc_sub : indiv_cast_sect /* 0:M */
1285 | indiv_dscr_sect /* 0:M */
1286 | indiv_educ_sect /* 0:M */
1287 | indiv_idno_sect /* 0:M */
1288 | indiv_nati_sect /* 0:M */
1289 | indiv_nchi_sect /* 0:M */
1290 | indiv_nmr_sect /* 0:M */
1291 | indiv_occu_sect /* 0:M */
1292 | indiv_prop_sect /* 0:M */
1293 | indiv_reli_sect /* 0:M */
1294 | indiv_resi_sect /* 0:M */
1295 | indiv_ssn_sect /* 0:M */
1296 | indiv_titl_sect /* 0:M */
1299 indiv_cast_sect : OPEN DELIM TAG_CAST DELIM line_item
1301 indiv_attr_event_subs
1305 indiv_dscr_sect : OPEN DELIM TAG_DSCR DELIM line_item
1307 indiv_attr_event_subs
1311 indiv_educ_sect : OPEN DELIM TAG_EDUC DELIM line_item
1313 indiv_attr_event_subs
1317 indiv_idno_sect : OPEN DELIM TAG_IDNO DELIM line_item
1319 indiv_attr_event_subs
1323 indiv_nati_sect : OPEN DELIM TAG_NATI DELIM line_item
1325 indiv_attr_event_subs
1329 indiv_nchi_sect : OPEN DELIM TAG_NCHI DELIM line_item
1331 indiv_attr_event_subs
1335 indiv_nmr_sect : OPEN DELIM TAG_NMR DELIM line_item
1337 indiv_attr_event_subs
1341 indiv_occu_sect : OPEN DELIM TAG_OCCU DELIM line_item
1343 indiv_attr_event_subs
1347 indiv_prop_sect : OPEN DELIM TAG_PROP DELIM line_item
1349 indiv_attr_event_subs
1353 indiv_reli_sect : OPEN DELIM TAG_RELI DELIM line_item
1355 indiv_attr_event_subs
1359 indiv_resi_sect : OPEN DELIM TAG_RESI
1361 indiv_attr_event_subs
1365 indiv_ssn_sect : OPEN DELIM TAG_SSN DELIM line_item
1367 indiv_attr_event_subs
1371 indiv_titl_sect : OPEN DELIM TAG_TITL DELIM line_item
1373 indiv_attr_event_subs
1378 indiv_attr_event_subs : /* empty */
1379 | indiv_attr_event_subs indiv_attr_event_sub
1382 indiv_attr_event_sub : event_detail_sub
1385 /* INDIVIDUAL EVENT STRUCTURE */
1386 indiv_even_struc_sub : indiv_birt_sect
1388 | indiv_adop_sect /* 0:M */
1389 | indiv_even_sect /* 0:M */
1392 indiv_birt_sect : OPEN DELIM indiv_birt_tag opt_value indiv_birt_subs
1397 indiv_birt_tag : TAG_BIRT { OPEN(BIRT) }
1398 | TAG_CHR { OPEN(CHR) }
1401 indiv_birt_subs : /* empty */
1402 | indiv_birt_subs indiv_birt_sub
1405 indiv_birt_sub : event_detail_sub
1406 | indiv_birt_famc_sect { OCCUR2(FAMC,0, 1) }
1409 indiv_birt_famc_sect : OPEN DELIM TAG_FAMC DELIM POINTER CLOSE { }
1412 indiv_gen_sect : OPEN DELIM indiv_gen_tag opt_value indiv_gen_subs
1417 indiv_gen_tag : TAG_DEAT { OPEN(DEAT) }
1418 | TAG_BURI { OPEN(BURI) }
1419 | TAG_CREM { OPEN(CREM) }
1420 | TAG_BAPM { OPEN(BAPM) }
1421 | TAG_BARM { OPEN(BARM) }
1422 | TAG_BASM { OPEN(BASM) }
1423 | TAG_BLES { OPEN(BLES) }
1424 | TAG_CHRA { OPEN(CHRA) }
1425 | TAG_CONF { OPEN(CONF) }
1426 | TAG_FCOM { OPEN(FCOM) }
1427 | TAG_ORDN { OPEN(ORDN) }
1428 | TAG_NATU { OPEN(NATU) }
1429 | TAG_EMIG { OPEN(EMIG) }
1430 | TAG_IMMI { OPEN(IMMI) }
1431 | TAG_CENS { OPEN(CENS) }
1432 | TAG_PROB { OPEN(PROB) }
1433 | TAG_WILL { OPEN(WILL) }
1434 | TAG_GRAD { OPEN(GRAD) }
1435 | TAG_RETI { OPEN(RETI) }
1438 indiv_gen_subs : /* empty */
1439 | indiv_gen_subs indiv_gen_sub
1442 indiv_gen_sub : event_detail_sub
1445 indiv_adop_sect : OPEN DELIM TAG_ADOP opt_value
1452 indiv_adop_subs : /* empty */
1453 | indiv_adop_subs indiv_adop_sub
1456 indiv_adop_sub : event_detail_sub
1457 | indiv_adop_famc_sect { OCCUR2(FAMC,0, 1) }
1460 indiv_adop_famc_sect : OPEN DELIM TAG_FAMC DELIM POINTER
1462 indiv_adop_famc_subs
1467 indiv_adop_famc_subs : /* empty */
1468 | indiv_adop_famc_subs indiv_adop_famc_sub
1471 indiv_adop_famc_sub : indiv_adop_famc_adop_sect { OCCUR2(ADOP,0, 1) }
1474 indiv_adop_famc_adop_sect : OPEN DELIM TAG_ADOP DELIM line_item CLOSE { }
1477 indiv_even_sect : OPEN DELIM TAG_EVEN
1484 /* LDS INDIVIDUAL ORDINANCE */
1485 lds_indiv_ord_sub : lio_bapl_sect /* 0:M */
1486 | lio_slgc_sect /* 0:M */
1489 lio_bapl_sect : OPEN DELIM lio_bapl_tag lio_bapl_subs
1494 lio_bapl_tag : TAG_BAPL { OPEN(BAPL) }
1495 | TAG_CONL { OPEN(CONL) }
1496 | TAG_ENDL { OPEN(ENDL) }
1499 lio_bapl_subs : /* empty */
1500 | lio_bapl_subs lio_bapl_sub
1503 lio_bapl_sub : lio_bapl_stat_sect { OCCUR2(STAT, 0, 1) }
1504 | lio_bapl_date_sect { OCCUR2(DATE, 0, 1) }
1505 | lio_bapl_temp_sect { OCCUR2(TEMP, 0, 1) }
1506 | lio_bapl_plac_sect { OCCUR2(PLAC, 0, 1) }
1511 lio_bapl_stat_sect : OPEN DELIM TAG_STAT DELIM line_item CLOSE { }
1513 lio_bapl_date_sect : OPEN DELIM TAG_DATE DELIM line_item CLOSE { }
1515 lio_bapl_temp_sect : OPEN DELIM TAG_TEMP DELIM line_item CLOSE { }
1517 lio_bapl_plac_sect : OPEN DELIM TAG_PLAC DELIM line_item CLOSE { }
1520 lio_slgc_sect : OPEN DELIM TAG_SLGC
1527 lio_slgc_subs : /* empty */
1528 | lio_slgc_subs lio_slgc_sub
1531 lio_slgc_sub : lio_bapl_sub
1532 | lio_slgc_famc_sect { OCCUR2(FAMC, 1, 1) }
1535 lio_slgc_famc_sect : OPEN DELIM TAG_FAMC DELIM POINTER CLOSE { }
1538 /* LDS SPOUSE SEALING */
1539 lds_spouse_seal_sub : lss_slgs_sect
1542 lss_slgs_sect : OPEN DELIM TAG_SLGS
1549 lss_slgs_subs : /* empty */
1550 | lss_slgs_subs lss_slgs_sub
1553 lss_slgs_sub : lss_slgs_stat_sect { OCCUR2(STAT, 0, 1) }
1554 | lss_slgs_date_sect { OCCUR2(DATE, 0, 1) }
1555 | lss_slgs_temp_sect { OCCUR2(TEMP, 0, 1) }
1556 | lss_slgs_plac_sect { OCCUR2(PLAC, 0, 1) }
1561 lss_slgs_stat_sect : OPEN DELIM TAG_STAT DELIM line_item CLOSE { }
1563 lss_slgs_date_sect : OPEN DELIM TAG_DATE DELIM line_item CLOSE { }
1565 lss_slgs_temp_sect : OPEN DELIM TAG_TEMP DELIM line_item CLOSE { }
1567 lss_slgs_plac_sect : OPEN DELIM TAG_PLAC DELIM line_item CLOSE { }
1570 /* MULTIMEDIA LINK */
1571 multim_link_sub : multim_obje_link_sect
1572 | multim_obje_emb_sect
1575 multim_obje_link_sect : OPEN DELIM TAG_OBJE DELIM POINTER CLOSE { }
1578 multim_obje_emb_sect : OPEN DELIM TAG_OBJE
1580 multim_obje_emb_subs
1581 { CHECK2(FORM,FILE) }
1585 multim_obje_emb_subs : /* empty */
1586 | multim_obje_emb_subs multim_obje_emb_sub
1589 multim_obje_emb_sub : multim_obje_form_sect { OCCUR2(FORM, 1, 1) }
1590 | multim_obje_titl_sect { OCCUR2(TITL, 0, 1) }
1591 | multim_obje_file_sect { OCCUR2(FILE, 1, 1) }
1595 multim_obje_form_sect : OPEN DELIM TAG_FORM DELIM line_item CLOSE { }
1597 multim_obje_titl_sect : OPEN DELIM TAG_TITL DELIM line_item CLOSE { }
1599 multim_obje_file_sect : OPEN DELIM TAG_FILE DELIM line_item CLOSE { }
1602 /* NOTE STRUCTURE */
1603 note_struc_sub : note_struc_link_sect /* 0:M */
1604 | note_struc_emb_sect /* 0:M */
1607 note_struc_link_sect : OPEN DELIM TAG_NOTE DELIM POINTER
1609 note_struc_link_subs
1614 note_struc_link_subs : /* empty */
1615 | note_struc_link_subs note_struc_link_sub
1618 note_struc_link_sub : source_cit_sub
1621 note_struc_emb_sect : OPEN DELIM TAG_NOTE opt_line_item
1628 note_struc_emb_subs : /* empty */
1629 | note_struc_emb_subs note_struc_emb_sub
1632 note_struc_emb_sub : continuation_sub
1636 /* PERSONAL NAME STRUCTURE */
1637 pers_name_struc_sub : pers_name_sect /* 0:M */
1640 pers_name_sect : OPEN DELIM TAG_NAME DELIM line_item
1647 pers_name_subs : /* empty */
1648 | pers_name_subs pers_name_sub
1651 pers_name_sub : pers_name_npfx_sect { OCCUR2(NPFX, 0, 1) }
1652 | pers_name_givn_sect { OCCUR2(GIVN, 0, 1) }
1653 | pers_name_nick_sect { OCCUR2(NICK, 0, 1) }
1654 | pers_name_spfx_sect { OCCUR2(SPFX, 0, 1) }
1655 | pers_name_surn_sect { OCCUR2(SURN, 0, 1) }
1656 | pers_name_nsfx_sect { OCCUR2(NSFX, 0, 1) }
1661 pers_name_npfx_sect : OPEN DELIM TAG_NPFX DELIM line_item CLOSE { }
1663 pers_name_givn_sect : OPEN DELIM TAG_GIVN DELIM line_item CLOSE { }
1665 pers_name_nick_sect : OPEN DELIM TAG_NICK DELIM line_item CLOSE { }
1667 pers_name_spfx_sect : OPEN DELIM TAG_SPFX DELIM line_item CLOSE { }
1669 pers_name_surn_sect : OPEN DELIM TAG_SURN DELIM line_item CLOSE { }
1671 pers_name_nsfx_sect : OPEN DELIM TAG_NSFX DELIM line_item CLOSE { }
1674 /* PLACE STRUCTURE */
1675 place_struc_sub : place_struc_plac_sect /* 0:M */
1678 place_struc_plac_sect : OPEN DELIM TAG_PLAC DELIM line_item
1680 place_struc_plac_subs
1685 place_struc_plac_subs : /* empty */
1686 | place_struc_plac_subs place_struc_plac_sub
1689 place_struc_plac_sub : place_plac_form_sect { OCCUR2(FORM, 0, 1) }
1694 place_plac_form_sect : OPEN DELIM TAG_FORM DELIM line_item CLOSE { }
1697 /* SOURCE_CITATION */
1698 source_cit_sub : source_cit_link_sect /* 0:M */
1699 | source_cit_emb_sect /* 0:M */
1702 source_cit_link_sect : OPEN DELIM TAG_SOUR DELIM POINTER
1704 source_cit_link_subs
1709 source_cit_link_subs : /* empty */
1710 | source_cit_link_subs source_cit_link_sub
1713 source_cit_link_sub : source_cit_page_sect { OCCUR2(PAGE, 0, 1) }
1714 | source_cit_even_sect { OCCUR2(EVEN, 0, 1) }
1715 | source_cit_data_sect { OCCUR2(DATA, 0, 1) }
1716 | source_cit_quay_sect { OCCUR2(QUAY, 0, 1) }
1721 source_cit_page_sect : OPEN DELIM TAG_PAGE DELIM line_item CLOSE { }
1724 source_cit_even_sect : OPEN DELIM TAG_EVEN DELIM line_item
1726 source_cit_even_subs
1731 source_cit_even_subs : /* empty */
1732 | source_cit_even_subs source_cit_even_sub
1735 source_cit_even_sub : source_cit_even_role_sect { OCCUR2(ROLE, 0, 1) }
1738 source_cit_even_role_sect : OPEN DELIM TAG_ROLE DELIM line_item CLOSE { }
1741 source_cit_data_sect : OPEN DELIM TAG_DATA
1743 source_cit_data_subs
1748 source_cit_data_subs : /* empty */
1749 | source_cit_data_subs source_cit_data_sub
1752 source_cit_data_sub : source_cit_data_date_sect { OCCUR2(DATE, 0, 1) }
1753 | source_cit_text_sect /* 0:M */
1756 source_cit_data_date_sect : OPEN DELIM TAG_DATE DELIM line_item CLOSE { }
1759 source_cit_text_sect : OPEN DELIM TAG_TEXT DELIM line_item
1761 source_cit_text_subs
1766 source_cit_text_subs : /* empty */
1767 | source_cit_text_subs source_cit_text_sub
1770 source_cit_text_sub : continuation_sub
1773 source_cit_quay_sect : OPEN DELIM TAG_QUAY DELIM line_item CLOSE { }
1776 source_cit_emb_sect : OPEN DELIM TAG_SOUR DELIM line_item
1783 source_cit_emb_subs : /* empty */
1784 | source_cit_emb_subs source_cit_emb_sub
1787 source_cit_emb_sub : continuation_sub
1788 | source_cit_text_sect /* 0:M */
1792 /* SOURCE REPOSITORY CITATION */
1793 source_repos_cit_sub : source_repos_repo_sect { OCCUR2(REPO, 0, 1) }
1796 source_repos_repo_sect : OPEN DELIM TAG_REPO DELIM POINTER
1798 source_repos_repo_subs
1803 source_repos_repo_subs : /* empty */
1804 | source_repos_repo_subs source_repos_repo_sub
1807 source_repos_repo_sub : note_struc_sub
1808 | caln_sect /* 0:M */
1811 caln_sect : OPEN DELIM TAG_CALN DELIM line_item
1818 caln_subs : /* empty */
1819 | caln_subs caln_sub
1822 caln_sub : caln_medi_sect { OCCUR2(MEDI, 0, 1) }
1825 caln_medi_sect : OPEN DELIM TAG_MEDI DELIM line_item CLOSE { }
1828 /* SPOUSE TO FAMILY LINK */
1829 spou_fam_link_sub : spou_fam_fams_sect /* 0:M */
1832 spou_fam_fams_sect : OPEN DELIM TAG_FAMS DELIM POINTER
1839 spou_fam_fams_subs : /* empty */
1840 | spou_fam_fams_subs spou_fam_fams_sub
1843 spou_fam_fams_sub : note_struc_sub
1846 /*********************************************************************/
1848 /*********************************************************************/
1850 user_sect : OPEN DELIM opt_xref USERTAG
1851 { if ($4[0] != '_') {
1852 gedcom_error("Undefined tag (and not a valid user tag): %s",
1857 opt_value user_sects CLOSE { }
1860 user_sects : /* empty */ { }
1861 | user_sects user_sect { }
1864 opt_xref : /* empty */ { }
1868 opt_value : /* empty */ { }
1869 | DELIM line_value { }
1872 line_value : POINTER { }
1876 opt_line_item : /* empty */ { }
1877 | DELIM line_item { }
1880 line_item : anychar { }
1882 | line_item anychar { }
1883 | line_item ESCAPE { }
1886 anychar : ANYCHAR { }
1891 gen_sect : OPEN DELIM opt_xref anytag
1892 { INVALID_TAG($4); }
1893 opt_value opt_sects CLOSE
1897 gen_rec : OPEN DELIM opt_xref anytag
1898 { INVALID_TOP_TAG($4) }
1899 opt_value opt_sects CLOSE
1903 opt_sects : <empty> { }
1904 | opt_sects gen_sect { }
2037 /* Functions that handle the counting of subtags */
2039 int* count_arrays[MAXGEDCOMLEVEL+1];
2040 char tag_stack[MAXGEDCOMLEVEL+1][MAXSTDTAGLENGTH+1];
2042 void push_countarray()
2045 if (count_level > MAXGEDCOMLEVEL) {
2046 gedcom_error("Internal error: count array overflow");
2050 count = (int *)calloc(YYNTOKENS, sizeof(int));
2051 if (count == NULL) { int *count = count_arrays[count_level];
2053 gedcom_error("Internal error: count array calloc error");
2057 count_arrays[count_level] = count;
2062 void set_parenttag(char* tag)
2064 strncpy(tag_stack[count_level], tag, MAXSTDTAGLENGTH+1);
2067 char* get_parenttag()
2069 return tag_stack[count_level];
2072 int count_tag(int tag)
2074 int *count = count_arrays[count_level];
2075 return ++count[tag - GEDCOMTAGOFFSET];
2078 int check_occurrence(int tag)
2080 int *count = count_arrays[count_level];
2081 return (count[tag - GEDCOMTAGOFFSET] > 0);
2084 void pop_countarray()
2087 if (count_level < 0) {
2088 gedcom_error("Internal error: count array underflow");
2092 count = count_arrays[count_level];
2094 count_arrays[count_level] = NULL;
2098 /* Enabling debug mode */
2100 void gedcom_enable_debug()
2107 /* Setting the error mechanism */
2109 void gedcom_set_error_handling(MECHANISM mechanism)
2111 curr_mechanism = mechanism;