1 /* This program is free software; you can redistribute it and/or modify *
2 * it under the terms of the GNU General Public License as published by *
3 * the Free Software Foundation; either version 2 of the License, or *
4 * (at your option) any later version. *
6 (C) 2001 by The Genes Development Team
7 Original author: Peter Verthez (Peter.Verthez@advalvas.be)
13 /* WARNING: THIS PARSER RELIES HEAVILY ON SOME FEATURES OF BISON.
14 DON'T TRY TO USE IT WITH YACC, IT WON'T WORK...
17 /* Design of the parser:
19 In general, a GEDCOM file contains records, each consisting of a line
20 (which we'll call a section), hierarchically containing other lines
21 (subsections of the section).
23 This means that in general we have:
25 A 'record' is a 'section' (sect) containing 'subsections' (subs)
26 Each 'subsection' (sub) is again a specific 'section' (sect)
28 In parser notation, this means:
32 sect : <some prefix> subs <some suffix>
34 subs : <empty> | subs sub
36 sub : sect_a | sect_b | ...
38 This pattern is repeated throughout the parser for the different types of
42 Cardinality of the subsections:
43 -------------------------------
44 Note that in the above, the order of the subsections is of no importance.
45 Indeed, this is the case in the GEDCOM grammar. However, this also makes
46 it difficult to check whether there are not too many subsections of a
47 specific type, or whether a mandatory subsection is indeed there.
49 Suppose there is a section A that can contain 0 or 1 B section and
52 This can be expressed in parser notation as follows:
54 A : CC | BCC | CBC | CCB
56 So, cardinality is indeed expressable. However, as the number of subsection
57 types and the limits grow bigger (and even theoretically limitless), listing
58 all possible permutations becomes quickly unfeasible.
60 Much simpler is to say:
63 subs : <empty> | subs sub
66 and then check the cardinality in the semantic actions, which is the
67 solution chosen in the parser below, using the following macros:
70 Make a new context for the <parent> tag to count child tags in
72 - OCCUR2(<child>, <min>, <max>)
73 Express that the <child> tag should occur at least <min> times and
74 at most <max> tags within its parent
76 What this actually does is the following. It increments the counter
77 for that tag and then checks whether the maximum is exceeded. If so,
78 then a parser error is produced. The minimum is not actually checked
79 by this macro, but it makes the statements more declarative.
81 - OCCUR1(<child>, <min>)
82 Express that the <child> tag should occur at least <min> times within
83 its parent (no upper limit)
85 Actually, this only increments the counter for the tag, but it looks
86 very like the previous macro.
88 If the minimum is 0, it is not necessary to express this constraint.
90 - CHECKn(<child1>, ..., <childn>)
91 This closes the context for the parent tag and checks whether the
92 given <child> tags did effectively occur within the parent (i.e.
93 these are the tags that were mandatory).
95 Since the <min> values above are always 0 or 1 in GEDCOM, this is
96 sufficient. All sub-tags that declare a minimum of 1 in the OCCUR
97 macros should be listed in this macro here.
99 The macros CHECK0 to CHECK4 are defined like this (the first one
100 has no arguments and is only used to close the parent context; note
101 that this is necessary for correct functioning).
105 Only sections that have subsections need to use these macros. This can
106 be done like this (the OPEN and CHECK macros are used as mid-rule
107 actions around the subsections):
109 head_sect : OPEN DELIM TAG_HEAD
113 CLOSE { <semantic actions> }
119 head_sub : head_sour_sect { OCCUR2(SOUR, 1, 1) }
120 | head_dest_sect { OCCUR2(DEST, 0, 1) }
121 | head_date_sect { OCCUR2(DATE, 0, 1) }
127 - The syntax analysis doesn't handle the contents of the line values;
128 this is done in the semantic analysis.
134 #include "multilex.h"
135 #include "encoding.h"
139 int compat_enabled = 1;
140 int gedcom_high_level_debug = 0;
141 int compatibility = 0;
142 MECHANISM error_mechanism = IMMED_FAIL;
144 char line_item_buf[MAXGEDCLINELEN * UTF_FACTOR + 1];
145 char *line_item_buf_ptr;
151 /* These are defined at the bottom of the file */
152 void push_countarray();
153 void set_parenttag(char* tag);
154 char* get_parenttag();
155 void pop_countarray();
156 int count_tag(int tag);
157 int check_occurrence(int tag);
158 void set_compatibility(char* program);
159 int compat_mode(int flags);
161 #define CLEAR_BUFFER(BUF) \
162 memset(BUF, 0, sizeof(BUF));
164 #define HANDLE_ERROR \
165 { if (error_mechanism == IMMED_FAIL) { \
168 else if (error_mechanism == DEFER_FAIL) { \
171 else if (error_mechanism == IGNORE_ERRORS) { \
175 #define START(PARENTTAG) \
177 set_parenttag(#PARENTTAG); \
181 { if (!check_occurrence(TAG_##TAG)) { \
182 char* parenttag = get_parenttag(); \
183 gedcom_error("The tag '%s' is mandatory within '%s', but missing", \
189 { pop_countarray(); \
193 #define CHECK1(TAG1) { CHK(TAG1); POP; }
194 #define CHECK2(TAG1,TAG2) \
195 { CHK(TAG1); CHK(TAG2); POP; }
196 #define CHECK3(TAG1,TAG2,TAG3) \
197 { CHK(TAG1); CHK(TAG2); CHK(TAG3); POP; }
198 #define CHECK4(TAG1,TAG2,TAG3,TAG4) \
199 { CHK(TAG1); CHK(TAG2); CHK(TAG3); CHK(TAG4); POP; }
200 #define OCCUR1(CHILDTAG, MIN) { count_tag(TAG_##CHILDTAG); }
201 #define OCCUR2(CHILDTAG, MIN, MAX) \
202 { int num = count_tag(TAG_##CHILDTAG); \
204 char* parenttag = get_parenttag(); \
205 gedcom_error("The tag '%s' can maximally occur %d " \
206 "time(s) within '%s'", \
207 #CHILDTAG, MAX, parenttag); \
211 #define INVALID_TAG(CHILDTAG) \
212 { char* parenttag = get_parenttag(); \
213 gedcom_error("The tag '%s' is not a valid tag within '%s'", \
214 CHILDTAG, parenttag); \
217 #define INVALID_TOP_TAG(CHILDTAG) \
218 { gedcom_error("The tag '%s' is not a valid top-level tag", \
233 %token <string> BADTOKEN
235 %token <string> CLOSE
236 %token <string> ESCAPE
237 %token <string> DELIM
238 %token <string> ANYCHAR
239 %token <string> POINTER
240 %token <string> USERTAG
241 %token <string> TAG_ABBR
242 %token <string> TAG_ADDR
243 %token <string> TAG_ADR1
244 %token <string> TAG_ADR2
245 %token <string> TAG_ADOP
246 %token <string> TAG_AFN
247 %token <string> TAG_AGE
248 %token <string> TAG_AGNC
249 %token <string> TAG_ALIA
250 %token <string> TAG_ANCE
251 %token <string> TAG_ANCI
252 %token <string> TAG_ANUL
253 %token <string> TAG_ASSO
254 %token <string> TAG_AUTH
255 %token <string> TAG_BAPL
256 %token <string> TAG_BAPM
257 %token <string> TAG_BARM
258 %token <string> TAG_BASM
259 %token <string> TAG_BIRT
260 %token <string> TAG_BLES
261 %token <string> TAG_BLOB
262 %token <string> TAG_BURI
263 %token <string> TAG_CALN
264 %token <string> TAG_CAST
265 %token <string> TAG_CAUS
266 %token <string> TAG_CENS
267 %token <string> TAG_CHAN
268 %token <string> TAG_CHAR
269 %token <string> TAG_CHIL
270 %token <string> TAG_CHR
271 %token <string> TAG_CHRA
272 %token <string> TAG_CITY
273 %token <string> TAG_CONC
274 %token <string> TAG_CONF
275 %token <string> TAG_CONL
276 %token <string> TAG_CONT
277 %token <string> TAG_COPR
278 %token <string> TAG_CORP
279 %token <string> TAG_CREM
280 %token <string> TAG_CTRY
281 %token <string> TAG_DATA
282 %token <string> TAG_DATE
283 %token <string> TAG_DEAT
284 %token <string> TAG_DESC
285 %token <string> TAG_DESI
286 %token <string> TAG_DEST
287 %token <string> TAG_DIV
288 %token <string> TAG_DIVF
289 %token <string> TAG_DSCR
290 %token <string> TAG_EDUC
291 %token <string> TAG_EMIG
292 %token <string> TAG_ENDL
293 %token <string> TAG_ENGA
294 %token <string> TAG_EVEN
295 %token <string> TAG_FAM
296 %token <string> TAG_FAMC
297 %token <string> TAG_FAMF
298 %token <string> TAG_FAMS
299 %token <string> TAG_FCOM
300 %token <string> TAG_FILE
301 %token <string> TAG_FORM
302 %token <string> TAG_GEDC
303 %token <string> TAG_GIVN
304 %token <string> TAG_GRAD
305 %token <string> TAG_HEAD
306 %token <string> TAG_HUSB
307 %token <string> TAG_IDNO
308 %token <string> TAG_IMMI
309 %token <string> TAG_INDI
310 %token <string> TAG_LANG
311 %token <string> TAG_LEGA
312 %token <string> TAG_MARB
313 %token <string> TAG_MARC
314 %token <string> TAG_MARL
315 %token <string> TAG_MARR
316 %token <string> TAG_MARS
317 %token <string> TAG_MEDI
318 %token <string> TAG_NAME
319 %token <string> TAG_NATI
320 %token <string> TAG_NATU
321 %token <string> TAG_NCHI
322 %token <string> TAG_NICK
323 %token <string> TAG_NMR
324 %token <string> TAG_NOTE
325 %token <string> TAG_NPFX
326 %token <string> TAG_NSFX
327 %token <string> TAG_OBJE
328 %token <string> TAG_OCCU
329 %token <string> TAG_ORDI
330 %token <string> TAG_ORDN
331 %token <string> TAG_PAGE
332 %token <string> TAG_PEDI
333 %token <string> TAG_PHON
334 %token <string> TAG_PLAC
335 %token <string> TAG_POST
336 %token <string> TAG_PROB
337 %token <string> TAG_PROP
338 %token <string> TAG_PUBL
339 %token <string> TAG_QUAY
340 %token <string> TAG_REFN
341 %token <string> TAG_RELA
342 %token <string> TAG_RELI
343 %token <string> TAG_REPO
344 %token <string> TAG_RESI
345 %token <string> TAG_RESN
346 %token <string> TAG_RETI
347 %token <string> TAG_RFN
348 %token <string> TAG_RIN
349 %token <string> TAG_ROLE
350 %token <string> TAG_SEX
351 %token <string> TAG_SLGC
352 %token <string> TAG_SLGS
353 %token <string> TAG_SOUR
354 %token <string> TAG_SPFX
355 %token <string> TAG_SSN
356 %token <string> TAG_STAE
357 %token <string> TAG_STAT
358 %token <string> TAG_SUBM
359 %token <string> TAG_SUBN
360 %token <string> TAG_SURN
361 %token <string> TAG_TEMP
362 %token <string> TAG_TEXT
363 %token <string> TAG_TIME
364 %token <string> TAG_TITL
365 %token <string> TAG_TRLR
366 %token <string> TAG_TYPE
367 %token <string> TAG_VERS
368 %token <string> TAG_WIFE
369 %token <string> TAG_WILL
371 %type <string> anystdtag
372 %type <string> anytoptag
373 %type <string> line_item
374 %type <string> mand_line_item
375 %type <string> note_line_item
376 %type <string> anychar
380 file : head_sect records trlr_sect
381 { if (fail == 1) YYABORT; }
384 records : /* empty */
399 /*********************************************************************/
401 /*********************************************************************/
402 head_sect : OPEN DELIM TAG_HEAD
405 { if (compat_mode(C_FTREE))
406 CHECK3(SOUR, GEDC, CHAR)
408 CHECK4(SOUR, SUBM, GEDC, CHAR)
413 head_subs : /* empty */
417 head_sub : head_sour_sect { OCCUR2(SOUR, 1, 1) }
418 | head_dest_sect { OCCUR2(DEST, 0, 1) }
419 | head_date_sect { OCCUR2(DATE, 0, 1) }
420 | head_subm_sect { OCCUR2(SUBM, 1, 1) }
421 | head_subn_sect { OCCUR2(SUBN, 0, 1) }
422 | head_file_sect { OCCUR2(FILE, 0, 1) }
423 | head_copr_sect { OCCUR2(COPR, 0, 1) }
424 | head_gedc_sect { OCCUR2(GEDC, 1, 1) }
425 | head_char_sect { OCCUR2(CHAR, 1, 1) }
426 | head_lang_sect { OCCUR2(LANG, 0, 1) }
427 | head_plac_sect { OCCUR2(PLAC, 0, 1) }
428 | head_note_sect { OCCUR2(NOTE, 0, 1) }
433 head_sour_sect : OPEN DELIM TAG_SOUR mand_line_item
434 { set_compatibility($4);
435 gedcom_debug_print("===Source: '%s', '%s'\n",
444 head_sour_subs : /* empty */
445 | head_sour_subs head_sour_sub
448 head_sour_sub : head_sour_vers_sect { OCCUR2(VERS, 0, 1) }
449 | head_sour_name_sect { OCCUR2(NAME, 0, 1) }
450 | head_sour_corp_sect { OCCUR2(CORP, 0, 1) }
451 | head_sour_data_sect { OCCUR2(DATA, 0, 1) }
455 head_sour_vers_sect : OPEN DELIM TAG_VERS mand_line_item
456 { START(VERS)} no_std_subs { CHECK0 } CLOSE
457 { gedcom_debug_print("===Source version: '%s'\n", $4);
460 head_sour_name_sect : OPEN DELIM TAG_NAME mand_line_item
461 { START(NAME) } no_std_subs { CHECK0 } CLOSE
462 { gedcom_debug_print("===Source name: '%s'\n", $4);
465 head_sour_corp_sect : OPEN DELIM TAG_CORP mand_line_item
466 { gedcom_debug_print("===Source corp name: '%s'\n", $4);
474 head_sour_corp_subs : /* empty */
475 | head_sour_corp_subs head_sour_corp_sub
478 head_sour_corp_sub : addr_struc_sub /* 0:1 */
482 head_sour_data_sect : OPEN DELIM TAG_DATA mand_line_item
490 head_sour_data_subs : /* empty */
491 | head_sour_data_subs head_sour_data_sub
494 head_sour_data_sub : head_sour_data_date_sect { OCCUR2(DATE, 0, 1) }
495 | head_sour_data_copr_sect { OCCUR2(COPR, 0, 1) }
499 head_sour_data_date_sect : OPEN DELIM TAG_DATE mand_line_item
500 { START(DATE) } no_std_subs { CHECK0 } CLOSE
503 head_sour_data_copr_sect : OPEN DELIM TAG_COPR mand_line_item
504 { START(COPR) } no_std_subs { CHECK0 } CLOSE
509 head_dest_sect : OPEN DELIM TAG_DEST mand_line_item
510 { START(DEST) } no_std_subs { CHECK0 } CLOSE
515 head_date_sect : OPEN DELIM TAG_DATE mand_line_item
523 head_date_subs : /* empty */
524 | head_date_subs head_date_sub
527 head_date_sub : head_date_time_sect { OCCUR2(TIME, 0, 1) }
531 head_date_time_sect : OPEN DELIM TAG_TIME mand_line_item
532 { START(TIME) } no_std_subs { CHECK0 } CLOSE
537 head_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
538 { START(SUBM) } no_std_subs { CHECK0 } CLOSE
542 head_subn_sect : OPEN DELIM TAG_SUBN mand_pointer
543 { START(SUBN) } no_std_subs { CHECK0 } CLOSE
547 head_file_sect : OPEN DELIM TAG_FILE mand_line_item
548 { START(FILE) } no_std_subs { CHECK0 } CLOSE
552 head_copr_sect : OPEN DELIM TAG_COPR mand_line_item
553 { START(COPR) } no_std_subs { CHECK0 } CLOSE
557 head_gedc_sect : OPEN DELIM TAG_GEDC
560 { CHECK2(VERS, FORM) }
565 head_gedc_subs : /* empty */
566 | head_gedc_subs head_gedc_sub
569 head_gedc_sub : head_gedc_vers_sect { OCCUR2(VERS, 1, 1) }
570 | head_gedc_form_sect { OCCUR2(FORM, 1, 1) }
573 head_gedc_vers_sect : OPEN DELIM TAG_VERS mand_line_item
574 { START(VERS) } no_std_subs { CHECK0 } CLOSE
577 head_gedc_form_sect : OPEN DELIM TAG_FORM mand_line_item
578 { START(FORM) } no_std_subs { CHECK0 } CLOSE
583 head_char_sect : OPEN DELIM TAG_CHAR mand_line_item
584 { if (open_conv_to_internal($4) == 0) YYERROR;
592 head_char_subs : /* empty */
593 | head_char_subs head_char_sub
596 head_char_sub : head_char_vers_sect { OCCUR2(VERS, 0, 1) }
599 head_char_vers_sect : OPEN DELIM TAG_VERS mand_line_item
600 { START(VERS) } no_std_subs { CHECK0 } CLOSE
605 head_lang_sect : OPEN DELIM TAG_LANG mand_line_item
606 { START(LANG) } no_std_subs { CHECK0 } CLOSE
610 head_plac_sect : OPEN DELIM TAG_PLAC
618 head_plac_subs : /* empty */
619 | head_plac_subs head_plac_sub
622 head_plac_sub : head_plac_form_sect { OCCUR2(FORM, 1, 1) }
625 head_plac_form_sect : OPEN DELIM TAG_FORM mand_line_item
626 { START(FORM) } no_std_subs { CHECK0 } CLOSE
631 head_note_sect : OPEN DELIM TAG_NOTE mand_line_item
639 head_note_subs : /* empty */
640 | head_note_subs head_note_sub
643 head_note_sub : continuation_sub /* 0:M */
647 /*********************************************************************/
649 /*********************************************************************/
650 trlr_sect : OPEN DELIM TAG_TRLR CLOSE { }
653 /*********************************************************************/
654 /**** Family record ****/
655 /*********************************************************************/
656 fam_rec : OPEN DELIM POINTER DELIM TAG_FAM
663 fam_subs : /* empty */
667 fam_sub : fam_event_struc_sub /* 0:M */
668 | fam_husb_sect { OCCUR2(HUSB, 0, 1) }
669 | fam_wife_sect { OCCUR2(WIFE, 0, 1) }
670 | fam_chil_sect /* 0:M */
671 | fam_nchi_sect { OCCUR2(NCHI, 0, 1) }
672 | fam_subm_sect /* 0:M */
673 | lds_spouse_seal_sub /* 0:M */
674 | source_cit_sub /* 0:M */
675 | multim_link_sub /* 0:M */
676 | note_struc_sub /* 0:M */
677 | ident_struc_sub /* 0:1 */
678 | change_date_sub /* 0:1 */
683 fam_husb_sect : OPEN DELIM TAG_HUSB mand_pointer
684 { START(HUSB) } no_std_subs { CHECK0 } CLOSE
689 fam_wife_sect : OPEN DELIM TAG_WIFE mand_pointer
690 { START(WIFE) } no_std_subs { CHECK0 } CLOSE
695 fam_chil_sect : OPEN DELIM TAG_CHIL mand_pointer
696 { START(CHIL) } no_std_subs { CHECK0 } CLOSE
701 fam_nchi_sect : OPEN DELIM TAG_NCHI mand_line_item
702 { START(NCHI) } no_std_subs { CHECK0 } CLOSE
707 fam_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
708 { START(SUBM) } no_std_subs { CHECK0 } CLOSE
712 /*********************************************************************/
713 /**** Individual record ****/
714 /*********************************************************************/
715 indiv_rec : OPEN DELIM POINTER DELIM TAG_INDI
722 indi_subs : /* empty */
726 indi_sub : indi_resn_sect { OCCUR2(RESN, 0, 1) }
727 | pers_name_struc_sub /* 0:M */
728 | indi_sex_sect { OCCUR2(SEX, 0, 1) }
729 | indiv_even_struc_sub /* 0:M */
730 | indiv_attr_struc_sub /* 0:M */
731 | lds_indiv_ord_sub /* 0:M */
732 | chi_fam_link_sub /* 0:M */
733 | spou_fam_link_sub /* 0:M */
734 | indi_subm_sect /* 0:M */
735 | assoc_struc_sub /* 0:M */
736 | indi_alia_sect /* 0:M */
737 | indi_anci_sect /* 0:M */
738 | indi_desi_sect /* 0:M */
739 | source_cit_sub /* 0:M */
740 | multim_link_sub /* 0:M */
741 | note_struc_sub /* 0:M */
742 | indi_rfn_sect { OCCUR2(RFN, 0, 1) }
743 | indi_afn_sect /* 0:M */
744 | ident_struc_sub /* 0:1 */
745 | change_date_sub /* 0:1 */
746 | ftree_addr_sect { if (!compat_mode(C_FTREE))
753 indi_resn_sect : OPEN DELIM TAG_RESN mand_line_item
754 { START(RESN) } no_std_subs { CHECK0 } CLOSE { }
758 indi_sex_sect : OPEN DELIM TAG_SEX mand_line_item
759 { START(SEX) } no_std_subs { CHECK0 } CLOSE { }
763 indi_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
764 { START(SUBM) } no_std_subs { CHECK0 } CLOSE { }
768 indi_alia_sect : OPEN DELIM TAG_ALIA mand_pointer
769 { START(ALIA) } no_std_subs { CHECK0 } CLOSE { }
773 indi_anci_sect : OPEN DELIM TAG_ANCI mand_pointer
774 { START(ANCI) } no_std_subs { CHECK0 } CLOSE { }
778 indi_desi_sect : OPEN DELIM TAG_DESI mand_pointer
779 { START(DESI) } no_std_subs { CHECK0 } CLOSE { }
783 indi_rfn_sect : OPEN DELIM TAG_RFN mand_line_item
784 { START(RFN) } no_std_subs { CHECK0 } CLOSE { }
788 indi_afn_sect : OPEN DELIM TAG_AFN mand_line_item
789 { START(AFN) } no_std_subs { CHECK0 } CLOSE { }
792 /* INDI.ADDR (Only for 'ftree' compatibility) */
793 ftree_addr_sect : OPEN DELIM TAG_ADDR opt_line_item
794 { START(ADDR) } no_std_subs { CHECK0 } CLOSE { }
796 /*********************************************************************/
797 /**** Multimedia record ****/
798 /*********************************************************************/
799 multim_rec : OPEN DELIM POINTER DELIM TAG_OBJE
802 { CHECK2(FORM, BLOB) }
806 obje_subs : /* empty */
810 obje_sub : obje_form_sect { OCCUR2(FORM, 1, 1) }
811 | obje_titl_sect { OCCUR2(TITL, 0, 1) }
812 | note_struc_sub /* 0:M */
813 | obje_blob_sect { OCCUR2(BLOB, 1, 1) }
814 | obje_obje_sect { OCCUR2(OBJE, 0, 1) }
815 | ident_struc_sub /* 0:1 */
816 | change_date_sub /* 0:1 */
821 obje_form_sect : OPEN DELIM TAG_FORM mand_line_item
822 { START(FORM) } no_std_subs { CHECK0 } CLOSE { }
826 obje_titl_sect : OPEN DELIM TAG_TITL mand_line_item
827 { START(TITL) } no_std_subs { CHECK0 } CLOSE { }
831 obje_blob_sect : OPEN DELIM TAG_BLOB
838 obje_blob_subs : /* empty */
839 | obje_blob_subs obje_blob_sub
842 obje_blob_sub : obje_blob_cont_sect { OCCUR1(CONT, 1) }
846 obje_blob_cont_sect : OPEN DELIM TAG_CONT mand_line_item
847 { START(CONT) } no_std_subs { CHECK0 } CLOSE { }
851 obje_obje_sect : OPEN DELIM TAG_OBJE mand_pointer
852 { START(OBJE) } no_std_subs { CHECK0 } CLOSE { }
855 /*********************************************************************/
856 /**** Note record ****/
857 /*********************************************************************/
858 note_rec : OPEN DELIM POINTER DELIM TAG_NOTE note_line_item
865 note_line_item : /* empty */
866 { if (!compat_mode(C_FTREE)) {
867 gedcom_error("Missing value"); YYERROR;
871 { gedcom_debug_print("==Val: %s==\n", $2);
875 note_subs : /* empty */
879 note_sub : continuation_sub /* 0:M */
880 | source_cit_sub /* 0:M */
881 | ident_struc_sub /* 0:1 */
882 | change_date_sub /* 0:1 */
886 /*********************************************************************/
887 /**** Repository record ****/
888 /*********************************************************************/
889 repos_rec : OPEN DELIM POINTER DELIM TAG_REPO
896 repo_subs : /* empty */
900 repo_sub : repo_name_sect { OCCUR2(NAME, 0, 1) }
901 | addr_struc_sub /* 0:1 */
902 | note_struc_sub /* 0:M */
903 | ident_struc_sub /* 0:1 */
904 | change_date_sub /* 0:1 */
909 repo_name_sect : OPEN DELIM TAG_NAME mand_line_item
910 { START(NAME) } no_std_subs { CHECK0 } CLOSE {}
913 /*********************************************************************/
914 /**** Source record ****/
915 /*********************************************************************/
916 source_rec : OPEN DELIM POINTER DELIM TAG_SOUR
923 sour_subs : /* empty */
927 sour_sub : sour_data_sect { OCCUR2(DATA, 0, 1) }
928 | sour_auth_sect { OCCUR2(AUTH, 0, 1) }
929 | sour_titl_sect { OCCUR2(TITL, 0, 1) }
930 | sour_abbr_sect { OCCUR2(ABBR, 0, 1) }
931 | sour_publ_sect { OCCUR2(PUBL, 0, 1) }
932 | sour_text_sect { OCCUR2(TEXT, 0, 1) }
933 | source_repos_cit_sub /* 0:1 */
934 | multim_link_sub /* 0:M */
935 | note_struc_sub /* 0:M */
936 | ident_struc_sub /* 0:1 */
937 | change_date_sub /* 0:1 */
942 sour_data_sect : OPEN DELIM TAG_DATA
949 sour_data_subs : /* empty */
950 | sour_data_subs sour_data_sub
953 sour_data_sub : sour_data_even_sect /* 0:M */
954 | sour_data_agnc_sect { OCCUR2(AGNC, 0, 1) }
955 | note_struc_sub /* 0:M */
959 sour_data_even_sect : OPEN DELIM TAG_EVEN mand_line_item
966 sour_data_even_subs : /* empty */
967 | sour_data_even_subs sour_data_even_sub
970 sour_data_even_sub : sour_data_even_date_sect { OCCUR2(DATE, 0, 1) }
971 | sour_data_even_plac_sect { OCCUR2(PLAC, 0, 1) }
975 sour_data_even_date_sect : OPEN DELIM TAG_DATE mand_line_item
976 { START(DATE) } no_std_subs { CHECK0 } CLOSE { }
979 sour_data_even_plac_sect : OPEN DELIM TAG_PLAC mand_line_item
980 { START(PLAC) } no_std_subs { CHECK0 } CLOSE { }
983 sour_data_agnc_sect : OPEN DELIM TAG_AGNC mand_line_item
984 { START(AGNC) } no_std_subs { CHECK0 } CLOSE { }
988 sour_auth_sect : OPEN DELIM TAG_AUTH mand_line_item
995 sour_auth_subs : /* empty */
996 | sour_auth_subs sour_auth_sub
999 sour_auth_sub : continuation_sub /* 0:M */
1004 sour_titl_sect : OPEN DELIM TAG_TITL mand_line_item
1011 sour_titl_subs : /* empty */
1012 | sour_titl_subs sour_titl_sub
1015 sour_titl_sub : continuation_sub /* 0:M */
1020 sour_abbr_sect : OPEN DELIM TAG_ABBR mand_line_item
1021 { START(ABBR) } no_std_subs { CHECK0 } CLOSE { }
1025 sour_publ_sect : OPEN DELIM TAG_PUBL mand_line_item
1032 sour_publ_subs : /* empty */
1033 | sour_publ_subs sour_publ_sub
1036 sour_publ_sub : continuation_sub /* 0:M */
1041 sour_text_sect : OPEN DELIM TAG_TEXT mand_line_item
1048 sour_text_subs : /* empty */
1049 | sour_text_subs sour_text_sub
1052 sour_text_sub : continuation_sub /* 0:M */
1056 /*********************************************************************/
1057 /**** Submission record ****/
1058 /*********************************************************************/
1059 submis_rec : OPEN DELIM POINTER DELIM TAG_SUBN
1066 subn_subs : /* empty */
1067 | subn_subs subn_sub
1070 subn_sub : subn_subm_sect { OCCUR2(SUBM, 0, 1) }
1071 | subn_famf_sect { OCCUR2(FAMF, 0, 1) }
1072 | subn_temp_sect { OCCUR2(TEMP, 0, 1) }
1073 | subn_ance_sect { OCCUR2(ANCE, 0, 1) }
1074 | subn_desc_sect { OCCUR2(DESC, 0, 1) }
1075 | subn_ordi_sect { OCCUR2(ORDI, 0, 1) }
1076 | subn_rin_sect { OCCUR2(RIN, 0, 1) }
1081 subn_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
1082 { START(SUBM) } no_std_subs { CHECK0 } CLOSE { }
1086 subn_famf_sect : OPEN DELIM TAG_FAMF mand_line_item
1087 { START(FAMF) } no_std_subs { CHECK0 } CLOSE { }
1091 subn_temp_sect : OPEN DELIM TAG_TEMP mand_line_item
1092 { START(TEMP) } no_std_subs { CHECK0 } CLOSE { }
1096 subn_ance_sect : OPEN DELIM TAG_ANCE mand_line_item
1097 { START(ANCE) } no_std_subs { CHECK0 } CLOSE { }
1101 subn_desc_sect : OPEN DELIM TAG_DESC mand_line_item
1102 { START(DESC) } no_std_subs { CHECK0 } CLOSE { }
1106 subn_ordi_sect : OPEN DELIM TAG_ORDI mand_line_item
1107 { START(ORDI) } no_std_subs { CHECK0 } CLOSE { }
1111 subn_rin_sect : OPEN DELIM TAG_RIN mand_line_item
1112 { START(RIN) } no_std_subs { CHECK0 } CLOSE { }
1115 /*********************************************************************/
1116 /**** Submitter record ****/
1117 /*********************************************************************/
1118 submit_rec : OPEN DELIM POINTER DELIM TAG_SUBM
1125 subm_subs : /* empty */
1126 | subm_subs subm_sub
1129 subm_sub : subm_name_sect { OCCUR2(NAME, 0, 1) }
1130 | addr_struc_sub /* 0:1 */
1131 | multim_link_sub /* 0:M */
1132 | subm_lang_sect { OCCUR2(LANG, 0, 3) }
1133 | subm_rfn_sect { OCCUR2(RFN, 0, 1) }
1134 | subm_rin_sect { OCCUR2(RIN, 0, 1) }
1135 | change_date_sub /* 0:1 */
1140 subm_name_sect : OPEN DELIM TAG_NAME mand_line_item
1141 { START(NAME) } no_std_subs { CHECK0 } CLOSE { }
1145 subm_lang_sect : OPEN DELIM TAG_LANG mand_line_item
1146 { START(LANG) } no_std_subs { CHECK0 } CLOSE { }
1150 subm_rfn_sect : OPEN DELIM TAG_RFN mand_line_item
1151 { START(RFN) } no_std_subs { CHECK0 } CLOSE { }
1155 subm_rin_sect : OPEN DELIM TAG_RIN mand_line_item
1156 { START(RIN) } no_std_subs { CHECK0 } CLOSE { }
1159 /*********************************************************************/
1160 /**** Substructures ****/
1161 /*********************************************************************/
1163 /* ADDRESS STRUCTURE */
1164 addr_struc_sub : addr_sect { OCCUR2(ADDR, 0, 1) }
1165 | phon_sect { OCCUR2(PHON, 0, 3) }
1168 addr_sect : OPEN DELIM TAG_ADDR mand_line_item
1175 addr_subs : /* empty */
1176 | addr_subs addr_sub
1179 addr_sub : addr_cont_sect /* 0:M */
1180 | addr_adr1_sect { OCCUR2(ADR1, 0, 1) }
1181 | addr_adr2_sect { OCCUR2(ADR2, 0, 1) }
1182 | addr_city_sect { OCCUR2(CITY, 0, 1) }
1183 | addr_stae_sect { OCCUR2(STAE, 0, 1) }
1184 | addr_post_sect { OCCUR2(POST, 0, 1) }
1185 | addr_ctry_sect { OCCUR2(CTRY, 0, 1) }
1189 addr_cont_sect : OPEN DELIM TAG_CONT mand_line_item
1190 { START(CONT) } no_std_subs { CHECK0 } CLOSE { }
1192 addr_adr1_sect : OPEN DELIM TAG_ADR1 mand_line_item
1193 { START(ADR1) } no_std_subs { CHECK0 } CLOSE { }
1195 addr_adr2_sect : OPEN DELIM TAG_ADR2 mand_line_item
1196 { START(ADR2) } no_std_subs { CHECK0 } CLOSE { }
1198 addr_city_sect : OPEN DELIM TAG_CITY mand_line_item
1199 { START(CITY) } no_std_subs { CHECK0 } CLOSE { }
1201 addr_stae_sect : OPEN DELIM TAG_STAE mand_line_item
1202 { START(STAE) } no_std_subs { CHECK0 } CLOSE { }
1204 addr_post_sect : OPEN DELIM TAG_POST mand_line_item
1205 { START(POST) } no_std_subs { CHECK0 } CLOSE { }
1207 addr_ctry_sect : OPEN DELIM TAG_CTRY mand_line_item
1208 { START(CTRY) } no_std_subs { CHECK0 } CLOSE { }
1211 phon_sect : OPEN DELIM TAG_PHON mand_line_item
1212 { START(PHON) } no_std_subs { CHECK0 } CLOSE { }
1215 /* ASSOCIATION STRUCTURE */
1216 assoc_struc_sub : asso_sect /* 0:M */
1219 asso_sect : OPEN DELIM TAG_ASSO mand_pointer
1222 { CHECK2(TYPE,RELA) }
1226 asso_subs : /* empty */
1227 | asso_type_sect { OCCUR2(TYPE, 1, 1) }
1228 | asso_rela_sect { OCCUR2(RELA, 1, 1) }
1234 asso_type_sect : OPEN DELIM TAG_TYPE mand_line_item
1235 { START(TYPE) } no_std_subs { CHECK0 } CLOSE { }
1238 asso_rela_sect : OPEN DELIM TAG_RELA mand_line_item
1239 { START(RELA) } no_std_subs { CHECK0 } CLOSE { }
1243 change_date_sub : change_date_chan_sect { OCCUR2(CHAN, 0, 1) }
1246 change_date_chan_sect : OPEN DELIM TAG_CHAN
1248 change_date_chan_subs
1253 change_date_chan_subs : /* empty */
1254 | change_date_chan_subs change_date_chan_sub
1257 change_date_chan_sub : change_date_date_sect { OCCUR2(DATE, 1, 1) }
1262 change_date_date_sect : OPEN DELIM TAG_DATE mand_line_item
1264 change_date_date_subs
1269 change_date_date_subs : /* empty */
1270 | change_date_date_subs change_date_date_sub
1273 change_date_date_sub : change_date_date_time_sect { OCCUR2(TIME, 0, 1) }
1277 change_date_date_time_sect : OPEN DELIM TAG_TIME mand_line_item
1278 { START(TIME) } no_std_subs { CHECK0 } CLOSE { }
1281 /* CHILD TO FAMILY LINK */
1282 chi_fam_link_sub : famc_sect /* 0:M */
1285 famc_sect : OPEN DELIM TAG_FAMC mand_pointer
1292 famc_subs : /* empty */
1293 | famc_subs famc_sub
1296 famc_sub : famc_pedi_sect /* 0:M */
1301 famc_pedi_sect : OPEN DELIM TAG_PEDI mand_line_item
1302 { START(PEDI) } no_std_subs { CHECK0 } CLOSE { }
1305 /* CONTINUATION SUBSECTIONS */
1306 continuation_sub : cont_sect /* 0:M */
1307 | conc_sect /* 0:M */
1310 cont_sect : OPEN DELIM TAG_CONT mand_line_item
1311 { START(CONT) } no_std_subs { CHECK0 } CLOSE { }
1314 conc_sect : OPEN DELIM TAG_CONC mand_line_item
1315 { START(CONC) } no_std_subs { CHECK0 } CLOSE { }
1319 event_detail_sub : event_detail_type_sect { OCCUR2(TYPE, 0, 1) }
1320 | event_detail_date_sect { OCCUR2(DATE, 0, 1) }
1323 | event_detail_age_sect { OCCUR2(AGE, 0, 1) }
1324 | event_detail_agnc_sect { OCCUR2(AGNC, 0, 1) }
1325 | event_detail_caus_sect { OCCUR2(CAUS, 0, 1) }
1331 event_detail_type_sect : OPEN DELIM TAG_TYPE mand_line_item
1332 { START(TYPE) } no_std_subs { CHECK0 } CLOSE { }
1334 event_detail_date_sect : OPEN DELIM TAG_DATE mand_line_item
1335 { START(DATE) } no_std_subs { CHECK0 } CLOSE { }
1337 event_detail_age_sect : OPEN DELIM TAG_AGE mand_line_item
1338 { START(AGE) } no_std_subs { CHECK0 } CLOSE { }
1340 event_detail_agnc_sect : OPEN DELIM TAG_AGNC mand_line_item
1341 { START(AGNC) } no_std_subs { CHECK0 } CLOSE { }
1343 event_detail_caus_sect : OPEN DELIM TAG_CAUS mand_line_item
1344 { START(CAUS) } no_std_subs { CHECK0 } CLOSE { }
1347 /* FAMILY EVENT STRUCTURE */
1348 fam_event_struc_sub : fam_event_sect
1349 | fam_gen_even_sect /* 0:M */
1352 fam_event_sect : OPEN DELIM fam_event_tag opt_value fam_event_subs
1357 fam_event_tag : TAG_ANUL { START(ANUL) }
1358 | TAG_CENS { START(CENS) }
1359 | TAG_DIV { START(DIV) }
1360 | TAG_DIVF { START(DIVF) }
1361 | TAG_ENGA { START(ENGA) }
1362 | TAG_MARR { START(MARR) }
1363 | TAG_MARB { START(MARB) }
1364 | TAG_MARC { START(MARC) }
1365 | TAG_MARL { START(MARL) }
1366 | TAG_MARS { START(MARS) }
1369 fam_event_subs : /* empty */
1370 | fam_event_subs fam_event_sub
1373 fam_event_sub : event_detail_sub
1374 | fam_even_husb_sect { OCCUR2(HUSB, 0, 1) }
1375 | fam_even_wife_sect { OCCUR2(WIFE, 0, 1) }
1379 fam_even_husb_sect : OPEN DELIM TAG_HUSB
1386 fam_even_husb_subs : /* empty */
1387 | fam_even_husb_subs fam_even_husb_sub
1390 fam_even_husb_sub : fam_even_husb_age_sect { OCCUR2(AGE, 1, 1) }
1394 fam_even_husb_age_sect : OPEN DELIM TAG_AGE mand_line_item
1395 { START(AGE) } no_std_subs { CHECK0 } CLOSE { }
1398 fam_even_wife_sect : OPEN DELIM TAG_WIFE
1405 fam_gen_even_sect : OPEN DELIM TAG_EVEN
1412 fam_gen_even_subs : /* empty */
1413 | fam_gen_even_subs fam_gen_even_sub
1416 fam_gen_even_sub : event_detail_sub
1417 | fam_even_husb_sect { OCCUR2(HUSB, 0, 1) }
1418 | fam_even_wife_sect { OCCUR2(WIFE, 0, 1) }
1422 /* IDENTIFICATION STRUCTURE */
1423 ident_struc_sub : ident_refn_sect /* 0:M */
1424 | ident_rin_sect { OCCUR2(RIN, 0, 1) }
1427 ident_refn_sect : OPEN DELIM TAG_REFN mand_line_item
1434 ident_refn_subs : /* empty */
1435 | ident_refn_subs ident_refn_sub
1438 ident_refn_sub : ident_refn_type_sect { OCCUR2(TYPE, 0, 1) }
1442 ident_refn_type_sect : OPEN DELIM TAG_TYPE mand_line_item
1443 { START(TYPE) } no_std_subs { CHECK0 } CLOSE { }
1446 ident_rin_sect : OPEN DELIM TAG_RIN mand_line_item
1447 { START(RIN) } no_std_subs { CHECK0 } CLOSE { }
1450 /* INDIVIDUAL ATTRIBUTE STRUCTURE */
1451 indiv_attr_struc_sub : indiv_cast_sect /* 0:M */
1452 | indiv_dscr_sect /* 0:M */
1453 | indiv_educ_sect /* 0:M */
1454 | indiv_idno_sect /* 0:M */
1455 | indiv_nati_sect /* 0:M */
1456 | indiv_nchi_sect /* 0:M */
1457 | indiv_nmr_sect /* 0:M */
1458 | indiv_occu_sect /* 0:M */
1459 | indiv_prop_sect /* 0:M */
1460 | indiv_reli_sect /* 0:M */
1461 | indiv_resi_sect /* 0:M */
1462 | indiv_ssn_sect /* 0:M */
1463 | indiv_titl_sect /* 0:M */
1466 indiv_cast_sect : OPEN DELIM TAG_CAST mand_line_item
1468 indiv_attr_event_subs
1472 indiv_dscr_sect : OPEN DELIM TAG_DSCR mand_line_item
1474 indiv_attr_event_subs
1478 indiv_educ_sect : OPEN DELIM TAG_EDUC mand_line_item
1480 indiv_attr_event_subs
1484 indiv_idno_sect : OPEN DELIM TAG_IDNO mand_line_item
1486 indiv_attr_event_subs
1490 indiv_nati_sect : OPEN DELIM TAG_NATI mand_line_item
1492 indiv_attr_event_subs
1496 indiv_nchi_sect : OPEN DELIM TAG_NCHI mand_line_item
1498 indiv_attr_event_subs
1502 indiv_nmr_sect : OPEN DELIM TAG_NMR mand_line_item
1504 indiv_attr_event_subs
1508 indiv_occu_sect : OPEN DELIM TAG_OCCU mand_line_item
1510 indiv_attr_event_subs
1514 indiv_prop_sect : OPEN DELIM TAG_PROP mand_line_item
1516 indiv_attr_event_subs
1520 indiv_reli_sect : OPEN DELIM TAG_RELI mand_line_item
1522 indiv_attr_event_subs
1526 indiv_resi_sect : OPEN DELIM TAG_RESI
1528 indiv_attr_event_subs
1532 indiv_ssn_sect : OPEN DELIM TAG_SSN mand_line_item
1534 indiv_attr_event_subs
1538 indiv_titl_sect : OPEN DELIM TAG_TITL mand_line_item
1540 indiv_attr_event_subs
1545 indiv_attr_event_subs : /* empty */
1546 | indiv_attr_event_subs indiv_attr_event_sub
1549 indiv_attr_event_sub : event_detail_sub
1553 /* INDIVIDUAL EVENT STRUCTURE */
1554 indiv_even_struc_sub : indiv_birt_sect
1556 | indiv_adop_sect /* 0:M */
1557 | indiv_even_sect /* 0:M */
1560 indiv_birt_sect : OPEN DELIM indiv_birt_tag opt_value indiv_birt_subs
1565 indiv_birt_tag : TAG_BIRT { START(BIRT) }
1566 | TAG_CHR { START(CHR) }
1569 indiv_birt_subs : /* empty */
1570 | indiv_birt_subs indiv_birt_sub
1573 indiv_birt_sub : event_detail_sub
1574 | indiv_birt_famc_sect { OCCUR2(FAMC,0, 1) }
1578 indiv_birt_famc_sect : OPEN DELIM TAG_FAMC mand_pointer
1579 { START(FAMC) } no_std_subs { CHECK0 } CLOSE { }
1582 indiv_gen_sect : OPEN DELIM indiv_gen_tag opt_value indiv_gen_subs
1587 indiv_gen_tag : TAG_DEAT { START(DEAT) }
1588 | TAG_BURI { START(BURI) }
1589 | TAG_CREM { START(CREM) }
1590 | TAG_BAPM { START(BAPM) }
1591 | TAG_BARM { START(BARM) }
1592 | TAG_BASM { START(BASM) }
1593 | TAG_BLES { START(BLES) }
1594 | TAG_CHRA { START(CHRA) }
1595 | TAG_CONF { START(CONF) }
1596 | TAG_FCOM { START(FCOM) }
1597 | TAG_ORDN { START(ORDN) }
1598 | TAG_NATU { START(NATU) }
1599 | TAG_EMIG { START(EMIG) }
1600 | TAG_IMMI { START(IMMI) }
1601 | TAG_CENS { START(CENS) }
1602 | TAG_PROB { START(PROB) }
1603 | TAG_WILL { START(WILL) }
1604 | TAG_GRAD { START(GRAD) }
1605 | TAG_RETI { START(RETI) }
1608 indiv_gen_subs : /* empty */
1609 | indiv_gen_subs indiv_gen_sub
1612 indiv_gen_sub : event_detail_sub
1616 indiv_adop_sect : OPEN DELIM TAG_ADOP opt_value
1623 indiv_adop_subs : /* empty */
1624 | indiv_adop_subs indiv_adop_sub
1627 indiv_adop_sub : event_detail_sub
1628 | indiv_adop_famc_sect { OCCUR2(FAMC,0, 1) }
1632 indiv_adop_famc_sect : OPEN DELIM TAG_FAMC mand_pointer
1634 indiv_adop_famc_subs
1639 indiv_adop_famc_subs : /* empty */
1640 | indiv_adop_famc_subs indiv_adop_famc_sub
1643 indiv_adop_famc_sub : indiv_adop_famc_adop_sect { OCCUR2(ADOP,0, 1) }
1647 indiv_adop_famc_adop_sect : OPEN DELIM TAG_ADOP mand_line_item
1648 { START(ADOP) } no_std_subs { CHECK0 } CLOSE { }
1651 indiv_even_sect : OPEN DELIM TAG_EVEN
1658 /* LDS INDIVIDUAL ORDINANCE */
1659 lds_indiv_ord_sub : lio_bapl_sect /* 0:M */
1660 | lio_slgc_sect /* 0:M */
1663 lio_bapl_sect : OPEN DELIM lio_bapl_tag lio_bapl_subs
1668 lio_bapl_tag : TAG_BAPL { START(BAPL) }
1669 | TAG_CONL { START(CONL) }
1670 | TAG_ENDL { START(ENDL) }
1673 lio_bapl_subs : /* empty */
1674 | lio_bapl_subs lio_bapl_sub
1677 lio_bapl_sub : lio_bapl_stat_sect { OCCUR2(STAT, 0, 1) }
1678 | lio_bapl_date_sect { OCCUR2(DATE, 0, 1) }
1679 | lio_bapl_temp_sect { OCCUR2(TEMP, 0, 1) }
1680 | lio_bapl_plac_sect { OCCUR2(PLAC, 0, 1) }
1686 lio_bapl_stat_sect : OPEN DELIM TAG_STAT mand_line_item
1687 { START(STAT) } no_std_subs { CHECK0 } CLOSE { }
1689 lio_bapl_date_sect : OPEN DELIM TAG_DATE mand_line_item
1690 { START(DATE) } no_std_subs { CHECK0 } CLOSE { }
1692 lio_bapl_temp_sect : OPEN DELIM TAG_TEMP mand_line_item
1693 { START(TEMP) } no_std_subs { CHECK0 } CLOSE { }
1695 lio_bapl_plac_sect : OPEN DELIM TAG_PLAC mand_line_item
1696 { START(PLAC) } no_std_subs { CHECK0 } CLOSE { }
1699 lio_slgc_sect : OPEN DELIM TAG_SLGC
1706 lio_slgc_subs : /* empty */
1707 | lio_slgc_subs lio_slgc_sub
1710 lio_slgc_sub : lio_bapl_sub
1711 | lio_slgc_famc_sect { OCCUR2(FAMC, 1, 1) }
1714 lio_slgc_famc_sect : OPEN DELIM TAG_FAMC mand_pointer
1715 { START(FAMC) } no_std_subs { CHECK0 } CLOSE { }
1718 /* LDS SPOUSE SEALING */
1719 lds_spouse_seal_sub : lss_slgs_sect
1722 lss_slgs_sect : OPEN DELIM TAG_SLGS
1729 lss_slgs_subs : /* empty */
1730 | lss_slgs_subs lss_slgs_sub
1733 lss_slgs_sub : lss_slgs_stat_sect { OCCUR2(STAT, 0, 1) }
1734 | lss_slgs_date_sect { OCCUR2(DATE, 0, 1) }
1735 | lss_slgs_temp_sect { OCCUR2(TEMP, 0, 1) }
1736 | lss_slgs_plac_sect { OCCUR2(PLAC, 0, 1) }
1742 lss_slgs_stat_sect : OPEN DELIM TAG_STAT mand_line_item
1743 { START(STAT) } no_std_subs { CHECK0 } CLOSE { }
1745 lss_slgs_date_sect : OPEN DELIM TAG_DATE mand_line_item
1746 { START(DATE) } no_std_subs { CHECK0 } CLOSE { }
1748 lss_slgs_temp_sect : OPEN DELIM TAG_TEMP mand_line_item
1749 { START(TEMP) } no_std_subs { CHECK0 } CLOSE { }
1751 lss_slgs_plac_sect : OPEN DELIM TAG_PLAC mand_line_item
1752 { START(PLAC) } no_std_subs { CHECK0 } CLOSE { }
1755 /* MULTIMEDIA LINK */
1756 multim_link_sub : multim_obje_link_sect
1757 | multim_obje_emb_sect
1760 multim_obje_link_sect : OPEN DELIM TAG_OBJE DELIM POINTER
1761 { START(OBJE) } no_std_subs { CHECK0 } CLOSE { }
1764 multim_obje_emb_sect : OPEN DELIM TAG_OBJE
1766 multim_obje_emb_subs
1767 { CHECK2(FORM,FILE) }
1771 multim_obje_emb_subs : /* empty */
1772 | multim_obje_emb_subs multim_obje_emb_sub
1775 multim_obje_emb_sub : multim_obje_form_sect { OCCUR2(FORM, 1, 1) }
1776 | multim_obje_titl_sect { OCCUR2(TITL, 0, 1) }
1777 | multim_obje_file_sect { OCCUR2(FILE, 1, 1) }
1782 multim_obje_form_sect : OPEN DELIM TAG_FORM mand_line_item
1783 { START(FORM) } no_std_subs { CHECK0 } CLOSE { }
1785 multim_obje_titl_sect : OPEN DELIM TAG_TITL mand_line_item
1786 { START(TITL) } no_std_subs { CHECK0 } CLOSE { }
1788 multim_obje_file_sect : OPEN DELIM TAG_FILE mand_line_item
1789 { START(FILE) } no_std_subs { CHECK0 } CLOSE { }
1792 /* NOTE STRUCTURE */
1793 note_struc_sub : note_struc_link_sect /* 0:M */
1794 | note_struc_emb_sect /* 0:M */
1797 note_struc_link_sect : OPEN DELIM TAG_NOTE DELIM POINTER
1799 note_struc_link_subs
1804 note_struc_link_subs : /* empty */
1805 | note_struc_link_subs note_struc_link_sub
1808 note_struc_link_sub : source_cit_sub
1812 note_struc_emb_sect : OPEN DELIM TAG_NOTE opt_line_item
1819 note_struc_emb_subs : /* empty */
1820 | note_struc_emb_subs note_struc_emb_sub
1823 note_struc_emb_sub : continuation_sub
1828 /* PERSONAL NAME STRUCTURE */
1829 pers_name_struc_sub : pers_name_sect /* 0:M */
1832 pers_name_sect : OPEN DELIM TAG_NAME mand_line_item
1839 pers_name_subs : /* empty */
1840 | pers_name_subs pers_name_sub
1843 pers_name_sub : pers_name_npfx_sect { OCCUR2(NPFX, 0, 1) }
1844 | pers_name_givn_sect { OCCUR2(GIVN, 0, 1) }
1845 | pers_name_nick_sect { OCCUR2(NICK, 0, 1) }
1846 | pers_name_spfx_sect { OCCUR2(SPFX, 0, 1) }
1847 | pers_name_surn_sect { OCCUR2(SURN, 0, 1) }
1848 | pers_name_nsfx_sect { OCCUR2(NSFX, 0, 1) }
1854 pers_name_npfx_sect : OPEN DELIM TAG_NPFX mand_line_item
1855 { START(NPFX) } no_std_subs { CHECK0 } CLOSE { }
1857 pers_name_givn_sect : OPEN DELIM TAG_GIVN mand_line_item
1858 { START(GIVN) } no_std_subs { CHECK0 } CLOSE { }
1860 pers_name_nick_sect : OPEN DELIM TAG_NICK mand_line_item
1861 { START(NICK) } no_std_subs { CHECK0 } CLOSE { }
1863 pers_name_spfx_sect : OPEN DELIM TAG_SPFX mand_line_item
1864 { START(SPFX) } no_std_subs { CHECK0 } CLOSE { }
1866 pers_name_surn_sect : OPEN DELIM TAG_SURN mand_line_item
1867 { START(SURN) } no_std_subs { CHECK0 } CLOSE { }
1869 pers_name_nsfx_sect : OPEN DELIM TAG_NSFX mand_line_item
1870 { START(NSFX) } no_std_subs { CHECK0 } CLOSE { }
1873 /* PLACE STRUCTURE */
1874 place_struc_sub : place_struc_plac_sect /* 0:M */
1877 place_struc_plac_sect : OPEN DELIM TAG_PLAC mand_line_item
1879 place_struc_plac_subs
1884 place_struc_plac_subs : /* empty */
1885 | place_struc_plac_subs place_struc_plac_sub
1888 place_struc_plac_sub : place_plac_form_sect { OCCUR2(FORM, 0, 1) }
1894 place_plac_form_sect : OPEN DELIM TAG_FORM mand_line_item
1895 { START(FORM) } no_std_subs { CHECK0 } CLOSE { }
1898 /* SOURCE_CITATION */
1899 source_cit_sub : source_cit_link_sect /* 0:M */
1900 | source_cit_emb_sect /* 0:M */
1903 source_cit_link_sect : OPEN DELIM TAG_SOUR DELIM POINTER
1905 source_cit_link_subs
1910 source_cit_link_subs : /* empty */
1911 | source_cit_link_subs source_cit_link_sub
1914 source_cit_link_sub : source_cit_page_sect { OCCUR2(PAGE, 0, 1) }
1915 | source_cit_even_sect { OCCUR2(EVEN, 0, 1) }
1916 | source_cit_data_sect { OCCUR2(DATA, 0, 1) }
1917 | source_cit_quay_sect { OCCUR2(QUAY, 0, 1) }
1923 source_cit_page_sect : OPEN DELIM TAG_PAGE mand_line_item
1924 { START(PAGE) } no_std_subs { CHECK0 } CLOSE { }
1927 source_cit_even_sect : OPEN DELIM TAG_EVEN mand_line_item
1929 source_cit_even_subs
1934 source_cit_even_subs : /* empty */
1935 | source_cit_even_subs source_cit_even_sub
1938 source_cit_even_sub : source_cit_even_role_sect { OCCUR2(ROLE, 0, 1) }
1942 source_cit_even_role_sect : OPEN DELIM TAG_ROLE mand_line_item
1943 { START(ROLE) } no_std_subs { CHECK0 } CLOSE { }
1946 source_cit_data_sect : OPEN DELIM TAG_DATA
1948 source_cit_data_subs
1953 source_cit_data_subs : /* empty */
1954 | source_cit_data_subs source_cit_data_sub
1957 source_cit_data_sub : source_cit_data_date_sect { OCCUR2(DATE, 0, 1) }
1958 | source_cit_text_sect /* 0:M */
1962 source_cit_data_date_sect : OPEN DELIM TAG_DATE mand_line_item
1963 { START(DATE) } no_std_subs { CHECK0 } CLOSE { }
1966 source_cit_text_sect : OPEN DELIM TAG_TEXT mand_line_item
1968 source_cit_text_subs
1973 source_cit_text_subs : /* empty */
1974 | source_cit_text_subs source_cit_text_sub
1977 source_cit_text_sub : continuation_sub
1981 source_cit_quay_sect : OPEN DELIM TAG_QUAY mand_line_item
1982 { START(QUAY) } no_std_subs { CHECK0 } CLOSE { }
1985 source_cit_emb_sect : OPEN DELIM TAG_SOUR mand_line_item
1992 source_cit_emb_subs : /* empty */
1993 | source_cit_emb_subs source_cit_emb_sub
1996 source_cit_emb_sub : continuation_sub
1997 | source_cit_text_sect /* 0:M */
2002 /* SOURCE REPOSITORY CITATION */
2003 source_repos_cit_sub : source_repos_repo_sect { OCCUR2(REPO, 0, 1) }
2006 source_repos_repo_sect : OPEN DELIM TAG_REPO mand_pointer
2008 source_repos_repo_subs
2013 source_repos_repo_subs : /* empty */
2014 | source_repos_repo_subs source_repos_repo_sub
2017 source_repos_repo_sub : note_struc_sub
2018 | caln_sect /* 0:M */
2022 caln_sect : OPEN DELIM TAG_CALN mand_line_item
2029 caln_subs : /* empty */
2030 | caln_subs caln_sub
2033 caln_sub : caln_medi_sect { OCCUR2(MEDI, 0, 1) }
2037 caln_medi_sect : OPEN DELIM TAG_MEDI mand_line_item
2038 { START(MEDI) } no_std_subs { CHECK0 } CLOSE { }
2041 /* SPOUSE TO FAMILY LINK */
2042 spou_fam_link_sub : spou_fam_fams_sect /* 0:M */
2045 spou_fam_fams_sect : OPEN DELIM TAG_FAMS mand_pointer
2052 spou_fam_fams_subs : /* empty */
2053 | spou_fam_fams_subs spou_fam_fams_sub
2056 spou_fam_fams_sub : note_struc_sub
2060 /*********************************************************************/
2062 /*********************************************************************/
2064 no_std_subs : /* empty */
2065 | no_std_subs no_std_sub
2068 no_std_sub : user_sect /* 0:M */
2070 | error error_subs CLOSE { HANDLE_ERROR }
2073 no_std_rec : user_rec /* 0:M */
2075 | error error_subs CLOSE { HANDLE_ERROR }
2078 user_rec : OPEN DELIM opt_xref USERTAG
2079 { if ($4[0] != '_') {
2080 gedcom_error("Undefined tag (and not a valid user tag): %s",
2085 opt_value user_sects CLOSE { }
2088 user_sect : OPEN DELIM opt_xref USERTAG
2089 { if ($4[0] != '_') {
2090 gedcom_error("Undefined tag (and not a valid user tag): %s",
2095 opt_value user_sects CLOSE { }
2098 user_sects : /* empty */ { }
2099 | user_sects user_sect { }
2102 opt_xref : /* empty */ { }
2106 opt_value : /* empty */ { }
2107 | DELIM line_value { }
2110 line_value : POINTER { }
2114 mand_pointer : /* empty */ { gedcom_error("Missing pointer"); YYERROR; }
2118 mand_line_item : /* empty */ { gedcom_error("Missing value"); YYERROR; }
2119 | DELIM line_item { gedcom_debug_print("==Val: %s==\n", $2);
2123 opt_line_item : /* empty */ { }
2124 | DELIM line_item { }
2127 line_item : anychar { size_t i;
2128 CLEAR_BUFFER(line_item_buf);
2129 line_item_buf_ptr = line_item_buf;
2130 /* The following also takes care of '@@' */
2131 if (!strncmp($1, "@@", 3))
2132 *line_item_buf_ptr++ = '@';
2134 for (i=0; i < strlen($1); i++)
2135 *line_item_buf_ptr++ = $1[i];
2138 | ESCAPE { CLEAR_BUFFER(line_item_buf);
2139 line_item_buf_ptr = line_item_buf;
2140 /* For now, ignore escapes */
2145 /* The following also takes care of '@@' */
2146 if (!strncmp($2, "@@", 3))
2147 *line_item_buf_ptr++ = '@';
2149 for (i=0; i < strlen($2); i++)
2150 *line_item_buf_ptr++ = $2[i];
2154 { /* For now, ignore escapes */
2159 anychar : ANYCHAR { }
2163 error_subs : /* empty */
2164 | error_subs error_sect
2167 error_sect : OPEN DELIM opt_xref anytag opt_value error_subs CLOSE { }
2169 gen_sect : OPEN DELIM opt_xref anystdtag
2170 { INVALID_TAG($4); }
2171 opt_value opt_sects CLOSE
2175 gen_rec : gen_rec_top
2179 gen_rec_norm : OPEN DELIM opt_xref anystdtag
2180 { INVALID_TOP_TAG($4) }
2181 opt_value opt_sects CLOSE
2185 gen_rec_top : OPEN DELIM anytoptag
2186 { gedcom_error("Missing cross-reference"); YYERROR; }
2187 opt_value opt_sects CLOSE
2191 opt_sects : /* empty */ { }
2192 | opt_sects gen_sect { }
2195 anytag : USERTAG { }
2209 anystdtag : TAG_ABBR
2339 /* Functions that handle the counting of subtags */
2341 int* count_arrays[MAXGEDCLEVEL+1];
2342 char tag_stack[MAXGEDCLEVEL+1][MAXSTDTAGLEN+1];
2344 void push_countarray()
2347 if (count_level > MAXGEDCLEVEL) {
2348 gedcom_error("Internal error: count array overflow");
2352 count = (int *)calloc(YYNTOKENS, sizeof(int));
2353 if (count == NULL) {
2354 gedcom_error("Internal error: count array calloc error");
2358 count_arrays[count_level] = count;
2363 void set_parenttag(char* tag)
2365 strncpy(tag_stack[count_level], tag, MAXSTDTAGLEN+1);
2368 char* get_parenttag()
2370 return tag_stack[count_level];
2373 int count_tag(int tag)
2375 int *count = count_arrays[count_level];
2376 return ++count[tag - GEDCOMTAGOFFSET];
2379 int check_occurrence(int tag)
2381 int *count = count_arrays[count_level];
2382 return (count[tag - GEDCOMTAGOFFSET] > 0);
2385 void pop_countarray()
2388 if (count_level < 0) {
2389 gedcom_error("Internal error: count array underflow");
2393 count = count_arrays[count_level];
2395 count_arrays[count_level] = NULL;
2399 /* Enabling debug mode */
2400 /* level 0: no debugging */
2401 /* level 1: only internal */
2402 /* level 2: also bison */
2403 void gedcom_set_debug_level(int level)
2406 gedcom_high_level_debug = 1;
2415 int gedcom_debug_print(char* s, ...)
2418 if (gedcom_high_level_debug) {
2421 res = vfprintf(stderr, s, ap);
2427 /* Setting the error mechanism */
2428 void gedcom_set_error_handling(MECHANISM mechanism)
2430 error_mechanism = mechanism;
2433 /* Compatibility handling */
2435 void gedcom_set_compat_handling(int enable_compat)
2437 compat_enabled = enable_compat;
2440 void set_compatibility(char* program)
2442 if (compat_enabled) {
2443 gedcom_debug_print("==== Program: %s\n", program);
2444 if (! strncmp(program, "ftree", 6)) {
2445 gedcom_warning("Enabling compatibility with 'ftree'");
2446 compatibility = C_FTREE;
2454 int compat_mode(int compat_flags)
2456 return (compat_flags & compatibility);