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 or their encoding; 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;
143 char string_buf[MAXGEDCLINELEN*4+1];
144 char *string_buf_ptr;
150 /* These are defined at the bottom of the file */
151 void push_countarray();
152 void set_parenttag(char* tag);
153 char* get_parenttag();
154 void pop_countarray();
155 int count_tag(int tag);
156 int check_occurrence(int tag);
157 void set_compatibility(char* program);
158 int compat_mode(int flags);
160 #define CLEAR_BUFFER(BUF) { memset(BUF, 0, sizeof(BUF)); }
162 #define HANDLE_ERROR \
164 if (error_mechanism == IMMED_FAIL) { \
167 else if (error_mechanism == DEFER_FAIL) { \
170 else if (error_mechanism == IGNORE_ERRORS) { \
174 #define START(PARENTTAG) \
176 set_parenttag(#PARENTTAG); \
180 { if (!check_occurrence(TAG_##TAG)) { \
181 char* parenttag = get_parenttag(); \
182 gedcom_error("The tag '%s' is mandatory within '%s', but missing", \
188 { pop_countarray(); \
192 #define CHECK1(TAG1) { CHK(TAG1); POP; }
193 #define CHECK2(TAG1,TAG2) \
194 { CHK(TAG1); CHK(TAG2); POP; }
195 #define CHECK3(TAG1,TAG2,TAG3) \
196 { CHK(TAG1); CHK(TAG2); CHK(TAG3); POP; }
197 #define CHECK4(TAG1,TAG2,TAG3,TAG4) \
198 { CHK(TAG1); CHK(TAG2); CHK(TAG3); CHK(TAG4); POP; }
199 #define OCCUR1(CHILDTAG, MIN) { count_tag(TAG_##CHILDTAG); }
200 #define OCCUR2(CHILDTAG, MIN, MAX) \
201 { int num = count_tag(TAG_##CHILDTAG); \
203 char* parenttag = get_parenttag(); \
204 gedcom_error("The tag '%s' can maximally occur %d " \
205 "time(s) within '%s'", \
206 #CHILDTAG, MAX, parenttag); \
210 #define INVALID_TAG(CHILDTAG) \
211 { char* parenttag = get_parenttag(); \
212 gedcom_error("The tag '%s' is not a valid tag within '%s'", \
213 CHILDTAG, parenttag); \
216 #define INVALID_TOP_TAG(CHILDTAG) \
217 { gedcom_error("The tag '%s' is not a valid top-level tag", \
231 %token <string> BADTOKEN
233 %token <string> CLOSE
234 %token <string> ESCAPE
235 %token <string> DELIM
236 %token <string> ANYCHAR
237 %token <string> POINTER
238 %token <string> USERTAG
239 %token <string> TAG_ABBR
240 %token <string> TAG_ADDR
241 %token <string> TAG_ADR1
242 %token <string> TAG_ADR2
243 %token <string> TAG_ADOP
244 %token <string> TAG_AFN
245 %token <string> TAG_AGE
246 %token <string> TAG_AGNC
247 %token <string> TAG_ALIA
248 %token <string> TAG_ANCE
249 %token <string> TAG_ANCI
250 %token <string> TAG_ANUL
251 %token <string> TAG_ASSO
252 %token <string> TAG_AUTH
253 %token <string> TAG_BAPL
254 %token <string> TAG_BAPM
255 %token <string> TAG_BARM
256 %token <string> TAG_BASM
257 %token <string> TAG_BIRT
258 %token <string> TAG_BLES
259 %token <string> TAG_BLOB
260 %token <string> TAG_BURI
261 %token <string> TAG_CALN
262 %token <string> TAG_CAST
263 %token <string> TAG_CAUS
264 %token <string> TAG_CENS
265 %token <string> TAG_CHAN
266 %token <string> TAG_CHAR
267 %token <string> TAG_CHIL
268 %token <string> TAG_CHR
269 %token <string> TAG_CHRA
270 %token <string> TAG_CITY
271 %token <string> TAG_CONC
272 %token <string> TAG_CONF
273 %token <string> TAG_CONL
274 %token <string> TAG_CONT
275 %token <string> TAG_COPR
276 %token <string> TAG_CORP
277 %token <string> TAG_CREM
278 %token <string> TAG_CTRY
279 %token <string> TAG_DATA
280 %token <string> TAG_DATE
281 %token <string> TAG_DEAT
282 %token <string> TAG_DESC
283 %token <string> TAG_DESI
284 %token <string> TAG_DEST
285 %token <string> TAG_DIV
286 %token <string> TAG_DIVF
287 %token <string> TAG_DSCR
288 %token <string> TAG_EDUC
289 %token <string> TAG_EMIG
290 %token <string> TAG_ENDL
291 %token <string> TAG_ENGA
292 %token <string> TAG_EVEN
293 %token <string> TAG_FAM
294 %token <string> TAG_FAMC
295 %token <string> TAG_FAMF
296 %token <string> TAG_FAMS
297 %token <string> TAG_FCOM
298 %token <string> TAG_FILE
299 %token <string> TAG_FORM
300 %token <string> TAG_GEDC
301 %token <string> TAG_GIVN
302 %token <string> TAG_GRAD
303 %token <string> TAG_HEAD
304 %token <string> TAG_HUSB
305 %token <string> TAG_IDNO
306 %token <string> TAG_IMMI
307 %token <string> TAG_INDI
308 %token <string> TAG_LANG
309 %token <string> TAG_LEGA
310 %token <string> TAG_MARB
311 %token <string> TAG_MARC
312 %token <string> TAG_MARL
313 %token <string> TAG_MARR
314 %token <string> TAG_MARS
315 %token <string> TAG_MEDI
316 %token <string> TAG_NAME
317 %token <string> TAG_NATI
318 %token <string> TAG_NATU
319 %token <string> TAG_NCHI
320 %token <string> TAG_NICK
321 %token <string> TAG_NMR
322 %token <string> TAG_NOTE
323 %token <string> TAG_NPFX
324 %token <string> TAG_NSFX
325 %token <string> TAG_OBJE
326 %token <string> TAG_OCCU
327 %token <string> TAG_ORDI
328 %token <string> TAG_ORDN
329 %token <string> TAG_PAGE
330 %token <string> TAG_PEDI
331 %token <string> TAG_PHON
332 %token <string> TAG_PLAC
333 %token <string> TAG_POST
334 %token <string> TAG_PROB
335 %token <string> TAG_PROP
336 %token <string> TAG_PUBL
337 %token <string> TAG_QUAY
338 %token <string> TAG_REFN
339 %token <string> TAG_RELA
340 %token <string> TAG_RELI
341 %token <string> TAG_REPO
342 %token <string> TAG_RESI
343 %token <string> TAG_RESN
344 %token <string> TAG_RETI
345 %token <string> TAG_RFN
346 %token <string> TAG_RIN
347 %token <string> TAG_ROLE
348 %token <string> TAG_SEX
349 %token <string> TAG_SLGC
350 %token <string> TAG_SLGS
351 %token <string> TAG_SOUR
352 %token <string> TAG_SPFX
353 %token <string> TAG_SSN
354 %token <string> TAG_STAE
355 %token <string> TAG_STAT
356 %token <string> TAG_SUBM
357 %token <string> TAG_SUBN
358 %token <string> TAG_SURN
359 %token <string> TAG_TEMP
360 %token <string> TAG_TEXT
361 %token <string> TAG_TIME
362 %token <string> TAG_TITL
363 %token <string> TAG_TRLR
364 %token <string> TAG_TYPE
365 %token <string> TAG_VERS
366 %token <string> TAG_WIFE
367 %token <string> TAG_WILL
369 %type <string> anystdtag
370 %type <string> anytoptag
371 %type <string> line_item
372 %type <string> mand_line_item
373 %type <string> note_line_item
374 %type <string> anychar
378 file : head_sect records trlr_sect
379 { if (fail == 1) YYABORT; }
382 records : /* empty */
397 /*********************************************************************/
399 /*********************************************************************/
400 head_sect : OPEN DELIM TAG_HEAD
403 { if (compat_mode(C_FTREE))
404 CHECK3(SOUR, GEDC, CHAR)
406 CHECK4(SOUR, SUBM, GEDC, CHAR)
411 head_subs : /* empty */
415 head_sub : head_sour_sect { OCCUR2(SOUR, 1, 1) }
416 | head_dest_sect { OCCUR2(DEST, 0, 1) }
417 | head_date_sect { OCCUR2(DATE, 0, 1) }
418 | head_subm_sect { OCCUR2(SUBM, 1, 1) }
419 | head_subn_sect { OCCUR2(SUBN, 0, 1) }
420 | head_file_sect { OCCUR2(FILE, 0, 1) }
421 | head_copr_sect { OCCUR2(COPR, 0, 1) }
422 | head_gedc_sect { OCCUR2(GEDC, 1, 1) }
423 | head_char_sect { OCCUR2(CHAR, 1, 1) }
424 | head_lang_sect { OCCUR2(LANG, 0, 1) }
425 | head_plac_sect { OCCUR2(PLAC, 0, 1) }
426 | head_note_sect { OCCUR2(NOTE, 0, 1) }
431 head_sour_sect : OPEN DELIM TAG_SOUR mand_line_item
432 { set_compatibility($4);
433 gedcom_debug_print("===Source: '%s'\n", $4);
441 head_sour_subs : /* empty */
442 | head_sour_subs head_sour_sub
445 head_sour_sub : head_sour_vers_sect { OCCUR2(VERS, 0, 1) }
446 | head_sour_name_sect { OCCUR2(NAME, 0, 1) }
447 | head_sour_corp_sect { OCCUR2(CORP, 0, 1) }
448 | head_sour_data_sect { OCCUR2(DATA, 0, 1) }
452 head_sour_vers_sect : OPEN DELIM TAG_VERS mand_line_item
453 { START(VERS)} no_std_subs { CHECK0 } CLOSE
454 { gedcom_debug_print("===Source version: '%s'\n", $4);
457 head_sour_name_sect : OPEN DELIM TAG_NAME mand_line_item
458 { START(NAME) } no_std_subs { CHECK0 } CLOSE
459 { gedcom_debug_print("===Source name: '%s'\n", $4);
462 head_sour_corp_sect : OPEN DELIM TAG_CORP mand_line_item
463 { gedcom_debug_print("===Source corp name: '%s'\n", $4);
471 head_sour_corp_subs : /* empty */
472 | head_sour_corp_subs head_sour_corp_sub
475 head_sour_corp_sub : addr_struc_sub /* 0:1 */
479 head_sour_data_sect : OPEN DELIM TAG_DATA mand_line_item
487 head_sour_data_subs : /* empty */
488 | head_sour_data_subs head_sour_data_sub
491 head_sour_data_sub : head_sour_data_date_sect { OCCUR2(DATE, 0, 1) }
492 | head_sour_data_copr_sect { OCCUR2(COPR, 0, 1) }
496 head_sour_data_date_sect : OPEN DELIM TAG_DATE mand_line_item
497 { START(DATE) } no_std_subs { CHECK0 } CLOSE
500 head_sour_data_copr_sect : OPEN DELIM TAG_COPR mand_line_item
501 { START(COPR) } no_std_subs { CHECK0 } CLOSE
506 head_dest_sect : OPEN DELIM TAG_DEST mand_line_item
507 { START(DEST) } no_std_subs { CHECK0 } CLOSE
512 head_date_sect : OPEN DELIM TAG_DATE mand_line_item
520 head_date_subs : /* empty */
521 | head_date_subs head_date_sub
524 head_date_sub : head_date_time_sect { OCCUR2(TIME, 0, 1) }
528 head_date_time_sect : OPEN DELIM TAG_TIME mand_line_item
529 { START(TIME) } no_std_subs { CHECK0 } CLOSE
534 head_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
535 { START(SUBM) } no_std_subs { CHECK0 } CLOSE
539 head_subn_sect : OPEN DELIM TAG_SUBN mand_pointer
540 { START(SUBN) } no_std_subs { CHECK0 } CLOSE
544 head_file_sect : OPEN DELIM TAG_FILE mand_line_item
545 { START(FILE) } no_std_subs { CHECK0 } CLOSE
549 head_copr_sect : OPEN DELIM TAG_COPR mand_line_item
550 { START(COPR) } no_std_subs { CHECK0 } CLOSE
554 head_gedc_sect : OPEN DELIM TAG_GEDC
557 { CHECK2(VERS, FORM) }
562 head_gedc_subs : /* empty */
563 | head_gedc_subs head_gedc_sub
566 head_gedc_sub : head_gedc_vers_sect { OCCUR2(VERS, 1, 1) }
567 | head_gedc_form_sect { OCCUR2(FORM, 1, 1) }
570 head_gedc_vers_sect : OPEN DELIM TAG_VERS mand_line_item
571 { START(VERS) } no_std_subs { CHECK0 } CLOSE
574 head_gedc_form_sect : OPEN DELIM TAG_FORM mand_line_item
575 { START(FORM) } no_std_subs { CHECK0 } CLOSE
580 head_char_sect : OPEN DELIM TAG_CHAR mand_line_item
581 { if (open_conv_to_internal($4) == 0) YYERROR;
589 head_char_subs : /* empty */
590 | head_char_subs head_char_sub
593 head_char_sub : head_char_vers_sect { OCCUR2(VERS, 0, 1) }
596 head_char_vers_sect : OPEN DELIM TAG_VERS mand_line_item
597 { START(VERS) } no_std_subs { CHECK0 } CLOSE
602 head_lang_sect : OPEN DELIM TAG_LANG mand_line_item
603 { START(LANG) } no_std_subs { CHECK0 } CLOSE
607 head_plac_sect : OPEN DELIM TAG_PLAC
615 head_plac_subs : /* empty */
616 | head_plac_subs head_plac_sub
619 head_plac_sub : head_plac_form_sect { OCCUR2(FORM, 1, 1) }
622 head_plac_form_sect : OPEN DELIM TAG_FORM mand_line_item
623 { START(FORM) } no_std_subs { CHECK0 } CLOSE
628 head_note_sect : OPEN DELIM TAG_NOTE mand_line_item
636 head_note_subs : /* empty */
637 | head_note_subs head_note_sub
640 head_note_sub : continuation_sub /* 0:M */
644 /*********************************************************************/
646 /*********************************************************************/
647 trlr_sect : OPEN DELIM TAG_TRLR CLOSE { }
650 /*********************************************************************/
651 /**** Family record ****/
652 /*********************************************************************/
653 fam_rec : OPEN DELIM POINTER DELIM TAG_FAM
660 fam_subs : /* empty */
664 fam_sub : fam_event_struc_sub /* 0:M */
665 | fam_husb_sect { OCCUR2(HUSB, 0, 1) }
666 | fam_wife_sect { OCCUR2(WIFE, 0, 1) }
667 | fam_chil_sect /* 0:M */
668 | fam_nchi_sect { OCCUR2(NCHI, 0, 1) }
669 | fam_subm_sect /* 0:M */
670 | lds_spouse_seal_sub /* 0:M */
671 | source_cit_sub /* 0:M */
672 | multim_link_sub /* 0:M */
673 | note_struc_sub /* 0:M */
674 | ident_struc_sub /* 0:1 */
675 | change_date_sub /* 0:1 */
680 fam_husb_sect : OPEN DELIM TAG_HUSB mand_pointer
681 { START(HUSB) } no_std_subs { CHECK0 } CLOSE
686 fam_wife_sect : OPEN DELIM TAG_WIFE mand_pointer
687 { START(WIFE) } no_std_subs { CHECK0 } CLOSE
692 fam_chil_sect : OPEN DELIM TAG_CHIL mand_pointer
693 { START(CHIL) } no_std_subs { CHECK0 } CLOSE
698 fam_nchi_sect : OPEN DELIM TAG_NCHI mand_line_item
699 { START(NCHI) } no_std_subs { CHECK0 } CLOSE
704 fam_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
705 { START(SUBM) } no_std_subs { CHECK0 } CLOSE
709 /*********************************************************************/
710 /**** Individual record ****/
711 /*********************************************************************/
712 indiv_rec : OPEN DELIM POINTER DELIM TAG_INDI
719 indi_subs : /* empty */
723 indi_sub : indi_resn_sect { OCCUR2(RESN, 0, 1) }
724 | pers_name_struc_sub /* 0:M */
725 | indi_sex_sect { OCCUR2(SEX, 0, 1) }
726 | indiv_even_struc_sub /* 0:M */
727 | indiv_attr_struc_sub /* 0:M */
728 | lds_indiv_ord_sub /* 0:M */
729 | chi_fam_link_sub /* 0:M */
730 | spou_fam_link_sub /* 0:M */
731 | indi_subm_sect /* 0:M */
732 | assoc_struc_sub /* 0:M */
733 | indi_alia_sect /* 0:M */
734 | indi_anci_sect /* 0:M */
735 | indi_desi_sect /* 0:M */
736 | source_cit_sub /* 0:M */
737 | multim_link_sub /* 0:M */
738 | note_struc_sub /* 0:M */
739 | indi_rfn_sect { OCCUR2(RFN, 0, 1) }
740 | indi_afn_sect /* 0:M */
741 | ident_struc_sub /* 0:1 */
742 | change_date_sub /* 0:1 */
743 | ftree_addr_sect { if (!compat_mode(C_FTREE))
750 indi_resn_sect : OPEN DELIM TAG_RESN mand_line_item
751 { START(RESN) } no_std_subs { CHECK0 } CLOSE { }
755 indi_sex_sect : OPEN DELIM TAG_SEX mand_line_item
756 { START(SEX) } no_std_subs { CHECK0 } CLOSE { }
760 indi_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
761 { START(SUBM) } no_std_subs { CHECK0 } CLOSE { }
765 indi_alia_sect : OPEN DELIM TAG_ALIA mand_pointer
766 { START(ALIA) } no_std_subs { CHECK0 } CLOSE { }
770 indi_anci_sect : OPEN DELIM TAG_ANCI mand_pointer
771 { START(ANCI) } no_std_subs { CHECK0 } CLOSE { }
775 indi_desi_sect : OPEN DELIM TAG_DESI mand_pointer
776 { START(DESI) } no_std_subs { CHECK0 } CLOSE { }
780 indi_rfn_sect : OPEN DELIM TAG_RFN mand_line_item
781 { START(RFN) } no_std_subs { CHECK0 } CLOSE { }
785 indi_afn_sect : OPEN DELIM TAG_AFN mand_line_item
786 { START(AFN) } no_std_subs { CHECK0 } CLOSE { }
789 /* INDI.ADDR (Only for 'ftree' compatibility) */
790 ftree_addr_sect : OPEN DELIM TAG_ADDR opt_line_item
791 { START(ADDR) } no_std_subs { CHECK0 } CLOSE { }
793 /*********************************************************************/
794 /**** Multimedia record ****/
795 /*********************************************************************/
796 multim_rec : OPEN DELIM POINTER DELIM TAG_OBJE
799 { CHECK2(FORM, BLOB) }
803 obje_subs : /* empty */
807 obje_sub : obje_form_sect { OCCUR2(FORM, 1, 1) }
808 | obje_titl_sect { OCCUR2(TITL, 0, 1) }
809 | note_struc_sub /* 0:M */
810 | obje_blob_sect { OCCUR2(BLOB, 1, 1) }
811 | obje_obje_sect { OCCUR2(OBJE, 0, 1) }
812 | ident_struc_sub /* 0:1 */
813 | change_date_sub /* 0:1 */
818 obje_form_sect : OPEN DELIM TAG_FORM mand_line_item
819 { START(FORM) } no_std_subs { CHECK0 } CLOSE { }
823 obje_titl_sect : OPEN DELIM TAG_TITL mand_line_item
824 { START(TITL) } no_std_subs { CHECK0 } CLOSE { }
828 obje_blob_sect : OPEN DELIM TAG_BLOB
835 obje_blob_subs : /* empty */
836 | obje_blob_subs obje_blob_sub
839 obje_blob_sub : obje_blob_cont_sect { OCCUR1(CONT, 1) }
843 obje_blob_cont_sect : OPEN DELIM TAG_CONT mand_line_item
844 { START(CONT) } no_std_subs { CHECK0 } CLOSE { }
848 obje_obje_sect : OPEN DELIM TAG_OBJE mand_pointer
849 { START(OBJE) } no_std_subs { CHECK0 } CLOSE { }
852 /*********************************************************************/
853 /**** Note record ****/
854 /*********************************************************************/
855 note_rec : OPEN DELIM POINTER DELIM TAG_NOTE note_line_item
862 note_line_item : /* empty */
863 { if (!compat_mode(C_FTREE)) {
864 gedcom_error("Missing value"); YYERROR;
868 { gedcom_debug_print("==Val: %s==\n", $2);
872 note_subs : /* empty */
876 note_sub : continuation_sub /* 0:M */
877 | source_cit_sub /* 0:M */
878 | ident_struc_sub /* 0:1 */
879 | change_date_sub /* 0:1 */
883 /*********************************************************************/
884 /**** Repository record ****/
885 /*********************************************************************/
886 repos_rec : OPEN DELIM POINTER DELIM TAG_REPO
893 repo_subs : /* empty */
897 repo_sub : repo_name_sect { OCCUR2(NAME, 0, 1) }
898 | addr_struc_sub /* 0:1 */
899 | note_struc_sub /* 0:M */
900 | ident_struc_sub /* 0:1 */
901 | change_date_sub /* 0:1 */
906 repo_name_sect : OPEN DELIM TAG_NAME mand_line_item
907 { START(NAME) } no_std_subs { CHECK0 } CLOSE {}
910 /*********************************************************************/
911 /**** Source record ****/
912 /*********************************************************************/
913 source_rec : OPEN DELIM POINTER DELIM TAG_SOUR
920 sour_subs : /* empty */
924 sour_sub : sour_data_sect { OCCUR2(DATA, 0, 1) }
925 | sour_auth_sect { OCCUR2(AUTH, 0, 1) }
926 | sour_titl_sect { OCCUR2(TITL, 0, 1) }
927 | sour_abbr_sect { OCCUR2(ABBR, 0, 1) }
928 | sour_publ_sect { OCCUR2(PUBL, 0, 1) }
929 | sour_text_sect { OCCUR2(TEXT, 0, 1) }
930 | source_repos_cit_sub /* 0:1 */
931 | multim_link_sub /* 0:M */
932 | note_struc_sub /* 0:M */
933 | ident_struc_sub /* 0:1 */
934 | change_date_sub /* 0:1 */
939 sour_data_sect : OPEN DELIM TAG_DATA
946 sour_data_subs : /* empty */
947 | sour_data_subs sour_data_sub
950 sour_data_sub : sour_data_even_sect /* 0:M */
951 | sour_data_agnc_sect { OCCUR2(AGNC, 0, 1) }
952 | note_struc_sub /* 0:M */
956 sour_data_even_sect : OPEN DELIM TAG_EVEN mand_line_item
963 sour_data_even_subs : /* empty */
964 | sour_data_even_subs sour_data_even_sub
967 sour_data_even_sub : sour_data_even_date_sect { OCCUR2(DATE, 0, 1) }
968 | sour_data_even_plac_sect { OCCUR2(PLAC, 0, 1) }
972 sour_data_even_date_sect : OPEN DELIM TAG_DATE mand_line_item
973 { START(DATE) } no_std_subs { CHECK0 } CLOSE { }
976 sour_data_even_plac_sect : OPEN DELIM TAG_PLAC mand_line_item
977 { START(PLAC) } no_std_subs { CHECK0 } CLOSE { }
980 sour_data_agnc_sect : OPEN DELIM TAG_AGNC mand_line_item
981 { START(AGNC) } no_std_subs { CHECK0 } CLOSE { }
985 sour_auth_sect : OPEN DELIM TAG_AUTH mand_line_item
992 sour_auth_subs : /* empty */
993 | sour_auth_subs sour_auth_sub
996 sour_auth_sub : continuation_sub /* 0:M */
1001 sour_titl_sect : OPEN DELIM TAG_TITL mand_line_item
1008 sour_titl_subs : /* empty */
1009 | sour_titl_subs sour_titl_sub
1012 sour_titl_sub : continuation_sub /* 0:M */
1017 sour_abbr_sect : OPEN DELIM TAG_ABBR mand_line_item
1018 { START(ABBR) } no_std_subs { CHECK0 } CLOSE { }
1022 sour_publ_sect : OPEN DELIM TAG_PUBL mand_line_item
1029 sour_publ_subs : /* empty */
1030 | sour_publ_subs sour_publ_sub
1033 sour_publ_sub : continuation_sub /* 0:M */
1038 sour_text_sect : OPEN DELIM TAG_TEXT mand_line_item
1045 sour_text_subs : /* empty */
1046 | sour_text_subs sour_text_sub
1049 sour_text_sub : continuation_sub /* 0:M */
1053 /*********************************************************************/
1054 /**** Submission record ****/
1055 /*********************************************************************/
1056 submis_rec : OPEN DELIM POINTER DELIM TAG_SUBN
1063 subn_subs : /* empty */
1064 | subn_subs subn_sub
1067 subn_sub : subn_subm_sect { OCCUR2(SUBM, 0, 1) }
1068 | subn_famf_sect { OCCUR2(FAMF, 0, 1) }
1069 | subn_temp_sect { OCCUR2(TEMP, 0, 1) }
1070 | subn_ance_sect { OCCUR2(ANCE, 0, 1) }
1071 | subn_desc_sect { OCCUR2(DESC, 0, 1) }
1072 | subn_ordi_sect { OCCUR2(ORDI, 0, 1) }
1073 | subn_rin_sect { OCCUR2(RIN, 0, 1) }
1078 subn_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
1079 { START(SUBM) } no_std_subs { CHECK0 } CLOSE { }
1083 subn_famf_sect : OPEN DELIM TAG_FAMF mand_line_item
1084 { START(FAMF) } no_std_subs { CHECK0 } CLOSE { }
1088 subn_temp_sect : OPEN DELIM TAG_TEMP mand_line_item
1089 { START(TEMP) } no_std_subs { CHECK0 } CLOSE { }
1093 subn_ance_sect : OPEN DELIM TAG_ANCE mand_line_item
1094 { START(ANCE) } no_std_subs { CHECK0 } CLOSE { }
1098 subn_desc_sect : OPEN DELIM TAG_DESC mand_line_item
1099 { START(DESC) } no_std_subs { CHECK0 } CLOSE { }
1103 subn_ordi_sect : OPEN DELIM TAG_ORDI mand_line_item
1104 { START(ORDI) } no_std_subs { CHECK0 } CLOSE { }
1108 subn_rin_sect : OPEN DELIM TAG_RIN mand_line_item
1109 { START(RIN) } no_std_subs { CHECK0 } CLOSE { }
1112 /*********************************************************************/
1113 /**** Submitter record ****/
1114 /*********************************************************************/
1115 submit_rec : OPEN DELIM POINTER DELIM TAG_SUBM
1122 subm_subs : /* empty */
1123 | subm_subs subm_sub
1126 subm_sub : subm_name_sect { OCCUR2(NAME, 0, 1) }
1127 | addr_struc_sub /* 0:1 */
1128 | multim_link_sub /* 0:M */
1129 | subm_lang_sect { OCCUR2(LANG, 0, 3) }
1130 | subm_rfn_sect { OCCUR2(RFN, 0, 1) }
1131 | subm_rin_sect { OCCUR2(RIN, 0, 1) }
1132 | change_date_sub /* 0:1 */
1137 subm_name_sect : OPEN DELIM TAG_NAME mand_line_item
1138 { START(NAME) } no_std_subs { CHECK0 } CLOSE { }
1142 subm_lang_sect : OPEN DELIM TAG_LANG mand_line_item
1143 { START(LANG) } no_std_subs { CHECK0 } CLOSE { }
1147 subm_rfn_sect : OPEN DELIM TAG_RFN mand_line_item
1148 { START(RFN) } no_std_subs { CHECK0 } CLOSE { }
1152 subm_rin_sect : OPEN DELIM TAG_RIN mand_line_item
1153 { START(RIN) } no_std_subs { CHECK0 } CLOSE { }
1156 /*********************************************************************/
1157 /**** Substructures ****/
1158 /*********************************************************************/
1160 /* ADDRESS STRUCTURE */
1161 addr_struc_sub : addr_sect { OCCUR2(ADDR, 0, 1) }
1162 | phon_sect { OCCUR2(PHON, 0, 3) }
1165 addr_sect : OPEN DELIM TAG_ADDR mand_line_item
1172 addr_subs : /* empty */
1173 | addr_subs addr_sub
1176 addr_sub : addr_cont_sect /* 0:M */
1177 | addr_adr1_sect { OCCUR2(ADR1, 0, 1) }
1178 | addr_adr2_sect { OCCUR2(ADR2, 0, 1) }
1179 | addr_city_sect { OCCUR2(CITY, 0, 1) }
1180 | addr_stae_sect { OCCUR2(STAE, 0, 1) }
1181 | addr_post_sect { OCCUR2(POST, 0, 1) }
1182 | addr_ctry_sect { OCCUR2(CTRY, 0, 1) }
1186 addr_cont_sect : OPEN DELIM TAG_CONT mand_line_item
1187 { START(CONT) } no_std_subs { CHECK0 } CLOSE { }
1189 addr_adr1_sect : OPEN DELIM TAG_ADR1 mand_line_item
1190 { START(ADR1) } no_std_subs { CHECK0 } CLOSE { }
1192 addr_adr2_sect : OPEN DELIM TAG_ADR2 mand_line_item
1193 { START(ADR2) } no_std_subs { CHECK0 } CLOSE { }
1195 addr_city_sect : OPEN DELIM TAG_CITY mand_line_item
1196 { START(CITY) } no_std_subs { CHECK0 } CLOSE { }
1198 addr_stae_sect : OPEN DELIM TAG_STAE mand_line_item
1199 { START(STAE) } no_std_subs { CHECK0 } CLOSE { }
1201 addr_post_sect : OPEN DELIM TAG_POST mand_line_item
1202 { START(POST) } no_std_subs { CHECK0 } CLOSE { }
1204 addr_ctry_sect : OPEN DELIM TAG_CTRY mand_line_item
1205 { START(CTRY) } no_std_subs { CHECK0 } CLOSE { }
1208 phon_sect : OPEN DELIM TAG_PHON mand_line_item
1209 { START(PHON) } no_std_subs { CHECK0 } CLOSE { }
1212 /* ASSOCIATION STRUCTURE */
1213 assoc_struc_sub : asso_sect /* 0:M */
1216 asso_sect : OPEN DELIM TAG_ASSO mand_pointer
1219 { CHECK2(TYPE,RELA) }
1223 asso_subs : /* empty */
1224 | asso_type_sect { OCCUR2(TYPE, 1, 1) }
1225 | asso_rela_sect { OCCUR2(RELA, 1, 1) }
1231 asso_type_sect : OPEN DELIM TAG_TYPE mand_line_item
1232 { START(TYPE) } no_std_subs { CHECK0 } CLOSE { }
1235 asso_rela_sect : OPEN DELIM TAG_RELA mand_line_item
1236 { START(RELA) } no_std_subs { CHECK0 } CLOSE { }
1240 change_date_sub : change_date_chan_sect { OCCUR2(CHAN, 0, 1) }
1243 change_date_chan_sect : OPEN DELIM TAG_CHAN
1245 change_date_chan_subs
1250 change_date_chan_subs : /* empty */
1251 | change_date_chan_subs change_date_chan_sub
1254 change_date_chan_sub : change_date_date_sect { OCCUR2(DATE, 1, 1) }
1259 change_date_date_sect : OPEN DELIM TAG_DATE mand_line_item
1261 change_date_date_subs
1266 change_date_date_subs : /* empty */
1267 | change_date_date_subs change_date_date_sub
1270 change_date_date_sub : change_date_date_time_sect { OCCUR2(TIME, 0, 1) }
1274 change_date_date_time_sect : OPEN DELIM TAG_TIME mand_line_item
1275 { START(TIME) } no_std_subs { CHECK0 } CLOSE { }
1278 /* CHILD TO FAMILY LINK */
1279 chi_fam_link_sub : famc_sect /* 0:M */
1282 famc_sect : OPEN DELIM TAG_FAMC mand_pointer
1289 famc_subs : /* empty */
1290 | famc_subs famc_sub
1293 famc_sub : famc_pedi_sect /* 0:M */
1298 famc_pedi_sect : OPEN DELIM TAG_PEDI mand_line_item
1299 { START(PEDI) } no_std_subs { CHECK0 } CLOSE { }
1302 /* CONTINUATION SUBSECTIONS */
1303 continuation_sub : cont_sect /* 0:M */
1304 | conc_sect /* 0:M */
1307 cont_sect : OPEN DELIM TAG_CONT mand_line_item
1308 { START(CONT) } no_std_subs { CHECK0 } CLOSE { }
1311 conc_sect : OPEN DELIM TAG_CONC mand_line_item
1312 { START(CONC) } no_std_subs { CHECK0 } CLOSE { }
1316 event_detail_sub : event_detail_type_sect { OCCUR2(TYPE, 0, 1) }
1317 | event_detail_date_sect { OCCUR2(DATE, 0, 1) }
1320 | event_detail_age_sect { OCCUR2(AGE, 0, 1) }
1321 | event_detail_agnc_sect { OCCUR2(AGNC, 0, 1) }
1322 | event_detail_caus_sect { OCCUR2(CAUS, 0, 1) }
1328 event_detail_type_sect : OPEN DELIM TAG_TYPE mand_line_item
1329 { START(TYPE) } no_std_subs { CHECK0 } CLOSE { }
1331 event_detail_date_sect : OPEN DELIM TAG_DATE mand_line_item
1332 { START(DATE) } no_std_subs { CHECK0 } CLOSE { }
1334 event_detail_age_sect : OPEN DELIM TAG_AGE mand_line_item
1335 { START(AGE) } no_std_subs { CHECK0 } CLOSE { }
1337 event_detail_agnc_sect : OPEN DELIM TAG_AGNC mand_line_item
1338 { START(AGNC) } no_std_subs { CHECK0 } CLOSE { }
1340 event_detail_caus_sect : OPEN DELIM TAG_CAUS mand_line_item
1341 { START(CAUS) } no_std_subs { CHECK0 } CLOSE { }
1344 /* FAMILY EVENT STRUCTURE */
1345 fam_event_struc_sub : fam_event_sect
1346 | fam_gen_even_sect /* 0:M */
1349 fam_event_sect : OPEN DELIM fam_event_tag opt_value fam_event_subs
1354 fam_event_tag : TAG_ANUL { START(ANUL) }
1355 | TAG_CENS { START(CENS) }
1356 | TAG_DIV { START(DIV) }
1357 | TAG_DIVF { START(DIVF) }
1358 | TAG_ENGA { START(ENGA) }
1359 | TAG_MARR { START(MARR) }
1360 | TAG_MARB { START(MARB) }
1361 | TAG_MARC { START(MARC) }
1362 | TAG_MARL { START(MARL) }
1363 | TAG_MARS { START(MARS) }
1366 fam_event_subs : /* empty */
1367 | fam_event_subs fam_event_sub
1370 fam_event_sub : event_detail_sub
1371 | fam_even_husb_sect { OCCUR2(HUSB, 0, 1) }
1372 | fam_even_wife_sect { OCCUR2(WIFE, 0, 1) }
1376 fam_even_husb_sect : OPEN DELIM TAG_HUSB
1383 fam_even_husb_subs : /* empty */
1384 | fam_even_husb_subs fam_even_husb_sub
1387 fam_even_husb_sub : fam_even_husb_age_sect { OCCUR2(AGE, 1, 1) }
1391 fam_even_husb_age_sect : OPEN DELIM TAG_AGE mand_line_item
1392 { START(AGE) } no_std_subs { CHECK0 } CLOSE { }
1395 fam_even_wife_sect : OPEN DELIM TAG_WIFE
1402 fam_gen_even_sect : OPEN DELIM TAG_EVEN
1409 fam_gen_even_subs : /* empty */
1410 | fam_gen_even_subs fam_gen_even_sub
1413 fam_gen_even_sub : event_detail_sub
1414 | fam_even_husb_sect { OCCUR2(HUSB, 0, 1) }
1415 | fam_even_wife_sect { OCCUR2(WIFE, 0, 1) }
1419 /* IDENTIFICATION STRUCTURE */
1420 ident_struc_sub : ident_refn_sect /* 0:M */
1421 | ident_rin_sect { OCCUR2(RIN, 0, 1) }
1424 ident_refn_sect : OPEN DELIM TAG_REFN mand_line_item
1431 ident_refn_subs : /* empty */
1432 | ident_refn_subs ident_refn_sub
1435 ident_refn_sub : ident_refn_type_sect { OCCUR2(TYPE, 0, 1) }
1439 ident_refn_type_sect : OPEN DELIM TAG_TYPE mand_line_item
1440 { START(TYPE) } no_std_subs { CHECK0 } CLOSE { }
1443 ident_rin_sect : OPEN DELIM TAG_RIN mand_line_item
1444 { START(RIN) } no_std_subs { CHECK0 } CLOSE { }
1447 /* INDIVIDUAL ATTRIBUTE STRUCTURE */
1448 indiv_attr_struc_sub : indiv_cast_sect /* 0:M */
1449 | indiv_dscr_sect /* 0:M */
1450 | indiv_educ_sect /* 0:M */
1451 | indiv_idno_sect /* 0:M */
1452 | indiv_nati_sect /* 0:M */
1453 | indiv_nchi_sect /* 0:M */
1454 | indiv_nmr_sect /* 0:M */
1455 | indiv_occu_sect /* 0:M */
1456 | indiv_prop_sect /* 0:M */
1457 | indiv_reli_sect /* 0:M */
1458 | indiv_resi_sect /* 0:M */
1459 | indiv_ssn_sect /* 0:M */
1460 | indiv_titl_sect /* 0:M */
1463 indiv_cast_sect : OPEN DELIM TAG_CAST mand_line_item
1465 indiv_attr_event_subs
1469 indiv_dscr_sect : OPEN DELIM TAG_DSCR mand_line_item
1471 indiv_attr_event_subs
1475 indiv_educ_sect : OPEN DELIM TAG_EDUC mand_line_item
1477 indiv_attr_event_subs
1481 indiv_idno_sect : OPEN DELIM TAG_IDNO mand_line_item
1483 indiv_attr_event_subs
1487 indiv_nati_sect : OPEN DELIM TAG_NATI mand_line_item
1489 indiv_attr_event_subs
1493 indiv_nchi_sect : OPEN DELIM TAG_NCHI mand_line_item
1495 indiv_attr_event_subs
1499 indiv_nmr_sect : OPEN DELIM TAG_NMR mand_line_item
1501 indiv_attr_event_subs
1505 indiv_occu_sect : OPEN DELIM TAG_OCCU mand_line_item
1507 indiv_attr_event_subs
1511 indiv_prop_sect : OPEN DELIM TAG_PROP mand_line_item
1513 indiv_attr_event_subs
1517 indiv_reli_sect : OPEN DELIM TAG_RELI mand_line_item
1519 indiv_attr_event_subs
1523 indiv_resi_sect : OPEN DELIM TAG_RESI
1525 indiv_attr_event_subs
1529 indiv_ssn_sect : OPEN DELIM TAG_SSN mand_line_item
1531 indiv_attr_event_subs
1535 indiv_titl_sect : OPEN DELIM TAG_TITL mand_line_item
1537 indiv_attr_event_subs
1542 indiv_attr_event_subs : /* empty */
1543 | indiv_attr_event_subs indiv_attr_event_sub
1546 indiv_attr_event_sub : event_detail_sub
1550 /* INDIVIDUAL EVENT STRUCTURE */
1551 indiv_even_struc_sub : indiv_birt_sect
1553 | indiv_adop_sect /* 0:M */
1554 | indiv_even_sect /* 0:M */
1557 indiv_birt_sect : OPEN DELIM indiv_birt_tag opt_value indiv_birt_subs
1562 indiv_birt_tag : TAG_BIRT { START(BIRT) }
1563 | TAG_CHR { START(CHR) }
1566 indiv_birt_subs : /* empty */
1567 | indiv_birt_subs indiv_birt_sub
1570 indiv_birt_sub : event_detail_sub
1571 | indiv_birt_famc_sect { OCCUR2(FAMC,0, 1) }
1575 indiv_birt_famc_sect : OPEN DELIM TAG_FAMC mand_pointer
1576 { START(FAMC) } no_std_subs { CHECK0 } CLOSE { }
1579 indiv_gen_sect : OPEN DELIM indiv_gen_tag opt_value indiv_gen_subs
1584 indiv_gen_tag : TAG_DEAT { START(DEAT) }
1585 | TAG_BURI { START(BURI) }
1586 | TAG_CREM { START(CREM) }
1587 | TAG_BAPM { START(BAPM) }
1588 | TAG_BARM { START(BARM) }
1589 | TAG_BASM { START(BASM) }
1590 | TAG_BLES { START(BLES) }
1591 | TAG_CHRA { START(CHRA) }
1592 | TAG_CONF { START(CONF) }
1593 | TAG_FCOM { START(FCOM) }
1594 | TAG_ORDN { START(ORDN) }
1595 | TAG_NATU { START(NATU) }
1596 | TAG_EMIG { START(EMIG) }
1597 | TAG_IMMI { START(IMMI) }
1598 | TAG_CENS { START(CENS) }
1599 | TAG_PROB { START(PROB) }
1600 | TAG_WILL { START(WILL) }
1601 | TAG_GRAD { START(GRAD) }
1602 | TAG_RETI { START(RETI) }
1605 indiv_gen_subs : /* empty */
1606 | indiv_gen_subs indiv_gen_sub
1609 indiv_gen_sub : event_detail_sub
1613 indiv_adop_sect : OPEN DELIM TAG_ADOP opt_value
1620 indiv_adop_subs : /* empty */
1621 | indiv_adop_subs indiv_adop_sub
1624 indiv_adop_sub : event_detail_sub
1625 | indiv_adop_famc_sect { OCCUR2(FAMC,0, 1) }
1629 indiv_adop_famc_sect : OPEN DELIM TAG_FAMC mand_pointer
1631 indiv_adop_famc_subs
1636 indiv_adop_famc_subs : /* empty */
1637 | indiv_adop_famc_subs indiv_adop_famc_sub
1640 indiv_adop_famc_sub : indiv_adop_famc_adop_sect { OCCUR2(ADOP,0, 1) }
1644 indiv_adop_famc_adop_sect : OPEN DELIM TAG_ADOP mand_line_item
1645 { START(ADOP) } no_std_subs { CHECK0 } CLOSE { }
1648 indiv_even_sect : OPEN DELIM TAG_EVEN
1655 /* LDS INDIVIDUAL ORDINANCE */
1656 lds_indiv_ord_sub : lio_bapl_sect /* 0:M */
1657 | lio_slgc_sect /* 0:M */
1660 lio_bapl_sect : OPEN DELIM lio_bapl_tag lio_bapl_subs
1665 lio_bapl_tag : TAG_BAPL { START(BAPL) }
1666 | TAG_CONL { START(CONL) }
1667 | TAG_ENDL { START(ENDL) }
1670 lio_bapl_subs : /* empty */
1671 | lio_bapl_subs lio_bapl_sub
1674 lio_bapl_sub : lio_bapl_stat_sect { OCCUR2(STAT, 0, 1) }
1675 | lio_bapl_date_sect { OCCUR2(DATE, 0, 1) }
1676 | lio_bapl_temp_sect { OCCUR2(TEMP, 0, 1) }
1677 | lio_bapl_plac_sect { OCCUR2(PLAC, 0, 1) }
1683 lio_bapl_stat_sect : OPEN DELIM TAG_STAT mand_line_item
1684 { START(STAT) } no_std_subs { CHECK0 } CLOSE { }
1686 lio_bapl_date_sect : OPEN DELIM TAG_DATE mand_line_item
1687 { START(DATE) } no_std_subs { CHECK0 } CLOSE { }
1689 lio_bapl_temp_sect : OPEN DELIM TAG_TEMP mand_line_item
1690 { START(TEMP) } no_std_subs { CHECK0 } CLOSE { }
1692 lio_bapl_plac_sect : OPEN DELIM TAG_PLAC mand_line_item
1693 { START(PLAC) } no_std_subs { CHECK0 } CLOSE { }
1696 lio_slgc_sect : OPEN DELIM TAG_SLGC
1703 lio_slgc_subs : /* empty */
1704 | lio_slgc_subs lio_slgc_sub
1707 lio_slgc_sub : lio_bapl_sub
1708 | lio_slgc_famc_sect { OCCUR2(FAMC, 1, 1) }
1711 lio_slgc_famc_sect : OPEN DELIM TAG_FAMC mand_pointer
1712 { START(FAMC) } no_std_subs { CHECK0 } CLOSE { }
1715 /* LDS SPOUSE SEALING */
1716 lds_spouse_seal_sub : lss_slgs_sect
1719 lss_slgs_sect : OPEN DELIM TAG_SLGS
1726 lss_slgs_subs : /* empty */
1727 | lss_slgs_subs lss_slgs_sub
1730 lss_slgs_sub : lss_slgs_stat_sect { OCCUR2(STAT, 0, 1) }
1731 | lss_slgs_date_sect { OCCUR2(DATE, 0, 1) }
1732 | lss_slgs_temp_sect { OCCUR2(TEMP, 0, 1) }
1733 | lss_slgs_plac_sect { OCCUR2(PLAC, 0, 1) }
1739 lss_slgs_stat_sect : OPEN DELIM TAG_STAT mand_line_item
1740 { START(STAT) } no_std_subs { CHECK0 } CLOSE { }
1742 lss_slgs_date_sect : OPEN DELIM TAG_DATE mand_line_item
1743 { START(DATE) } no_std_subs { CHECK0 } CLOSE { }
1745 lss_slgs_temp_sect : OPEN DELIM TAG_TEMP mand_line_item
1746 { START(TEMP) } no_std_subs { CHECK0 } CLOSE { }
1748 lss_slgs_plac_sect : OPEN DELIM TAG_PLAC mand_line_item
1749 { START(PLAC) } no_std_subs { CHECK0 } CLOSE { }
1752 /* MULTIMEDIA LINK */
1753 multim_link_sub : multim_obje_link_sect
1754 | multim_obje_emb_sect
1757 multim_obje_link_sect : OPEN DELIM TAG_OBJE DELIM POINTER
1758 { START(OBJE) } no_std_subs { CHECK0 } CLOSE { }
1761 multim_obje_emb_sect : OPEN DELIM TAG_OBJE
1763 multim_obje_emb_subs
1764 { CHECK2(FORM,FILE) }
1768 multim_obje_emb_subs : /* empty */
1769 | multim_obje_emb_subs multim_obje_emb_sub
1772 multim_obje_emb_sub : multim_obje_form_sect { OCCUR2(FORM, 1, 1) }
1773 | multim_obje_titl_sect { OCCUR2(TITL, 0, 1) }
1774 | multim_obje_file_sect { OCCUR2(FILE, 1, 1) }
1779 multim_obje_form_sect : OPEN DELIM TAG_FORM mand_line_item
1780 { START(FORM) } no_std_subs { CHECK0 } CLOSE { }
1782 multim_obje_titl_sect : OPEN DELIM TAG_TITL mand_line_item
1783 { START(TITL) } no_std_subs { CHECK0 } CLOSE { }
1785 multim_obje_file_sect : OPEN DELIM TAG_FILE mand_line_item
1786 { START(FILE) } no_std_subs { CHECK0 } CLOSE { }
1789 /* NOTE STRUCTURE */
1790 note_struc_sub : note_struc_link_sect /* 0:M */
1791 | note_struc_emb_sect /* 0:M */
1794 note_struc_link_sect : OPEN DELIM TAG_NOTE DELIM POINTER
1796 note_struc_link_subs
1801 note_struc_link_subs : /* empty */
1802 | note_struc_link_subs note_struc_link_sub
1805 note_struc_link_sub : source_cit_sub
1809 note_struc_emb_sect : OPEN DELIM TAG_NOTE opt_line_item
1816 note_struc_emb_subs : /* empty */
1817 | note_struc_emb_subs note_struc_emb_sub
1820 note_struc_emb_sub : continuation_sub
1825 /* PERSONAL NAME STRUCTURE */
1826 pers_name_struc_sub : pers_name_sect /* 0:M */
1829 pers_name_sect : OPEN DELIM TAG_NAME mand_line_item
1836 pers_name_subs : /* empty */
1837 | pers_name_subs pers_name_sub
1840 pers_name_sub : pers_name_npfx_sect { OCCUR2(NPFX, 0, 1) }
1841 | pers_name_givn_sect { OCCUR2(GIVN, 0, 1) }
1842 | pers_name_nick_sect { OCCUR2(NICK, 0, 1) }
1843 | pers_name_spfx_sect { OCCUR2(SPFX, 0, 1) }
1844 | pers_name_surn_sect { OCCUR2(SURN, 0, 1) }
1845 | pers_name_nsfx_sect { OCCUR2(NSFX, 0, 1) }
1851 pers_name_npfx_sect : OPEN DELIM TAG_NPFX mand_line_item
1852 { START(NPFX) } no_std_subs { CHECK0 } CLOSE { }
1854 pers_name_givn_sect : OPEN DELIM TAG_GIVN mand_line_item
1855 { START(GIVN) } no_std_subs { CHECK0 } CLOSE { }
1857 pers_name_nick_sect : OPEN DELIM TAG_NICK mand_line_item
1858 { START(NICK) } no_std_subs { CHECK0 } CLOSE { }
1860 pers_name_spfx_sect : OPEN DELIM TAG_SPFX mand_line_item
1861 { START(SPFX) } no_std_subs { CHECK0 } CLOSE { }
1863 pers_name_surn_sect : OPEN DELIM TAG_SURN mand_line_item
1864 { START(SURN) } no_std_subs { CHECK0 } CLOSE { }
1866 pers_name_nsfx_sect : OPEN DELIM TAG_NSFX mand_line_item
1867 { START(NSFX) } no_std_subs { CHECK0 } CLOSE { }
1870 /* PLACE STRUCTURE */
1871 place_struc_sub : place_struc_plac_sect /* 0:M */
1874 place_struc_plac_sect : OPEN DELIM TAG_PLAC mand_line_item
1876 place_struc_plac_subs
1881 place_struc_plac_subs : /* empty */
1882 | place_struc_plac_subs place_struc_plac_sub
1885 place_struc_plac_sub : place_plac_form_sect { OCCUR2(FORM, 0, 1) }
1891 place_plac_form_sect : OPEN DELIM TAG_FORM mand_line_item
1892 { START(FORM) } no_std_subs { CHECK0 } CLOSE { }
1895 /* SOURCE_CITATION */
1896 source_cit_sub : source_cit_link_sect /* 0:M */
1897 | source_cit_emb_sect /* 0:M */
1900 source_cit_link_sect : OPEN DELIM TAG_SOUR DELIM POINTER
1902 source_cit_link_subs
1907 source_cit_link_subs : /* empty */
1908 | source_cit_link_subs source_cit_link_sub
1911 source_cit_link_sub : source_cit_page_sect { OCCUR2(PAGE, 0, 1) }
1912 | source_cit_even_sect { OCCUR2(EVEN, 0, 1) }
1913 | source_cit_data_sect { OCCUR2(DATA, 0, 1) }
1914 | source_cit_quay_sect { OCCUR2(QUAY, 0, 1) }
1920 source_cit_page_sect : OPEN DELIM TAG_PAGE mand_line_item
1921 { START(PAGE) } no_std_subs { CHECK0 } CLOSE { }
1924 source_cit_even_sect : OPEN DELIM TAG_EVEN mand_line_item
1926 source_cit_even_subs
1931 source_cit_even_subs : /* empty */
1932 | source_cit_even_subs source_cit_even_sub
1935 source_cit_even_sub : source_cit_even_role_sect { OCCUR2(ROLE, 0, 1) }
1939 source_cit_even_role_sect : OPEN DELIM TAG_ROLE mand_line_item
1940 { START(ROLE) } no_std_subs { CHECK0 } CLOSE { }
1943 source_cit_data_sect : OPEN DELIM TAG_DATA
1945 source_cit_data_subs
1950 source_cit_data_subs : /* empty */
1951 | source_cit_data_subs source_cit_data_sub
1954 source_cit_data_sub : source_cit_data_date_sect { OCCUR2(DATE, 0, 1) }
1955 | source_cit_text_sect /* 0:M */
1959 source_cit_data_date_sect : OPEN DELIM TAG_DATE mand_line_item
1960 { START(DATE) } no_std_subs { CHECK0 } CLOSE { }
1963 source_cit_text_sect : OPEN DELIM TAG_TEXT mand_line_item
1965 source_cit_text_subs
1970 source_cit_text_subs : /* empty */
1971 | source_cit_text_subs source_cit_text_sub
1974 source_cit_text_sub : continuation_sub
1978 source_cit_quay_sect : OPEN DELIM TAG_QUAY mand_line_item
1979 { START(QUAY) } no_std_subs { CHECK0 } CLOSE { }
1982 source_cit_emb_sect : OPEN DELIM TAG_SOUR mand_line_item
1989 source_cit_emb_subs : /* empty */
1990 | source_cit_emb_subs source_cit_emb_sub
1993 source_cit_emb_sub : continuation_sub
1994 | source_cit_text_sect /* 0:M */
1999 /* SOURCE REPOSITORY CITATION */
2000 source_repos_cit_sub : source_repos_repo_sect { OCCUR2(REPO, 0, 1) }
2003 source_repos_repo_sect : OPEN DELIM TAG_REPO mand_pointer
2005 source_repos_repo_subs
2010 source_repos_repo_subs : /* empty */
2011 | source_repos_repo_subs source_repos_repo_sub
2014 source_repos_repo_sub : note_struc_sub
2015 | caln_sect /* 0:M */
2019 caln_sect : OPEN DELIM TAG_CALN mand_line_item
2026 caln_subs : /* empty */
2027 | caln_subs caln_sub
2030 caln_sub : caln_medi_sect { OCCUR2(MEDI, 0, 1) }
2034 caln_medi_sect : OPEN DELIM TAG_MEDI mand_line_item
2035 { START(MEDI) } no_std_subs { CHECK0 } CLOSE { }
2038 /* SPOUSE TO FAMILY LINK */
2039 spou_fam_link_sub : spou_fam_fams_sect /* 0:M */
2042 spou_fam_fams_sect : OPEN DELIM TAG_FAMS mand_pointer
2049 spou_fam_fams_subs : /* empty */
2050 | spou_fam_fams_subs spou_fam_fams_sub
2053 spou_fam_fams_sub : note_struc_sub
2057 /*********************************************************************/
2059 /*********************************************************************/
2061 no_std_subs : /* empty */
2062 | no_std_subs no_std_sub
2065 no_std_sub : user_sect /* 0:M */
2067 | error error_subs CLOSE { HANDLE_ERROR }
2070 no_std_rec : user_rec /* 0:M */
2072 | error error_subs CLOSE { HANDLE_ERROR }
2075 user_rec : OPEN DELIM opt_xref USERTAG
2076 { if ($4[0] != '_') {
2077 gedcom_error("Undefined tag (and not a valid user tag): %s",
2082 opt_value user_sects CLOSE { }
2085 user_sect : OPEN DELIM opt_xref USERTAG
2086 { if ($4[0] != '_') {
2087 gedcom_error("Undefined tag (and not a valid user tag): %s",
2092 opt_value user_sects CLOSE { }
2095 user_sects : /* empty */ { }
2096 | user_sects user_sect { }
2099 opt_xref : /* empty */ { }
2103 opt_value : /* empty */ { }
2104 | DELIM line_value { }
2107 line_value : POINTER { }
2111 mand_pointer : /* empty */ { gedcom_error("Missing pointer"); YYERROR; }
2115 mand_line_item : /* empty */ { gedcom_error("Missing value"); YYERROR; }
2116 | DELIM line_item { gedcom_debug_print("==Val: %s==\n", $2);
2120 opt_line_item : /* empty */ { }
2121 | DELIM line_item { }
2124 line_item : anychar { size_t i;
2125 CLEAR_BUFFER(string_buf);
2126 string_buf_ptr = string_buf;
2127 /* The following also takes care of '@@' */
2128 if (!strncmp($1, "@@", 3))
2129 *string_buf_ptr++ = '@';
2131 for (i=0; i < strlen($1); i++)
2132 *string_buf_ptr++ = $1[i];
2135 | ESCAPE { CLEAR_BUFFER(string_buf);
2136 string_buf_ptr = string_buf;
2137 /* For now, ignore escapes */
2141 { if (strlen(string_buf) >= MAXGEDCLINELEN) {
2142 gedcom_error("Line too long");
2147 /* The following also takes care of '@@' */
2148 if (!strncmp($2, "@@", 3))
2149 *string_buf_ptr++ = '@';
2151 for (i=0; i < strlen($2); i++)
2152 *string_buf_ptr++ = $2[i];
2157 { /* For now, ignore escapes */
2162 anychar : ANYCHAR { }
2166 error_subs : /* empty */
2167 | error_subs error_sect
2170 error_sect : OPEN DELIM opt_xref anytag opt_value error_subs CLOSE { }
2172 gen_sect : OPEN DELIM opt_xref anystdtag
2173 { INVALID_TAG($4); }
2174 opt_value opt_sects CLOSE
2178 gen_rec : gen_rec_top
2182 gen_rec_norm : OPEN DELIM opt_xref anystdtag
2183 { INVALID_TOP_TAG($4) }
2184 opt_value opt_sects CLOSE
2188 gen_rec_top : OPEN DELIM anytoptag
2189 { gedcom_error("Missing cross-reference"); YYERROR; }
2190 opt_value opt_sects CLOSE
2194 opt_sects : /* empty */ { }
2195 | opt_sects gen_sect { }
2198 anytag : USERTAG { }
2212 anystdtag : TAG_ABBR
2342 /* Functions that handle the counting of subtags */
2344 int* count_arrays[MAXGEDCLEVEL+1];
2345 char tag_stack[MAXGEDCLEVEL+1][MAXSTDTAGLENGTH+1];
2347 void push_countarray()
2350 if (count_level > MAXGEDCLEVEL) {
2351 gedcom_error("Internal error: count array overflow");
2355 count = (int *)calloc(YYNTOKENS, sizeof(int));
2356 if (count == NULL) {
2357 gedcom_error("Internal error: count array calloc error");
2361 count_arrays[count_level] = count;
2366 void set_parenttag(char* tag)
2368 strncpy(tag_stack[count_level], tag, MAXSTDTAGLENGTH+1);
2371 char* get_parenttag()
2373 return tag_stack[count_level];
2376 int count_tag(int tag)
2378 int *count = count_arrays[count_level];
2379 return ++count[tag - GEDCOMTAGOFFSET];
2382 int check_occurrence(int tag)
2384 int *count = count_arrays[count_level];
2385 return (count[tag - GEDCOMTAGOFFSET] > 0);
2388 void pop_countarray()
2391 if (count_level < 0) {
2392 gedcom_error("Internal error: count array underflow");
2396 count = count_arrays[count_level];
2398 count_arrays[count_level] = NULL;
2402 /* Enabling debug mode */
2403 /* level 0: no debugging */
2404 /* level 1: only internal */
2405 /* level 2: also bison */
2406 void gedcom_set_debug_level(int level)
2409 gedcom_high_level_debug = 1;
2418 int gedcom_debug_print(char* s, ...)
2421 if (gedcom_high_level_debug) {
2424 res = vfprintf(stderr, s, ap);
2430 /* Setting the error mechanism */
2431 void gedcom_set_error_handling(MECHANISM mechanism)
2433 error_mechanism = mechanism;
2436 /* Compatibility handling */
2438 void gedcom_set_compat_handling(int enable_compat)
2440 compat_enabled = enable_compat;
2443 void set_compatibility(char* program)
2445 if (compat_enabled) {
2446 gedcom_debug_print("==== Program: %s\n", program);
2447 if (! strncmp(program, "ftree", 6)) {
2448 gedcom_warning("Enabling compatibility with 'ftree'");
2449 compatibility = C_FTREE;
2457 int compat_mode(int compat_flags)
2459 return (compat_flags & compatibility);