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 START1(PARENTTAG) \
192 { set_parenttag(#PARENTTAG); \
194 #define START2(PARENTCTXT) \
195 { set_parentctxt(PARENTCTXT); \
199 #define START(PARENTTAG,PARENTCTXT) \
200 { START1(PARENTTAG); \
201 START2(PARENTCTXT); \
206 { if (!check_occurrence(TAG_##TAG)) { \
207 char* parenttag = get_parenttag(); \
208 gedcom_error(_("The tag '%s' is mandatory within '%s', but missing"),\
214 { pop_countarray(); \
218 #define CHECK1(TAG1) { CHK(TAG1); POP; }
219 #define CHECK2(TAG1,TAG2) \
220 { CHK(TAG1); CHK(TAG2); POP; }
221 #define CHECK3(TAG1,TAG2,TAG3) \
222 { CHK(TAG1); CHK(TAG2); CHK(TAG3); POP; }
223 #define CHECK4(TAG1,TAG2,TAG3,TAG4) \
224 { CHK(TAG1); CHK(TAG2); CHK(TAG3); CHK(TAG4); POP; }
225 #define OCCUR1(CHILDTAG, MIN) { count_tag(TAG_##CHILDTAG); }
226 #define OCCUR2(CHILDTAG, MIN, MAX) \
227 { int num = count_tag(TAG_##CHILDTAG); \
229 char* parenttag = get_parenttag(); \
230 gedcom_error(_("The tag '%s' can maximally occur %d time(s) within '%s'"), \
231 #CHILDTAG, MAX, parenttag); \
235 #define INVALID_TAG(CHILDTAG) \
236 { char* parenttag = get_parenttag(); \
237 gedcom_error(_("The tag '%s' is not a valid tag within '%s'"), \
238 CHILDTAG, parenttag); \
241 #define INVALID_TOP_TAG(CHILDTAG) \
242 { gedcom_error(_("The tag '%s' is not a valid top-level tag"), \
252 struct tag_struct tag;
259 %token <string> BADTOKEN
261 %token <string> CLOSE
262 %token <string> ESCAPE
263 %token <string> DELIM
264 %token <string> ANYCHAR
265 %token <string> POINTER
267 %token <tag> TAG_ABBR
268 %token <tag> TAG_ADDR
269 %token <tag> TAG_ADR1
270 %token <tag> TAG_ADR2
271 %token <tag> TAG_ADOP
274 %token <tag> TAG_AGNC
275 %token <tag> TAG_ALIA
276 %token <tag> TAG_ANCE
277 %token <tag> TAG_ANCI
278 %token <tag> TAG_ANUL
279 %token <tag> TAG_ASSO
280 %token <tag> TAG_AUTH
281 %token <tag> TAG_BAPL
282 %token <tag> TAG_BAPM
283 %token <tag> TAG_BARM
284 %token <tag> TAG_BASM
285 %token <tag> TAG_BIRT
286 %token <tag> TAG_BLES
287 %token <tag> TAG_BLOB
288 %token <tag> TAG_BURI
289 %token <tag> TAG_CALN
290 %token <tag> TAG_CAST
291 %token <tag> TAG_CAUS
292 %token <tag> TAG_CENS
293 %token <tag> TAG_CHAN
294 %token <tag> TAG_CHAR
295 %token <tag> TAG_CHIL
297 %token <tag> TAG_CHRA
298 %token <tag> TAG_CITY
299 %token <tag> TAG_CONC
300 %token <tag> TAG_CONF
301 %token <tag> TAG_CONL
302 %token <tag> TAG_CONT
303 %token <tag> TAG_COPR
304 %token <tag> TAG_CORP
305 %token <tag> TAG_CREM
306 %token <tag> TAG_CTRY
307 %token <tag> TAG_DATA
308 %token <tag> TAG_DATE
309 %token <tag> TAG_DEAT
310 %token <tag> TAG_DESC
311 %token <tag> TAG_DESI
312 %token <tag> TAG_DEST
314 %token <tag> TAG_DIVF
315 %token <tag> TAG_DSCR
316 %token <tag> TAG_EDUC
317 %token <tag> TAG_EMIG
318 %token <tag> TAG_ENDL
319 %token <tag> TAG_ENGA
320 %token <tag> TAG_EVEN
322 %token <tag> TAG_FAMC
323 %token <tag> TAG_FAMF
324 %token <tag> TAG_FAMS
325 %token <tag> TAG_FCOM
326 %token <tag> TAG_FILE
327 %token <tag> TAG_FORM
328 %token <tag> TAG_GEDC
329 %token <tag> TAG_GIVN
330 %token <tag> TAG_GRAD
331 %token <tag> TAG_HEAD
332 %token <tag> TAG_HUSB
333 %token <tag> TAG_IDNO
334 %token <tag> TAG_IMMI
335 %token <tag> TAG_INDI
336 %token <tag> TAG_LANG
337 %token <tag> TAG_LEGA
338 %token <tag> TAG_MARB
339 %token <tag> TAG_MARC
340 %token <tag> TAG_MARL
341 %token <tag> TAG_MARR
342 %token <tag> TAG_MARS
343 %token <tag> TAG_MEDI
344 %token <tag> TAG_NAME
345 %token <tag> TAG_NATI
346 %token <tag> TAG_NATU
347 %token <tag> TAG_NCHI
348 %token <tag> TAG_NICK
350 %token <tag> TAG_NOTE
351 %token <tag> TAG_NPFX
352 %token <tag> TAG_NSFX
353 %token <tag> TAG_OBJE
354 %token <tag> TAG_OCCU
355 %token <tag> TAG_ORDI
356 %token <tag> TAG_ORDN
357 %token <tag> TAG_PAGE
358 %token <tag> TAG_PEDI
359 %token <tag> TAG_PHON
360 %token <tag> TAG_PLAC
361 %token <tag> TAG_POST
362 %token <tag> TAG_PROB
363 %token <tag> TAG_PROP
364 %token <tag> TAG_PUBL
365 %token <tag> TAG_QUAY
366 %token <tag> TAG_REFN
367 %token <tag> TAG_RELA
368 %token <tag> TAG_RELI
369 %token <tag> TAG_REPO
370 %token <tag> TAG_RESI
371 %token <tag> TAG_RESN
372 %token <tag> TAG_RETI
375 %token <tag> TAG_ROLE
377 %token <tag> TAG_SLGC
378 %token <tag> TAG_SLGS
379 %token <tag> TAG_SOUR
380 %token <tag> TAG_SPFX
382 %token <tag> TAG_STAE
383 %token <tag> TAG_STAT
384 %token <tag> TAG_SUBM
385 %token <tag> TAG_SUBN
386 %token <tag> TAG_SURN
387 %token <tag> TAG_TEMP
388 %token <tag> TAG_TEXT
389 %token <tag> TAG_TIME
390 %token <tag> TAG_TITL
391 %token <tag> TAG_TRLR
392 %token <tag> TAG_TYPE
393 %token <tag> TAG_VERS
394 %token <tag> TAG_WIFE
395 %token <tag> TAG_WILL
397 %type <tag> anystdtag
398 %type <tag> anytoptag
399 %type <tag> fam_event_tag
400 %type <tag> indiv_attr_tag
401 %type <tag> indiv_birt_tag
402 %type <tag> indiv_gen_tag
403 %type <tag> lio_bapl_tag
404 %type <string> line_item
405 %type <string> line_value
406 %type <string> mand_line_item
407 %type <string> mand_pointer
408 %type <string> note_line_item
409 %type <string> anychar
410 %type <string> opt_xref
411 %type <string> opt_value
412 %type <string> opt_line_item
413 %type <ctxt> head_sect
417 file : head_sect records trlr_sect
418 { if (fail == 1) YYABORT; }
421 records : /* empty */
436 /*********************************************************************/
438 /*********************************************************************/
439 head_sect : OPEN DELIM TAG_HEAD
440 { $<ctxt>$ = start_record(REC_HEAD, $1, GEDCOM_MAKE_NULL(), $3,
441 NULL, GEDCOM_MAKE_NULL());
442 START(HEAD, $<ctxt>$) }
444 { if (compat_mode(C_FTREE))
445 CHECK3(SOUR, GEDC, CHAR)
447 CHECK4(SOUR, SUBM, GEDC, CHAR)
450 { end_record(REC_HEAD, $<ctxt>4); }
453 head_subs : /* empty */
457 head_sub : head_sour_sect { OCCUR2(SOUR, 1, 1) }
458 | head_dest_sect { OCCUR2(DEST, 0, 1) }
459 | head_date_sect { OCCUR2(DATE, 0, 1) }
460 | head_subm_sect { OCCUR2(SUBM, 1, 1) }
461 | head_subn_sect { OCCUR2(SUBN, 0, 1) }
462 | head_file_sect { OCCUR2(FILE, 0, 1) }
463 | head_copr_sect { OCCUR2(COPR, 0, 1) }
464 | head_gedc_sect { OCCUR2(GEDC, 1, 1) }
465 | head_char_sect { OCCUR2(CHAR, 1, 1) }
466 | head_lang_sect { OCCUR2(LANG, 0, 1) }
467 | head_plac_sect { OCCUR2(PLAC, 0, 1) }
468 | head_note_sect { OCCUR2(NOTE, 0, 1) }
473 head_sour_sect : OPEN DELIM TAG_SOUR mand_line_item
474 { set_compatibility($4);
475 $<ctxt>$ = start_element(ELT_HEAD_SOUR, PARENT,
477 GEDCOM_MAKE_STRING($4));
478 START(SOUR, $<ctxt>$)
483 { end_element(ELT_HEAD_SOUR, PARENT, $<ctxt>5, NULL); }
486 head_sour_subs : /* empty */
487 | head_sour_subs head_sour_sub
490 head_sour_sub : head_sour_vers_sect { OCCUR2(VERS, 0, 1) }
491 | head_sour_name_sect { OCCUR2(NAME, 0, 1) }
492 | head_sour_corp_sect { OCCUR2(CORP, 0, 1) }
493 | head_sour_data_sect { OCCUR2(DATA, 0, 1) }
497 head_sour_vers_sect : OPEN DELIM TAG_VERS mand_line_item
498 { $<ctxt>$ = start_element(ELT_HEAD_SOUR_VERS, PARENT,
500 GEDCOM_MAKE_STRING($4));
501 START(VERS, $<ctxt>$)
506 { end_element(ELT_HEAD_SOUR_VERS,
507 PARENT, $<ctxt>5, NULL);
510 head_sour_name_sect : OPEN DELIM TAG_NAME mand_line_item
511 { $<ctxt>$ = start_element(ELT_HEAD_SOUR_NAME, PARENT,
513 GEDCOM_MAKE_STRING($4));
514 START(NAME, $<ctxt>$)
519 { end_element(ELT_HEAD_SOUR_NAME,
520 PARENT, $<ctxt>5, NULL);
523 head_sour_corp_sect : OPEN DELIM TAG_CORP mand_line_item
524 { $<ctxt>$ = start_element(ELT_HEAD_SOUR_CORP, PARENT,
526 GEDCOM_MAKE_STRING($4));
527 START(CORP, $<ctxt>$)
532 { end_element(ELT_HEAD_SOUR_CORP,
533 PARENT, $<ctxt>5, NULL);
537 head_sour_corp_subs : /* empty */
538 | head_sour_corp_subs head_sour_corp_sub
541 head_sour_corp_sub : addr_struc_sub /* 0:1 */
545 head_sour_data_sect : OPEN DELIM TAG_DATA mand_line_item
546 { $<ctxt>$ = start_element(ELT_HEAD_SOUR_DATA, PARENT,
548 GEDCOM_MAKE_STRING($4));
549 START(DATA, $<ctxt>$)
554 { end_element(ELT_HEAD_SOUR_DATA,
555 PARENT, $<ctxt>5, NULL);
559 head_sour_data_subs : /* empty */
560 | head_sour_data_subs head_sour_data_sub
563 head_sour_data_sub : head_sour_data_date_sect { OCCUR2(DATE, 0, 1) }
564 | head_sour_data_copr_sect { OCCUR2(COPR, 0, 1) }
568 head_sour_data_date_sect : OPEN DELIM TAG_DATE mand_line_item
569 { struct date_value dv = gedcom_parse_date($4);
570 $<ctxt>$ = start_element(ELT_HEAD_SOUR_DATA_DATE,
572 GEDCOM_MAKE_DATE(dv));
573 START(DATE, $<ctxt>$)
578 { end_element(ELT_HEAD_SOUR_DATA_DATE,
579 PARENT, $<ctxt>5, NULL);
582 head_sour_data_copr_sect : OPEN DELIM TAG_COPR mand_line_item
583 { $<ctxt>$ = start_element(ELT_HEAD_SOUR_DATA_COPR,
585 GEDCOM_MAKE_STRING($4));
586 START(COPR, $<ctxt>$)
591 { end_element(ELT_HEAD_SOUR_DATA_COPR,
592 PARENT, $<ctxt>5, NULL);
597 head_dest_sect : OPEN DELIM TAG_DEST mand_line_item
598 { $<ctxt>$ = start_element(ELT_HEAD_DEST,
600 GEDCOM_MAKE_STRING($4));
601 START(DEST, $<ctxt>$)
606 { end_element(ELT_HEAD_DEST,
607 PARENT, $<ctxt>5, NULL);
612 head_date_sect : OPEN DELIM TAG_DATE mand_line_item
613 { struct date_value dv = gedcom_parse_date($4);
614 $<ctxt>$ = start_element(ELT_HEAD_DATE,
616 GEDCOM_MAKE_DATE(dv));
617 START(DATE, $<ctxt>$)
622 { end_element(ELT_HEAD_DATE,
623 PARENT, $<ctxt>5, NULL);
627 head_date_subs : /* empty */
628 | head_date_subs head_date_sub
631 head_date_sub : head_date_time_sect { OCCUR2(TIME, 0, 1) }
635 head_date_time_sect : OPEN DELIM TAG_TIME mand_line_item
636 { $<ctxt>$ = start_element(ELT_HEAD_DATE_TIME,
638 GEDCOM_MAKE_STRING($4));
639 START(TIME, $<ctxt>$)
644 { end_element(ELT_HEAD_DATE_TIME,
645 PARENT, $<ctxt>5, NULL);
650 head_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
651 { $<ctxt>$ = start_element(ELT_HEAD_SUBM,
653 GEDCOM_MAKE_STRING($4));
654 START(SUBM, $<ctxt>$)
659 { end_element(ELT_HEAD_SUBM,
660 PARENT, $<ctxt>5, NULL);
664 head_subn_sect : OPEN DELIM TAG_SUBN mand_pointer
665 { $<ctxt>$ = start_element(ELT_HEAD_SUBN,
667 GEDCOM_MAKE_STRING($4));
668 START(SUBN, $<ctxt>$)
673 { end_element(ELT_HEAD_SUBN,
674 PARENT, $<ctxt>5, NULL);
678 head_file_sect : OPEN DELIM TAG_FILE mand_line_item
679 { $<ctxt>$ = start_element(ELT_HEAD_FILE,
681 GEDCOM_MAKE_STRING($4));
682 START(FILE, $<ctxt>$)
687 { end_element(ELT_HEAD_FILE, PARENT, $<ctxt>5, NULL);
691 head_copr_sect : OPEN DELIM TAG_COPR mand_line_item
692 { $<ctxt>$ = start_element(ELT_HEAD_COPR,
694 GEDCOM_MAKE_STRING($4));
695 START(COPR, $<ctxt>$)
700 { end_element(ELT_HEAD_COPR, PARENT, $<ctxt>5, NULL);
704 head_gedc_sect : OPEN DELIM TAG_GEDC
705 { $<ctxt>$ = start_element(ELT_HEAD_GEDC,
706 PARENT, $1, $3, NULL,
708 START(GEDC, $<ctxt>$)
711 { CHECK2(VERS, FORM) }
713 { end_element(ELT_HEAD_GEDC, PARENT, $<ctxt>4, NULL);
717 head_gedc_subs : /* empty */
718 | head_gedc_subs head_gedc_sub
721 head_gedc_sub : head_gedc_vers_sect { OCCUR2(VERS, 1, 1) }
722 | head_gedc_form_sect { OCCUR2(FORM, 1, 1) }
725 head_gedc_vers_sect : OPEN DELIM TAG_VERS mand_line_item
726 { $<ctxt>$ = start_element(ELT_HEAD_GEDC_VERS,
728 GEDCOM_MAKE_STRING($4));
729 START(VERS, $<ctxt>$)
734 { end_element(ELT_HEAD_GEDC_VERS,
735 PARENT, $<ctxt>5, NULL);
738 head_gedc_form_sect : OPEN DELIM TAG_FORM mand_line_item
739 { $<ctxt>$ = start_element(ELT_HEAD_GEDC_FORM,
741 GEDCOM_MAKE_STRING($4));
742 START(FORM, $<ctxt>$)
747 { end_element(ELT_HEAD_GEDC_FORM,
748 PARENT, $<ctxt>5, NULL);
753 head_char_sect : OPEN DELIM TAG_CHAR mand_line_item
754 { if (open_conv_to_internal($4) == 0) YYERROR;
755 $<ctxt>$ = start_element(ELT_HEAD_CHAR,
757 GEDCOM_MAKE_STRING($4));
758 START(CHAR, $<ctxt>$)
763 { end_element(ELT_HEAD_CHAR, PARENT, $<ctxt>5, NULL);
767 head_char_subs : /* empty */
768 | head_char_subs head_char_sub
771 head_char_sub : head_char_vers_sect { OCCUR2(VERS, 0, 1) }
774 head_char_vers_sect : OPEN DELIM TAG_VERS mand_line_item
775 { $<ctxt>$ = start_element(ELT_HEAD_CHAR_VERS,
777 GEDCOM_MAKE_STRING($4));
778 START(VERS, $<ctxt>$)
783 { end_element(ELT_HEAD_CHAR_VERS,
784 PARENT, $<ctxt>5, NULL);
789 head_lang_sect : OPEN DELIM TAG_LANG mand_line_item
790 { $<ctxt>$ = start_element(ELT_HEAD_LANG,
792 GEDCOM_MAKE_STRING($4));
793 START(LANG, $<ctxt>$)
798 { end_element(ELT_HEAD_LANG, PARENT, $<ctxt>5, NULL);
802 head_plac_sect : OPEN DELIM TAG_PLAC
803 { $<ctxt>$ = start_element(ELT_HEAD_PLAC,
804 PARENT, $1, $3, NULL,
806 START(PLAC, $<ctxt>$)
811 { end_element(ELT_HEAD_PLAC, PARENT, $<ctxt>4, NULL);
815 head_plac_subs : /* empty */
816 | head_plac_subs head_plac_sub
819 head_plac_sub : head_plac_form_sect { OCCUR2(FORM, 1, 1) }
822 head_plac_form_sect : OPEN DELIM TAG_FORM mand_line_item
823 { $<ctxt>$ = start_element(ELT_HEAD_PLAC_FORM,
825 GEDCOM_MAKE_STRING($4));
826 START(FORM, $<ctxt>$)
831 { end_element(ELT_HEAD_PLAC_FORM,
832 PARENT, $<ctxt>5, NULL);
837 head_note_sect : OPEN DELIM TAG_NOTE mand_line_item
838 { $<ctxt>$ = start_element(ELT_HEAD_NOTE,
840 GEDCOM_MAKE_STRING($4));
841 START(NOTE, $<ctxt>$)
846 { end_element(ELT_HEAD_NOTE, PARENT, $<ctxt>5, NULL);
850 head_note_subs : /* empty */
851 | head_note_subs head_note_sub
854 head_note_sub : continuation_sub /* 0:M */
858 /*********************************************************************/
860 /*********************************************************************/
861 /* Don't need callbacks here, there is no information... */
862 trlr_sect : OPEN DELIM TAG_TRLR CLOSE { }
865 /*********************************************************************/
866 /**** Family record ****/
867 /*********************************************************************/
868 fam_rec : OPEN DELIM POINTER DELIM TAG_FAM
869 { $<ctxt>$ = start_record(REC_FAM,
870 $1, GEDCOM_MAKE_STRING($3), $5,
871 NULL, GEDCOM_MAKE_NULL());
872 START(FAM, $<ctxt>$) }
876 { end_record(REC_FAM, $<ctxt>6); }
879 fam_subs : /* empty */
883 fam_sub : fam_event_struc_sub /* 0:M */
884 | fam_husb_sect { OCCUR2(HUSB, 0, 1) }
885 | fam_wife_sect { OCCUR2(WIFE, 0, 1) }
886 | fam_chil_sect /* 0:M */
887 | fam_nchi_sect { OCCUR2(NCHI, 0, 1) }
888 | fam_subm_sect /* 0:M */
889 | lds_spouse_seal_sub /* 0:M */
890 | source_cit_sub /* 0:M */
891 | multim_link_sub /* 0:M */
892 | note_struc_sub /* 0:M */
893 | ident_struc_sub /* 0:1 */
894 | change_date_sub /* 0:1 */
899 fam_husb_sect : OPEN DELIM TAG_HUSB mand_pointer
900 { $<ctxt>$ = start_element(ELT_FAM_HUSB,
902 GEDCOM_MAKE_STRING($4));
903 START(HUSB, $<ctxt>$)
908 { end_element(ELT_FAM_HUSB, PARENT, $<ctxt>5, NULL);
913 fam_wife_sect : OPEN DELIM TAG_WIFE mand_pointer
914 { $<ctxt>$ = start_element(ELT_FAM_WIFE,
916 GEDCOM_MAKE_STRING($4));
917 START(WIFE, $<ctxt>$)
922 { end_element(ELT_FAM_WIFE, PARENT, $<ctxt>5, NULL);
927 fam_chil_sect : OPEN DELIM TAG_CHIL mand_pointer
928 { $<ctxt>$ = start_element(ELT_FAM_CHIL,
930 GEDCOM_MAKE_STRING($4));
931 START(CHIL, $<ctxt>$)
936 { end_element(ELT_FAM_CHIL, PARENT, $<ctxt>5, NULL);
941 fam_nchi_sect : OPEN DELIM TAG_NCHI mand_line_item
942 { $<ctxt>$ = start_element(ELT_FAM_NCHI,
944 GEDCOM_MAKE_STRING($4));
945 START(NCHI, $<ctxt>$)
950 { end_element(ELT_FAM_NCHI, PARENT, $<ctxt>5, NULL);
955 fam_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
956 { $<ctxt>$ = start_element(ELT_FAM_SUBM,
958 GEDCOM_MAKE_STRING($4));
959 START(SUBM, $<ctxt>$)
964 { end_element(ELT_FAM_SUBM, PARENT, $<ctxt>5, NULL);
968 /*********************************************************************/
969 /**** Individual record ****/
970 /*********************************************************************/
971 indiv_rec : OPEN DELIM POINTER DELIM TAG_INDI
972 { $<ctxt>$ = start_record(REC_INDI,
973 $1, GEDCOM_MAKE_STRING($3), $5,
974 NULL, GEDCOM_MAKE_NULL());
975 START(INDI, $<ctxt>$) }
979 { end_record(REC_INDI, $<ctxt>6); }
982 indi_subs : /* empty */
986 indi_sub : indi_resn_sect { OCCUR2(RESN, 0, 1) }
987 | pers_name_struc_sub /* 0:M */
988 | indi_sex_sect { OCCUR2(SEX, 0, 1) }
989 | indiv_even_struc_sub /* 0:M */
990 | indiv_attr_struc_sub /* 0:M */
991 | lds_indiv_ord_sub /* 0:M */
992 | chi_fam_link_sub /* 0:M */
993 | spou_fam_link_sub /* 0:M */
994 | indi_subm_sect /* 0:M */
995 | assoc_struc_sub /* 0:M */
996 | indi_alia_sect /* 0:M */
997 | indi_anci_sect /* 0:M */
998 | indi_desi_sect /* 0:M */
999 | source_cit_sub /* 0:M */
1000 | multim_link_sub /* 0:M */
1001 | note_struc_sub /* 0:M */
1002 | indi_rfn_sect { OCCUR2(RFN, 0, 1) }
1003 | indi_afn_sect /* 0:M */
1004 | ident_struc_sub /* 0:1 */
1005 | change_date_sub /* 0:1 */
1006 | ftree_addr_sect { if (!compat_mode(C_FTREE))
1007 INVALID_TAG("ADDR");
1013 indi_resn_sect : OPEN DELIM TAG_RESN mand_line_item
1014 { $<ctxt>$ = start_element(ELT_INDI_RESN,
1016 GEDCOM_MAKE_STRING($4));
1017 START(RESN, $<ctxt>$)
1022 { end_element(ELT_INDI_RESN, PARENT, $<ctxt>5, NULL);
1027 indi_sex_sect : OPEN DELIM TAG_SEX mand_line_item
1028 { $<ctxt>$ = start_element(ELT_INDI_SEX,
1030 GEDCOM_MAKE_STRING($4));
1031 START(SEX, $<ctxt>$)
1036 { end_element(ELT_INDI_SEX, PARENT, $<ctxt>5, NULL);
1041 indi_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
1042 { $<ctxt>$ = start_element(ELT_INDI_SUBM,
1044 GEDCOM_MAKE_STRING($4));
1045 START(SUBM, $<ctxt>$)
1050 { end_element(ELT_INDI_SUBM, PARENT, $<ctxt>5, NULL);
1055 indi_alia_sect : OPEN DELIM TAG_ALIA mand_pointer
1056 { $<ctxt>$ = start_element(ELT_INDI_ALIA,
1058 GEDCOM_MAKE_STRING($4));
1059 START(ALIA, $<ctxt>$)
1064 { end_element(ELT_INDI_ALIA, PARENT, $<ctxt>5, NULL);
1069 indi_anci_sect : OPEN DELIM TAG_ANCI mand_pointer
1070 { $<ctxt>$ = start_element(ELT_INDI_ANCI,
1072 GEDCOM_MAKE_STRING($4));
1073 START(ANCI, $<ctxt>$)
1078 { end_element(ELT_INDI_ANCI, PARENT, $<ctxt>5, NULL);
1083 indi_desi_sect : OPEN DELIM TAG_DESI mand_pointer
1084 { $<ctxt>$ = start_element(ELT_INDI_DESI,
1086 GEDCOM_MAKE_STRING($4));
1087 START(DESI, $<ctxt>$)
1092 { end_element(ELT_INDI_DESI, PARENT, $<ctxt>5, NULL);
1097 indi_rfn_sect : OPEN DELIM TAG_RFN mand_line_item
1098 { $<ctxt>$ = start_element(ELT_INDI_RFN,
1100 GEDCOM_MAKE_STRING($4));
1101 START(RFN, $<ctxt>$)
1106 { end_element(ELT_INDI_RFN, PARENT, $<ctxt>5, NULL);
1111 indi_afn_sect : OPEN DELIM TAG_AFN mand_line_item
1112 { $<ctxt>$ = start_element(ELT_INDI_AFN,
1114 GEDCOM_MAKE_STRING($4));
1115 START(AFN, $<ctxt>$)
1120 { end_element(ELT_INDI_AFN, PARENT, $<ctxt>5, NULL);
1124 /* INDI.ADDR (Only for 'ftree' compatibility) */
1125 ftree_addr_sect : OPEN DELIM TAG_ADDR opt_line_item
1126 { START(ADDR, NULL) } no_std_subs { CHECK0 } CLOSE { }
1128 /*********************************************************************/
1129 /**** Multimedia record ****/
1130 /*********************************************************************/
1131 multim_rec : OPEN DELIM POINTER DELIM TAG_OBJE
1132 { $<ctxt>$ = start_record(REC_OBJE,
1133 $1, GEDCOM_MAKE_STRING($3), $5,
1134 NULL, GEDCOM_MAKE_NULL());
1135 START(OBJE, $<ctxt>$) }
1137 { CHECK2(FORM, BLOB) }
1139 { end_record(REC_OBJE, $<ctxt>6); }
1142 obje_subs : /* empty */
1143 | obje_subs obje_sub
1146 obje_sub : obje_form_sect { OCCUR2(FORM, 1, 1) }
1147 | obje_titl_sect { OCCUR2(TITL, 0, 1) }
1148 | note_struc_sub /* 0:M */
1149 | obje_blob_sect { OCCUR2(BLOB, 1, 1) }
1150 | obje_obje_sect { OCCUR2(OBJE, 0, 1) }
1151 | ident_struc_sub /* 0:1 */
1152 | change_date_sub /* 0:1 */
1157 obje_form_sect : OPEN DELIM TAG_FORM mand_line_item
1158 { $<ctxt>$ = start_element(ELT_OBJE_FORM,
1160 GEDCOM_MAKE_STRING($4));
1161 START(FORM, $<ctxt>$)
1166 { end_element(ELT_OBJE_FORM, PARENT, $<ctxt>5, NULL);
1171 obje_titl_sect : OPEN DELIM TAG_TITL mand_line_item
1172 { $<ctxt>$ = start_element(ELT_OBJE_TITL,
1174 GEDCOM_MAKE_STRING($4));
1175 START(TITL, $<ctxt>$)
1180 { end_element(ELT_OBJE_TITL, PARENT, $<ctxt>5, NULL);
1185 obje_blob_sect : OPEN DELIM TAG_BLOB
1186 { $<ctxt>$ = start_element(ELT_OBJE_BLOB,
1187 PARENT, $1, $3, NULL,
1188 GEDCOM_MAKE_NULL());
1189 START(BLOB, $<ctxt>$)
1194 { end_element(ELT_OBJE_BLOB, PARENT, $<ctxt>4, NULL);
1198 obje_blob_subs : /* empty */
1199 | obje_blob_subs obje_blob_sub
1202 obje_blob_sub : obje_blob_cont_sect { OCCUR1(CONT, 1) }
1206 obje_blob_cont_sect : OPEN DELIM TAG_CONT mand_line_item
1207 { $<ctxt>$ = start_element(ELT_OBJE_BLOB_CONT,
1209 GEDCOM_MAKE_STRING($4));
1210 START(CONT, $<ctxt>$)
1215 { end_element(ELT_OBJE_BLOB_CONT, PARENT,
1221 obje_obje_sect : OPEN DELIM TAG_OBJE mand_pointer
1222 { $<ctxt>$ = start_element(ELT_OBJE_OBJE,
1224 GEDCOM_MAKE_STRING($4));
1225 START(OBJE, $<ctxt>$)
1230 { end_element(ELT_OBJE_OBJE, PARENT, $<ctxt>5, NULL);
1234 /*********************************************************************/
1235 /**** Note record ****/
1236 /*********************************************************************/
1237 note_rec : OPEN DELIM POINTER DELIM TAG_NOTE note_line_item
1238 { $<ctxt>$ = start_record(REC_NOTE,
1239 $1, GEDCOM_MAKE_STRING($3), $5,
1240 $6, GEDCOM_MAKE_STRING($6));
1241 START(NOTE, $<ctxt>$) }
1245 { end_record(REC_NOTE, $<ctxt>7); }
1248 note_line_item : /* empty */
1249 { if (!compat_mode(C_FTREE)) {
1250 gedcom_error(_("Missing value")); YYERROR;
1254 { gedcom_debug_print("==Val: %s==", $2);
1258 note_subs : /* empty */
1259 | note_subs note_sub
1262 note_sub : continuation_sub /* 0:M */
1263 | source_cit_sub /* 0:M */
1264 | ident_struc_sub /* 0:1 */
1265 | change_date_sub /* 0:1 */
1269 /*********************************************************************/
1270 /**** Repository record ****/
1271 /*********************************************************************/
1272 repos_rec : OPEN DELIM POINTER DELIM TAG_REPO
1273 { $<ctxt>$ = start_record(REC_REPO,
1274 $1, GEDCOM_MAKE_STRING($3), $5,
1275 NULL, GEDCOM_MAKE_NULL());
1276 START(REPO, $<ctxt>$) }
1280 { end_record(REC_REPO, $<ctxt>6); }
1283 repo_subs : /* empty */
1284 | repo_subs repo_sub
1287 repo_sub : repo_name_sect { OCCUR2(NAME, 0, 1) }
1288 | addr_struc_sub /* 0:1 */
1289 | note_struc_sub /* 0:M */
1290 | ident_struc_sub /* 0:1 */
1291 | change_date_sub /* 0:1 */
1296 repo_name_sect : OPEN DELIM TAG_NAME mand_line_item
1297 { $<ctxt>$ = start_element(ELT_REPO_NAME,
1299 GEDCOM_MAKE_STRING($4));
1300 START(NAME, $<ctxt>$)
1305 { end_element(ELT_REPO_NAME, PARENT, $<ctxt>5, NULL);
1309 /*********************************************************************/
1310 /**** Source record ****/
1311 /*********************************************************************/
1312 source_rec : OPEN DELIM POINTER DELIM TAG_SOUR
1313 { $<ctxt>$ = start_record(REC_SOUR,
1314 $1, GEDCOM_MAKE_STRING($3), $5,
1315 NULL, GEDCOM_MAKE_NULL());
1316 START(SOUR, $<ctxt>$) }
1320 { end_record(REC_SOUR, $<ctxt>6); }
1323 sour_subs : /* empty */
1324 | sour_subs sour_sub
1327 sour_sub : sour_data_sect { OCCUR2(DATA, 0, 1) }
1328 | sour_auth_sect { OCCUR2(AUTH, 0, 1) }
1329 | sour_titl_sect { OCCUR2(TITL, 0, 1) }
1330 | sour_abbr_sect { OCCUR2(ABBR, 0, 1) }
1331 | sour_publ_sect { OCCUR2(PUBL, 0, 1) }
1332 | sour_text_sect { OCCUR2(TEXT, 0, 1) }
1333 | source_repos_cit_sub /* 0:1 */
1334 | multim_link_sub /* 0:M */
1335 | note_struc_sub /* 0:M */
1336 | ident_struc_sub /* 0:1 */
1337 | change_date_sub /* 0:1 */
1342 sour_data_sect : OPEN DELIM TAG_DATA
1343 { $<ctxt>$ = start_element(ELT_SOUR_DATA,
1344 PARENT, $1, $3, NULL,
1345 GEDCOM_MAKE_NULL());
1346 START(DATA, $<ctxt>$)
1351 { end_element(ELT_SOUR_DATA, PARENT, $<ctxt>4, NULL);
1355 sour_data_subs : /* empty */
1356 | sour_data_subs sour_data_sub
1359 sour_data_sub : sour_data_even_sect /* 0:M */
1360 | sour_data_agnc_sect { OCCUR2(AGNC, 0, 1) }
1361 | note_struc_sub /* 0:M */
1365 sour_data_even_sect : OPEN DELIM TAG_EVEN mand_line_item
1366 { $<ctxt>$ = start_element(ELT_SOUR_DATA_EVEN,
1368 GEDCOM_MAKE_STRING($4));
1369 START(EVEN, $<ctxt>$)
1374 { end_element(ELT_SOUR_DATA_EVEN, PARENT,
1379 sour_data_even_subs : /* empty */
1380 | sour_data_even_subs sour_data_even_sub
1383 sour_data_even_sub : sour_data_even_date_sect { OCCUR2(DATE, 0, 1) }
1384 | sour_data_even_plac_sect { OCCUR2(PLAC, 0, 1) }
1388 sour_data_even_date_sect : OPEN DELIM TAG_DATE mand_line_item
1389 { struct date_value dv = gedcom_parse_date($4);
1390 $<ctxt>$ = start_element(ELT_SOUR_DATA_EVEN_DATE,
1392 GEDCOM_MAKE_DATE(dv));
1393 START(DATE, $<ctxt>$)
1398 { end_element(ELT_SOUR_DATA_EVEN_DATE, PARENT,
1403 sour_data_even_plac_sect : OPEN DELIM TAG_PLAC mand_line_item
1404 { $<ctxt>$ = start_element(ELT_SOUR_DATA_EVEN_PLAC,
1406 GEDCOM_MAKE_STRING($4));
1407 START(PLAC, $<ctxt>$)
1412 { end_element(ELT_SOUR_DATA_EVEN_PLAC, PARENT,
1417 sour_data_agnc_sect : OPEN DELIM TAG_AGNC mand_line_item
1418 { $<ctxt>$ = start_element(ELT_SOUR_DATA_AGNC,
1420 GEDCOM_MAKE_STRING($4));
1421 START(AGNC, $<ctxt>$)
1426 { end_element(ELT_SOUR_DATA_AGNC, PARENT,
1432 sour_auth_sect : OPEN DELIM TAG_AUTH mand_line_item
1433 { $<ctxt>$ = start_element(ELT_SOUR_AUTH,
1435 GEDCOM_MAKE_STRING($4));
1436 START(AUTH, $<ctxt>$)
1441 { end_element(ELT_SOUR_AUTH, PARENT, $<ctxt>5, NULL);
1445 sour_auth_subs : /* empty */
1446 | sour_auth_subs sour_auth_sub
1449 sour_auth_sub : continuation_sub /* 0:M */
1454 sour_titl_sect : OPEN DELIM TAG_TITL mand_line_item
1455 { $<ctxt>$ = start_element(ELT_SOUR_TITL,
1457 GEDCOM_MAKE_STRING($4));
1458 START(TITL, $<ctxt>$)
1463 { end_element(ELT_SOUR_TITL, PARENT, $<ctxt>5, NULL);
1467 sour_titl_subs : /* empty */
1468 | sour_titl_subs sour_titl_sub
1471 sour_titl_sub : continuation_sub /* 0:M */
1476 sour_abbr_sect : OPEN DELIM TAG_ABBR mand_line_item
1477 { $<ctxt>$ = start_element(ELT_SOUR_ABBR,
1479 GEDCOM_MAKE_STRING($4));
1480 START(ABBR, $<ctxt>$)
1485 { end_element(ELT_SOUR_ABBR, PARENT, $<ctxt>5, NULL);
1490 sour_publ_sect : OPEN DELIM TAG_PUBL mand_line_item
1491 { $<ctxt>$ = start_element(ELT_SOUR_PUBL,
1493 GEDCOM_MAKE_STRING($4));
1494 START(PUBL, $<ctxt>$)
1499 { end_element(ELT_SOUR_PUBL, PARENT, $<ctxt>5, NULL);
1503 sour_publ_subs : /* empty */
1504 | sour_publ_subs sour_publ_sub
1507 sour_publ_sub : continuation_sub /* 0:M */
1512 sour_text_sect : OPEN DELIM TAG_TEXT mand_line_item
1513 { $<ctxt>$ = start_element(ELT_SOUR_TEXT,
1515 GEDCOM_MAKE_STRING($4));
1516 START(TEXT, $<ctxt>$)
1521 { end_element(ELT_SOUR_TEXT, PARENT, $<ctxt>5, NULL);
1525 sour_text_subs : /* empty */
1526 | sour_text_subs sour_text_sub
1529 sour_text_sub : continuation_sub /* 0:M */
1533 /*********************************************************************/
1534 /**** Submission record ****/
1535 /*********************************************************************/
1536 submis_rec : OPEN DELIM POINTER DELIM TAG_SUBN
1537 { $<ctxt>$ = start_record(REC_SUBN,
1538 $1, GEDCOM_MAKE_STRING($3), $5,
1539 NULL, GEDCOM_MAKE_NULL());
1540 START(SUBN, $<ctxt>$) }
1544 { end_record(REC_SUBN, $<ctxt>6); }
1547 subn_subs : /* empty */
1548 | subn_subs subn_sub
1551 subn_sub : subn_subm_sect { OCCUR2(SUBM, 0, 1) }
1552 | subn_famf_sect { OCCUR2(FAMF, 0, 1) }
1553 | subn_temp_sect { OCCUR2(TEMP, 0, 1) }
1554 | subn_ance_sect { OCCUR2(ANCE, 0, 1) }
1555 | subn_desc_sect { OCCUR2(DESC, 0, 1) }
1556 | subn_ordi_sect { OCCUR2(ORDI, 0, 1) }
1557 | subn_rin_sect { OCCUR2(RIN, 0, 1) }
1562 subn_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
1563 { $<ctxt>$ = start_element(ELT_SUBN_SUBM,
1565 GEDCOM_MAKE_STRING($4));
1566 START(SUBM, $<ctxt>$)
1571 { end_element(ELT_SUBN_SUBM, PARENT, $<ctxt>5, NULL);
1576 subn_famf_sect : OPEN DELIM TAG_FAMF mand_line_item
1577 { $<ctxt>$ = start_element(ELT_SUBN_FAMF,
1579 GEDCOM_MAKE_STRING($4));
1580 START(FAMF, $<ctxt>$)
1585 { end_element(ELT_SUBN_FAMF, PARENT, $<ctxt>5, NULL);
1590 subn_temp_sect : OPEN DELIM TAG_TEMP mand_line_item
1591 { $<ctxt>$ = start_element(ELT_SUBN_TEMP,
1593 GEDCOM_MAKE_STRING($4));
1594 START(TEMP, $<ctxt>$)
1599 { end_element(ELT_SUBN_TEMP, PARENT, $<ctxt>5, NULL);
1604 subn_ance_sect : OPEN DELIM TAG_ANCE mand_line_item
1605 { $<ctxt>$ = start_element(ELT_SUBN_ANCE,
1607 GEDCOM_MAKE_STRING($4));
1608 START(ANCE, $<ctxt>$)
1613 { end_element(ELT_SUBN_ANCE, PARENT, $<ctxt>5, NULL);
1618 subn_desc_sect : OPEN DELIM TAG_DESC mand_line_item
1619 { $<ctxt>$ = start_element(ELT_SUBN_DESC,
1621 GEDCOM_MAKE_STRING($4));
1622 START(DESC, $<ctxt>$)
1627 { end_element(ELT_SUBN_DESC, PARENT, $<ctxt>5, NULL);
1632 subn_ordi_sect : OPEN DELIM TAG_ORDI mand_line_item
1633 { $<ctxt>$ = start_element(ELT_SUBN_ORDI,
1635 GEDCOM_MAKE_STRING($4));
1636 START(ORDI, $<ctxt>$)
1641 { end_element(ELT_SUBN_ORDI, PARENT, $<ctxt>5, NULL);
1646 subn_rin_sect : OPEN DELIM TAG_RIN mand_line_item
1647 { $<ctxt>$ = start_element(ELT_SUBN_RIN,
1649 GEDCOM_MAKE_STRING($4));
1650 START(RIN, $<ctxt>$)
1655 { end_element(ELT_SUBN_RIN, PARENT, $<ctxt>5, NULL);
1659 /*********************************************************************/
1660 /**** Submitter record ****/
1661 /*********************************************************************/
1662 submit_rec : OPEN DELIM POINTER DELIM TAG_SUBM
1663 { $<ctxt>$ = start_record(REC_SUBM,
1664 $1, GEDCOM_MAKE_STRING($3), $5,
1665 NULL, GEDCOM_MAKE_NULL());
1666 START(SUBM, $<ctxt>$) }
1670 { end_record(REC_SUBM, $<ctxt>6); }
1673 subm_subs : /* empty */
1674 | subm_subs subm_sub
1677 subm_sub : subm_name_sect { OCCUR2(NAME, 0, 1) }
1678 | addr_struc_sub /* 0:1 */
1679 | multim_link_sub /* 0:M */
1680 | subm_lang_sect { OCCUR2(LANG, 0, 3) }
1681 | subm_rfn_sect { OCCUR2(RFN, 0, 1) }
1682 | subm_rin_sect { OCCUR2(RIN, 0, 1) }
1683 | change_date_sub /* 0:1 */
1688 subm_name_sect : OPEN DELIM TAG_NAME mand_line_item
1689 { $<ctxt>$ = start_element(ELT_SUBM_NAME,
1691 GEDCOM_MAKE_STRING($4));
1692 START(NAME, $<ctxt>$)
1697 { end_element(ELT_SUBM_NAME, PARENT, $<ctxt>5, NULL);
1702 subm_lang_sect : OPEN DELIM TAG_LANG mand_line_item
1703 { $<ctxt>$ = start_element(ELT_SUBM_LANG,
1705 GEDCOM_MAKE_STRING($4));
1706 START(LANG, $<ctxt>$)
1711 { end_element(ELT_SUBM_LANG, PARENT, $<ctxt>5, NULL);
1716 subm_rfn_sect : OPEN DELIM TAG_RFN mand_line_item
1717 { $<ctxt>$ = start_element(ELT_SUBM_RFN,
1719 GEDCOM_MAKE_STRING($4));
1720 START(RFN, $<ctxt>$)
1725 { end_element(ELT_SUBM_RFN, PARENT, $<ctxt>5, NULL);
1730 subm_rin_sect : OPEN DELIM TAG_RIN mand_line_item
1731 { $<ctxt>$ = start_element(ELT_SUBM_RIN,
1733 GEDCOM_MAKE_STRING($4));
1734 START(RIN, $<ctxt>$)
1739 { end_element(ELT_SUBM_RIN, PARENT, $<ctxt>5, NULL);
1743 /*********************************************************************/
1744 /**** Substructures ****/
1745 /*********************************************************************/
1747 /* ADDRESS STRUCTURE */
1748 addr_struc_sub : addr_sect { OCCUR2(ADDR, 0, 1) }
1749 | phon_sect { OCCUR2(PHON, 0, 3) }
1752 addr_sect : OPEN DELIM TAG_ADDR mand_line_item
1753 { $<ctxt>$ = start_element(ELT_SUB_ADDR,
1755 GEDCOM_MAKE_STRING($4));
1756 START(ADDR, $<ctxt>$)
1761 { end_element(ELT_SUB_ADDR, PARENT, $<ctxt>5, NULL);
1765 addr_subs : /* empty */
1766 | addr_subs addr_sub
1769 addr_sub : addr_cont_sect /* 0:M */
1770 | addr_adr1_sect { OCCUR2(ADR1, 0, 1) }
1771 | addr_adr2_sect { OCCUR2(ADR2, 0, 1) }
1772 | addr_city_sect { OCCUR2(CITY, 0, 1) }
1773 | addr_stae_sect { OCCUR2(STAE, 0, 1) }
1774 | addr_post_sect { OCCUR2(POST, 0, 1) }
1775 | addr_ctry_sect { OCCUR2(CTRY, 0, 1) }
1779 addr_cont_sect : OPEN DELIM TAG_CONT mand_line_item
1780 { $<ctxt>$ = start_element(ELT_SUB_ADDR_CONT,
1782 GEDCOM_MAKE_STRING($4));
1783 START(CONT, $<ctxt>$)
1788 { end_element(ELT_SUB_ADDR_CONT, PARENT, $<ctxt>5, NULL);
1791 addr_adr1_sect : OPEN DELIM TAG_ADR1 mand_line_item
1792 { $<ctxt>$ = start_element(ELT_SUB_ADDR_ADR1,
1794 GEDCOM_MAKE_STRING($4));
1795 START(ADR1, $<ctxt>$)
1800 { end_element(ELT_SUB_ADDR_ADR1, PARENT, $<ctxt>5, NULL);
1803 addr_adr2_sect : OPEN DELIM TAG_ADR2 mand_line_item
1804 { $<ctxt>$ = start_element(ELT_SUB_ADDR_ADR2,
1806 GEDCOM_MAKE_STRING($4));
1807 START(ADR2, $<ctxt>$)
1812 { end_element(ELT_SUB_ADDR_ADR2, PARENT, $<ctxt>5, NULL);
1815 addr_city_sect : OPEN DELIM TAG_CITY mand_line_item
1816 { $<ctxt>$ = start_element(ELT_SUB_ADDR_CITY,
1818 GEDCOM_MAKE_STRING($4));
1819 START(CITY, $<ctxt>$)
1824 { end_element(ELT_SUB_ADDR_CITY, PARENT, $<ctxt>5, NULL);
1827 addr_stae_sect : OPEN DELIM TAG_STAE mand_line_item
1828 { $<ctxt>$ = start_element(ELT_SUB_ADDR_STAE,
1830 GEDCOM_MAKE_STRING($4));
1831 START(STAE, $<ctxt>$)
1836 { end_element(ELT_SUB_ADDR_STAE, PARENT, $<ctxt>5, NULL);
1839 addr_post_sect : OPEN DELIM TAG_POST mand_line_item
1840 { $<ctxt>$ = start_element(ELT_SUB_ADDR_POST,
1842 GEDCOM_MAKE_STRING($4));
1843 START(POST, $<ctxt>$)
1848 { end_element(ELT_SUB_ADDR_POST, PARENT, $<ctxt>5, NULL);
1851 addr_ctry_sect : OPEN DELIM TAG_CTRY mand_line_item
1852 { $<ctxt>$ = start_element(ELT_SUB_ADDR_CTRY,
1854 GEDCOM_MAKE_STRING($4));
1855 START(CTRY, $<ctxt>$)
1860 { end_element(ELT_SUB_ADDR_CTRY, PARENT, $<ctxt>5, NULL);
1864 phon_sect : OPEN DELIM TAG_PHON mand_line_item
1865 { $<ctxt>$ = start_element(ELT_SUB_PHON,
1867 GEDCOM_MAKE_STRING($4));
1868 START(PHON, $<ctxt>$)
1873 { end_element(ELT_SUB_PHON, PARENT, $<ctxt>5, NULL);
1877 /* ASSOCIATION STRUCTURE */
1878 assoc_struc_sub : asso_sect /* 0:M */
1881 asso_sect : OPEN DELIM TAG_ASSO mand_pointer
1882 { $<ctxt>$ = start_element(ELT_SUB_ASSO,
1884 GEDCOM_MAKE_STRING($4));
1885 START(ASSO, $<ctxt>$)
1888 { CHECK2(TYPE,RELA) }
1890 { end_element(ELT_SUB_ASSO, PARENT, $<ctxt>5, NULL);
1894 asso_subs : /* empty */
1895 | asso_type_sect { OCCUR2(TYPE, 1, 1) }
1896 | asso_rela_sect { OCCUR2(RELA, 1, 1) }
1902 asso_type_sect : OPEN DELIM TAG_TYPE mand_line_item
1903 { $<ctxt>$ = start_element(ELT_SUB_ASSO_TYPE,
1905 GEDCOM_MAKE_STRING($4));
1906 START(TYPE, $<ctxt>$)
1911 { end_element(ELT_SUB_ASSO_TYPE, PARENT, $<ctxt>5, NULL);
1915 asso_rela_sect : OPEN DELIM TAG_RELA mand_line_item
1916 { $<ctxt>$ = start_element(ELT_SUB_ASSO_RELA,
1918 GEDCOM_MAKE_STRING($4));
1919 START(RELA, $<ctxt>$)
1924 { end_element(ELT_SUB_ASSO_RELA, PARENT, $<ctxt>5, NULL);
1929 change_date_sub : change_date_chan_sect { OCCUR2(CHAN, 0, 1) }
1932 change_date_chan_sect : OPEN DELIM TAG_CHAN
1933 { $<ctxt>$ = start_element(ELT_SUB_CHAN,
1934 PARENT, $1, $3, NULL,
1935 GEDCOM_MAKE_NULL());
1936 START(CHAN, $<ctxt>$)
1938 change_date_chan_subs
1941 { end_element(ELT_SUB_CHAN, PARENT, $<ctxt>4, NULL);
1945 change_date_chan_subs : /* empty */
1946 | change_date_chan_subs change_date_chan_sub
1949 change_date_chan_sub : change_date_date_sect { OCCUR2(DATE, 1, 1) }
1954 change_date_date_sect : OPEN DELIM TAG_DATE mand_line_item
1955 { struct date_value dv = gedcom_parse_date($4);
1956 $<ctxt>$ = start_element(ELT_SUB_CHAN_DATE,
1958 GEDCOM_MAKE_DATE(dv));
1959 START(DATE, $<ctxt>$) }
1960 change_date_date_subs
1963 { end_element(ELT_SUB_CHAN_DATE, PARENT, $<ctxt>5,
1968 change_date_date_subs : /* empty */
1969 | change_date_date_subs change_date_date_sub
1972 change_date_date_sub : change_date_date_time_sect { OCCUR2(TIME, 0, 1) }
1976 change_date_date_time_sect : OPEN DELIM TAG_TIME mand_line_item
1978 = start_element(ELT_SUB_CHAN_TIME,
1980 GEDCOM_MAKE_STRING($4));
1981 START(TIME, $<ctxt>$)
1986 { end_element(ELT_SUB_CHAN_TIME, PARENT, $<ctxt>5,
1991 /* CHILD TO FAMILY LINK */
1992 chi_fam_link_sub : famc_sect /* 0:M */
1995 famc_sect : OPEN DELIM TAG_FAMC mand_pointer
1996 { $<ctxt>$ = start_element(ELT_SUB_FAMC,
1998 GEDCOM_MAKE_STRING($4));
1999 START(FAMC, $<ctxt>$)
2004 { end_element(ELT_SUB_FAMC, PARENT, $<ctxt>5, NULL);
2008 famc_subs : /* empty */
2009 | famc_subs famc_sub
2012 famc_sub : famc_pedi_sect /* 0:M */
2017 famc_pedi_sect : OPEN DELIM TAG_PEDI mand_line_item
2018 { $<ctxt>$ = start_element(ELT_SUB_FAMC_PEDI,
2020 GEDCOM_MAKE_STRING($4));
2021 START(PEDI, $<ctxt>$)
2026 { end_element(ELT_SUB_FAMC_PEDI, PARENT, $<ctxt>5, NULL);
2030 /* CONTINUATION SUBSECTIONS */
2031 continuation_sub : cont_sect /* 0:M */
2032 | conc_sect /* 0:M */
2035 cont_sect : OPEN DELIM TAG_CONT mand_line_item
2036 { $<ctxt>$ = start_element(ELT_SUB_CONT,
2038 GEDCOM_MAKE_STRING($4));
2039 START(CONT, $<ctxt>$)
2044 { end_element(ELT_SUB_CONT, PARENT, $<ctxt>5, NULL);
2048 conc_sect : OPEN DELIM TAG_CONC mand_line_item
2049 { $<ctxt>$ = start_element(ELT_SUB_CONC,
2051 GEDCOM_MAKE_STRING($4));
2052 START(CONC, $<ctxt>$)
2057 { end_element(ELT_SUB_CONC, PARENT, $<ctxt>5, NULL);
2062 event_detail_sub : event_detail_type_sect { OCCUR2(TYPE, 0, 1) }
2063 | event_detail_date_sect { OCCUR2(DATE, 0, 1) }
2066 | event_detail_age_sect { OCCUR2(AGE, 0, 1) }
2067 | event_detail_agnc_sect { OCCUR2(AGNC, 0, 1) }
2068 | event_detail_caus_sect { OCCUR2(CAUS, 0, 1) }
2074 event_detail_type_sect : OPEN DELIM TAG_TYPE mand_line_item
2075 { $<ctxt>$ = start_element(ELT_SUB_EVT_TYPE,
2077 GEDCOM_MAKE_STRING($4));
2078 START(TYPE, $<ctxt>$)
2083 { end_element(ELT_SUB_EVT_TYPE, PARENT, $<ctxt>5,
2087 event_detail_date_sect : OPEN DELIM TAG_DATE mand_line_item
2088 { struct date_value dv = gedcom_parse_date($4);
2089 $<ctxt>$ = start_element(ELT_SUB_EVT_DATE,
2091 GEDCOM_MAKE_DATE(dv));
2092 START(DATE, $<ctxt>$)
2097 { end_element(ELT_SUB_EVT_DATE, PARENT, $<ctxt>5,
2101 event_detail_age_sect : OPEN DELIM TAG_AGE mand_line_item
2102 { $<ctxt>$ = start_element(ELT_SUB_EVT_AGE,
2104 GEDCOM_MAKE_STRING($4));
2105 START(AGE, $<ctxt>$)
2110 { end_element(ELT_SUB_EVT_AGE, PARENT, $<ctxt>5,
2114 event_detail_agnc_sect : OPEN DELIM TAG_AGNC mand_line_item
2115 { $<ctxt>$ = start_element(ELT_SUB_EVT_AGNC,
2117 GEDCOM_MAKE_STRING($4));
2118 START(AGNC, $<ctxt>$)
2123 { end_element(ELT_SUB_EVT_AGNC, PARENT, $<ctxt>5,
2127 event_detail_caus_sect : OPEN DELIM TAG_CAUS mand_line_item
2128 { $<ctxt>$ = start_element(ELT_SUB_EVT_CAUS,
2130 GEDCOM_MAKE_STRING($4));
2131 START(CAUS, $<ctxt>$)
2136 { end_element(ELT_SUB_EVT_CAUS, PARENT, $<ctxt>5,
2141 /* FAMILY EVENT STRUCTURE */
2142 fam_event_struc_sub : fam_event_sect
2143 | fam_gen_even_sect /* 0:M */
2146 fam_event_sect : OPEN DELIM fam_event_tag opt_value
2148 $<ctxt>$ = start_element(ELT_SUB_FAM_EVT,
2150 GEDCOM_MAKE_NULL_OR_STRING($4));
2156 { end_element(ELT_SUB_FAM_EVT, PARENT, $<ctxt>5, NULL);
2160 fam_event_tag : TAG_ANUL { $$ = $1; START1(ANUL) }
2161 | TAG_CENS { $$ = $1; START1(CENS) }
2162 | TAG_DIV { $$ = $1; START1(DIV) }
2163 | TAG_DIVF { $$ = $1; START1(DIVF) }
2164 | TAG_ENGA { $$ = $1; START1(ENGA) }
2165 | TAG_MARR { $$ = $1; START1(MARR) }
2166 | TAG_MARB { $$ = $1; START1(MARB) }
2167 | TAG_MARC { $$ = $1; START1(MARC) }
2168 | TAG_MARL { $$ = $1; START1(MARL) }
2169 | TAG_MARS { $$ = $1; START1(MARS) }
2172 fam_event_subs : /* empty */
2173 | fam_event_subs fam_event_sub
2176 fam_event_sub : event_detail_sub
2177 | fam_even_husb_sect { OCCUR2(HUSB, 0, 1) }
2178 | fam_even_wife_sect { OCCUR2(WIFE, 0, 1) }
2182 fam_even_husb_sect : OPEN DELIM TAG_HUSB
2183 { $<ctxt>$ = start_element(ELT_SUB_FAM_EVT_HUSB,
2184 PARENT, $1, $3, NULL,
2185 GEDCOM_MAKE_NULL());
2186 START(HUSB, $<ctxt>$)
2191 { end_element(ELT_SUB_FAM_EVT_HUSB, PARENT, $<ctxt>4,
2196 fam_even_husb_subs : /* empty */
2197 | fam_even_husb_subs fam_even_husb_sub
2200 fam_even_husb_sub : fam_even_age_sect { OCCUR2(AGE, 1, 1) }
2204 fam_even_age_sect : OPEN DELIM TAG_AGE mand_line_item
2205 { $<ctxt>$ = start_element(ELT_SUB_FAM_EVT_AGE,
2207 GEDCOM_MAKE_STRING($4));
2208 START(AGE, $<ctxt>$)
2213 { end_element(ELT_SUB_FAM_EVT_AGE, PARENT, $<ctxt>5,
2218 fam_even_wife_sect : OPEN DELIM TAG_WIFE
2219 { $<ctxt>$ = start_element(ELT_SUB_FAM_EVT_WIFE,
2220 PARENT, $1, $3, NULL,
2221 GEDCOM_MAKE_NULL());
2222 START(WIFE, $<ctxt>$)
2227 { end_element(ELT_SUB_FAM_EVT_WIFE, PARENT, $<ctxt>4,
2232 fam_gen_even_sect : OPEN DELIM TAG_EVEN
2233 { $<ctxt>$ = start_element(ELT_SUB_FAM_EVT_EVEN,
2234 PARENT, $1, $3, NULL,
2235 GEDCOM_MAKE_NULL());
2236 START(EVEN, $<ctxt>$)
2241 { end_element(ELT_SUB_FAM_EVT_EVEN, PARENT, $<ctxt>4,
2246 fam_gen_even_subs : /* empty */
2247 | fam_gen_even_subs fam_gen_even_sub
2250 fam_gen_even_sub : event_detail_sub
2251 | fam_even_husb_sect { OCCUR2(HUSB, 0, 1) }
2252 | fam_even_wife_sect { OCCUR2(WIFE, 0, 1) }
2256 /* IDENTIFICATION STRUCTURE */
2257 ident_struc_sub : ident_refn_sect /* 0:M */
2258 | ident_rin_sect { OCCUR2(RIN, 0, 1) }
2261 ident_refn_sect : OPEN DELIM TAG_REFN mand_line_item
2262 { $<ctxt>$ = start_element(ELT_SUB_IDENT_REFN,
2264 GEDCOM_MAKE_STRING($4));
2265 START(REFN, $<ctxt>$)
2270 { end_element(ELT_SUB_IDENT_REFN, PARENT, $<ctxt>5,
2275 ident_refn_subs : /* empty */
2276 | ident_refn_subs ident_refn_sub
2279 ident_refn_sub : ident_refn_type_sect { OCCUR2(TYPE, 0, 1) }
2283 ident_refn_type_sect : OPEN DELIM TAG_TYPE mand_line_item
2284 { $<ctxt>$ = start_element(ELT_SUB_IDENT_REFN_TYPE,
2286 GEDCOM_MAKE_STRING($4));
2287 START(TYPE, $<ctxt>$)
2292 { end_element(ELT_SUB_IDENT_REFN_TYPE, PARENT, $<ctxt>5,
2297 ident_rin_sect : OPEN DELIM TAG_RIN mand_line_item
2298 { $<ctxt>$ = start_element(ELT_SUB_IDENT_RIN,
2300 GEDCOM_MAKE_STRING($4));
2301 START(RIN, $<ctxt>$)
2306 { end_element(ELT_SUB_IDENT_RIN, PARENT, $<ctxt>5,
2311 /* INDIVIDUAL ATTRIBUTE STRUCTURE */
2312 indiv_attr_struc_sub : indiv_attr_sect /* 0:M */
2313 | indiv_resi_sect /* 0:M */
2316 indiv_attr_sect : OPEN DELIM indiv_attr_tag mand_line_item
2317 { $<ctxt>$ = start_element(ELT_SUB_INDIV_ATTR,
2319 GEDCOM_MAKE_STRING($4));
2322 indiv_attr_event_subs
2325 { end_element(ELT_SUB_INDIV_ATTR, PARENT, $<ctxt>5, NULL);
2328 indiv_attr_tag : TAG_CAST { $$ = $1; START1(CAST) }
2329 | TAG_DSCR { $$ = $1; START1(DSCR) }
2330 | TAG_EDUC { $$ = $1; START1(EDUC) }
2331 | TAG_IDNO { $$ = $1; START1(IDNO) }
2332 | TAG_NATI { $$ = $1; START1(NATI) }
2333 | TAG_NCHI { $$ = $1; START1(NCHI) }
2334 | TAG_NMR { $$ = $1; START1(NMR) }
2335 | TAG_OCCU { $$ = $1; START1(OCCU) }
2336 | TAG_PROP { $$ = $1; START1(PROP) }
2337 | TAG_RELI { $$ = $1; START1(RELI) }
2338 | TAG_SSN { $$ = $1; START1(SSN) }
2339 | TAG_TITL { $$ = $1; START1(TITL) }
2341 indiv_resi_sect : OPEN DELIM TAG_RESI
2342 { $<ctxt>$ = start_element(ELT_SUB_INDIV_RESI,
2343 PARENT, $1, $3, NULL,
2344 GEDCOM_MAKE_NULL());
2345 START(RESI, $<ctxt>$)
2347 indiv_attr_event_subs
2350 { end_element(ELT_SUB_INDIV_RESI, PARENT, $<ctxt>4, NULL);
2354 indiv_attr_event_subs : /* empty */
2355 | indiv_attr_event_subs indiv_attr_event_sub
2358 indiv_attr_event_sub : event_detail_sub
2362 /* INDIVIDUAL EVENT STRUCTURE */
2363 indiv_even_struc_sub : indiv_birt_sect
2365 | indiv_adop_sect /* 0:M */
2366 | indiv_even_sect /* 0:M */
2369 indiv_birt_sect : OPEN DELIM indiv_birt_tag opt_value
2370 { $<ctxt>$ = start_element(ELT_SUB_INDIV_BIRT,
2372 GEDCOM_MAKE_NULL_OR_STRING($4));
2378 { end_element(ELT_SUB_INDIV_BIRT, PARENT, $<ctxt>5, NULL);
2382 indiv_birt_tag : TAG_BIRT { $$ = $1; START1(BIRT) }
2383 | TAG_CHR { $$ = $1; START1(CHR) }
2386 indiv_birt_subs : /* empty */
2387 | indiv_birt_subs indiv_birt_sub
2390 indiv_birt_sub : event_detail_sub
2391 | indiv_birt_famc_sect { OCCUR2(FAMC,0, 1) }
2395 indiv_birt_famc_sect : OPEN DELIM TAG_FAMC mand_pointer
2396 { $<ctxt>$ = start_element(ELT_SUB_INDIV_BIRT_FAMC,
2398 GEDCOM_MAKE_STRING($4));
2399 START(FAMC, $<ctxt>$)
2404 { end_element(ELT_SUB_INDIV_BIRT_FAMC, PARENT, $<ctxt>5,
2409 indiv_gen_sect : OPEN DELIM indiv_gen_tag opt_value
2410 { $<ctxt>$ = start_element(ELT_SUB_INDIV_GEN,
2412 GEDCOM_MAKE_NULL_OR_STRING($4));
2418 { end_element(ELT_SUB_INDIV_GEN, PARENT, $<ctxt>5, NULL);
2422 indiv_gen_tag : TAG_DEAT { $$ = $1; START1(DEAT) }
2423 | TAG_BURI { $$ = $1; START1(BURI) }
2424 | TAG_CREM { $$ = $1; START1(CREM) }
2425 | TAG_BAPM { $$ = $1; START1(BAPM) }
2426 | TAG_BARM { $$ = $1; START1(BARM) }
2427 | TAG_BASM { $$ = $1; START1(BASM) }
2428 | TAG_BLES { $$ = $1; START1(BLES) }
2429 | TAG_CHRA { $$ = $1; START1(CHRA) }
2430 | TAG_CONF { $$ = $1; START1(CONF) }
2431 | TAG_FCOM { $$ = $1; START1(FCOM) }
2432 | TAG_ORDN { $$ = $1; START1(ORDN) }
2433 | TAG_NATU { $$ = $1; START1(NATU) }
2434 | TAG_EMIG { $$ = $1; START1(EMIG) }
2435 | TAG_IMMI { $$ = $1; START1(IMMI) }
2436 | TAG_CENS { $$ = $1; START1(CENS) }
2437 | TAG_PROB { $$ = $1; START1(PROB) }
2438 | TAG_WILL { $$ = $1; START1(WILL) }
2439 | TAG_GRAD { $$ = $1; START1(GRAD) }
2440 | TAG_RETI { $$ = $1; START1(RETI) }
2443 indiv_gen_subs : /* empty */
2444 | indiv_gen_subs indiv_gen_sub
2447 indiv_gen_sub : event_detail_sub
2451 indiv_adop_sect : OPEN DELIM TAG_ADOP opt_value
2452 { $<ctxt>$ = start_element(ELT_SUB_INDIV_ADOP,
2454 GEDCOM_MAKE_NULL_OR_STRING($4));
2455 START(ADOP, $<ctxt>$) }
2459 { end_element(ELT_SUB_INDIV_ADOP, PARENT, $<ctxt>5, NULL);
2463 indiv_adop_subs : /* empty */
2464 | indiv_adop_subs indiv_adop_sub
2467 indiv_adop_sub : event_detail_sub
2468 | indiv_adop_famc_sect { OCCUR2(FAMC,0, 1) }
2472 indiv_adop_famc_sect : OPEN DELIM TAG_FAMC mand_pointer
2473 { $<ctxt>$ = start_element(ELT_SUB_INDIV_ADOP_FAMC,
2475 GEDCOM_MAKE_STRING($4));
2476 START(FAMC, $<ctxt>$) }
2477 indiv_adop_famc_subs
2480 { end_element(ELT_SUB_INDIV_ADOP_FAMC, PARENT, $<ctxt>5,
2485 indiv_adop_famc_subs : /* empty */
2486 | indiv_adop_famc_subs indiv_adop_famc_sub
2489 indiv_adop_famc_sub : indiv_adop_famc_adop_sect { OCCUR2(ADOP,0, 1) }
2493 indiv_adop_famc_adop_sect : OPEN DELIM TAG_ADOP mand_line_item
2495 = start_element(ELT_SUB_INDIV_ADOP_FAMC_ADOP,
2497 GEDCOM_MAKE_STRING($4));
2498 START(ADOP, $<ctxt>$) }
2502 { end_element(ELT_SUB_INDIV_ADOP_FAMC_ADOP,
2503 PARENT, $<ctxt>5, NULL);
2507 indiv_even_sect : OPEN DELIM TAG_EVEN
2508 { $<ctxt>$ = start_element(ELT_SUB_INDIV_EVEN,
2509 PARENT, $1, $3, NULL,
2510 GEDCOM_MAKE_NULL());
2511 START(EVEN, $<ctxt>$) }
2515 { end_element(ELT_SUB_INDIV_EVEN, PARENT, $<ctxt>4, NULL);
2519 /* LDS INDIVIDUAL ORDINANCE */
2520 lds_indiv_ord_sub : lio_bapl_sect /* 0:M */
2521 | lio_slgc_sect /* 0:M */
2524 lio_bapl_sect : OPEN DELIM lio_bapl_tag
2525 { $<ctxt>$ = start_element(ELT_SUB_LIO_BAPL,
2526 PARENT, $1, $3, NULL,
2527 GEDCOM_MAKE_NULL());
2533 { end_element(ELT_SUB_LIO_BAPL, PARENT, $<ctxt>4, NULL);
2537 lio_bapl_tag : TAG_BAPL { $$ = $1; START1(BAPL) }
2538 | TAG_CONL { $$ = $1; START1(CONL) }
2539 | TAG_ENDL { $$ = $1; START1(ENDL) }
2542 lio_bapl_subs : /* empty */
2543 | lio_bapl_subs lio_bapl_sub
2546 lio_bapl_sub : lio_bapl_stat_sect { OCCUR2(STAT, 0, 1) }
2547 | lio_bapl_date_sect { OCCUR2(DATE, 0, 1) }
2548 | lio_bapl_temp_sect { OCCUR2(TEMP, 0, 1) }
2549 | lio_bapl_plac_sect { OCCUR2(PLAC, 0, 1) }
2555 lio_bapl_stat_sect : OPEN DELIM TAG_STAT mand_line_item
2556 { $<ctxt>$ = start_element(ELT_SUB_LIO_BAPL_STAT,
2558 GEDCOM_MAKE_STRING($4));
2559 START(STAT, $<ctxt>$)
2564 { end_element(ELT_SUB_LIO_BAPL_STAT, PARENT, $<ctxt>5,
2568 lio_bapl_date_sect : OPEN DELIM TAG_DATE mand_line_item
2569 { struct date_value dv = gedcom_parse_date($4);
2570 $<ctxt>$ = start_element(ELT_SUB_LIO_BAPL_DATE,
2572 GEDCOM_MAKE_DATE(dv));
2573 START(DATE, $<ctxt>$)
2578 { end_element(ELT_SUB_LIO_BAPL_DATE, PARENT, $<ctxt>5,
2582 lio_bapl_temp_sect : OPEN DELIM TAG_TEMP mand_line_item
2583 { $<ctxt>$ = start_element(ELT_SUB_LIO_BAPL_TEMP,
2585 GEDCOM_MAKE_STRING($4));
2586 START(TEMP, $<ctxt>$)
2591 { end_element(ELT_SUB_LIO_BAPL_TEMP, PARENT, $<ctxt>5,
2595 lio_bapl_plac_sect : OPEN DELIM TAG_PLAC mand_line_item
2596 { $<ctxt>$ = start_element(ELT_SUB_LIO_BAPL_PLAC,
2598 GEDCOM_MAKE_STRING($4));
2599 START(PLAC, $<ctxt>$)
2604 { end_element(ELT_SUB_LIO_BAPL_PLAC, PARENT, $<ctxt>5,
2609 lio_slgc_sect : OPEN DELIM TAG_SLGC
2610 { $<ctxt>$ = start_element(ELT_SUB_LIO_SLGC,
2611 PARENT, $1, $3, NULL,
2612 GEDCOM_MAKE_NULL());
2613 START(SLGC, $<ctxt>$)
2618 { end_element(ELT_SUB_LIO_SLGC, PARENT, $<ctxt>4, NULL);
2622 lio_slgc_subs : /* empty */
2623 | lio_slgc_subs lio_slgc_sub
2626 lio_slgc_sub : lio_bapl_sub
2627 | lio_slgc_famc_sect { OCCUR2(FAMC, 1, 1) }
2630 lio_slgc_famc_sect : OPEN DELIM TAG_FAMC mand_pointer
2631 { $<ctxt>$ = start_element(ELT_SUB_LIO_SLGC_FAMC,
2633 GEDCOM_MAKE_STRING($4));
2634 START(FAMC, $<ctxt>$)
2639 { end_element(ELT_SUB_LIO_SLGC_FAMC, PARENT, $<ctxt>5,
2644 /* LDS SPOUSE SEALING */
2645 lds_spouse_seal_sub : lss_slgs_sect
2648 lss_slgs_sect : OPEN DELIM TAG_SLGS
2649 { $<ctxt>$ = start_element(ELT_SUB_LSS_SLGS,
2650 PARENT, $1, $3, NULL,
2651 GEDCOM_MAKE_NULL());
2652 START(SLGS, $<ctxt>$) }
2656 { end_element(ELT_SUB_LIO_SLGC, PARENT, $<ctxt>4, NULL);
2660 lss_slgs_subs : /* empty */
2661 | lss_slgs_subs lss_slgs_sub
2664 lss_slgs_sub : lss_slgs_stat_sect { OCCUR2(STAT, 0, 1) }
2665 | lss_slgs_date_sect { OCCUR2(DATE, 0, 1) }
2666 | lss_slgs_temp_sect { OCCUR2(TEMP, 0, 1) }
2667 | lss_slgs_plac_sect { OCCUR2(PLAC, 0, 1) }
2673 lss_slgs_stat_sect : OPEN DELIM TAG_STAT mand_line_item
2674 { $<ctxt>$ = start_element(ELT_SUB_LSS_SLGS_STAT,
2676 GEDCOM_MAKE_STRING($4));
2677 START(STAT, $<ctxt>$)
2682 { end_element(ELT_SUB_LSS_SLGS_STAT, PARENT, $<ctxt>5,
2686 lss_slgs_date_sect : OPEN DELIM TAG_DATE mand_line_item
2687 { struct date_value dv = gedcom_parse_date($4);
2688 $<ctxt>$ = start_element(ELT_SUB_LSS_SLGS_DATE,
2690 GEDCOM_MAKE_DATE(dv));
2691 START(DATE, $<ctxt>$)
2696 { end_element(ELT_SUB_LSS_SLGS_DATE, PARENT, $<ctxt>5,
2700 lss_slgs_temp_sect : OPEN DELIM TAG_TEMP mand_line_item
2701 { $<ctxt>$ = start_element(ELT_SUB_LSS_SLGS_TEMP,
2703 GEDCOM_MAKE_STRING($4));
2704 START(TEMP, $<ctxt>$)
2709 { end_element(ELT_SUB_LSS_SLGS_TEMP, PARENT, $<ctxt>5,
2713 lss_slgs_plac_sect : OPEN DELIM TAG_PLAC mand_line_item
2714 { $<ctxt>$ = start_element(ELT_SUB_LSS_SLGS_PLAC,
2716 GEDCOM_MAKE_STRING($4));
2717 START(PLAC, $<ctxt>$)
2722 { end_element(ELT_SUB_LSS_SLGS_PLAC, PARENT, $<ctxt>5,
2727 /* MULTIMEDIA LINK */
2728 multim_link_sub : multim_obje_link_sect
2729 | multim_obje_emb_sect
2732 multim_obje_link_sect : OPEN DELIM TAG_OBJE DELIM POINTER
2733 { $<ctxt>$ = start_element(ELT_SUB_MULTIM_OBJE,
2735 GEDCOM_MAKE_STRING($5));
2736 START(OBJE, $<ctxt>$)
2741 { end_element(ELT_SUB_MULTIM_OBJE, PARENT, $<ctxt>6,
2746 multim_obje_emb_sect : OPEN DELIM TAG_OBJE
2747 { $<ctxt>$ = start_element(ELT_SUB_MULTIM_OBJE,
2748 PARENT, $1, $3, NULL,
2749 GEDCOM_MAKE_NULL());
2750 START(OBJE, $<ctxt>$)
2752 multim_obje_emb_subs
2753 { CHECK2(FORM,FILE) }
2755 { end_element(ELT_SUB_MULTIM_OBJE, PARENT, $<ctxt>4,
2760 multim_obje_emb_subs : /* empty */
2761 | multim_obje_emb_subs multim_obje_emb_sub
2764 multim_obje_emb_sub : multim_obje_form_sect { OCCUR2(FORM, 1, 1) }
2765 | multim_obje_titl_sect { OCCUR2(TITL, 0, 1) }
2766 | multim_obje_file_sect { OCCUR2(FILE, 1, 1) }
2771 multim_obje_form_sect : OPEN DELIM TAG_FORM mand_line_item
2772 { $<ctxt>$ = start_element(ELT_SUB_MULTIM_OBJE_FORM,
2774 GEDCOM_MAKE_STRING($4));
2775 START(FORM, $<ctxt>$)
2780 { end_element(ELT_SUB_MULTIM_OBJE_FORM,
2781 PARENT, $<ctxt>5, NULL);
2784 multim_obje_titl_sect : OPEN DELIM TAG_TITL mand_line_item
2785 { $<ctxt>$ = start_element(ELT_SUB_MULTIM_OBJE_TITL,
2787 GEDCOM_MAKE_STRING($4));
2788 START(TITL, $<ctxt>$)
2793 { end_element(ELT_SUB_MULTIM_OBJE_TITL,
2794 PARENT, $<ctxt>5, NULL);
2797 multim_obje_file_sect : OPEN DELIM TAG_FILE mand_line_item
2798 { $<ctxt>$ = start_element(ELT_SUB_MULTIM_OBJE_FILE,
2800 GEDCOM_MAKE_STRING($4));
2801 START(FILE, $<ctxt>$)
2806 { end_element(ELT_SUB_MULTIM_OBJE_FILE,
2807 PARENT, $<ctxt>5, NULL);
2811 /* NOTE STRUCTURE */
2812 note_struc_sub : note_struc_link_sect /* 0:M */
2813 | note_struc_emb_sect /* 0:M */
2816 note_struc_link_sect : OPEN DELIM TAG_NOTE DELIM POINTER
2817 { $<ctxt>$ = start_element(ELT_SUB_NOTE,
2819 GEDCOM_MAKE_STRING($5));
2820 START(NOTE, $<ctxt>$)
2822 note_struc_link_subs
2825 { end_element(ELT_SUB_NOTE, PARENT, $<ctxt>6, NULL);
2829 note_struc_link_subs : /* empty */
2830 | note_struc_link_subs note_struc_link_sub
2833 note_struc_link_sub : source_cit_sub
2837 note_struc_emb_sect : OPEN DELIM TAG_NOTE opt_line_item
2839 = start_element(ELT_SUB_NOTE,
2841 GEDCOM_MAKE_NULL_OR_STRING($4));
2842 START(NOTE, $<ctxt>$)
2847 { end_element(ELT_SUB_NOTE, PARENT, $<ctxt>5, NULL);
2851 note_struc_emb_subs : /* empty */
2852 | note_struc_emb_subs note_struc_emb_sub
2855 note_struc_emb_sub : continuation_sub
2860 /* PERSONAL NAME STRUCTURE */
2861 pers_name_struc_sub : pers_name_sect /* 0:M */
2864 pers_name_sect : OPEN DELIM TAG_NAME mand_line_item
2865 { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME,
2867 GEDCOM_MAKE_STRING($4));
2868 START(NAME, $<ctxt>$)
2873 { end_element(ELT_SUB_PERS_NAME, PARENT, $<ctxt>5, NULL);
2877 pers_name_subs : /* empty */
2878 | pers_name_subs pers_name_sub
2881 pers_name_sub : pers_name_npfx_sect { OCCUR2(NPFX, 0, 1) }
2882 | pers_name_givn_sect { OCCUR2(GIVN, 0, 1) }
2883 | pers_name_nick_sect { OCCUR2(NICK, 0, 1) }
2884 | pers_name_spfx_sect { OCCUR2(SPFX, 0, 1) }
2885 | pers_name_surn_sect { OCCUR2(SURN, 0, 1) }
2886 | pers_name_nsfx_sect { OCCUR2(NSFX, 0, 1) }
2892 pers_name_npfx_sect : OPEN DELIM TAG_NPFX mand_line_item
2893 { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME_NPFX,
2895 GEDCOM_MAKE_STRING($4));
2896 START(NPFX, $<ctxt>$)
2901 { end_element(ELT_SUB_PERS_NAME_NPFX, PARENT, $<ctxt>5,
2905 pers_name_givn_sect : OPEN DELIM TAG_GIVN mand_line_item
2906 { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME_GIVN,
2908 GEDCOM_MAKE_STRING($4));
2909 START(GIVN, $<ctxt>$)
2914 { end_element(ELT_SUB_PERS_NAME_GIVN, PARENT, $<ctxt>5,
2918 pers_name_nick_sect : OPEN DELIM TAG_NICK mand_line_item
2919 { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME_NICK,
2921 GEDCOM_MAKE_STRING($4));
2922 START(NICK, $<ctxt>$)
2927 { end_element(ELT_SUB_PERS_NAME_NICK, PARENT, $<ctxt>5,
2931 pers_name_spfx_sect : OPEN DELIM TAG_SPFX mand_line_item
2932 { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME_SPFX,
2934 GEDCOM_MAKE_STRING($4));
2935 START(SPFX, $<ctxt>$)
2940 { end_element(ELT_SUB_PERS_NAME_SPFX, PARENT, $<ctxt>5,
2944 pers_name_surn_sect : OPEN DELIM TAG_SURN mand_line_item
2945 { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME_SURN,
2947 GEDCOM_MAKE_STRING($4));
2948 START(SURN, $<ctxt>$)
2953 { end_element(ELT_SUB_PERS_NAME_SURN, PARENT, $<ctxt>5,
2957 pers_name_nsfx_sect : OPEN DELIM TAG_NSFX mand_line_item
2958 { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME_NSFX,
2960 GEDCOM_MAKE_STRING($4));
2961 START(NSFX, $<ctxt>$)
2966 { end_element(ELT_SUB_PERS_NAME_NSFX, PARENT, $<ctxt>5,
2971 /* PLACE STRUCTURE */
2972 place_struc_sub : place_struc_plac_sect /* 0:M */
2975 place_struc_plac_sect : OPEN DELIM TAG_PLAC mand_line_item
2976 { $<ctxt>$ = start_element(ELT_SUB_PLAC,
2978 GEDCOM_MAKE_STRING($4));
2979 START(PLAC, $<ctxt>$)
2981 place_struc_plac_subs
2984 { end_element(ELT_SUB_PLAC, PARENT, $<ctxt>5, NULL);
2988 place_struc_plac_subs : /* empty */
2989 | place_struc_plac_subs place_struc_plac_sub
2992 place_struc_plac_sub : place_plac_form_sect { OCCUR2(FORM, 0, 1) }
2998 place_plac_form_sect : OPEN DELIM TAG_FORM mand_line_item
2999 { $<ctxt>$ = start_element(ELT_SUB_PLAC_FORM,
3001 GEDCOM_MAKE_STRING($4));
3002 START(FORM, $<ctxt>$)
3007 { end_element(ELT_SUB_PLAC_FORM, PARENT, $<ctxt>5,
3012 /* SOURCE_CITATION */
3013 source_cit_sub : source_cit_link_sect /* 0:M */
3014 | source_cit_emb_sect /* 0:M */
3017 source_cit_link_sect : OPEN DELIM TAG_SOUR DELIM POINTER
3018 { $<ctxt>$ = start_element(ELT_SUB_SOUR,
3020 GEDCOM_MAKE_STRING($5));
3021 START(SOUR, $<ctxt>$)
3023 source_cit_link_subs
3026 { end_element(ELT_SUB_SOUR, PARENT, $<ctxt>6, NULL);
3030 source_cit_link_subs : /* empty */
3031 | source_cit_link_subs source_cit_link_sub
3034 source_cit_link_sub : source_cit_page_sect { OCCUR2(PAGE, 0, 1) }
3035 | source_cit_even_sect { OCCUR2(EVEN, 0, 1) }
3036 | source_cit_data_sect { OCCUR2(DATA, 0, 1) }
3037 | source_cit_quay_sect { OCCUR2(QUAY, 0, 1) }
3043 source_cit_page_sect : OPEN DELIM TAG_PAGE mand_line_item
3044 { $<ctxt>$ = start_element(ELT_SUB_SOUR_PAGE,
3046 GEDCOM_MAKE_STRING($4));
3047 START(PAGE, $<ctxt>$)
3052 { end_element(ELT_SUB_SOUR_PAGE, PARENT, $<ctxt>5,
3057 source_cit_even_sect : OPEN DELIM TAG_EVEN mand_line_item
3058 { $<ctxt>$ = start_element(ELT_SUB_SOUR_EVEN,
3060 GEDCOM_MAKE_STRING($4));
3061 START(EVEN, $<ctxt>$)
3063 source_cit_even_subs
3066 { end_element(ELT_SUB_SOUR_EVEN, PARENT, $<ctxt>5,
3071 source_cit_even_subs : /* empty */
3072 | source_cit_even_subs source_cit_even_sub
3075 source_cit_even_sub : source_cit_even_role_sect { OCCUR2(ROLE, 0, 1) }
3079 source_cit_even_role_sect : OPEN DELIM TAG_ROLE mand_line_item
3080 { $<ctxt>$ = start_element(ELT_SUB_SOUR_EVEN_ROLE,
3082 GEDCOM_MAKE_STRING($4));
3083 START(ROLE, $<ctxt>$)
3088 { end_element(ELT_SUB_SOUR_EVEN_ROLE,
3089 PARENT, $<ctxt>5, NULL);
3093 source_cit_data_sect : OPEN DELIM TAG_DATA
3094 { $<ctxt>$ = start_element(ELT_SUB_SOUR_DATA,
3095 PARENT, $1, $3, NULL,
3096 GEDCOM_MAKE_NULL());
3097 START(DATA, $<ctxt>$)
3099 source_cit_data_subs
3102 { end_element(ELT_SUB_SOUR_DATA, PARENT, $<ctxt>4,
3107 source_cit_data_subs : /* empty */
3108 | source_cit_data_subs source_cit_data_sub
3111 source_cit_data_sub : source_cit_data_date_sect { OCCUR2(DATE, 0, 1) }
3112 | source_cit_text_sect /* 0:M */
3116 source_cit_data_date_sect : OPEN DELIM TAG_DATE mand_line_item
3117 { struct date_value dv = gedcom_parse_date($4);
3118 $<ctxt>$ = start_element(ELT_SUB_SOUR_DATA_DATE,
3120 GEDCOM_MAKE_DATE(dv));
3121 START(DATE, $<ctxt>$)
3126 { end_element(ELT_SUB_SOUR_DATA_DATE,
3127 PARENT, $<ctxt>5, NULL);
3131 source_cit_text_sect : OPEN DELIM TAG_TEXT mand_line_item
3132 { $<ctxt>$ = start_element(ELT_SUB_SOUR_TEXT,
3134 GEDCOM_MAKE_STRING($4));
3135 START(TEXT, $<ctxt>$)
3137 source_cit_text_subs
3140 { end_element(ELT_SUB_SOUR_TEXT, PARENT, $<ctxt>5,
3145 source_cit_text_subs : /* empty */
3146 | source_cit_text_subs source_cit_text_sub
3149 source_cit_text_sub : continuation_sub
3153 source_cit_quay_sect : OPEN DELIM TAG_QUAY mand_line_item
3154 { $<ctxt>$ = start_element(ELT_SUB_SOUR_QUAY,
3156 GEDCOM_MAKE_STRING($4));
3157 START(QUAY, $<ctxt>$)
3162 { end_element(ELT_SUB_SOUR_QUAY, PARENT, $<ctxt>5,
3167 source_cit_emb_sect : OPEN DELIM TAG_SOUR mand_line_item
3168 { $<ctxt>$ = start_element(ELT_SUB_SOUR,
3170 GEDCOM_MAKE_STRING($4));
3171 START(SOUR, $<ctxt>$)
3176 { end_element(ELT_SUB_SOUR, PARENT, $<ctxt>5, NULL);
3180 source_cit_emb_subs : /* empty */
3181 | source_cit_emb_subs source_cit_emb_sub
3184 source_cit_emb_sub : continuation_sub
3185 | source_cit_text_sect /* 0:M */
3190 /* SOURCE REPOSITORY CITATION */
3191 source_repos_cit_sub : source_repos_repo_sect { OCCUR2(REPO, 0, 1) }
3194 source_repos_repo_sect : OPEN DELIM TAG_REPO mand_pointer
3195 { $<ctxt>$ = start_element(ELT_SUB_REPO,
3197 GEDCOM_MAKE_STRING($4));
3198 START(REPO, $<ctxt>$)
3200 source_repos_repo_subs
3203 { end_element(ELT_SUB_REPO, PARENT, $<ctxt>5, NULL);
3207 source_repos_repo_subs : /* empty */
3208 | source_repos_repo_subs source_repos_repo_sub
3211 source_repos_repo_sub : note_struc_sub
3212 | caln_sect /* 0:M */
3216 caln_sect : OPEN DELIM TAG_CALN mand_line_item
3217 { $<ctxt>$ = start_element(ELT_SUB_REPO_CALN,
3219 GEDCOM_MAKE_STRING($4));
3220 START(CALN, $<ctxt>$)
3225 { end_element(ELT_SUB_REPO_CALN, PARENT, $<ctxt>5, NULL);
3229 caln_subs : /* empty */
3230 | caln_subs caln_sub
3233 caln_sub : caln_medi_sect { OCCUR2(MEDI, 0, 1) }
3237 caln_medi_sect : OPEN DELIM TAG_MEDI mand_line_item
3238 { $<ctxt>$ = start_element(ELT_SUB_REPO_CALN_MEDI,
3240 GEDCOM_MAKE_STRING($4));
3241 START(MEDI, $<ctxt>$)
3246 { end_element(ELT_SUB_REPO_CALN_MEDI, PARENT, $<ctxt>5, NULL);
3250 /* SPOUSE TO FAMILY LINK */
3251 spou_fam_link_sub : spou_fam_fams_sect /* 0:M */
3254 spou_fam_fams_sect : OPEN DELIM TAG_FAMS mand_pointer
3255 { $<ctxt>$ = start_element(ELT_SUB_FAMS,
3257 GEDCOM_MAKE_STRING($4));
3258 START(FAMS, $<ctxt>$)
3263 { end_element(ELT_SUB_FAMS, PARENT, $<ctxt>5, NULL);
3267 spou_fam_fams_subs : /* empty */
3268 | spou_fam_fams_subs spou_fam_fams_sub
3271 spou_fam_fams_sub : note_struc_sub
3275 /*********************************************************************/
3277 /*********************************************************************/
3279 no_std_subs : /* empty */
3280 | no_std_subs no_std_sub
3283 no_std_sub : user_sect /* 0:M */
3285 | error error_subs CLOSE { HANDLE_ERROR }
3288 no_std_rec : user_rec /* 0:M */
3290 | error error_subs CLOSE { HANDLE_ERROR }
3293 user_rec : OPEN DELIM opt_xref USERTAG
3294 { if ($4.string[0] != '_') {
3295 gedcom_error(_("Undefined tag (and not a valid user tag): %s"),
3301 { $<ctxt>$ = start_record(REC_USER,
3302 $1, GEDCOM_MAKE_NULL_OR_STRING($3), $4,
3303 $6, GEDCOM_MAKE_NULL_OR_STRING($6));
3309 { end_record(REC_USER, $<ctxt>7); }
3311 user_sect : OPEN DELIM opt_xref USERTAG
3312 { if ($4.string[0] != '_') {
3313 gedcom_error(_("Undefined tag (and not a valid user tag): %s"),
3319 { $<ctxt>$ = start_element(ELT_USER, PARENT, $1, $4, $6,
3320 GEDCOM_MAKE_NULL_OR_STRING($6));
3321 START($4, $<ctxt>$);
3326 { end_element(ELT_USER, PARENT, $<ctxt>7, NULL);
3330 user_sects : /* empty */ { }
3331 | user_sects user_sect { }
3334 opt_xref : /* empty */ { $$ = NULL; }
3335 | POINTER DELIM { $$ = $1; }
3338 opt_value : /* empty */ { $$ = NULL; }
3339 | DELIM line_value { $$ = $2; }
3342 line_value : POINTER { $$ = $1; }
3343 | line_item { $$ = $1; }
3346 mand_pointer : /* empty */ { gedcom_error(_("Missing pointer")); YYERROR; }
3347 | DELIM POINTER { gedcom_debug_print("==Ptr: %s==", $2);
3351 mand_line_item : /* empty */ { gedcom_error(_("Missing value")); YYERROR; }
3352 | DELIM line_item { gedcom_debug_print("==Val: %s==", $2);
3356 opt_line_item : /* empty */ { }
3357 | DELIM line_item { gedcom_debug_print("==Val: %s==", $2);
3361 line_item : anychar { size_t i;
3362 CLEAR_BUFFER(line_item_buf);
3363 line_item_buf_ptr = line_item_buf;
3364 /* The following also takes care of '@@' */
3365 if (!strncmp($1, "@@", 3))
3366 *line_item_buf_ptr++ = '@';
3368 for (i=0; i < strlen($1); i++)
3369 *line_item_buf_ptr++ = $1[i];
3372 | ESCAPE { size_t i;
3373 CLEAR_BUFFER(line_item_buf);
3374 line_item_buf_ptr = line_item_buf;
3375 for (i=0; i < strlen($1); i++)
3376 *line_item_buf_ptr++ = $1[i];
3381 /* The following also takes care of '@@' */
3382 if (!strncmp($2, "@@", 3))
3383 *line_item_buf_ptr++ = '@';
3385 for (i=0; i < strlen($2); i++)
3386 *line_item_buf_ptr++ = $2[i];
3391 for (i=0; i < strlen($2); i++)
3392 *line_item_buf_ptr++ = $2[i];
3397 anychar : ANYCHAR { }
3401 error_subs : /* empty */
3402 | error_subs error_sect
3405 error_sect : OPEN DELIM opt_xref anytag opt_value error_subs CLOSE { }
3407 gen_sect : OPEN DELIM opt_xref anystdtag
3408 { INVALID_TAG($4); }
3409 opt_value opt_sects CLOSE
3413 gen_rec : gen_rec_top
3417 gen_rec_norm : OPEN DELIM opt_xref anystdtag
3418 { INVALID_TOP_TAG($4) }
3419 opt_value opt_sects CLOSE
3423 gen_rec_top : OPEN DELIM anytoptag
3424 { gedcom_error(_("Missing cross-reference")); YYERROR; }
3425 opt_value opt_sects CLOSE
3429 opt_sects : /* empty */ { }
3430 | opt_sects gen_sect { }
3433 anytag : USERTAG { }
3447 anystdtag : TAG_ABBR
3577 /* Functions that handle the counting of subtags */
3579 int* count_arrays[MAXGEDCLEVEL+1];
3580 char tag_stack[MAXGEDCLEVEL+1][MAXSTDTAGLEN+1];
3581 Gedcom_ctxt ctxt_stack[MAXGEDCLEVEL+1];
3583 void push_countarray()
3586 if (count_level > MAXGEDCLEVEL) {
3587 gedcom_error(_("Internal error: count array overflow"));
3591 count = (int *)calloc(YYNTOKENS, sizeof(int));
3592 if (count == NULL) {
3593 gedcom_error(_("Internal error: count array calloc error"));
3597 count_arrays[count_level] = count;
3602 void set_parenttag(char* tag)
3604 strncpy(tag_stack[count_level+1], tag, MAXSTDTAGLEN+1);
3607 void set_parentctxt(Gedcom_ctxt ctxt)
3609 ctxt_stack[count_level+1] = ctxt;
3612 char* get_parenttag()
3614 return tag_stack[count_level];
3617 Gedcom_ctxt get_parentctxt()
3619 return ctxt_stack[count_level];
3622 int count_tag(int tag)
3624 int *count = count_arrays[count_level];
3625 return ++count[tag - GEDCOMTAGOFFSET];
3628 int check_occurrence(int tag)
3630 int *count = count_arrays[count_level];
3631 return (count[tag - GEDCOMTAGOFFSET] > 0);
3634 void pop_countarray()
3637 if (count_level < 0) {
3638 gedcom_error(_("Internal error: count array underflow"));
3642 count = count_arrays[count_level];
3644 count_arrays[count_level] = NULL;
3648 /* Enabling debug mode */
3649 /* level 0: no debugging */
3650 /* level 1: only internal */
3651 /* level 2: also bison */
3654 void gedcom_set_debug_level(int level, FILE* f)
3659 trace_output = stderr;
3661 gedcom_high_level_debug = 1;
3670 int gedcom_debug_print(char* s, ...)
3673 if (gedcom_high_level_debug) {
3676 res = vfprintf(trace_output, s, ap);
3678 fprintf(trace_output, "\n");
3683 /* Setting the error mechanism */
3684 void gedcom_set_error_handling(Gedcom_err_mech mechanism)
3686 error_mechanism = mechanism;
3689 /* Compatibility handling */
3691 void gedcom_set_compat_handling(int enable_compat)
3693 compat_enabled = enable_compat;
3696 void set_compatibility(char* program)
3698 if (compat_enabled) {
3699 if (! strncmp(program, "ftree", 6)) {
3700 gedcom_warning(_("Enabling compatibility with 'ftree'"));
3701 compatibility = C_FTREE;
3709 int compat_mode(int compat_flags)
3711 return (compat_flags & compatibility);