2 Copyright (C) 2001, 2002 The Genes Development Team
3 This file is part of the Gedcom parser library.
4 Contributed by Peter Verthez <Peter.Verthez@advalvas.be>, 2001.
6 The Gedcom parser library is free software; you can redistribute it
7 and/or modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The Gedcom parser library is distributed in the hope that it will be
12 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the Gedcom parser library; if not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
24 /* WARNING: THIS PARSER RELIES HEAVILY ON SOME FEATURES OF BISON.
25 DON'T TRY TO USE IT WITH YACC, IT WON'T WORK...
28 /* Design of the parser:
30 In general, a GEDCOM file contains records, each consisting of a line
31 (which we'll call a section), hierarchically containing other lines
32 (subsections of the section).
34 This means that in general we have:
36 A 'record' is a 'section' (sect) containing 'subsections' (subs)
37 Each 'subsection' (sub) is again a specific 'section' (sect)
39 In parser notation, this means:
43 sect : <some prefix> subs <some suffix>
45 subs : <empty> | subs sub
47 sub : sect_a | sect_b | ...
49 This pattern is repeated throughout the parser for the different types of
53 Cardinality of the subsections:
54 -------------------------------
55 Note that in the above, the order of the subsections is of no importance.
56 Indeed, this is the case in the GEDCOM grammar. However, this also makes
57 it difficult to check whether there are not too many subsections of a
58 specific type, or whether a mandatory subsection is indeed there.
60 Suppose there is a section A that can contain 0 or 1 B section and
63 This can be expressed in parser notation as follows:
65 A : CC | BCC | CBC | CCB
67 So, cardinality is indeed expressable. However, as the number of subsection
68 types and the limits grow bigger (and even theoretically limitless), listing
69 all possible permutations becomes quickly unfeasible.
71 Much simpler is to say:
74 subs : <empty> | subs sub
77 and then check the cardinality in the semantic actions, which is the
78 solution chosen in the parser below, using the following macros:
81 Make a new context for the <parent> tag to count child tags in
83 - OCCUR2(<child>, <min>, <max>)
84 Express that the <child> tag should occur at least <min> times and
85 at most <max> tags within its parent
87 What this actually does is the following. It increments the counter
88 for that tag and then checks whether the maximum is exceeded. If so,
89 then a parser error is produced. The minimum is not actually checked
90 by this macro, but it makes the statements more declarative.
92 - OCCUR1(<child>, <min>)
93 Express that the <child> tag should occur at least <min> times within
94 its parent (no upper limit)
96 Actually, this only increments the counter for the tag, but it looks
97 very like the previous macro.
99 If the minimum is 0, it is not necessary to express this constraint.
101 - CHECKn(<child1>, ..., <childn>)
102 This closes the context for the parent tag and checks whether the
103 given <child> tags did effectively occur within the parent (i.e.
104 these are the tags that were mandatory).
106 Since the <min> values above are always 0 or 1 in GEDCOM, this is
107 sufficient. All sub-tags that declare a minimum of 1 in the OCCUR
108 macros should be listed in this macro here.
110 The macros CHECK0 to CHECK4 are defined like this (the first one
111 has no arguments and is only used to close the parent context; note
112 that this is necessary for correct functioning).
116 Only sections that have subsections need to use these macros. This can
117 be done like this (the OPEN and CHECK macros are used as mid-rule
118 actions around the subsections):
120 head_sect : OPEN DELIM TAG_HEAD
124 CLOSE { <semantic actions> }
130 head_sub : head_sour_sect { OCCUR2(SOUR, 1, 1) }
131 | head_dest_sect { OCCUR2(DEST, 0, 1) }
132 | head_date_sect { OCCUR2(DATE, 0, 1) }
138 - The syntax analysis doesn't handle the contents of the line values;
139 this is done in the semantic analysis.
144 #include "gedcom_internal.h"
145 #include "multilex.h"
146 #include "encoding.h"
147 #include "interface.h"
152 int compat_enabled = 1;
153 int gedcom_high_level_debug = 0;
154 int compatibility = 0;
155 Gedcom_err_mech error_mechanism = IMMED_FAIL;
156 Gedcom_val_struct val;
158 char line_item_buf[MAXGEDCLINELEN * UTF_FACTOR + 1];
159 char *line_item_buf_ptr;
165 /* These are defined at the bottom of the file */
166 void push_countarray();
167 void set_parenttag(char* tag);
168 char* get_parenttag();
169 void set_parentctxt(Gedcom_ctxt ctxt);
170 Gedcom_ctxt get_parentctxt();
171 void pop_countarray();
172 int count_tag(int tag);
173 int check_occurrence(int tag);
174 void set_compatibility(char* program);
175 int compat_mode(int flags);
177 #define CLEAR_BUFFER(BUF) \
178 memset(BUF, 0, sizeof(BUF));
180 #define HANDLE_ERROR \
181 { if (error_mechanism == IMMED_FAIL) { \
184 else if (error_mechanism == DEFER_FAIL) { \
187 else if (error_mechanism == IGNORE_ERRORS) { \
191 #define START(PARENTTAG,PARENTCTXT) \
193 set_parenttag(#PARENTTAG); \
194 set_parentctxt(PARENTCTXT); \
200 { if (!check_occurrence(TAG_##TAG)) { \
201 char* parenttag = get_parenttag(); \
202 gedcom_error(_("The tag '%s' is mandatory within '%s', but missing"),\
208 { pop_countarray(); \
212 #define CHECK1(TAG1) { CHK(TAG1); POP; }
213 #define CHECK2(TAG1,TAG2) \
214 { CHK(TAG1); CHK(TAG2); POP; }
215 #define CHECK3(TAG1,TAG2,TAG3) \
216 { CHK(TAG1); CHK(TAG2); CHK(TAG3); POP; }
217 #define CHECK4(TAG1,TAG2,TAG3,TAG4) \
218 { CHK(TAG1); CHK(TAG2); CHK(TAG3); CHK(TAG4); POP; }
219 #define OCCUR1(CHILDTAG, MIN) { count_tag(TAG_##CHILDTAG); }
220 #define OCCUR2(CHILDTAG, MIN, MAX) \
221 { int num = count_tag(TAG_##CHILDTAG); \
223 char* parenttag = get_parenttag(); \
224 gedcom_error(_("The tag '%s' can maximally occur %d time(s) within '%s'"), \
225 #CHILDTAG, MAX, parenttag); \
229 #define INVALID_TAG(CHILDTAG) \
230 { char* parenttag = get_parenttag(); \
231 gedcom_error(_("The tag '%s' is not a valid tag within '%s'"), \
232 CHILDTAG, parenttag); \
235 #define INVALID_TOP_TAG(CHILDTAG) \
236 { gedcom_error(_("The tag '%s' is not a valid top-level tag"), \
246 struct tag_struct tag;
253 %token <string> BADTOKEN
255 %token <string> CLOSE
256 %token <string> ESCAPE
257 %token <string> DELIM
258 %token <string> ANYCHAR
259 %token <string> POINTER
261 %token <tag> TAG_ABBR
262 %token <tag> TAG_ADDR
263 %token <tag> TAG_ADR1
264 %token <tag> TAG_ADR2
265 %token <tag> TAG_ADOP
268 %token <tag> TAG_AGNC
269 %token <tag> TAG_ALIA
270 %token <tag> TAG_ANCE
271 %token <tag> TAG_ANCI
272 %token <tag> TAG_ANUL
273 %token <tag> TAG_ASSO
274 %token <tag> TAG_AUTH
275 %token <tag> TAG_BAPL
276 %token <tag> TAG_BAPM
277 %token <tag> TAG_BARM
278 %token <tag> TAG_BASM
279 %token <tag> TAG_BIRT
280 %token <tag> TAG_BLES
281 %token <tag> TAG_BLOB
282 %token <tag> TAG_BURI
283 %token <tag> TAG_CALN
284 %token <tag> TAG_CAST
285 %token <tag> TAG_CAUS
286 %token <tag> TAG_CENS
287 %token <tag> TAG_CHAN
288 %token <tag> TAG_CHAR
289 %token <tag> TAG_CHIL
291 %token <tag> TAG_CHRA
292 %token <tag> TAG_CITY
293 %token <tag> TAG_CONC
294 %token <tag> TAG_CONF
295 %token <tag> TAG_CONL
296 %token <tag> TAG_CONT
297 %token <tag> TAG_COPR
298 %token <tag> TAG_CORP
299 %token <tag> TAG_CREM
300 %token <tag> TAG_CTRY
301 %token <tag> TAG_DATA
302 %token <tag> TAG_DATE
303 %token <tag> TAG_DEAT
304 %token <tag> TAG_DESC
305 %token <tag> TAG_DESI
306 %token <tag> TAG_DEST
308 %token <tag> TAG_DIVF
309 %token <tag> TAG_DSCR
310 %token <tag> TAG_EDUC
311 %token <tag> TAG_EMIG
312 %token <tag> TAG_ENDL
313 %token <tag> TAG_ENGA
314 %token <tag> TAG_EVEN
316 %token <tag> TAG_FAMC
317 %token <tag> TAG_FAMF
318 %token <tag> TAG_FAMS
319 %token <tag> TAG_FCOM
320 %token <tag> TAG_FILE
321 %token <tag> TAG_FORM
322 %token <tag> TAG_GEDC
323 %token <tag> TAG_GIVN
324 %token <tag> TAG_GRAD
325 %token <tag> TAG_HEAD
326 %token <tag> TAG_HUSB
327 %token <tag> TAG_IDNO
328 %token <tag> TAG_IMMI
329 %token <tag> TAG_INDI
330 %token <tag> TAG_LANG
331 %token <tag> TAG_LEGA
332 %token <tag> TAG_MARB
333 %token <tag> TAG_MARC
334 %token <tag> TAG_MARL
335 %token <tag> TAG_MARR
336 %token <tag> TAG_MARS
337 %token <tag> TAG_MEDI
338 %token <tag> TAG_NAME
339 %token <tag> TAG_NATI
340 %token <tag> TAG_NATU
341 %token <tag> TAG_NCHI
342 %token <tag> TAG_NICK
344 %token <tag> TAG_NOTE
345 %token <tag> TAG_NPFX
346 %token <tag> TAG_NSFX
347 %token <tag> TAG_OBJE
348 %token <tag> TAG_OCCU
349 %token <tag> TAG_ORDI
350 %token <tag> TAG_ORDN
351 %token <tag> TAG_PAGE
352 %token <tag> TAG_PEDI
353 %token <tag> TAG_PHON
354 %token <tag> TAG_PLAC
355 %token <tag> TAG_POST
356 %token <tag> TAG_PROB
357 %token <tag> TAG_PROP
358 %token <tag> TAG_PUBL
359 %token <tag> TAG_QUAY
360 %token <tag> TAG_REFN
361 %token <tag> TAG_RELA
362 %token <tag> TAG_RELI
363 %token <tag> TAG_REPO
364 %token <tag> TAG_RESI
365 %token <tag> TAG_RESN
366 %token <tag> TAG_RETI
369 %token <tag> TAG_ROLE
371 %token <tag> TAG_SLGC
372 %token <tag> TAG_SLGS
373 %token <tag> TAG_SOUR
374 %token <tag> TAG_SPFX
376 %token <tag> TAG_STAE
377 %token <tag> TAG_STAT
378 %token <tag> TAG_SUBM
379 %token <tag> TAG_SUBN
380 %token <tag> TAG_SURN
381 %token <tag> TAG_TEMP
382 %token <tag> TAG_TEXT
383 %token <tag> TAG_TIME
384 %token <tag> TAG_TITL
385 %token <tag> TAG_TRLR
386 %token <tag> TAG_TYPE
387 %token <tag> TAG_VERS
388 %token <tag> TAG_WIFE
389 %token <tag> TAG_WILL
391 %type <tag> anystdtag
392 %type <tag> anytoptag
393 %type <tag> fam_event_tag
394 %type <tag> indiv_attr_tag
395 %type <tag> indiv_birt_tag
396 %type <tag> indiv_gen_tag
397 %type <tag> lio_bapl_tag
398 %type <string> line_item
399 %type <string> line_value
400 %type <string> mand_line_item
401 %type <string> mand_pointer
402 %type <string> note_line_item
403 %type <string> anychar
404 %type <string> opt_xref
405 %type <string> opt_value
406 %type <string> opt_line_item
407 %type <ctxt> head_sect
411 file : head_sect records trlr_sect
412 { if (fail == 1) YYABORT; }
415 records : /* empty */
430 /*********************************************************************/
432 /*********************************************************************/
433 head_sect : OPEN DELIM TAG_HEAD
434 { $<ctxt>$ = start_record(REC_HEAD, $1, GEDCOM_MAKE_NULL(), $3);
435 START(HEAD, $<ctxt>$) }
437 { if (compat_mode(C_FTREE))
438 CHECK3(SOUR, GEDC, CHAR)
440 CHECK4(SOUR, SUBM, GEDC, CHAR)
443 { end_record(REC_HEAD, $<ctxt>4); }
446 head_subs : /* empty */
450 head_sub : head_sour_sect { OCCUR2(SOUR, 1, 1) }
451 | head_dest_sect { OCCUR2(DEST, 0, 1) }
452 | head_date_sect { OCCUR2(DATE, 0, 1) }
453 | head_subm_sect { OCCUR2(SUBM, 1, 1) }
454 | head_subn_sect { OCCUR2(SUBN, 0, 1) }
455 | head_file_sect { OCCUR2(FILE, 0, 1) }
456 | head_copr_sect { OCCUR2(COPR, 0, 1) }
457 | head_gedc_sect { OCCUR2(GEDC, 1, 1) }
458 | head_char_sect { OCCUR2(CHAR, 1, 1) }
459 | head_lang_sect { OCCUR2(LANG, 0, 1) }
460 | head_plac_sect { OCCUR2(PLAC, 0, 1) }
461 | head_note_sect { OCCUR2(NOTE, 0, 1) }
466 head_sour_sect : OPEN DELIM TAG_SOUR mand_line_item
467 { set_compatibility($4);
468 $<ctxt>$ = start_element(ELT_HEAD_SOUR, PARENT,
470 GEDCOM_MAKE_STRING($4));
471 START(SOUR, $<ctxt>$)
476 { end_element(ELT_HEAD_SOUR, PARENT, $<ctxt>5, NULL); }
479 head_sour_subs : /* empty */
480 | head_sour_subs head_sour_sub
483 head_sour_sub : head_sour_vers_sect { OCCUR2(VERS, 0, 1) }
484 | head_sour_name_sect { OCCUR2(NAME, 0, 1) }
485 | head_sour_corp_sect { OCCUR2(CORP, 0, 1) }
486 | head_sour_data_sect { OCCUR2(DATA, 0, 1) }
490 head_sour_vers_sect : OPEN DELIM TAG_VERS mand_line_item
491 { $<ctxt>$ = start_element(ELT_HEAD_SOUR_VERS, PARENT,
493 GEDCOM_MAKE_STRING($4));
494 START(VERS, $<ctxt>$)
499 { end_element(ELT_HEAD_SOUR_VERS,
500 PARENT, $<ctxt>5, NULL);
503 head_sour_name_sect : OPEN DELIM TAG_NAME mand_line_item
504 { $<ctxt>$ = start_element(ELT_HEAD_SOUR_NAME, PARENT,
506 GEDCOM_MAKE_STRING($4));
507 START(NAME, $<ctxt>$)
512 { end_element(ELT_HEAD_SOUR_NAME,
513 PARENT, $<ctxt>5, NULL);
516 head_sour_corp_sect : OPEN DELIM TAG_CORP mand_line_item
517 { $<ctxt>$ = start_element(ELT_HEAD_SOUR_CORP, PARENT,
519 GEDCOM_MAKE_STRING($4));
520 START(CORP, $<ctxt>$)
525 { end_element(ELT_HEAD_SOUR_CORP,
526 PARENT, $<ctxt>5, NULL);
530 head_sour_corp_subs : /* empty */
531 | head_sour_corp_subs head_sour_corp_sub
534 head_sour_corp_sub : addr_struc_sub /* 0:1 */
538 head_sour_data_sect : OPEN DELIM TAG_DATA mand_line_item
539 { $<ctxt>$ = start_element(ELT_HEAD_SOUR_DATA, PARENT,
541 GEDCOM_MAKE_STRING($4));
542 START(DATA, $<ctxt>$)
547 { end_element(ELT_HEAD_SOUR_DATA,
548 PARENT, $<ctxt>5, NULL);
552 head_sour_data_subs : /* empty */
553 | head_sour_data_subs head_sour_data_sub
556 head_sour_data_sub : head_sour_data_date_sect { OCCUR2(DATE, 0, 1) }
557 | head_sour_data_copr_sect { OCCUR2(COPR, 0, 1) }
561 head_sour_data_date_sect : OPEN DELIM TAG_DATE mand_line_item
562 { struct date_value dv = gedcom_parse_date($4);
563 $<ctxt>$ = start_element(ELT_HEAD_SOUR_DATA_DATE,
565 GEDCOM_MAKE_DATE(dv));
566 START(DATE, $<ctxt>$)
571 { end_element(ELT_HEAD_SOUR_DATA_DATE,
572 PARENT, $<ctxt>5, NULL);
575 head_sour_data_copr_sect : OPEN DELIM TAG_COPR mand_line_item
576 { $<ctxt>$ = start_element(ELT_HEAD_SOUR_DATA_COPR,
578 GEDCOM_MAKE_STRING($4));
579 START(COPR, $<ctxt>$)
584 { end_element(ELT_HEAD_SOUR_DATA_COPR,
585 PARENT, $<ctxt>5, NULL);
590 head_dest_sect : OPEN DELIM TAG_DEST mand_line_item
591 { $<ctxt>$ = start_element(ELT_HEAD_DEST,
593 GEDCOM_MAKE_STRING($4));
594 START(DEST, $<ctxt>$)
599 { end_element(ELT_HEAD_DEST,
600 PARENT, $<ctxt>5, NULL);
605 head_date_sect : OPEN DELIM TAG_DATE mand_line_item
606 { struct date_value dv = gedcom_parse_date($4);
607 $<ctxt>$ = start_element(ELT_HEAD_DATE,
609 GEDCOM_MAKE_DATE(dv));
610 START(DATE, $<ctxt>$)
615 { end_element(ELT_HEAD_DATE,
616 PARENT, $<ctxt>5, NULL);
620 head_date_subs : /* empty */
621 | head_date_subs head_date_sub
624 head_date_sub : head_date_time_sect { OCCUR2(TIME, 0, 1) }
628 head_date_time_sect : OPEN DELIM TAG_TIME mand_line_item
629 { $<ctxt>$ = start_element(ELT_HEAD_DATE_TIME,
631 GEDCOM_MAKE_STRING($4));
632 START(TIME, $<ctxt>$)
637 { end_element(ELT_HEAD_DATE_TIME,
638 PARENT, $<ctxt>5, NULL);
643 head_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
644 { $<ctxt>$ = start_element(ELT_HEAD_SUBM,
646 GEDCOM_MAKE_STRING($4));
647 START(SUBM, $<ctxt>$)
652 { end_element(ELT_HEAD_SUBM,
653 PARENT, $<ctxt>5, NULL);
657 head_subn_sect : OPEN DELIM TAG_SUBN mand_pointer
658 { $<ctxt>$ = start_element(ELT_HEAD_SUBN,
660 GEDCOM_MAKE_STRING($4));
661 START(SUBN, $<ctxt>$)
666 { end_element(ELT_HEAD_SUBN,
667 PARENT, $<ctxt>5, NULL);
671 head_file_sect : OPEN DELIM TAG_FILE mand_line_item
672 { $<ctxt>$ = start_element(ELT_HEAD_FILE,
674 GEDCOM_MAKE_STRING($4));
675 START(FILE, $<ctxt>$)
680 { end_element(ELT_HEAD_FILE, PARENT, $<ctxt>5, NULL);
684 head_copr_sect : OPEN DELIM TAG_COPR mand_line_item
685 { $<ctxt>$ = start_element(ELT_HEAD_COPR,
687 GEDCOM_MAKE_STRING($4));
688 START(COPR, $<ctxt>$)
693 { end_element(ELT_HEAD_COPR, PARENT, $<ctxt>5, NULL);
697 head_gedc_sect : OPEN DELIM TAG_GEDC
698 { $<ctxt>$ = start_element(ELT_HEAD_GEDC,
699 PARENT, $1, $3, NULL,
701 START(GEDC, $<ctxt>$)
704 { CHECK2(VERS, FORM) }
706 { end_element(ELT_HEAD_GEDC, PARENT, $<ctxt>4, NULL);
710 head_gedc_subs : /* empty */
711 | head_gedc_subs head_gedc_sub
714 head_gedc_sub : head_gedc_vers_sect { OCCUR2(VERS, 1, 1) }
715 | head_gedc_form_sect { OCCUR2(FORM, 1, 1) }
718 head_gedc_vers_sect : OPEN DELIM TAG_VERS mand_line_item
719 { $<ctxt>$ = start_element(ELT_HEAD_GEDC_VERS,
721 GEDCOM_MAKE_STRING($4));
722 START(VERS, $<ctxt>$)
727 { end_element(ELT_HEAD_GEDC_VERS,
728 PARENT, $<ctxt>5, NULL);
731 head_gedc_form_sect : OPEN DELIM TAG_FORM mand_line_item
732 { $<ctxt>$ = start_element(ELT_HEAD_GEDC_FORM,
734 GEDCOM_MAKE_STRING($4));
735 START(FORM, $<ctxt>$)
740 { end_element(ELT_HEAD_GEDC_FORM,
741 PARENT, $<ctxt>5, NULL);
746 head_char_sect : OPEN DELIM TAG_CHAR mand_line_item
747 { if (open_conv_to_internal($4) == 0) YYERROR;
748 $<ctxt>$ = start_element(ELT_HEAD_CHAR,
750 GEDCOM_MAKE_STRING($4));
751 START(CHAR, $<ctxt>$)
756 { end_element(ELT_HEAD_CHAR, PARENT, $<ctxt>5, NULL);
760 head_char_subs : /* empty */
761 | head_char_subs head_char_sub
764 head_char_sub : head_char_vers_sect { OCCUR2(VERS, 0, 1) }
767 head_char_vers_sect : OPEN DELIM TAG_VERS mand_line_item
768 { $<ctxt>$ = start_element(ELT_HEAD_CHAR_VERS,
770 GEDCOM_MAKE_STRING($4));
771 START(VERS, $<ctxt>$)
776 { end_element(ELT_HEAD_CHAR_VERS,
777 PARENT, $<ctxt>5, NULL);
782 head_lang_sect : OPEN DELIM TAG_LANG mand_line_item
783 { $<ctxt>$ = start_element(ELT_HEAD_LANG,
785 GEDCOM_MAKE_STRING($4));
786 START(LANG, $<ctxt>$)
791 { end_element(ELT_HEAD_LANG, PARENT, $<ctxt>5, NULL);
795 head_plac_sect : OPEN DELIM TAG_PLAC
796 { $<ctxt>$ = start_element(ELT_HEAD_PLAC,
797 PARENT, $1, $3, NULL,
799 START(PLAC, $<ctxt>$)
804 { end_element(ELT_HEAD_PLAC, PARENT, $<ctxt>4, NULL);
808 head_plac_subs : /* empty */
809 | head_plac_subs head_plac_sub
812 head_plac_sub : head_plac_form_sect { OCCUR2(FORM, 1, 1) }
815 head_plac_form_sect : OPEN DELIM TAG_FORM mand_line_item
816 { $<ctxt>$ = start_element(ELT_HEAD_PLAC_FORM,
818 GEDCOM_MAKE_STRING($4));
819 START(FORM, $<ctxt>$)
824 { end_element(ELT_HEAD_PLAC_FORM,
825 PARENT, $<ctxt>5, NULL);
830 head_note_sect : OPEN DELIM TAG_NOTE mand_line_item
831 { $<ctxt>$ = start_element(ELT_HEAD_NOTE,
833 GEDCOM_MAKE_STRING($4));
834 START(NOTE, $<ctxt>$)
839 { end_element(ELT_HEAD_NOTE, PARENT, $<ctxt>5, NULL);
843 head_note_subs : /* empty */
844 | head_note_subs head_note_sub
847 head_note_sub : continuation_sub /* 0:M */
851 /*********************************************************************/
853 /*********************************************************************/
854 /* Don't need callbacks here, there is no information... */
855 trlr_sect : OPEN DELIM TAG_TRLR CLOSE { }
858 /*********************************************************************/
859 /**** Family record ****/
860 /*********************************************************************/
861 fam_rec : OPEN DELIM POINTER DELIM TAG_FAM
862 { $<ctxt>$ = start_record(REC_FAM,
863 $1, GEDCOM_MAKE_STRING($3), $5);
864 START(FAM, $<ctxt>$) }
868 { end_record(REC_FAM, $<ctxt>6); }
871 fam_subs : /* empty */
875 fam_sub : fam_event_struc_sub /* 0:M */
876 | fam_husb_sect { OCCUR2(HUSB, 0, 1) }
877 | fam_wife_sect { OCCUR2(WIFE, 0, 1) }
878 | fam_chil_sect /* 0:M */
879 | fam_nchi_sect { OCCUR2(NCHI, 0, 1) }
880 | fam_subm_sect /* 0:M */
881 | lds_spouse_seal_sub /* 0:M */
882 | source_cit_sub /* 0:M */
883 | multim_link_sub /* 0:M */
884 | note_struc_sub /* 0:M */
885 | ident_struc_sub /* 0:1 */
886 | change_date_sub /* 0:1 */
891 fam_husb_sect : OPEN DELIM TAG_HUSB mand_pointer
892 { $<ctxt>$ = start_element(ELT_FAM_HUSB,
894 GEDCOM_MAKE_STRING($4));
895 START(HUSB, $<ctxt>$)
900 { end_element(ELT_FAM_HUSB, PARENT, $<ctxt>5, NULL);
905 fam_wife_sect : OPEN DELIM TAG_WIFE mand_pointer
906 { $<ctxt>$ = start_element(ELT_FAM_WIFE,
908 GEDCOM_MAKE_STRING($4));
909 START(WIFE, $<ctxt>$)
914 { end_element(ELT_FAM_WIFE, PARENT, $<ctxt>5, NULL);
919 fam_chil_sect : OPEN DELIM TAG_CHIL mand_pointer
920 { $<ctxt>$ = start_element(ELT_FAM_CHIL,
922 GEDCOM_MAKE_STRING($4));
923 START(CHIL, $<ctxt>$)
928 { end_element(ELT_FAM_CHIL, PARENT, $<ctxt>5, NULL);
933 fam_nchi_sect : OPEN DELIM TAG_NCHI mand_line_item
934 { $<ctxt>$ = start_element(ELT_FAM_NCHI,
936 GEDCOM_MAKE_STRING($4));
937 START(NCHI, $<ctxt>$)
942 { end_element(ELT_FAM_NCHI, PARENT, $<ctxt>5, NULL);
947 fam_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
948 { $<ctxt>$ = start_element(ELT_FAM_SUBM,
950 GEDCOM_MAKE_STRING($4));
951 START(SUBM, $<ctxt>$)
956 { end_element(ELT_FAM_SUBM, PARENT, $<ctxt>5, NULL);
960 /*********************************************************************/
961 /**** Individual record ****/
962 /*********************************************************************/
963 indiv_rec : OPEN DELIM POINTER DELIM TAG_INDI
964 { $<ctxt>$ = start_record(REC_INDI,
965 $1, GEDCOM_MAKE_STRING($3), $5);
966 START(INDI, $<ctxt>$) }
970 { end_record(REC_INDI, $<ctxt>6); }
973 indi_subs : /* empty */
977 indi_sub : indi_resn_sect { OCCUR2(RESN, 0, 1) }
978 | pers_name_struc_sub /* 0:M */
979 | indi_sex_sect { OCCUR2(SEX, 0, 1) }
980 | indiv_even_struc_sub /* 0:M */
981 | indiv_attr_struc_sub /* 0:M */
982 | lds_indiv_ord_sub /* 0:M */
983 | chi_fam_link_sub /* 0:M */
984 | spou_fam_link_sub /* 0:M */
985 | indi_subm_sect /* 0:M */
986 | assoc_struc_sub /* 0:M */
987 | indi_alia_sect /* 0:M */
988 | indi_anci_sect /* 0:M */
989 | indi_desi_sect /* 0:M */
990 | source_cit_sub /* 0:M */
991 | multim_link_sub /* 0:M */
992 | note_struc_sub /* 0:M */
993 | indi_rfn_sect { OCCUR2(RFN, 0, 1) }
994 | indi_afn_sect /* 0:M */
995 | ident_struc_sub /* 0:1 */
996 | change_date_sub /* 0:1 */
997 | ftree_addr_sect { if (!compat_mode(C_FTREE))
1004 indi_resn_sect : OPEN DELIM TAG_RESN mand_line_item
1005 { $<ctxt>$ = start_element(ELT_INDI_RESN,
1007 GEDCOM_MAKE_STRING($4));
1008 START(RESN, $<ctxt>$)
1013 { end_element(ELT_INDI_RESN, PARENT, $<ctxt>5, NULL);
1018 indi_sex_sect : OPEN DELIM TAG_SEX mand_line_item
1019 { $<ctxt>$ = start_element(ELT_INDI_SEX,
1021 GEDCOM_MAKE_STRING($4));
1022 START(SEX, $<ctxt>$)
1027 { end_element(ELT_INDI_SEX, PARENT, $<ctxt>5, NULL);
1032 indi_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
1033 { $<ctxt>$ = start_element(ELT_INDI_SUBM,
1035 GEDCOM_MAKE_STRING($4));
1036 START(SUBM, $<ctxt>$)
1041 { end_element(ELT_INDI_SUBM, PARENT, $<ctxt>5, NULL);
1046 indi_alia_sect : OPEN DELIM TAG_ALIA mand_pointer
1047 { $<ctxt>$ = start_element(ELT_INDI_ALIA,
1049 GEDCOM_MAKE_STRING($4));
1050 START(ALIA, $<ctxt>$)
1055 { end_element(ELT_INDI_ALIA, PARENT, $<ctxt>5, NULL);
1060 indi_anci_sect : OPEN DELIM TAG_ANCI mand_pointer
1061 { $<ctxt>$ = start_element(ELT_INDI_ANCI,
1063 GEDCOM_MAKE_STRING($4));
1064 START(ANCI, $<ctxt>$)
1069 { end_element(ELT_INDI_ANCI, PARENT, $<ctxt>5, NULL);
1074 indi_desi_sect : OPEN DELIM TAG_DESI mand_pointer
1075 { $<ctxt>$ = start_element(ELT_INDI_DESI,
1077 GEDCOM_MAKE_STRING($4));
1078 START(DESI, $<ctxt>$)
1083 { end_element(ELT_INDI_DESI, PARENT, $<ctxt>5, NULL);
1088 indi_rfn_sect : OPEN DELIM TAG_RFN mand_line_item
1089 { $<ctxt>$ = start_element(ELT_INDI_RFN,
1091 GEDCOM_MAKE_STRING($4));
1092 START(RFN, $<ctxt>$)
1097 { end_element(ELT_INDI_RFN, PARENT, $<ctxt>5, NULL);
1102 indi_afn_sect : OPEN DELIM TAG_AFN mand_line_item
1103 { $<ctxt>$ = start_element(ELT_INDI_AFN,
1105 GEDCOM_MAKE_STRING($4));
1106 START(AFN, $<ctxt>$)
1111 { end_element(ELT_INDI_AFN, PARENT, $<ctxt>5, NULL);
1115 /* INDI.ADDR (Only for 'ftree' compatibility) */
1116 ftree_addr_sect : OPEN DELIM TAG_ADDR opt_line_item
1117 { START(ADDR, NULL) } no_std_subs { CHECK0 } CLOSE { }
1119 /*********************************************************************/
1120 /**** Multimedia record ****/
1121 /*********************************************************************/
1122 multim_rec : OPEN DELIM POINTER DELIM TAG_OBJE
1123 { $<ctxt>$ = start_record(REC_OBJE,
1124 $1, GEDCOM_MAKE_STRING($3), $5);
1125 START(OBJE, $<ctxt>$) }
1127 { CHECK2(FORM, BLOB) }
1129 { end_record(REC_OBJE, $<ctxt>6); }
1132 obje_subs : /* empty */
1133 | obje_subs obje_sub
1136 obje_sub : obje_form_sect { OCCUR2(FORM, 1, 1) }
1137 | obje_titl_sect { OCCUR2(TITL, 0, 1) }
1138 | note_struc_sub /* 0:M */
1139 | obje_blob_sect { OCCUR2(BLOB, 1, 1) }
1140 | obje_obje_sect { OCCUR2(OBJE, 0, 1) }
1141 | ident_struc_sub /* 0:1 */
1142 | change_date_sub /* 0:1 */
1147 obje_form_sect : OPEN DELIM TAG_FORM mand_line_item
1148 { $<ctxt>$ = start_element(ELT_OBJE_FORM,
1150 GEDCOM_MAKE_STRING($4));
1151 START(FORM, $<ctxt>$)
1156 { end_element(ELT_OBJE_FORM, PARENT, $<ctxt>5, NULL);
1161 obje_titl_sect : OPEN DELIM TAG_TITL mand_line_item
1162 { $<ctxt>$ = start_element(ELT_OBJE_TITL,
1164 GEDCOM_MAKE_STRING($4));
1165 START(TITL, $<ctxt>$)
1170 { end_element(ELT_OBJE_TITL, PARENT, $<ctxt>5, NULL);
1175 obje_blob_sect : OPEN DELIM TAG_BLOB
1176 { $<ctxt>$ = start_element(ELT_OBJE_BLOB,
1177 PARENT, $1, $3, NULL,
1178 GEDCOM_MAKE_NULL());
1179 START(BLOB, $<ctxt>$)
1184 { end_element(ELT_OBJE_BLOB, PARENT, $<ctxt>4, NULL);
1188 obje_blob_subs : /* empty */
1189 | obje_blob_subs obje_blob_sub
1192 obje_blob_sub : obje_blob_cont_sect { OCCUR1(CONT, 1) }
1196 obje_blob_cont_sect : OPEN DELIM TAG_CONT mand_line_item
1197 { $<ctxt>$ = start_element(ELT_OBJE_BLOB_CONT,
1199 GEDCOM_MAKE_STRING($4));
1200 START(CONT, $<ctxt>$)
1205 { end_element(ELT_OBJE_BLOB_CONT, PARENT,
1211 obje_obje_sect : OPEN DELIM TAG_OBJE mand_pointer
1212 { $<ctxt>$ = start_element(ELT_OBJE_OBJE,
1214 GEDCOM_MAKE_STRING($4));
1215 START(OBJE, $<ctxt>$)
1220 { end_element(ELT_OBJE_OBJE, PARENT, $<ctxt>5, NULL);
1224 /*********************************************************************/
1225 /**** Note record ****/
1226 /*********************************************************************/
1227 note_rec : OPEN DELIM POINTER DELIM TAG_NOTE note_line_item
1228 { $<ctxt>$ = start_record(REC_NOTE,
1229 $1, GEDCOM_MAKE_STRING($3), $5);
1230 START(NOTE, $<ctxt>$) }
1234 { end_record(REC_NOTE, $<ctxt>6); }
1237 note_line_item : /* empty */
1238 { if (!compat_mode(C_FTREE)) {
1239 gedcom_error(_("Missing value")); YYERROR;
1243 { gedcom_debug_print("==Val: %s==", $2);
1247 note_subs : /* empty */
1248 | note_subs note_sub
1251 note_sub : continuation_sub /* 0:M */
1252 | source_cit_sub /* 0:M */
1253 | ident_struc_sub /* 0:1 */
1254 | change_date_sub /* 0:1 */
1258 /*********************************************************************/
1259 /**** Repository record ****/
1260 /*********************************************************************/
1261 repos_rec : OPEN DELIM POINTER DELIM TAG_REPO
1262 { $<ctxt>$ = start_record(REC_REPO,
1263 $1, GEDCOM_MAKE_STRING($3), $5);
1264 START(REPO, $<ctxt>$) }
1268 { end_record(REC_REPO, $<ctxt>6); }
1271 repo_subs : /* empty */
1272 | repo_subs repo_sub
1275 repo_sub : repo_name_sect { OCCUR2(NAME, 0, 1) }
1276 | addr_struc_sub /* 0:1 */
1277 | note_struc_sub /* 0:M */
1278 | ident_struc_sub /* 0:1 */
1279 | change_date_sub /* 0:1 */
1284 repo_name_sect : OPEN DELIM TAG_NAME mand_line_item
1285 { $<ctxt>$ = start_element(ELT_REPO_NAME,
1287 GEDCOM_MAKE_STRING($4));
1288 START(NAME, $<ctxt>$)
1293 { end_element(ELT_REPO_NAME, PARENT, $<ctxt>5, NULL);
1297 /*********************************************************************/
1298 /**** Source record ****/
1299 /*********************************************************************/
1300 source_rec : OPEN DELIM POINTER DELIM TAG_SOUR
1301 { $<ctxt>$ = start_record(REC_SOUR,
1302 $1, GEDCOM_MAKE_STRING($3), $5);
1303 START(SOUR, $<ctxt>$) }
1307 { end_record(REC_SOUR, $<ctxt>6); }
1310 sour_subs : /* empty */
1311 | sour_subs sour_sub
1314 sour_sub : sour_data_sect { OCCUR2(DATA, 0, 1) }
1315 | sour_auth_sect { OCCUR2(AUTH, 0, 1) }
1316 | sour_titl_sect { OCCUR2(TITL, 0, 1) }
1317 | sour_abbr_sect { OCCUR2(ABBR, 0, 1) }
1318 | sour_publ_sect { OCCUR2(PUBL, 0, 1) }
1319 | sour_text_sect { OCCUR2(TEXT, 0, 1) }
1320 | source_repos_cit_sub /* 0:1 */
1321 | multim_link_sub /* 0:M */
1322 | note_struc_sub /* 0:M */
1323 | ident_struc_sub /* 0:1 */
1324 | change_date_sub /* 0:1 */
1329 sour_data_sect : OPEN DELIM TAG_DATA
1330 { $<ctxt>$ = start_element(ELT_SOUR_DATA,
1331 PARENT, $1, $3, NULL,
1332 GEDCOM_MAKE_NULL());
1333 START(DATA, $<ctxt>$)
1338 { end_element(ELT_SOUR_DATA, PARENT, $<ctxt>4, NULL);
1342 sour_data_subs : /* empty */
1343 | sour_data_subs sour_data_sub
1346 sour_data_sub : sour_data_even_sect /* 0:M */
1347 | sour_data_agnc_sect { OCCUR2(AGNC, 0, 1) }
1348 | note_struc_sub /* 0:M */
1352 sour_data_even_sect : OPEN DELIM TAG_EVEN mand_line_item
1353 { $<ctxt>$ = start_element(ELT_SOUR_DATA_EVEN,
1355 GEDCOM_MAKE_STRING($4));
1356 START(EVEN, $<ctxt>$)
1361 { end_element(ELT_SOUR_DATA_EVEN, PARENT,
1366 sour_data_even_subs : /* empty */
1367 | sour_data_even_subs sour_data_even_sub
1370 sour_data_even_sub : sour_data_even_date_sect { OCCUR2(DATE, 0, 1) }
1371 | sour_data_even_plac_sect { OCCUR2(PLAC, 0, 1) }
1375 sour_data_even_date_sect : OPEN DELIM TAG_DATE mand_line_item
1376 { struct date_value dv = gedcom_parse_date($4);
1377 $<ctxt>$ = start_element(ELT_SOUR_DATA_EVEN_DATE,
1379 GEDCOM_MAKE_DATE(dv));
1380 START(DATE, $<ctxt>$)
1385 { end_element(ELT_SOUR_DATA_EVEN_DATE, PARENT,
1390 sour_data_even_plac_sect : OPEN DELIM TAG_PLAC mand_line_item
1391 { $<ctxt>$ = start_element(ELT_SOUR_DATA_EVEN_PLAC,
1393 GEDCOM_MAKE_STRING($4));
1394 START(PLAC, $<ctxt>$)
1399 { end_element(ELT_SOUR_DATA_EVEN_PLAC, PARENT,
1404 sour_data_agnc_sect : OPEN DELIM TAG_AGNC mand_line_item
1405 { $<ctxt>$ = start_element(ELT_SOUR_DATA_AGNC,
1407 GEDCOM_MAKE_STRING($4));
1408 START(AGNC, $<ctxt>$)
1413 { end_element(ELT_SOUR_DATA_AGNC, PARENT,
1419 sour_auth_sect : OPEN DELIM TAG_AUTH mand_line_item
1420 { $<ctxt>$ = start_element(ELT_SOUR_AUTH,
1422 GEDCOM_MAKE_STRING($4));
1423 START(AUTH, $<ctxt>$)
1428 { end_element(ELT_SOUR_AUTH, PARENT, $<ctxt>5, NULL);
1432 sour_auth_subs : /* empty */
1433 | sour_auth_subs sour_auth_sub
1436 sour_auth_sub : continuation_sub /* 0:M */
1441 sour_titl_sect : OPEN DELIM TAG_TITL mand_line_item
1442 { $<ctxt>$ = start_element(ELT_SOUR_TITL,
1444 GEDCOM_MAKE_STRING($4));
1445 START(TITL, $<ctxt>$)
1450 { end_element(ELT_SOUR_TITL, PARENT, $<ctxt>5, NULL);
1454 sour_titl_subs : /* empty */
1455 | sour_titl_subs sour_titl_sub
1458 sour_titl_sub : continuation_sub /* 0:M */
1463 sour_abbr_sect : OPEN DELIM TAG_ABBR mand_line_item
1464 { $<ctxt>$ = start_element(ELT_SOUR_ABBR,
1466 GEDCOM_MAKE_STRING($4));
1467 START(ABBR, $<ctxt>$)
1472 { end_element(ELT_SOUR_ABBR, PARENT, $<ctxt>5, NULL);
1477 sour_publ_sect : OPEN DELIM TAG_PUBL mand_line_item
1478 { $<ctxt>$ = start_element(ELT_SOUR_PUBL,
1480 GEDCOM_MAKE_STRING($4));
1481 START(PUBL, $<ctxt>$)
1486 { end_element(ELT_SOUR_PUBL, PARENT, $<ctxt>5, NULL);
1490 sour_publ_subs : /* empty */
1491 | sour_publ_subs sour_publ_sub
1494 sour_publ_sub : continuation_sub /* 0:M */
1499 sour_text_sect : OPEN DELIM TAG_TEXT mand_line_item
1500 { $<ctxt>$ = start_element(ELT_SOUR_TEXT,
1502 GEDCOM_MAKE_STRING($4));
1503 START(TEXT, $<ctxt>$)
1508 { end_element(ELT_SOUR_TEXT, PARENT, $<ctxt>5, NULL);
1512 sour_text_subs : /* empty */
1513 | sour_text_subs sour_text_sub
1516 sour_text_sub : continuation_sub /* 0:M */
1520 /*********************************************************************/
1521 /**** Submission record ****/
1522 /*********************************************************************/
1523 submis_rec : OPEN DELIM POINTER DELIM TAG_SUBN
1524 { $<ctxt>$ = start_record(REC_SUBN,
1525 $1, GEDCOM_MAKE_STRING($3), $5);
1526 START(SUBN, $<ctxt>$) }
1530 { end_record(REC_SUBN, $<ctxt>6); }
1533 subn_subs : /* empty */
1534 | subn_subs subn_sub
1537 subn_sub : subn_subm_sect { OCCUR2(SUBM, 0, 1) }
1538 | subn_famf_sect { OCCUR2(FAMF, 0, 1) }
1539 | subn_temp_sect { OCCUR2(TEMP, 0, 1) }
1540 | subn_ance_sect { OCCUR2(ANCE, 0, 1) }
1541 | subn_desc_sect { OCCUR2(DESC, 0, 1) }
1542 | subn_ordi_sect { OCCUR2(ORDI, 0, 1) }
1543 | subn_rin_sect { OCCUR2(RIN, 0, 1) }
1548 subn_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
1549 { $<ctxt>$ = start_element(ELT_SUBN_SUBM,
1551 GEDCOM_MAKE_STRING($4));
1552 START(SUBM, $<ctxt>$)
1557 { end_element(ELT_SUBN_SUBM, PARENT, $<ctxt>5, NULL);
1562 subn_famf_sect : OPEN DELIM TAG_FAMF mand_line_item
1563 { $<ctxt>$ = start_element(ELT_SUBN_FAMF,
1565 GEDCOM_MAKE_STRING($4));
1566 START(FAMF, $<ctxt>$)
1571 { end_element(ELT_SUBN_FAMF, PARENT, $<ctxt>5, NULL);
1576 subn_temp_sect : OPEN DELIM TAG_TEMP mand_line_item
1577 { $<ctxt>$ = start_element(ELT_SUBN_TEMP,
1579 GEDCOM_MAKE_STRING($4));
1580 START(TEMP, $<ctxt>$)
1585 { end_element(ELT_SUBN_TEMP, PARENT, $<ctxt>5, NULL);
1590 subn_ance_sect : OPEN DELIM TAG_ANCE mand_line_item
1591 { $<ctxt>$ = start_element(ELT_SUBN_ANCE,
1593 GEDCOM_MAKE_STRING($4));
1594 START(ANCE, $<ctxt>$)
1599 { end_element(ELT_SUBN_ANCE, PARENT, $<ctxt>5, NULL);
1604 subn_desc_sect : OPEN DELIM TAG_DESC mand_line_item
1605 { $<ctxt>$ = start_element(ELT_SUBN_DESC,
1607 GEDCOM_MAKE_STRING($4));
1608 START(DESC, $<ctxt>$)
1613 { end_element(ELT_SUBN_DESC, PARENT, $<ctxt>5, NULL);
1618 subn_ordi_sect : OPEN DELIM TAG_ORDI mand_line_item
1619 { $<ctxt>$ = start_element(ELT_SUBN_ORDI,
1621 GEDCOM_MAKE_STRING($4));
1622 START(ORDI, $<ctxt>$)
1627 { end_element(ELT_SUBN_ORDI, PARENT, $<ctxt>5, NULL);
1632 subn_rin_sect : OPEN DELIM TAG_RIN mand_line_item
1633 { $<ctxt>$ = start_element(ELT_SUBN_RIN,
1635 GEDCOM_MAKE_STRING($4));
1636 START(RIN, $<ctxt>$)
1641 { end_element(ELT_SUBN_RIN, PARENT, $<ctxt>5, NULL);
1645 /*********************************************************************/
1646 /**** Submitter record ****/
1647 /*********************************************************************/
1648 submit_rec : OPEN DELIM POINTER DELIM TAG_SUBM
1649 { $<ctxt>$ = start_record(REC_SUBM,
1650 $1, GEDCOM_MAKE_STRING($3), $5);
1651 START(SUBM, $<ctxt>$) }
1655 { end_record(REC_SUBM, $<ctxt>6); }
1658 subm_subs : /* empty */
1659 | subm_subs subm_sub
1662 subm_sub : subm_name_sect { OCCUR2(NAME, 0, 1) }
1663 | addr_struc_sub /* 0:1 */
1664 | multim_link_sub /* 0:M */
1665 | subm_lang_sect { OCCUR2(LANG, 0, 3) }
1666 | subm_rfn_sect { OCCUR2(RFN, 0, 1) }
1667 | subm_rin_sect { OCCUR2(RIN, 0, 1) }
1668 | change_date_sub /* 0:1 */
1673 subm_name_sect : OPEN DELIM TAG_NAME mand_line_item
1674 { $<ctxt>$ = start_element(ELT_SUBM_NAME,
1676 GEDCOM_MAKE_STRING($4));
1677 START(NAME, $<ctxt>$)
1682 { end_element(ELT_SUBM_NAME, PARENT, $<ctxt>5, NULL);
1687 subm_lang_sect : OPEN DELIM TAG_LANG mand_line_item
1688 { $<ctxt>$ = start_element(ELT_SUBM_LANG,
1690 GEDCOM_MAKE_STRING($4));
1691 START(LANG, $<ctxt>$)
1696 { end_element(ELT_SUBM_LANG, PARENT, $<ctxt>5, NULL);
1701 subm_rfn_sect : OPEN DELIM TAG_RFN mand_line_item
1702 { $<ctxt>$ = start_element(ELT_SUBM_RFN,
1704 GEDCOM_MAKE_STRING($4));
1705 START(RFN, $<ctxt>$)
1710 { end_element(ELT_SUBM_RFN, PARENT, $<ctxt>5, NULL);
1715 subm_rin_sect : OPEN DELIM TAG_RIN mand_line_item
1716 { $<ctxt>$ = start_element(ELT_SUBM_RIN,
1718 GEDCOM_MAKE_STRING($4));
1719 START(RIN, $<ctxt>$)
1724 { end_element(ELT_SUBM_RIN, PARENT, $<ctxt>5, NULL);
1728 /*********************************************************************/
1729 /**** Substructures ****/
1730 /*********************************************************************/
1732 /* ADDRESS STRUCTURE */
1733 addr_struc_sub : addr_sect { OCCUR2(ADDR, 0, 1) }
1734 | phon_sect { OCCUR2(PHON, 0, 3) }
1737 addr_sect : OPEN DELIM TAG_ADDR mand_line_item
1738 { $<ctxt>$ = start_element(ELT_SUB_ADDR,
1740 GEDCOM_MAKE_STRING($4));
1741 START(ADDR, $<ctxt>$)
1746 { end_element(ELT_SUB_ADDR, PARENT, $<ctxt>5, NULL);
1750 addr_subs : /* empty */
1751 | addr_subs addr_sub
1754 addr_sub : addr_cont_sect /* 0:M */
1755 | addr_adr1_sect { OCCUR2(ADR1, 0, 1) }
1756 | addr_adr2_sect { OCCUR2(ADR2, 0, 1) }
1757 | addr_city_sect { OCCUR2(CITY, 0, 1) }
1758 | addr_stae_sect { OCCUR2(STAE, 0, 1) }
1759 | addr_post_sect { OCCUR2(POST, 0, 1) }
1760 | addr_ctry_sect { OCCUR2(CTRY, 0, 1) }
1764 addr_cont_sect : OPEN DELIM TAG_CONT mand_line_item
1765 { $<ctxt>$ = start_element(ELT_SUB_ADDR_CONT,
1767 GEDCOM_MAKE_STRING($4));
1768 START(CONT, $<ctxt>$)
1773 { end_element(ELT_SUB_ADDR_CONT, PARENT, $<ctxt>5, NULL);
1776 addr_adr1_sect : OPEN DELIM TAG_ADR1 mand_line_item
1777 { $<ctxt>$ = start_element(ELT_SUB_ADDR_ADR1,
1779 GEDCOM_MAKE_STRING($4));
1780 START(ADR1, $<ctxt>$)
1785 { end_element(ELT_SUB_ADDR_ADR1, PARENT, $<ctxt>5, NULL);
1788 addr_adr2_sect : OPEN DELIM TAG_ADR2 mand_line_item
1789 { $<ctxt>$ = start_element(ELT_SUB_ADDR_ADR2,
1791 GEDCOM_MAKE_STRING($4));
1792 START(ADR2, $<ctxt>$)
1797 { end_element(ELT_SUB_ADDR_ADR2, PARENT, $<ctxt>5, NULL);
1800 addr_city_sect : OPEN DELIM TAG_CITY mand_line_item
1801 { $<ctxt>$ = start_element(ELT_SUB_ADDR_CITY,
1803 GEDCOM_MAKE_STRING($4));
1804 START(CITY, $<ctxt>$)
1809 { end_element(ELT_SUB_ADDR_CITY, PARENT, $<ctxt>5, NULL);
1812 addr_stae_sect : OPEN DELIM TAG_STAE mand_line_item
1813 { $<ctxt>$ = start_element(ELT_SUB_ADDR_STAE,
1815 GEDCOM_MAKE_STRING($4));
1816 START(STAE, $<ctxt>$)
1821 { end_element(ELT_SUB_ADDR_STAE, PARENT, $<ctxt>5, NULL);
1824 addr_post_sect : OPEN DELIM TAG_POST mand_line_item
1825 { $<ctxt>$ = start_element(ELT_SUB_ADDR_POST,
1827 GEDCOM_MAKE_STRING($4));
1828 START(POST, $<ctxt>$)
1833 { end_element(ELT_SUB_ADDR_POST, PARENT, $<ctxt>5, NULL);
1836 addr_ctry_sect : OPEN DELIM TAG_CTRY mand_line_item
1837 { $<ctxt>$ = start_element(ELT_SUB_ADDR_CTRY,
1839 GEDCOM_MAKE_STRING($4));
1840 START(CTRY, $<ctxt>$)
1845 { end_element(ELT_SUB_ADDR_CTRY, PARENT, $<ctxt>5, NULL);
1849 phon_sect : OPEN DELIM TAG_PHON mand_line_item
1850 { $<ctxt>$ = start_element(ELT_SUB_PHON,
1852 GEDCOM_MAKE_STRING($4));
1853 START(PHON, $<ctxt>$)
1858 { end_element(ELT_SUB_PHON, PARENT, $<ctxt>5, NULL);
1862 /* ASSOCIATION STRUCTURE */
1863 assoc_struc_sub : asso_sect /* 0:M */
1866 asso_sect : OPEN DELIM TAG_ASSO mand_pointer
1867 { $<ctxt>$ = start_element(ELT_SUB_ASSO,
1869 GEDCOM_MAKE_STRING($4));
1870 START(ASSO, $<ctxt>$)
1873 { CHECK2(TYPE,RELA) }
1875 { end_element(ELT_SUB_ASSO, PARENT, $<ctxt>5, NULL);
1879 asso_subs : /* empty */
1880 | asso_type_sect { OCCUR2(TYPE, 1, 1) }
1881 | asso_rela_sect { OCCUR2(RELA, 1, 1) }
1887 asso_type_sect : OPEN DELIM TAG_TYPE mand_line_item
1888 { $<ctxt>$ = start_element(ELT_SUB_ASSO_TYPE,
1890 GEDCOM_MAKE_STRING($4));
1891 START(TYPE, $<ctxt>$)
1896 { end_element(ELT_SUB_ASSO_TYPE, PARENT, $<ctxt>5, NULL);
1900 asso_rela_sect : OPEN DELIM TAG_RELA mand_line_item
1901 { $<ctxt>$ = start_element(ELT_SUB_ASSO_RELA,
1903 GEDCOM_MAKE_STRING($4));
1904 START(RELA, $<ctxt>$)
1909 { end_element(ELT_SUB_ASSO_RELA, PARENT, $<ctxt>5, NULL);
1914 change_date_sub : change_date_chan_sect { OCCUR2(CHAN, 0, 1) }
1917 change_date_chan_sect : OPEN DELIM TAG_CHAN
1918 { $<ctxt>$ = start_element(ELT_SUB_CHAN,
1919 PARENT, $1, $3, NULL,
1920 GEDCOM_MAKE_NULL());
1921 START(CHAN, $<ctxt>$)
1923 change_date_chan_subs
1926 { end_element(ELT_SUB_CHAN, PARENT, $<ctxt>4, NULL);
1930 change_date_chan_subs : /* empty */
1931 | change_date_chan_subs change_date_chan_sub
1934 change_date_chan_sub : change_date_date_sect { OCCUR2(DATE, 1, 1) }
1939 change_date_date_sect : OPEN DELIM TAG_DATE mand_line_item
1940 { struct date_value dv = gedcom_parse_date($4);
1941 $<ctxt>$ = start_element(ELT_SUB_CHAN_DATE,
1943 GEDCOM_MAKE_DATE(dv));
1944 START(DATE, $<ctxt>$) }
1945 change_date_date_subs
1948 { end_element(ELT_SUB_CHAN_DATE, PARENT, $<ctxt>5,
1953 change_date_date_subs : /* empty */
1954 | change_date_date_subs change_date_date_sub
1957 change_date_date_sub : change_date_date_time_sect { OCCUR2(TIME, 0, 1) }
1961 change_date_date_time_sect : OPEN DELIM TAG_TIME mand_line_item
1963 = start_element(ELT_SUB_CHAN_TIME,
1965 GEDCOM_MAKE_STRING($4));
1966 START(TIME, $<ctxt>$)
1971 { end_element(ELT_SUB_CHAN_TIME, PARENT, $<ctxt>5,
1976 /* CHILD TO FAMILY LINK */
1977 chi_fam_link_sub : famc_sect /* 0:M */
1980 famc_sect : OPEN DELIM TAG_FAMC mand_pointer
1981 { $<ctxt>$ = start_element(ELT_SUB_FAMC,
1983 GEDCOM_MAKE_STRING($4));
1984 START(FAMC, $<ctxt>$)
1989 { end_element(ELT_SUB_FAMC, PARENT, $<ctxt>5, NULL);
1993 famc_subs : /* empty */
1994 | famc_subs famc_sub
1997 famc_sub : famc_pedi_sect /* 0:M */
2002 famc_pedi_sect : OPEN DELIM TAG_PEDI mand_line_item
2003 { $<ctxt>$ = start_element(ELT_SUB_FAMC_PEDI,
2005 GEDCOM_MAKE_STRING($4));
2006 START(PEDI, $<ctxt>$)
2011 { end_element(ELT_SUB_FAMC_PEDI, PARENT, $<ctxt>5, NULL);
2015 /* CONTINUATION SUBSECTIONS */
2016 continuation_sub : cont_sect /* 0:M */
2017 | conc_sect /* 0:M */
2020 cont_sect : OPEN DELIM TAG_CONT mand_line_item
2021 { $<ctxt>$ = start_element(ELT_SUB_CONT,
2023 GEDCOM_MAKE_STRING($4));
2024 START(CONT, $<ctxt>$)
2029 { end_element(ELT_SUB_CONT, PARENT, $<ctxt>5, NULL);
2033 conc_sect : OPEN DELIM TAG_CONC mand_line_item
2034 { $<ctxt>$ = start_element(ELT_SUB_CONC,
2036 GEDCOM_MAKE_STRING($4));
2037 START(CONC, $<ctxt>$)
2042 { end_element(ELT_SUB_CONC, PARENT, $<ctxt>5, NULL);
2047 event_detail_sub : event_detail_type_sect { OCCUR2(TYPE, 0, 1) }
2048 | event_detail_date_sect { OCCUR2(DATE, 0, 1) }
2051 | event_detail_age_sect { OCCUR2(AGE, 0, 1) }
2052 | event_detail_agnc_sect { OCCUR2(AGNC, 0, 1) }
2053 | event_detail_caus_sect { OCCUR2(CAUS, 0, 1) }
2059 event_detail_type_sect : OPEN DELIM TAG_TYPE mand_line_item
2060 { $<ctxt>$ = start_element(ELT_SUB_EVT_TYPE,
2062 GEDCOM_MAKE_STRING($4));
2063 START(TYPE, $<ctxt>$)
2068 { end_element(ELT_SUB_EVT_TYPE, PARENT, $<ctxt>5,
2072 event_detail_date_sect : OPEN DELIM TAG_DATE mand_line_item
2073 { struct date_value dv = gedcom_parse_date($4);
2074 $<ctxt>$ = start_element(ELT_SUB_EVT_DATE,
2076 GEDCOM_MAKE_DATE(dv));
2077 START(DATE, $<ctxt>$)
2082 { end_element(ELT_SUB_EVT_DATE, PARENT, $<ctxt>5,
2086 event_detail_age_sect : OPEN DELIM TAG_AGE mand_line_item
2087 { $<ctxt>$ = start_element(ELT_SUB_EVT_AGE,
2089 GEDCOM_MAKE_STRING($4));
2090 START(AGE, $<ctxt>$)
2095 { end_element(ELT_SUB_EVT_AGE, PARENT, $<ctxt>5,
2099 event_detail_agnc_sect : OPEN DELIM TAG_AGNC mand_line_item
2100 { $<ctxt>$ = start_element(ELT_SUB_EVT_AGNC,
2102 GEDCOM_MAKE_STRING($4));
2103 START(AGNC, $<ctxt>$)
2108 { end_element(ELT_SUB_EVT_AGNC, PARENT, $<ctxt>5,
2112 event_detail_caus_sect : OPEN DELIM TAG_CAUS mand_line_item
2113 { $<ctxt>$ = start_element(ELT_SUB_EVT_CAUS,
2115 GEDCOM_MAKE_STRING($4));
2116 START(CAUS, $<ctxt>$)
2121 { end_element(ELT_SUB_EVT_CAUS, PARENT, $<ctxt>5,
2126 /* FAMILY EVENT STRUCTURE */
2127 fam_event_struc_sub : fam_event_sect
2128 | fam_gen_even_sect /* 0:M */
2131 fam_event_sect : OPEN DELIM fam_event_tag opt_value
2133 $<ctxt>$ = start_element(ELT_SUB_FAM_EVT,
2135 GEDCOM_MAKE_NULL_OR_STRING($4));
2136 /* set the parent context separately from START here */
2137 set_parentctxt($<ctxt>$);
2142 { end_element(ELT_SUB_FAM_EVT, PARENT, $<ctxt>5, NULL);
2146 fam_event_tag : TAG_ANUL { $$ = $1; START(ANUL, NULL) }
2147 | TAG_CENS { $$ = $1; START(CENS, NULL) }
2148 | TAG_DIV { $$ = $1; START(DIV, NULL) }
2149 | TAG_DIVF { $$ = $1; START(DIVF, NULL) }
2150 | TAG_ENGA { $$ = $1; START(ENGA, NULL) }
2151 | TAG_MARR { $$ = $1; START(MARR, NULL) }
2152 | TAG_MARB { $$ = $1; START(MARB, NULL) }
2153 | TAG_MARC { $$ = $1; START(MARC, NULL) }
2154 | TAG_MARL { $$ = $1; START(MARL, NULL) }
2155 | TAG_MARS { $$ = $1; START(MARS, NULL) }
2158 fam_event_subs : /* empty */
2159 | fam_event_subs fam_event_sub
2162 fam_event_sub : event_detail_sub
2163 | fam_even_husb_sect { OCCUR2(HUSB, 0, 1) }
2164 | fam_even_wife_sect { OCCUR2(WIFE, 0, 1) }
2168 fam_even_husb_sect : OPEN DELIM TAG_HUSB
2169 { $<ctxt>$ = start_element(ELT_SUB_FAM_EVT_HUSB,
2170 PARENT, $1, $3, NULL,
2171 GEDCOM_MAKE_NULL());
2172 START(HUSB, $<ctxt>$)
2177 { end_element(ELT_SUB_FAM_EVT_HUSB, PARENT, $<ctxt>4,
2182 fam_even_husb_subs : /* empty */
2183 | fam_even_husb_subs fam_even_husb_sub
2186 fam_even_husb_sub : fam_even_age_sect { OCCUR2(AGE, 1, 1) }
2190 fam_even_age_sect : OPEN DELIM TAG_AGE mand_line_item
2191 { $<ctxt>$ = start_element(ELT_SUB_FAM_EVT_AGE,
2193 GEDCOM_MAKE_STRING($4));
2194 START(AGE, $<ctxt>$)
2199 { end_element(ELT_SUB_FAM_EVT_AGE, PARENT, $<ctxt>5,
2204 fam_even_wife_sect : OPEN DELIM TAG_WIFE
2205 { $<ctxt>$ = start_element(ELT_SUB_FAM_EVT_WIFE,
2206 PARENT, $1, $3, NULL,
2207 GEDCOM_MAKE_NULL());
2208 START(WIFE, $<ctxt>$)
2213 { end_element(ELT_SUB_FAM_EVT_WIFE, PARENT, $<ctxt>4,
2218 fam_gen_even_sect : OPEN DELIM TAG_EVEN
2219 { $<ctxt>$ = start_element(ELT_SUB_FAM_EVT_EVEN,
2220 PARENT, $1, $3, NULL,
2221 GEDCOM_MAKE_NULL());
2222 START(EVEN, $<ctxt>$)
2227 { end_element(ELT_SUB_FAM_EVT_EVEN, PARENT, $<ctxt>4,
2232 fam_gen_even_subs : /* empty */
2233 | fam_gen_even_subs fam_gen_even_sub
2236 fam_gen_even_sub : event_detail_sub
2237 | fam_even_husb_sect { OCCUR2(HUSB, 0, 1) }
2238 | fam_even_wife_sect { OCCUR2(WIFE, 0, 1) }
2242 /* IDENTIFICATION STRUCTURE */
2243 ident_struc_sub : ident_refn_sect /* 0:M */
2244 | ident_rin_sect { OCCUR2(RIN, 0, 1) }
2247 ident_refn_sect : OPEN DELIM TAG_REFN mand_line_item
2248 { $<ctxt>$ = start_element(ELT_SUB_IDENT_REFN,
2250 GEDCOM_MAKE_STRING($4));
2251 START(REFN, $<ctxt>$)
2256 { end_element(ELT_SUB_IDENT_REFN, PARENT, $<ctxt>5,
2261 ident_refn_subs : /* empty */
2262 | ident_refn_subs ident_refn_sub
2265 ident_refn_sub : ident_refn_type_sect { OCCUR2(TYPE, 0, 1) }
2269 ident_refn_type_sect : OPEN DELIM TAG_TYPE mand_line_item
2270 { $<ctxt>$ = start_element(ELT_SUB_IDENT_REFN_TYPE,
2272 GEDCOM_MAKE_STRING($4));
2273 START(TYPE, $<ctxt>$)
2278 { end_element(ELT_SUB_IDENT_REFN_TYPE, PARENT, $<ctxt>5,
2283 ident_rin_sect : OPEN DELIM TAG_RIN mand_line_item
2284 { $<ctxt>$ = start_element(ELT_SUB_IDENT_RIN,
2286 GEDCOM_MAKE_STRING($4));
2287 START(RIN, $<ctxt>$)
2292 { end_element(ELT_SUB_IDENT_RIN, PARENT, $<ctxt>5,
2297 /* INDIVIDUAL ATTRIBUTE STRUCTURE */
2298 indiv_attr_struc_sub : indiv_attr_sect /* 0:M */
2299 | indiv_resi_sect /* 0:M */
2302 indiv_attr_sect : OPEN DELIM indiv_attr_tag mand_line_item
2303 { $<ctxt>$ = start_element(ELT_SUB_INDIV_ATTR,
2305 GEDCOM_MAKE_STRING($4));
2306 /* set the parent context separately from START here */
2307 set_parentctxt($<ctxt>$);
2309 indiv_attr_event_subs
2312 { end_element(ELT_SUB_INDIV_ATTR, PARENT, $<ctxt>5, NULL);
2315 indiv_attr_tag : TAG_CAST { $$ = $1; START(CAST, NULL) }
2316 | TAG_DSCR { $$ = $1; START(DSCR, NULL) }
2317 | TAG_EDUC { $$ = $1; START(EDUC, NULL) }
2318 | TAG_IDNO { $$ = $1; START(IDNO, NULL) }
2319 | TAG_NATI { $$ = $1; START(NATI, NULL) }
2320 | TAG_NCHI { $$ = $1; START(NCHI, NULL) }
2321 | TAG_NMR { $$ = $1; START(NMR, NULL) }
2322 | TAG_OCCU { $$ = $1; START(OCCU, NULL) }
2323 | TAG_PROP { $$ = $1; START(PROP, NULL) }
2324 | TAG_RELI { $$ = $1; START(RELI, NULL) }
2325 | TAG_SSN { $$ = $1; START(SSN, NULL) }
2326 | TAG_TITL { $$ = $1; START(TITL, NULL) }
2328 indiv_resi_sect : OPEN DELIM TAG_RESI
2329 { $<ctxt>$ = start_element(ELT_SUB_INDIV_RESI,
2330 PARENT, $1, $3, NULL,
2331 GEDCOM_MAKE_NULL());
2332 START(RESI, $<ctxt>$)
2334 indiv_attr_event_subs
2337 { end_element(ELT_SUB_INDIV_RESI, PARENT, $<ctxt>4, NULL);
2341 indiv_attr_event_subs : /* empty */
2342 | indiv_attr_event_subs indiv_attr_event_sub
2345 indiv_attr_event_sub : event_detail_sub
2349 /* INDIVIDUAL EVENT STRUCTURE */
2350 indiv_even_struc_sub : indiv_birt_sect
2352 | indiv_adop_sect /* 0:M */
2353 | indiv_even_sect /* 0:M */
2356 indiv_birt_sect : OPEN DELIM indiv_birt_tag opt_value
2357 { $<ctxt>$ = start_element(ELT_SUB_INDIV_BIRT,
2359 GEDCOM_MAKE_NULL_OR_STRING($4));
2360 /* set the parent context separately from START here */
2361 set_parentctxt($<ctxt>$);
2366 { end_element(ELT_SUB_INDIV_BIRT, PARENT, $<ctxt>5, NULL);
2370 indiv_birt_tag : TAG_BIRT { $$ = $1; START(BIRT, NULL) }
2371 | TAG_CHR { $$ = $1; START(CHR, NULL) }
2374 indiv_birt_subs : /* empty */
2375 | indiv_birt_subs indiv_birt_sub
2378 indiv_birt_sub : event_detail_sub
2379 | indiv_birt_famc_sect { OCCUR2(FAMC,0, 1) }
2383 indiv_birt_famc_sect : OPEN DELIM TAG_FAMC mand_pointer
2384 { $<ctxt>$ = start_element(ELT_SUB_INDIV_BIRT_FAMC,
2386 GEDCOM_MAKE_STRING($4));
2387 START(FAMC, $<ctxt>$)
2392 { end_element(ELT_SUB_INDIV_BIRT_FAMC, PARENT, $<ctxt>5,
2397 indiv_gen_sect : OPEN DELIM indiv_gen_tag opt_value
2398 { $<ctxt>$ = start_element(ELT_SUB_INDIV_GEN,
2400 GEDCOM_MAKE_NULL_OR_STRING($4));
2401 /* set the parent context separately from START here */
2402 set_parentctxt($<ctxt>$);
2407 { end_element(ELT_SUB_INDIV_GEN, PARENT, $<ctxt>5, NULL);
2411 indiv_gen_tag : TAG_DEAT { $$ = $1; START(DEAT, NULL) }
2412 | TAG_BURI { $$ = $1; START(BURI, NULL) }
2413 | TAG_CREM { $$ = $1; START(CREM, NULL) }
2414 | TAG_BAPM { $$ = $1; START(BAPM, NULL) }
2415 | TAG_BARM { $$ = $1; START(BARM, NULL) }
2416 | TAG_BASM { $$ = $1; START(BASM, NULL) }
2417 | TAG_BLES { $$ = $1; START(BLES, NULL) }
2418 | TAG_CHRA { $$ = $1; START(CHRA, NULL) }
2419 | TAG_CONF { $$ = $1; START(CONF, NULL) }
2420 | TAG_FCOM { $$ = $1; START(FCOM, NULL) }
2421 | TAG_ORDN { $$ = $1; START(ORDN, NULL) }
2422 | TAG_NATU { $$ = $1; START(NATU, NULL) }
2423 | TAG_EMIG { $$ = $1; START(EMIG, NULL) }
2424 | TAG_IMMI { $$ = $1; START(IMMI, NULL) }
2425 | TAG_CENS { $$ = $1; START(CENS, NULL) }
2426 | TAG_PROB { $$ = $1; START(PROB, NULL) }
2427 | TAG_WILL { $$ = $1; START(WILL, NULL) }
2428 | TAG_GRAD { $$ = $1; START(GRAD, NULL) }
2429 | TAG_RETI { $$ = $1; START(RETI, NULL) }
2432 indiv_gen_subs : /* empty */
2433 | indiv_gen_subs indiv_gen_sub
2436 indiv_gen_sub : event_detail_sub
2440 indiv_adop_sect : OPEN DELIM TAG_ADOP opt_value
2441 { $<ctxt>$ = start_element(ELT_SUB_INDIV_ADOP,
2443 GEDCOM_MAKE_NULL_OR_STRING($4));
2444 START(ADOP, $<ctxt>$) }
2448 { end_element(ELT_SUB_INDIV_ADOP, PARENT, $<ctxt>5, NULL);
2452 indiv_adop_subs : /* empty */
2453 | indiv_adop_subs indiv_adop_sub
2456 indiv_adop_sub : event_detail_sub
2457 | indiv_adop_famc_sect { OCCUR2(FAMC,0, 1) }
2461 indiv_adop_famc_sect : OPEN DELIM TAG_FAMC mand_pointer
2462 { $<ctxt>$ = start_element(ELT_SUB_INDIV_ADOP_FAMC,
2464 GEDCOM_MAKE_STRING($4));
2465 START(FAMC, $<ctxt>$) }
2466 indiv_adop_famc_subs
2469 { end_element(ELT_SUB_INDIV_ADOP_FAMC, PARENT, $<ctxt>5,
2474 indiv_adop_famc_subs : /* empty */
2475 | indiv_adop_famc_subs indiv_adop_famc_sub
2478 indiv_adop_famc_sub : indiv_adop_famc_adop_sect { OCCUR2(ADOP,0, 1) }
2482 indiv_adop_famc_adop_sect : OPEN DELIM TAG_ADOP mand_line_item
2484 = start_element(ELT_SUB_INDIV_ADOP_FAMC_ADOP,
2486 GEDCOM_MAKE_STRING($4));
2487 START(ADOP, $<ctxt>$) }
2491 { end_element(ELT_SUB_INDIV_ADOP_FAMC_ADOP,
2492 PARENT, $<ctxt>5, NULL);
2496 indiv_even_sect : OPEN DELIM TAG_EVEN
2497 { $<ctxt>$ = start_element(ELT_SUB_INDIV_EVEN,
2498 PARENT, $1, $3, NULL,
2499 GEDCOM_MAKE_NULL());
2500 START(EVEN, $<ctxt>$) }
2504 { end_element(ELT_SUB_INDIV_EVEN, PARENT, $<ctxt>4, NULL);
2508 /* LDS INDIVIDUAL ORDINANCE */
2509 lds_indiv_ord_sub : lio_bapl_sect /* 0:M */
2510 | lio_slgc_sect /* 0:M */
2513 lio_bapl_sect : OPEN DELIM lio_bapl_tag
2514 { $<ctxt>$ = start_element(ELT_SUB_LIO_BAPL,
2515 PARENT, $1, $3, NULL,
2516 GEDCOM_MAKE_NULL());
2517 /* set the parent context separately from START here */
2518 set_parentctxt($<ctxt>$);
2523 { end_element(ELT_SUB_LIO_BAPL, PARENT, $<ctxt>4, NULL);
2527 lio_bapl_tag : TAG_BAPL { $$ = $1; START(BAPL, NULL) }
2528 | TAG_CONL { $$ = $1; START(CONL, NULL) }
2529 | TAG_ENDL { $$ = $1; START(ENDL, NULL) }
2532 lio_bapl_subs : /* empty */
2533 | lio_bapl_subs lio_bapl_sub
2536 lio_bapl_sub : lio_bapl_stat_sect { OCCUR2(STAT, 0, 1) }
2537 | lio_bapl_date_sect { OCCUR2(DATE, 0, 1) }
2538 | lio_bapl_temp_sect { OCCUR2(TEMP, 0, 1) }
2539 | lio_bapl_plac_sect { OCCUR2(PLAC, 0, 1) }
2545 lio_bapl_stat_sect : OPEN DELIM TAG_STAT mand_line_item
2546 { $<ctxt>$ = start_element(ELT_SUB_LIO_BAPL_STAT,
2548 GEDCOM_MAKE_STRING($4));
2549 START(STAT, $<ctxt>$)
2554 { end_element(ELT_SUB_LIO_BAPL_STAT, PARENT, $<ctxt>5,
2558 lio_bapl_date_sect : OPEN DELIM TAG_DATE mand_line_item
2559 { struct date_value dv = gedcom_parse_date($4);
2560 $<ctxt>$ = start_element(ELT_SUB_LIO_BAPL_DATE,
2562 GEDCOM_MAKE_DATE(dv));
2563 START(DATE, $<ctxt>$)
2568 { end_element(ELT_SUB_LIO_BAPL_DATE, PARENT, $<ctxt>5,
2572 lio_bapl_temp_sect : OPEN DELIM TAG_TEMP mand_line_item
2573 { $<ctxt>$ = start_element(ELT_SUB_LIO_BAPL_TEMP,
2575 GEDCOM_MAKE_STRING($4));
2576 START(TEMP, $<ctxt>$)
2581 { end_element(ELT_SUB_LIO_BAPL_TEMP, PARENT, $<ctxt>5,
2585 lio_bapl_plac_sect : OPEN DELIM TAG_PLAC mand_line_item
2586 { $<ctxt>$ = start_element(ELT_SUB_LIO_BAPL_PLAC,
2588 GEDCOM_MAKE_STRING($4));
2589 START(PLAC, $<ctxt>$)
2594 { end_element(ELT_SUB_LIO_BAPL_PLAC, PARENT, $<ctxt>5,
2599 lio_slgc_sect : OPEN DELIM TAG_SLGC
2600 { $<ctxt>$ = start_element(ELT_SUB_LIO_SLGC,
2601 PARENT, $1, $3, NULL,
2602 GEDCOM_MAKE_NULL());
2603 START(SLGC, $<ctxt>$)
2608 { end_element(ELT_SUB_LIO_SLGC, PARENT, $<ctxt>4, NULL);
2612 lio_slgc_subs : /* empty */
2613 | lio_slgc_subs lio_slgc_sub
2616 lio_slgc_sub : lio_bapl_sub
2617 | lio_slgc_famc_sect { OCCUR2(FAMC, 1, 1) }
2620 lio_slgc_famc_sect : OPEN DELIM TAG_FAMC mand_pointer
2621 { $<ctxt>$ = start_element(ELT_SUB_LIO_SLGC_FAMC,
2623 GEDCOM_MAKE_STRING($4));
2624 START(FAMC, $<ctxt>$)
2629 { end_element(ELT_SUB_LIO_SLGC_FAMC, PARENT, $<ctxt>5,
2634 /* LDS SPOUSE SEALING */
2635 lds_spouse_seal_sub : lss_slgs_sect
2638 lss_slgs_sect : OPEN DELIM TAG_SLGS
2639 { $<ctxt>$ = start_element(ELT_SUB_LSS_SLGS,
2640 PARENT, $1, $3, NULL,
2641 GEDCOM_MAKE_NULL());
2642 START(SLGS, $<ctxt>$) }
2646 { end_element(ELT_SUB_LIO_SLGC, PARENT, $<ctxt>4, NULL);
2650 lss_slgs_subs : /* empty */
2651 | lss_slgs_subs lss_slgs_sub
2654 lss_slgs_sub : lss_slgs_stat_sect { OCCUR2(STAT, 0, 1) }
2655 | lss_slgs_date_sect { OCCUR2(DATE, 0, 1) }
2656 | lss_slgs_temp_sect { OCCUR2(TEMP, 0, 1) }
2657 | lss_slgs_plac_sect { OCCUR2(PLAC, 0, 1) }
2663 lss_slgs_stat_sect : OPEN DELIM TAG_STAT mand_line_item
2664 { $<ctxt>$ = start_element(ELT_SUB_LSS_SLGS_STAT,
2666 GEDCOM_MAKE_STRING($4));
2667 START(STAT, $<ctxt>$)
2672 { end_element(ELT_SUB_LSS_SLGS_STAT, PARENT, $<ctxt>5,
2676 lss_slgs_date_sect : OPEN DELIM TAG_DATE mand_line_item
2677 { struct date_value dv = gedcom_parse_date($4);
2678 $<ctxt>$ = start_element(ELT_SUB_LSS_SLGS_DATE,
2680 GEDCOM_MAKE_DATE(dv));
2681 START(DATE, $<ctxt>$)
2686 { end_element(ELT_SUB_LSS_SLGS_DATE, PARENT, $<ctxt>5,
2690 lss_slgs_temp_sect : OPEN DELIM TAG_TEMP mand_line_item
2691 { $<ctxt>$ = start_element(ELT_SUB_LSS_SLGS_TEMP,
2693 GEDCOM_MAKE_STRING($4));
2694 START(TEMP, $<ctxt>$)
2699 { end_element(ELT_SUB_LSS_SLGS_TEMP, PARENT, $<ctxt>5,
2703 lss_slgs_plac_sect : OPEN DELIM TAG_PLAC mand_line_item
2704 { $<ctxt>$ = start_element(ELT_SUB_LSS_SLGS_PLAC,
2706 GEDCOM_MAKE_STRING($4));
2707 START(PLAC, $<ctxt>$)
2712 { end_element(ELT_SUB_LSS_SLGS_PLAC, PARENT, $<ctxt>5,
2717 /* MULTIMEDIA LINK */
2718 multim_link_sub : multim_obje_link_sect
2719 | multim_obje_emb_sect
2722 multim_obje_link_sect : OPEN DELIM TAG_OBJE DELIM POINTER
2723 { $<ctxt>$ = start_element(ELT_SUB_MULTIM_OBJE,
2725 GEDCOM_MAKE_STRING($5));
2726 START(OBJE, $<ctxt>$)
2731 { end_element(ELT_SUB_MULTIM_OBJE, PARENT, $<ctxt>6,
2736 multim_obje_emb_sect : OPEN DELIM TAG_OBJE
2737 { $<ctxt>$ = start_element(ELT_SUB_MULTIM_OBJE,
2738 PARENT, $1, $3, NULL,
2739 GEDCOM_MAKE_NULL());
2740 START(OBJE, $<ctxt>$)
2742 multim_obje_emb_subs
2743 { CHECK2(FORM,FILE) }
2745 { end_element(ELT_SUB_MULTIM_OBJE, PARENT, $<ctxt>4,
2750 multim_obje_emb_subs : /* empty */
2751 | multim_obje_emb_subs multim_obje_emb_sub
2754 multim_obje_emb_sub : multim_obje_form_sect { OCCUR2(FORM, 1, 1) }
2755 | multim_obje_titl_sect { OCCUR2(TITL, 0, 1) }
2756 | multim_obje_file_sect { OCCUR2(FILE, 1, 1) }
2761 multim_obje_form_sect : OPEN DELIM TAG_FORM mand_line_item
2762 { $<ctxt>$ = start_element(ELT_SUB_MULTIM_OBJE_FORM,
2764 GEDCOM_MAKE_STRING($4));
2765 START(FORM, $<ctxt>$)
2770 { end_element(ELT_SUB_MULTIM_OBJE_FORM,
2771 PARENT, $<ctxt>5, NULL);
2774 multim_obje_titl_sect : OPEN DELIM TAG_TITL mand_line_item
2775 { $<ctxt>$ = start_element(ELT_SUB_MULTIM_OBJE_TITL,
2777 GEDCOM_MAKE_STRING($4));
2778 START(TITL, $<ctxt>$)
2783 { end_element(ELT_SUB_MULTIM_OBJE_TITL,
2784 PARENT, $<ctxt>5, NULL);
2787 multim_obje_file_sect : OPEN DELIM TAG_FILE mand_line_item
2788 { $<ctxt>$ = start_element(ELT_SUB_MULTIM_OBJE_FILE,
2790 GEDCOM_MAKE_STRING($4));
2791 START(FILE, $<ctxt>$)
2796 { end_element(ELT_SUB_MULTIM_OBJE_FILE,
2797 PARENT, $<ctxt>5, NULL);
2801 /* NOTE STRUCTURE */
2802 note_struc_sub : note_struc_link_sect /* 0:M */
2803 | note_struc_emb_sect /* 0:M */
2806 note_struc_link_sect : OPEN DELIM TAG_NOTE DELIM POINTER
2807 { $<ctxt>$ = start_element(ELT_SUB_NOTE,
2809 GEDCOM_MAKE_STRING($5));
2810 START(NOTE, $<ctxt>$)
2812 note_struc_link_subs
2815 { end_element(ELT_SUB_NOTE, PARENT, $<ctxt>6, NULL);
2819 note_struc_link_subs : /* empty */
2820 | note_struc_link_subs note_struc_link_sub
2823 note_struc_link_sub : source_cit_sub
2827 note_struc_emb_sect : OPEN DELIM TAG_NOTE opt_line_item
2829 = start_element(ELT_SUB_NOTE,
2831 GEDCOM_MAKE_NULL_OR_STRING($4));
2832 START(NOTE, $<ctxt>$)
2837 { end_element(ELT_SUB_NOTE, PARENT, $<ctxt>5, NULL);
2841 note_struc_emb_subs : /* empty */
2842 | note_struc_emb_subs note_struc_emb_sub
2845 note_struc_emb_sub : continuation_sub
2850 /* PERSONAL NAME STRUCTURE */
2851 pers_name_struc_sub : pers_name_sect /* 0:M */
2854 pers_name_sect : OPEN DELIM TAG_NAME mand_line_item
2855 { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME,
2857 GEDCOM_MAKE_STRING($4));
2858 START(NAME, $<ctxt>$)
2863 { end_element(ELT_SUB_PERS_NAME, PARENT, $<ctxt>5, NULL);
2867 pers_name_subs : /* empty */
2868 | pers_name_subs pers_name_sub
2871 pers_name_sub : pers_name_npfx_sect { OCCUR2(NPFX, 0, 1) }
2872 | pers_name_givn_sect { OCCUR2(GIVN, 0, 1) }
2873 | pers_name_nick_sect { OCCUR2(NICK, 0, 1) }
2874 | pers_name_spfx_sect { OCCUR2(SPFX, 0, 1) }
2875 | pers_name_surn_sect { OCCUR2(SURN, 0, 1) }
2876 | pers_name_nsfx_sect { OCCUR2(NSFX, 0, 1) }
2882 pers_name_npfx_sect : OPEN DELIM TAG_NPFX mand_line_item
2883 { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME_NPFX,
2885 GEDCOM_MAKE_STRING($4));
2886 START(NPFX, $<ctxt>$)
2891 { end_element(ELT_SUB_PERS_NAME_NPFX, PARENT, $<ctxt>5,
2895 pers_name_givn_sect : OPEN DELIM TAG_GIVN mand_line_item
2896 { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME_GIVN,
2898 GEDCOM_MAKE_STRING($4));
2899 START(GIVN, $<ctxt>$)
2904 { end_element(ELT_SUB_PERS_NAME_GIVN, PARENT, $<ctxt>5,
2908 pers_name_nick_sect : OPEN DELIM TAG_NICK mand_line_item
2909 { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME_NICK,
2911 GEDCOM_MAKE_STRING($4));
2912 START(NICK, $<ctxt>$)
2917 { end_element(ELT_SUB_PERS_NAME_NICK, PARENT, $<ctxt>5,
2921 pers_name_spfx_sect : OPEN DELIM TAG_SPFX mand_line_item
2922 { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME_SPFX,
2924 GEDCOM_MAKE_STRING($4));
2925 START(SPFX, $<ctxt>$)
2930 { end_element(ELT_SUB_PERS_NAME_SPFX, PARENT, $<ctxt>5,
2934 pers_name_surn_sect : OPEN DELIM TAG_SURN mand_line_item
2935 { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME_SURN,
2937 GEDCOM_MAKE_STRING($4));
2938 START(SURN, $<ctxt>$)
2943 { end_element(ELT_SUB_PERS_NAME_SURN, PARENT, $<ctxt>5,
2947 pers_name_nsfx_sect : OPEN DELIM TAG_NSFX mand_line_item
2948 { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME_NSFX,
2950 GEDCOM_MAKE_STRING($4));
2951 START(NSFX, $<ctxt>$)
2956 { end_element(ELT_SUB_PERS_NAME_NSFX, PARENT, $<ctxt>5,
2961 /* PLACE STRUCTURE */
2962 place_struc_sub : place_struc_plac_sect /* 0:M */
2965 place_struc_plac_sect : OPEN DELIM TAG_PLAC mand_line_item
2966 { $<ctxt>$ = start_element(ELT_SUB_PLAC,
2968 GEDCOM_MAKE_STRING($4));
2969 START(PLAC, $<ctxt>$)
2971 place_struc_plac_subs
2974 { end_element(ELT_SUB_PLAC, PARENT, $<ctxt>5, NULL);
2978 place_struc_plac_subs : /* empty */
2979 | place_struc_plac_subs place_struc_plac_sub
2982 place_struc_plac_sub : place_plac_form_sect { OCCUR2(FORM, 0, 1) }
2988 place_plac_form_sect : OPEN DELIM TAG_FORM mand_line_item
2989 { $<ctxt>$ = start_element(ELT_SUB_PLAC_FORM,
2991 GEDCOM_MAKE_STRING($4));
2992 START(FORM, $<ctxt>$)
2997 { end_element(ELT_SUB_PLAC_FORM, PARENT, $<ctxt>5,
3002 /* SOURCE_CITATION */
3003 source_cit_sub : source_cit_link_sect /* 0:M */
3004 | source_cit_emb_sect /* 0:M */
3007 source_cit_link_sect : OPEN DELIM TAG_SOUR DELIM POINTER
3008 { $<ctxt>$ = start_element(ELT_SUB_SOUR,
3010 GEDCOM_MAKE_STRING($5));
3011 START(SOUR, $<ctxt>$)
3013 source_cit_link_subs
3016 { end_element(ELT_SUB_SOUR, PARENT, $<ctxt>6, NULL);
3020 source_cit_link_subs : /* empty */
3021 | source_cit_link_subs source_cit_link_sub
3024 source_cit_link_sub : source_cit_page_sect { OCCUR2(PAGE, 0, 1) }
3025 | source_cit_even_sect { OCCUR2(EVEN, 0, 1) }
3026 | source_cit_data_sect { OCCUR2(DATA, 0, 1) }
3027 | source_cit_quay_sect { OCCUR2(QUAY, 0, 1) }
3033 source_cit_page_sect : OPEN DELIM TAG_PAGE mand_line_item
3034 { $<ctxt>$ = start_element(ELT_SUB_SOUR_PAGE,
3036 GEDCOM_MAKE_STRING($4));
3037 START(PAGE, $<ctxt>$)
3042 { end_element(ELT_SUB_SOUR_PAGE, PARENT, $<ctxt>5,
3047 source_cit_even_sect : OPEN DELIM TAG_EVEN mand_line_item
3048 { $<ctxt>$ = start_element(ELT_SUB_SOUR_EVEN,
3050 GEDCOM_MAKE_STRING($4));
3051 START(EVEN, $<ctxt>$)
3053 source_cit_even_subs
3056 { end_element(ELT_SUB_SOUR_EVEN, PARENT, $<ctxt>5,
3061 source_cit_even_subs : /* empty */
3062 | source_cit_even_subs source_cit_even_sub
3065 source_cit_even_sub : source_cit_even_role_sect { OCCUR2(ROLE, 0, 1) }
3069 source_cit_even_role_sect : OPEN DELIM TAG_ROLE mand_line_item
3070 { $<ctxt>$ = start_element(ELT_SUB_SOUR_EVEN_ROLE,
3072 GEDCOM_MAKE_STRING($4));
3073 START(ROLE, $<ctxt>$)
3078 { end_element(ELT_SUB_SOUR_EVEN_ROLE,
3079 PARENT, $<ctxt>5, NULL);
3083 source_cit_data_sect : OPEN DELIM TAG_DATA
3084 { $<ctxt>$ = start_element(ELT_SUB_SOUR_DATA,
3085 PARENT, $1, $3, NULL,
3086 GEDCOM_MAKE_NULL());
3087 START(DATA, $<ctxt>$)
3089 source_cit_data_subs
3092 { end_element(ELT_SUB_SOUR_DATA, PARENT, $<ctxt>4,
3097 source_cit_data_subs : /* empty */
3098 | source_cit_data_subs source_cit_data_sub
3101 source_cit_data_sub : source_cit_data_date_sect { OCCUR2(DATE, 0, 1) }
3102 | source_cit_text_sect /* 0:M */
3106 source_cit_data_date_sect : OPEN DELIM TAG_DATE mand_line_item
3107 { struct date_value dv = gedcom_parse_date($4);
3108 $<ctxt>$ = start_element(ELT_SUB_SOUR_DATA_DATE,
3110 GEDCOM_MAKE_DATE(dv));
3111 START(DATE, $<ctxt>$)
3116 { end_element(ELT_SUB_SOUR_DATA_DATE,
3117 PARENT, $<ctxt>5, NULL);
3121 source_cit_text_sect : OPEN DELIM TAG_TEXT mand_line_item
3122 { $<ctxt>$ = start_element(ELT_SUB_SOUR_TEXT,
3124 GEDCOM_MAKE_STRING($4));
3125 START(TEXT, $<ctxt>$)
3127 source_cit_text_subs
3130 { end_element(ELT_SUB_SOUR_TEXT, PARENT, $<ctxt>5,
3135 source_cit_text_subs : /* empty */
3136 | source_cit_text_subs source_cit_text_sub
3139 source_cit_text_sub : continuation_sub
3143 source_cit_quay_sect : OPEN DELIM TAG_QUAY mand_line_item
3144 { $<ctxt>$ = start_element(ELT_SUB_SOUR_QUAY,
3146 GEDCOM_MAKE_STRING($4));
3147 START(QUAY, $<ctxt>$)
3152 { end_element(ELT_SUB_SOUR_QUAY, PARENT, $<ctxt>5,
3157 source_cit_emb_sect : OPEN DELIM TAG_SOUR mand_line_item
3158 { $<ctxt>$ = start_element(ELT_SUB_SOUR,
3160 GEDCOM_MAKE_STRING($4));
3161 START(SOUR, $<ctxt>$)
3166 { end_element(ELT_SUB_SOUR, PARENT, $<ctxt>5, NULL);
3170 source_cit_emb_subs : /* empty */
3171 | source_cit_emb_subs source_cit_emb_sub
3174 source_cit_emb_sub : continuation_sub
3175 | source_cit_text_sect /* 0:M */
3180 /* SOURCE REPOSITORY CITATION */
3181 source_repos_cit_sub : source_repos_repo_sect { OCCUR2(REPO, 0, 1) }
3184 source_repos_repo_sect : OPEN DELIM TAG_REPO mand_pointer
3185 { $<ctxt>$ = start_element(ELT_SUB_REPO,
3187 GEDCOM_MAKE_STRING($4));
3188 START(REPO, $<ctxt>$)
3190 source_repos_repo_subs
3193 { end_element(ELT_SUB_REPO, PARENT, $<ctxt>5, NULL);
3197 source_repos_repo_subs : /* empty */
3198 | source_repos_repo_subs source_repos_repo_sub
3201 source_repos_repo_sub : note_struc_sub
3202 | caln_sect /* 0:M */
3206 caln_sect : OPEN DELIM TAG_CALN mand_line_item
3207 { $<ctxt>$ = start_element(ELT_SUB_REPO_CALN,
3209 GEDCOM_MAKE_STRING($4));
3210 START(CALN, $<ctxt>$)
3215 { end_element(ELT_SUB_REPO_CALN, PARENT, $<ctxt>5, NULL);
3219 caln_subs : /* empty */
3220 | caln_subs caln_sub
3223 caln_sub : caln_medi_sect { OCCUR2(MEDI, 0, 1) }
3227 caln_medi_sect : OPEN DELIM TAG_MEDI mand_line_item
3228 { $<ctxt>$ = start_element(ELT_SUB_REPO_CALN_MEDI,
3230 GEDCOM_MAKE_STRING($4));
3231 START(MEDI, $<ctxt>$)
3236 { end_element(ELT_SUB_REPO_CALN_MEDI, PARENT, $<ctxt>5, NULL);
3240 /* SPOUSE TO FAMILY LINK */
3241 spou_fam_link_sub : spou_fam_fams_sect /* 0:M */
3244 spou_fam_fams_sect : OPEN DELIM TAG_FAMS mand_pointer
3245 { $<ctxt>$ = start_element(ELT_SUB_FAMS,
3247 GEDCOM_MAKE_STRING($4));
3248 START(FAMS, $<ctxt>$)
3253 { end_element(ELT_SUB_FAMS, PARENT, $<ctxt>5, NULL);
3257 spou_fam_fams_subs : /* empty */
3258 | spou_fam_fams_subs spou_fam_fams_sub
3261 spou_fam_fams_sub : note_struc_sub
3265 /*********************************************************************/
3267 /*********************************************************************/
3269 no_std_subs : /* empty */
3270 | no_std_subs no_std_sub
3273 no_std_sub : user_sect /* 0:M */
3275 | error error_subs CLOSE { HANDLE_ERROR }
3278 no_std_rec : user_rec /* 0:M */
3280 | error error_subs CLOSE { HANDLE_ERROR }
3283 user_rec : OPEN DELIM opt_xref USERTAG
3284 { if ($4.string[0] != '_') {
3285 gedcom_error(_("Undefined tag (and not a valid user tag): %s"),
3291 { $<ctxt>$ = start_record(REC_USER,
3292 $1, GEDCOM_MAKE_NULL_OR_STRING($3), $4);
3298 { end_record(REC_USER, $<ctxt>7); }
3300 user_sect : OPEN DELIM opt_xref USERTAG
3301 { if ($4.string[0] != '_') {
3302 gedcom_error(_("Undefined tag (and not a valid user tag): %s"),
3308 { $<ctxt>$ = start_element(ELT_USER, PARENT, $1, $4, $6,
3309 GEDCOM_MAKE_NULL_OR_STRING($6));
3310 START($4, $<ctxt>$);
3315 { end_element(ELT_USER, PARENT, $<ctxt>7, NULL);
3319 user_sects : /* empty */ { }
3320 | user_sects user_sect { }
3323 opt_xref : /* empty */ { $$ = NULL; }
3324 | POINTER DELIM { $$ = $1; }
3327 opt_value : /* empty */ { $$ = NULL; }
3328 | DELIM line_value { $$ = $2; }
3331 line_value : POINTER { $$ = $1; }
3332 | line_item { $$ = $1; }
3335 mand_pointer : /* empty */ { gedcom_error(_("Missing pointer")); YYERROR; }
3336 | DELIM POINTER { gedcom_debug_print("==Ptr: %s==", $2);
3340 mand_line_item : /* empty */ { gedcom_error(_("Missing value")); YYERROR; }
3341 | DELIM line_item { gedcom_debug_print("==Val: %s==", $2);
3345 opt_line_item : /* empty */ { }
3346 | DELIM line_item { }
3349 line_item : anychar { size_t i;
3350 CLEAR_BUFFER(line_item_buf);
3351 line_item_buf_ptr = line_item_buf;
3352 /* The following also takes care of '@@' */
3353 if (!strncmp($1, "@@", 3))
3354 *line_item_buf_ptr++ = '@';
3356 for (i=0; i < strlen($1); i++)
3357 *line_item_buf_ptr++ = $1[i];
3360 | ESCAPE { size_t i;
3361 CLEAR_BUFFER(line_item_buf);
3362 line_item_buf_ptr = line_item_buf;
3363 for (i=0; i < strlen($1); i++)
3364 *line_item_buf_ptr++ = $1[i];
3369 /* The following also takes care of '@@' */
3370 if (!strncmp($2, "@@", 3))
3371 *line_item_buf_ptr++ = '@';
3373 for (i=0; i < strlen($2); i++)
3374 *line_item_buf_ptr++ = $2[i];
3379 for (i=0; i < strlen($2); i++)
3380 *line_item_buf_ptr++ = $2[i];
3385 anychar : ANYCHAR { }
3389 error_subs : /* empty */
3390 | error_subs error_sect
3393 error_sect : OPEN DELIM opt_xref anytag opt_value error_subs CLOSE { }
3395 gen_sect : OPEN DELIM opt_xref anystdtag
3396 { INVALID_TAG($4); }
3397 opt_value opt_sects CLOSE
3401 gen_rec : gen_rec_top
3405 gen_rec_norm : OPEN DELIM opt_xref anystdtag
3406 { INVALID_TOP_TAG($4) }
3407 opt_value opt_sects CLOSE
3411 gen_rec_top : OPEN DELIM anytoptag
3412 { gedcom_error(_("Missing cross-reference")); YYERROR; }
3413 opt_value opt_sects CLOSE
3417 opt_sects : /* empty */ { }
3418 | opt_sects gen_sect { }
3421 anytag : USERTAG { }
3435 anystdtag : TAG_ABBR
3565 /* Functions that handle the counting of subtags */
3567 int* count_arrays[MAXGEDCLEVEL+1];
3568 char tag_stack[MAXGEDCLEVEL+1][MAXSTDTAGLEN+1];
3569 Gedcom_ctxt ctxt_stack[MAXGEDCLEVEL+1];
3571 void push_countarray()
3574 if (count_level > MAXGEDCLEVEL) {
3575 gedcom_error(_("Internal error: count array overflow"));
3579 count = (int *)calloc(YYNTOKENS, sizeof(int));
3580 if (count == NULL) {
3581 gedcom_error(_("Internal error: count array calloc error"));
3585 count_arrays[count_level] = count;
3590 void set_parenttag(char* tag)
3592 strncpy(tag_stack[count_level], tag, MAXSTDTAGLEN+1);
3595 void set_parentctxt(Gedcom_ctxt ctxt)
3597 ctxt_stack[count_level] = ctxt;
3600 char* get_parenttag()
3602 return tag_stack[count_level];
3605 Gedcom_ctxt get_parentctxt()
3607 return ctxt_stack[count_level];
3610 int count_tag(int tag)
3612 int *count = count_arrays[count_level];
3613 return ++count[tag - GEDCOMTAGOFFSET];
3616 int check_occurrence(int tag)
3618 int *count = count_arrays[count_level];
3619 return (count[tag - GEDCOMTAGOFFSET] > 0);
3622 void pop_countarray()
3625 if (count_level < 0) {
3626 gedcom_error(_("Internal error: count array underflow"));
3630 count = count_arrays[count_level];
3632 count_arrays[count_level] = NULL;
3636 /* Enabling debug mode */
3637 /* level 0: no debugging */
3638 /* level 1: only internal */
3639 /* level 2: also bison */
3642 void gedcom_set_debug_level(int level, FILE* f)
3647 trace_output = stderr;
3649 gedcom_high_level_debug = 1;
3658 int gedcom_debug_print(char* s, ...)
3661 if (gedcom_high_level_debug) {
3664 res = vfprintf(trace_output, s, ap);
3666 fprintf(trace_output, "\n");
3671 /* Setting the error mechanism */
3672 void gedcom_set_error_handling(Gedcom_err_mech mechanism)
3674 error_mechanism = mechanism;
3677 /* Compatibility handling */
3679 void gedcom_set_compat_handling(int enable_compat)
3681 compat_enabled = enable_compat;
3684 void set_compatibility(char* program)
3686 if (compat_enabled) {
3687 if (! strncmp(program, "ftree", 6)) {
3688 gedcom_warning(_("Enabling compatibility with 'ftree'"));
3689 compatibility = C_FTREE;
3697 int compat_mode(int compat_flags)
3699 return (compat_flags & compatibility);