2 Copyright (C) 2001 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"), \
252 %token <string> BADTOKEN
254 %token <string> CLOSE
255 %token <string> ESCAPE
256 %token <string> DELIM
257 %token <string> ANYCHAR
258 %token <string> POINTER
259 %token <string> USERTAG
260 %token <string> TAG_ABBR
261 %token <string> TAG_ADDR
262 %token <string> TAG_ADR1
263 %token <string> TAG_ADR2
264 %token <string> TAG_ADOP
265 %token <string> TAG_AFN
266 %token <string> TAG_AGE
267 %token <string> TAG_AGNC
268 %token <string> TAG_ALIA
269 %token <string> TAG_ANCE
270 %token <string> TAG_ANCI
271 %token <string> TAG_ANUL
272 %token <string> TAG_ASSO
273 %token <string> TAG_AUTH
274 %token <string> TAG_BAPL
275 %token <string> TAG_BAPM
276 %token <string> TAG_BARM
277 %token <string> TAG_BASM
278 %token <string> TAG_BIRT
279 %token <string> TAG_BLES
280 %token <string> TAG_BLOB
281 %token <string> TAG_BURI
282 %token <string> TAG_CALN
283 %token <string> TAG_CAST
284 %token <string> TAG_CAUS
285 %token <string> TAG_CENS
286 %token <string> TAG_CHAN
287 %token <string> TAG_CHAR
288 %token <string> TAG_CHIL
289 %token <string> TAG_CHR
290 %token <string> TAG_CHRA
291 %token <string> TAG_CITY
292 %token <string> TAG_CONC
293 %token <string> TAG_CONF
294 %token <string> TAG_CONL
295 %token <string> TAG_CONT
296 %token <string> TAG_COPR
297 %token <string> TAG_CORP
298 %token <string> TAG_CREM
299 %token <string> TAG_CTRY
300 %token <string> TAG_DATA
301 %token <string> TAG_DATE
302 %token <string> TAG_DEAT
303 %token <string> TAG_DESC
304 %token <string> TAG_DESI
305 %token <string> TAG_DEST
306 %token <string> TAG_DIV
307 %token <string> TAG_DIVF
308 %token <string> TAG_DSCR
309 %token <string> TAG_EDUC
310 %token <string> TAG_EMIG
311 %token <string> TAG_ENDL
312 %token <string> TAG_ENGA
313 %token <string> TAG_EVEN
314 %token <string> TAG_FAM
315 %token <string> TAG_FAMC
316 %token <string> TAG_FAMF
317 %token <string> TAG_FAMS
318 %token <string> TAG_FCOM
319 %token <string> TAG_FILE
320 %token <string> TAG_FORM
321 %token <string> TAG_GEDC
322 %token <string> TAG_GIVN
323 %token <string> TAG_GRAD
324 %token <string> TAG_HEAD
325 %token <string> TAG_HUSB
326 %token <string> TAG_IDNO
327 %token <string> TAG_IMMI
328 %token <string> TAG_INDI
329 %token <string> TAG_LANG
330 %token <string> TAG_LEGA
331 %token <string> TAG_MARB
332 %token <string> TAG_MARC
333 %token <string> TAG_MARL
334 %token <string> TAG_MARR
335 %token <string> TAG_MARS
336 %token <string> TAG_MEDI
337 %token <string> TAG_NAME
338 %token <string> TAG_NATI
339 %token <string> TAG_NATU
340 %token <string> TAG_NCHI
341 %token <string> TAG_NICK
342 %token <string> TAG_NMR
343 %token <string> TAG_NOTE
344 %token <string> TAG_NPFX
345 %token <string> TAG_NSFX
346 %token <string> TAG_OBJE
347 %token <string> TAG_OCCU
348 %token <string> TAG_ORDI
349 %token <string> TAG_ORDN
350 %token <string> TAG_PAGE
351 %token <string> TAG_PEDI
352 %token <string> TAG_PHON
353 %token <string> TAG_PLAC
354 %token <string> TAG_POST
355 %token <string> TAG_PROB
356 %token <string> TAG_PROP
357 %token <string> TAG_PUBL
358 %token <string> TAG_QUAY
359 %token <string> TAG_REFN
360 %token <string> TAG_RELA
361 %token <string> TAG_RELI
362 %token <string> TAG_REPO
363 %token <string> TAG_RESI
364 %token <string> TAG_RESN
365 %token <string> TAG_RETI
366 %token <string> TAG_RFN
367 %token <string> TAG_RIN
368 %token <string> TAG_ROLE
369 %token <string> TAG_SEX
370 %token <string> TAG_SLGC
371 %token <string> TAG_SLGS
372 %token <string> TAG_SOUR
373 %token <string> TAG_SPFX
374 %token <string> TAG_SSN
375 %token <string> TAG_STAE
376 %token <string> TAG_STAT
377 %token <string> TAG_SUBM
378 %token <string> TAG_SUBN
379 %token <string> TAG_SURN
380 %token <string> TAG_TEMP
381 %token <string> TAG_TEXT
382 %token <string> TAG_TIME
383 %token <string> TAG_TITL
384 %token <string> TAG_TRLR
385 %token <string> TAG_TYPE
386 %token <string> TAG_VERS
387 %token <string> TAG_WIFE
388 %token <string> TAG_WILL
390 %type <string> anystdtag
391 %type <string> anytoptag
392 %type <string> line_item
393 %type <string> line_value
394 %type <string> mand_line_item
395 %type <string> mand_pointer
396 %type <string> note_line_item
397 %type <string> anychar
398 %type <string> opt_xref
399 %type <string> opt_value
400 %type <string> opt_line_item
401 %type <string> fam_event_tag
402 %type <string> indiv_attr_tag
403 %type <string> indiv_birt_tag
404 %type <string> indiv_gen_tag
405 %type <string> lio_bapl_tag
406 %type <ctxt> head_sect
410 file : head_sect records trlr_sect
411 { if (fail == 1) YYABORT; }
414 records : /* empty */
429 /*********************************************************************/
431 /*********************************************************************/
432 head_sect : OPEN DELIM TAG_HEAD
433 { $<ctxt>$ = start_record(REC_HEAD, $1, NULL, $3);
434 START(HEAD, $<ctxt>$) }
436 { if (compat_mode(C_FTREE))
437 CHECK3(SOUR, GEDC, CHAR)
439 CHECK4(SOUR, SUBM, GEDC, CHAR)
442 { end_record(REC_HEAD, $<ctxt>4); }
445 head_subs : /* empty */
449 head_sub : head_sour_sect { OCCUR2(SOUR, 1, 1) }
450 | head_dest_sect { OCCUR2(DEST, 0, 1) }
451 | head_date_sect { OCCUR2(DATE, 0, 1) }
452 | head_subm_sect { OCCUR2(SUBM, 1, 1) }
453 | head_subn_sect { OCCUR2(SUBN, 0, 1) }
454 | head_file_sect { OCCUR2(FILE, 0, 1) }
455 | head_copr_sect { OCCUR2(COPR, 0, 1) }
456 | head_gedc_sect { OCCUR2(GEDC, 1, 1) }
457 | head_char_sect { OCCUR2(CHAR, 1, 1) }
458 | head_lang_sect { OCCUR2(LANG, 0, 1) }
459 | head_plac_sect { OCCUR2(PLAC, 0, 1) }
460 | head_note_sect { OCCUR2(NOTE, 0, 1) }
465 head_sour_sect : OPEN DELIM TAG_SOUR mand_line_item
466 { set_compatibility($4);
467 $<ctxt>$ = start_element(ELT_HEAD_SOUR, PARENT,
469 GEDCOM_MAKE_STRING($4));
470 START(SOUR, $<ctxt>$)
475 { end_element(ELT_HEAD_SOUR, PARENT, $<ctxt>5, NULL); }
478 head_sour_subs : /* empty */
479 | head_sour_subs head_sour_sub
482 head_sour_sub : head_sour_vers_sect { OCCUR2(VERS, 0, 1) }
483 | head_sour_name_sect { OCCUR2(NAME, 0, 1) }
484 | head_sour_corp_sect { OCCUR2(CORP, 0, 1) }
485 | head_sour_data_sect { OCCUR2(DATA, 0, 1) }
489 head_sour_vers_sect : OPEN DELIM TAG_VERS mand_line_item
490 { $<ctxt>$ = start_element(ELT_HEAD_SOUR_VERS, PARENT,
492 GEDCOM_MAKE_STRING($4));
493 START(VERS, $<ctxt>$)
498 { end_element(ELT_HEAD_SOUR_VERS,
499 PARENT, $<ctxt>5, NULL);
502 head_sour_name_sect : OPEN DELIM TAG_NAME mand_line_item
503 { $<ctxt>$ = start_element(ELT_HEAD_SOUR_NAME, PARENT,
505 GEDCOM_MAKE_STRING($4));
506 START(NAME, $<ctxt>$)
511 { end_element(ELT_HEAD_SOUR_NAME,
512 PARENT, $<ctxt>5, NULL);
515 head_sour_corp_sect : OPEN DELIM TAG_CORP mand_line_item
516 { $<ctxt>$ = start_element(ELT_HEAD_SOUR_CORP, PARENT,
518 GEDCOM_MAKE_STRING($4));
519 START(CORP, $<ctxt>$)
524 { end_element(ELT_HEAD_SOUR_CORP,
525 PARENT, $<ctxt>5, NULL);
529 head_sour_corp_subs : /* empty */
530 | head_sour_corp_subs head_sour_corp_sub
533 head_sour_corp_sub : addr_struc_sub /* 0:1 */
537 head_sour_data_sect : OPEN DELIM TAG_DATA mand_line_item
538 { $<ctxt>$ = start_element(ELT_HEAD_SOUR_DATA, PARENT,
540 GEDCOM_MAKE_STRING($4));
541 START(DATA, $<ctxt>$)
546 { end_element(ELT_HEAD_SOUR_DATA,
547 PARENT, $<ctxt>5, NULL);
551 head_sour_data_subs : /* empty */
552 | head_sour_data_subs head_sour_data_sub
555 head_sour_data_sub : head_sour_data_date_sect { OCCUR2(DATE, 0, 1) }
556 | head_sour_data_copr_sect { OCCUR2(COPR, 0, 1) }
560 head_sour_data_date_sect : OPEN DELIM TAG_DATE mand_line_item
561 { struct date_value dv = gedcom_parse_date($4);
562 $<ctxt>$ = start_element(ELT_HEAD_SOUR_DATA_DATE,
564 GEDCOM_MAKE_DATE(dv));
565 START(DATE, $<ctxt>$)
570 { end_element(ELT_HEAD_SOUR_DATA_DATE,
571 PARENT, $<ctxt>5, NULL);
574 head_sour_data_copr_sect : OPEN DELIM TAG_COPR mand_line_item
575 { $<ctxt>$ = start_element(ELT_HEAD_SOUR_DATA_COPR,
577 GEDCOM_MAKE_STRING($4));
578 START(COPR, $<ctxt>$)
583 { end_element(ELT_HEAD_SOUR_DATA_COPR,
584 PARENT, $<ctxt>5, NULL);
589 head_dest_sect : OPEN DELIM TAG_DEST mand_line_item
590 { $<ctxt>$ = start_element(ELT_HEAD_DEST,
592 GEDCOM_MAKE_STRING($4));
593 START(DEST, $<ctxt>$)
598 { end_element(ELT_HEAD_DEST,
599 PARENT, $<ctxt>5, NULL);
604 head_date_sect : OPEN DELIM TAG_DATE mand_line_item
605 { struct date_value dv = gedcom_parse_date($4);
606 $<ctxt>$ = start_element(ELT_HEAD_DATE,
608 GEDCOM_MAKE_DATE(dv));
609 START(DATE, $<ctxt>$)
614 { end_element(ELT_HEAD_DATE,
615 PARENT, $<ctxt>5, NULL);
619 head_date_subs : /* empty */
620 | head_date_subs head_date_sub
623 head_date_sub : head_date_time_sect { OCCUR2(TIME, 0, 1) }
627 head_date_time_sect : OPEN DELIM TAG_TIME mand_line_item
628 { $<ctxt>$ = start_element(ELT_HEAD_DATE_TIME,
630 GEDCOM_MAKE_STRING($4));
631 START(TIME, $<ctxt>$)
636 { end_element(ELT_HEAD_DATE_TIME,
637 PARENT, $<ctxt>5, NULL);
642 head_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
643 { $<ctxt>$ = start_element(ELT_HEAD_SUBM,
645 GEDCOM_MAKE_STRING($4));
646 START(SUBM, $<ctxt>$)
651 { end_element(ELT_HEAD_SUBM,
652 PARENT, $<ctxt>5, NULL);
656 head_subn_sect : OPEN DELIM TAG_SUBN mand_pointer
657 { $<ctxt>$ = start_element(ELT_HEAD_SUBN,
659 GEDCOM_MAKE_STRING($4));
660 START(SUBN, $<ctxt>$)
665 { end_element(ELT_HEAD_SUBN,
666 PARENT, $<ctxt>5, NULL);
670 head_file_sect : OPEN DELIM TAG_FILE mand_line_item
671 { $<ctxt>$ = start_element(ELT_HEAD_FILE,
673 GEDCOM_MAKE_STRING($4));
674 START(FILE, $<ctxt>$)
679 { end_element(ELT_HEAD_FILE, PARENT, $<ctxt>5, NULL);
683 head_copr_sect : OPEN DELIM TAG_COPR mand_line_item
684 { $<ctxt>$ = start_element(ELT_HEAD_COPR,
686 GEDCOM_MAKE_STRING($4));
687 START(COPR, $<ctxt>$)
692 { end_element(ELT_HEAD_COPR, PARENT, $<ctxt>5, NULL);
696 head_gedc_sect : OPEN DELIM TAG_GEDC
697 { $<ctxt>$ = start_element(ELT_HEAD_GEDC,
698 PARENT, $1, $3, NULL,
700 START(GEDC, $<ctxt>$)
703 { CHECK2(VERS, FORM) }
705 { end_element(ELT_HEAD_GEDC, PARENT, $<ctxt>4, NULL);
709 head_gedc_subs : /* empty */
710 | head_gedc_subs head_gedc_sub
713 head_gedc_sub : head_gedc_vers_sect { OCCUR2(VERS, 1, 1) }
714 | head_gedc_form_sect { OCCUR2(FORM, 1, 1) }
717 head_gedc_vers_sect : OPEN DELIM TAG_VERS mand_line_item
718 { $<ctxt>$ = start_element(ELT_HEAD_GEDC_VERS,
720 GEDCOM_MAKE_STRING($4));
721 START(VERS, $<ctxt>$)
726 { end_element(ELT_HEAD_GEDC_VERS,
727 PARENT, $<ctxt>5, NULL);
730 head_gedc_form_sect : OPEN DELIM TAG_FORM mand_line_item
731 { $<ctxt>$ = start_element(ELT_HEAD_GEDC_FORM,
733 GEDCOM_MAKE_STRING($4));
734 START(FORM, $<ctxt>$)
739 { end_element(ELT_HEAD_GEDC_FORM,
740 PARENT, $<ctxt>5, NULL);
745 head_char_sect : OPEN DELIM TAG_CHAR mand_line_item
746 { if (open_conv_to_internal($4) == 0) YYERROR;
747 $<ctxt>$ = start_element(ELT_HEAD_CHAR,
749 GEDCOM_MAKE_STRING($4));
750 START(CHAR, $<ctxt>$)
755 { end_element(ELT_HEAD_CHAR, PARENT, $<ctxt>5, NULL);
759 head_char_subs : /* empty */
760 | head_char_subs head_char_sub
763 head_char_sub : head_char_vers_sect { OCCUR2(VERS, 0, 1) }
766 head_char_vers_sect : OPEN DELIM TAG_VERS mand_line_item
767 { $<ctxt>$ = start_element(ELT_HEAD_CHAR_VERS,
769 GEDCOM_MAKE_STRING($4));
770 START(VERS, $<ctxt>$)
775 { end_element(ELT_HEAD_CHAR_VERS,
776 PARENT, $<ctxt>5, NULL);
781 head_lang_sect : OPEN DELIM TAG_LANG mand_line_item
782 { $<ctxt>$ = start_element(ELT_HEAD_LANG,
784 GEDCOM_MAKE_STRING($4));
785 START(LANG, $<ctxt>$)
790 { end_element(ELT_HEAD_LANG, PARENT, $<ctxt>5, NULL);
794 head_plac_sect : OPEN DELIM TAG_PLAC
795 { $<ctxt>$ = start_element(ELT_HEAD_PLAC,
796 PARENT, $1, $3, NULL,
798 START(PLAC, $<ctxt>$)
803 { end_element(ELT_HEAD_PLAC, PARENT, $<ctxt>4, NULL);
807 head_plac_subs : /* empty */
808 | head_plac_subs head_plac_sub
811 head_plac_sub : head_plac_form_sect { OCCUR2(FORM, 1, 1) }
814 head_plac_form_sect : OPEN DELIM TAG_FORM mand_line_item
815 { $<ctxt>$ = start_element(ELT_HEAD_PLAC_FORM,
817 GEDCOM_MAKE_STRING($4));
818 START(FORM, $<ctxt>$)
823 { end_element(ELT_HEAD_PLAC_FORM,
824 PARENT, $<ctxt>5, NULL);
829 head_note_sect : OPEN DELIM TAG_NOTE mand_line_item
830 { $<ctxt>$ = start_element(ELT_HEAD_NOTE,
832 GEDCOM_MAKE_STRING($4));
833 START(NOTE, $<ctxt>$)
838 { end_element(ELT_HEAD_NOTE, PARENT, $<ctxt>5, NULL);
842 head_note_subs : /* empty */
843 | head_note_subs head_note_sub
846 head_note_sub : continuation_sub /* 0:M */
850 /*********************************************************************/
852 /*********************************************************************/
853 /* Don't need callbacks here, there is no information... */
854 trlr_sect : OPEN DELIM TAG_TRLR CLOSE { }
857 /*********************************************************************/
858 /**** Family record ****/
859 /*********************************************************************/
860 fam_rec : OPEN DELIM POINTER DELIM TAG_FAM
861 { $<ctxt>$ = start_record(REC_FAM, $1, $3, $5);
862 START(FAM, $<ctxt>$) }
866 { end_record(REC_FAM, $<ctxt>6); }
869 fam_subs : /* empty */
873 fam_sub : fam_event_struc_sub /* 0:M */
874 | fam_husb_sect { OCCUR2(HUSB, 0, 1) }
875 | fam_wife_sect { OCCUR2(WIFE, 0, 1) }
876 | fam_chil_sect /* 0:M */
877 | fam_nchi_sect { OCCUR2(NCHI, 0, 1) }
878 | fam_subm_sect /* 0:M */
879 | lds_spouse_seal_sub /* 0:M */
880 | source_cit_sub /* 0:M */
881 | multim_link_sub /* 0:M */
882 | note_struc_sub /* 0:M */
883 | ident_struc_sub /* 0:1 */
884 | change_date_sub /* 0:1 */
889 fam_husb_sect : OPEN DELIM TAG_HUSB mand_pointer
890 { $<ctxt>$ = start_element(ELT_FAM_HUSB,
892 GEDCOM_MAKE_STRING($4));
893 START(HUSB, $<ctxt>$)
898 { end_element(ELT_FAM_HUSB, PARENT, $<ctxt>5, NULL);
903 fam_wife_sect : OPEN DELIM TAG_WIFE mand_pointer
904 { $<ctxt>$ = start_element(ELT_FAM_WIFE,
906 GEDCOM_MAKE_STRING($4));
907 START(WIFE, $<ctxt>$)
912 { end_element(ELT_FAM_WIFE, PARENT, $<ctxt>5, NULL);
917 fam_chil_sect : OPEN DELIM TAG_CHIL mand_pointer
918 { $<ctxt>$ = start_element(ELT_FAM_CHIL,
920 GEDCOM_MAKE_STRING($4));
921 START(CHIL, $<ctxt>$)
926 { end_element(ELT_FAM_CHIL, PARENT, $<ctxt>5, NULL);
931 fam_nchi_sect : OPEN DELIM TAG_NCHI mand_line_item
932 { $<ctxt>$ = start_element(ELT_FAM_NCHI,
934 GEDCOM_MAKE_STRING($4));
935 START(NCHI, $<ctxt>$)
940 { end_element(ELT_FAM_NCHI, PARENT, $<ctxt>5, NULL);
945 fam_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
946 { $<ctxt>$ = start_element(ELT_FAM_SUBM,
948 GEDCOM_MAKE_STRING($4));
949 START(SUBM, $<ctxt>$)
954 { end_element(ELT_FAM_SUBM, PARENT, $<ctxt>5, NULL);
958 /*********************************************************************/
959 /**** Individual record ****/
960 /*********************************************************************/
961 indiv_rec : OPEN DELIM POINTER DELIM TAG_INDI
962 { $<ctxt>$ = start_record(REC_INDI, $1, $3, $5);
963 START(INDI, $<ctxt>$) }
967 { end_record(REC_INDI, $<ctxt>6); }
970 indi_subs : /* empty */
974 indi_sub : indi_resn_sect { OCCUR2(RESN, 0, 1) }
975 | pers_name_struc_sub /* 0:M */
976 | indi_sex_sect { OCCUR2(SEX, 0, 1) }
977 | indiv_even_struc_sub /* 0:M */
978 | indiv_attr_struc_sub /* 0:M */
979 | lds_indiv_ord_sub /* 0:M */
980 | chi_fam_link_sub /* 0:M */
981 | spou_fam_link_sub /* 0:M */
982 | indi_subm_sect /* 0:M */
983 | assoc_struc_sub /* 0:M */
984 | indi_alia_sect /* 0:M */
985 | indi_anci_sect /* 0:M */
986 | indi_desi_sect /* 0:M */
987 | source_cit_sub /* 0:M */
988 | multim_link_sub /* 0:M */
989 | note_struc_sub /* 0:M */
990 | indi_rfn_sect { OCCUR2(RFN, 0, 1) }
991 | indi_afn_sect /* 0:M */
992 | ident_struc_sub /* 0:1 */
993 | change_date_sub /* 0:1 */
994 | ftree_addr_sect { if (!compat_mode(C_FTREE))
1001 indi_resn_sect : OPEN DELIM TAG_RESN mand_line_item
1002 { $<ctxt>$ = start_element(ELT_INDI_RESN,
1004 GEDCOM_MAKE_STRING($4));
1005 START(RESN, $<ctxt>$)
1010 { end_element(ELT_INDI_RESN, PARENT, $<ctxt>5, NULL);
1015 indi_sex_sect : OPEN DELIM TAG_SEX mand_line_item
1016 { $<ctxt>$ = start_element(ELT_INDI_SEX,
1018 GEDCOM_MAKE_STRING($4));
1019 START(SEX, $<ctxt>$)
1024 { end_element(ELT_INDI_SEX, PARENT, $<ctxt>5, NULL);
1029 indi_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
1030 { $<ctxt>$ = start_element(ELT_INDI_SUBM,
1032 GEDCOM_MAKE_STRING($4));
1033 START(SUBM, $<ctxt>$)
1038 { end_element(ELT_INDI_SUBM, PARENT, $<ctxt>5, NULL);
1043 indi_alia_sect : OPEN DELIM TAG_ALIA mand_pointer
1044 { $<ctxt>$ = start_element(ELT_INDI_ALIA,
1046 GEDCOM_MAKE_STRING($4));
1047 START(ALIA, $<ctxt>$)
1052 { end_element(ELT_INDI_ALIA, PARENT, $<ctxt>5, NULL);
1057 indi_anci_sect : OPEN DELIM TAG_ANCI mand_pointer
1058 { $<ctxt>$ = start_element(ELT_INDI_ANCI,
1060 GEDCOM_MAKE_STRING($4));
1061 START(ANCI, $<ctxt>$)
1066 { end_element(ELT_INDI_ANCI, PARENT, $<ctxt>5, NULL);
1071 indi_desi_sect : OPEN DELIM TAG_DESI mand_pointer
1072 { $<ctxt>$ = start_element(ELT_INDI_DESI,
1074 GEDCOM_MAKE_STRING($4));
1075 START(DESI, $<ctxt>$)
1080 { end_element(ELT_INDI_DESI, PARENT, $<ctxt>5, NULL);
1085 indi_rfn_sect : OPEN DELIM TAG_RFN mand_line_item
1086 { $<ctxt>$ = start_element(ELT_INDI_RFN,
1088 GEDCOM_MAKE_STRING($4));
1089 START(RFN, $<ctxt>$)
1094 { end_element(ELT_INDI_RFN, PARENT, $<ctxt>5, NULL);
1099 indi_afn_sect : OPEN DELIM TAG_AFN mand_line_item
1100 { $<ctxt>$ = start_element(ELT_INDI_AFN,
1102 GEDCOM_MAKE_STRING($4));
1103 START(AFN, $<ctxt>$)
1108 { end_element(ELT_INDI_AFN, PARENT, $<ctxt>5, NULL);
1112 /* INDI.ADDR (Only for 'ftree' compatibility) */
1113 ftree_addr_sect : OPEN DELIM TAG_ADDR opt_line_item
1114 { START(ADDR, NULL) } no_std_subs { CHECK0 } CLOSE { }
1116 /*********************************************************************/
1117 /**** Multimedia record ****/
1118 /*********************************************************************/
1119 multim_rec : OPEN DELIM POINTER DELIM TAG_OBJE
1120 { $<ctxt>$ = start_record(REC_OBJE, $1, $3, $5);
1121 START(OBJE, $<ctxt>$) }
1123 { CHECK2(FORM, BLOB) }
1125 { end_record(REC_OBJE, $<ctxt>6); }
1128 obje_subs : /* empty */
1129 | obje_subs obje_sub
1132 obje_sub : obje_form_sect { OCCUR2(FORM, 1, 1) }
1133 | obje_titl_sect { OCCUR2(TITL, 0, 1) }
1134 | note_struc_sub /* 0:M */
1135 | obje_blob_sect { OCCUR2(BLOB, 1, 1) }
1136 | obje_obje_sect { OCCUR2(OBJE, 0, 1) }
1137 | ident_struc_sub /* 0:1 */
1138 | change_date_sub /* 0:1 */
1143 obje_form_sect : OPEN DELIM TAG_FORM mand_line_item
1144 { $<ctxt>$ = start_element(ELT_OBJE_FORM,
1146 GEDCOM_MAKE_STRING($4));
1147 START(FORM, $<ctxt>$)
1152 { end_element(ELT_OBJE_FORM, PARENT, $<ctxt>5, NULL);
1157 obje_titl_sect : OPEN DELIM TAG_TITL mand_line_item
1158 { $<ctxt>$ = start_element(ELT_OBJE_TITL,
1160 GEDCOM_MAKE_STRING($4));
1161 START(TITL, $<ctxt>$)
1166 { end_element(ELT_OBJE_TITL, PARENT, $<ctxt>5, NULL);
1171 obje_blob_sect : OPEN DELIM TAG_BLOB
1172 { $<ctxt>$ = start_element(ELT_OBJE_BLOB,
1173 PARENT, $1, $3, NULL,
1174 GEDCOM_MAKE_NULL());
1175 START(BLOB, $<ctxt>$)
1180 { end_element(ELT_OBJE_BLOB, PARENT, $<ctxt>4, NULL);
1184 obje_blob_subs : /* empty */
1185 | obje_blob_subs obje_blob_sub
1188 obje_blob_sub : obje_blob_cont_sect { OCCUR1(CONT, 1) }
1192 obje_blob_cont_sect : OPEN DELIM TAG_CONT mand_line_item
1193 { $<ctxt>$ = start_element(ELT_OBJE_BLOB_CONT,
1195 GEDCOM_MAKE_STRING($4));
1196 START(CONT, $<ctxt>$)
1201 { end_element(ELT_OBJE_BLOB_CONT, PARENT,
1207 obje_obje_sect : OPEN DELIM TAG_OBJE mand_pointer
1208 { $<ctxt>$ = start_element(ELT_OBJE_OBJE,
1210 GEDCOM_MAKE_STRING($4));
1211 START(OBJE, $<ctxt>$)
1216 { end_element(ELT_OBJE_OBJE, PARENT, $<ctxt>5, NULL);
1220 /*********************************************************************/
1221 /**** Note record ****/
1222 /*********************************************************************/
1223 note_rec : OPEN DELIM POINTER DELIM TAG_NOTE note_line_item
1224 { $<ctxt>$ = start_record(REC_NOTE, $1, $3, $5);
1225 START(NOTE, $<ctxt>$) }
1229 { end_record(REC_NOTE, $<ctxt>6); }
1232 note_line_item : /* empty */
1233 { if (!compat_mode(C_FTREE)) {
1234 gedcom_error(_("Missing value")); YYERROR;
1238 { gedcom_debug_print("==Val: %s==", $2);
1242 note_subs : /* empty */
1243 | note_subs note_sub
1246 note_sub : continuation_sub /* 0:M */
1247 | source_cit_sub /* 0:M */
1248 | ident_struc_sub /* 0:1 */
1249 | change_date_sub /* 0:1 */
1253 /*********************************************************************/
1254 /**** Repository record ****/
1255 /*********************************************************************/
1256 repos_rec : OPEN DELIM POINTER DELIM TAG_REPO
1257 { $<ctxt>$ = start_record(REC_REPO, $1, $3, $5);
1258 START(REPO, $<ctxt>$) }
1262 { end_record(REC_REPO, $<ctxt>6); }
1265 repo_subs : /* empty */
1266 | repo_subs repo_sub
1269 repo_sub : repo_name_sect { OCCUR2(NAME, 0, 1) }
1270 | addr_struc_sub /* 0:1 */
1271 | note_struc_sub /* 0:M */
1272 | ident_struc_sub /* 0:1 */
1273 | change_date_sub /* 0:1 */
1278 repo_name_sect : OPEN DELIM TAG_NAME mand_line_item
1279 { $<ctxt>$ = start_element(ELT_REPO_NAME,
1281 GEDCOM_MAKE_STRING($4));
1282 START(NAME, $<ctxt>$)
1287 { end_element(ELT_REPO_NAME, PARENT, $<ctxt>5, NULL);
1291 /*********************************************************************/
1292 /**** Source record ****/
1293 /*********************************************************************/
1294 source_rec : OPEN DELIM POINTER DELIM TAG_SOUR
1295 { $<ctxt>$ = start_record(REC_SOUR, $1, $3, $5);
1296 START(SOUR, $<ctxt>$) }
1300 { end_record(REC_SOUR, $<ctxt>6); }
1303 sour_subs : /* empty */
1304 | sour_subs sour_sub
1307 sour_sub : sour_data_sect { OCCUR2(DATA, 0, 1) }
1308 | sour_auth_sect { OCCUR2(AUTH, 0, 1) }
1309 | sour_titl_sect { OCCUR2(TITL, 0, 1) }
1310 | sour_abbr_sect { OCCUR2(ABBR, 0, 1) }
1311 | sour_publ_sect { OCCUR2(PUBL, 0, 1) }
1312 | sour_text_sect { OCCUR2(TEXT, 0, 1) }
1313 | source_repos_cit_sub /* 0:1 */
1314 | multim_link_sub /* 0:M */
1315 | note_struc_sub /* 0:M */
1316 | ident_struc_sub /* 0:1 */
1317 | change_date_sub /* 0:1 */
1322 sour_data_sect : OPEN DELIM TAG_DATA
1323 { $<ctxt>$ = start_element(ELT_SOUR_DATA,
1324 PARENT, $1, $3, NULL,
1325 GEDCOM_MAKE_NULL());
1326 START(DATA, $<ctxt>$)
1331 { end_element(ELT_SOUR_DATA, PARENT, $<ctxt>4, NULL);
1335 sour_data_subs : /* empty */
1336 | sour_data_subs sour_data_sub
1339 sour_data_sub : sour_data_even_sect /* 0:M */
1340 | sour_data_agnc_sect { OCCUR2(AGNC, 0, 1) }
1341 | note_struc_sub /* 0:M */
1345 sour_data_even_sect : OPEN DELIM TAG_EVEN mand_line_item
1346 { $<ctxt>$ = start_element(ELT_SOUR_DATA_EVEN,
1348 GEDCOM_MAKE_STRING($4));
1349 START(EVEN, $<ctxt>$)
1354 { end_element(ELT_SOUR_DATA_EVEN, PARENT,
1359 sour_data_even_subs : /* empty */
1360 | sour_data_even_subs sour_data_even_sub
1363 sour_data_even_sub : sour_data_even_date_sect { OCCUR2(DATE, 0, 1) }
1364 | sour_data_even_plac_sect { OCCUR2(PLAC, 0, 1) }
1368 sour_data_even_date_sect : OPEN DELIM TAG_DATE mand_line_item
1369 { struct date_value dv = gedcom_parse_date($4);
1370 $<ctxt>$ = start_element(ELT_SOUR_DATA_EVEN_DATE,
1372 GEDCOM_MAKE_DATE(dv));
1373 START(DATE, $<ctxt>$)
1378 { end_element(ELT_SOUR_DATA_EVEN_DATE, PARENT,
1383 sour_data_even_plac_sect : OPEN DELIM TAG_PLAC mand_line_item
1384 { $<ctxt>$ = start_element(ELT_SOUR_DATA_EVEN_PLAC,
1386 GEDCOM_MAKE_STRING($4));
1387 START(PLAC, $<ctxt>$)
1392 { end_element(ELT_SOUR_DATA_EVEN_PLAC, PARENT,
1397 sour_data_agnc_sect : OPEN DELIM TAG_AGNC mand_line_item
1398 { $<ctxt>$ = start_element(ELT_SOUR_DATA_AGNC,
1400 GEDCOM_MAKE_STRING($4));
1401 START(AGNC, $<ctxt>$)
1406 { end_element(ELT_SOUR_DATA_AGNC, PARENT,
1412 sour_auth_sect : OPEN DELIM TAG_AUTH mand_line_item
1413 { $<ctxt>$ = start_element(ELT_SOUR_AUTH,
1415 GEDCOM_MAKE_STRING($4));
1416 START(AUTH, $<ctxt>$)
1421 { end_element(ELT_SOUR_AUTH, PARENT, $<ctxt>5, NULL);
1425 sour_auth_subs : /* empty */
1426 | sour_auth_subs sour_auth_sub
1429 sour_auth_sub : continuation_sub /* 0:M */
1434 sour_titl_sect : OPEN DELIM TAG_TITL mand_line_item
1435 { $<ctxt>$ = start_element(ELT_SOUR_TITL,
1437 GEDCOM_MAKE_STRING($4));
1438 START(TITL, $<ctxt>$)
1443 { end_element(ELT_SOUR_TITL, PARENT, $<ctxt>5, NULL);
1447 sour_titl_subs : /* empty */
1448 | sour_titl_subs sour_titl_sub
1451 sour_titl_sub : continuation_sub /* 0:M */
1456 sour_abbr_sect : OPEN DELIM TAG_ABBR mand_line_item
1457 { $<ctxt>$ = start_element(ELT_SOUR_ABBR,
1459 GEDCOM_MAKE_STRING($4));
1460 START(ABBR, $<ctxt>$)
1465 { end_element(ELT_SOUR_ABBR, PARENT, $<ctxt>5, NULL);
1470 sour_publ_sect : OPEN DELIM TAG_PUBL mand_line_item
1471 { $<ctxt>$ = start_element(ELT_SOUR_PUBL,
1473 GEDCOM_MAKE_STRING($4));
1474 START(PUBL, $<ctxt>$)
1479 { end_element(ELT_SOUR_PUBL, PARENT, $<ctxt>5, NULL);
1483 sour_publ_subs : /* empty */
1484 | sour_publ_subs sour_publ_sub
1487 sour_publ_sub : continuation_sub /* 0:M */
1492 sour_text_sect : OPEN DELIM TAG_TEXT mand_line_item
1493 { $<ctxt>$ = start_element(ELT_SOUR_TEXT,
1495 GEDCOM_MAKE_STRING($4));
1496 START(TEXT, $<ctxt>$)
1501 { end_element(ELT_SOUR_TEXT, PARENT, $<ctxt>5, NULL);
1505 sour_text_subs : /* empty */
1506 | sour_text_subs sour_text_sub
1509 sour_text_sub : continuation_sub /* 0:M */
1513 /*********************************************************************/
1514 /**** Submission record ****/
1515 /*********************************************************************/
1516 submis_rec : OPEN DELIM POINTER DELIM TAG_SUBN
1517 { $<ctxt>$ = start_record(REC_SUBN, $1, $3, $5);
1518 START(SUBN, $<ctxt>$) }
1522 { end_record(REC_SUBN, $<ctxt>6); }
1525 subn_subs : /* empty */
1526 | subn_subs subn_sub
1529 subn_sub : subn_subm_sect { OCCUR2(SUBM, 0, 1) }
1530 | subn_famf_sect { OCCUR2(FAMF, 0, 1) }
1531 | subn_temp_sect { OCCUR2(TEMP, 0, 1) }
1532 | subn_ance_sect { OCCUR2(ANCE, 0, 1) }
1533 | subn_desc_sect { OCCUR2(DESC, 0, 1) }
1534 | subn_ordi_sect { OCCUR2(ORDI, 0, 1) }
1535 | subn_rin_sect { OCCUR2(RIN, 0, 1) }
1540 subn_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
1541 { $<ctxt>$ = start_element(ELT_SUBN_SUBM,
1543 GEDCOM_MAKE_STRING($4));
1544 START(SUBM, $<ctxt>$)
1549 { end_element(ELT_SUBN_SUBM, PARENT, $<ctxt>5, NULL);
1554 subn_famf_sect : OPEN DELIM TAG_FAMF mand_line_item
1555 { $<ctxt>$ = start_element(ELT_SUBN_FAMF,
1557 GEDCOM_MAKE_STRING($4));
1558 START(FAMF, $<ctxt>$)
1563 { end_element(ELT_SUBN_FAMF, PARENT, $<ctxt>5, NULL);
1568 subn_temp_sect : OPEN DELIM TAG_TEMP mand_line_item
1569 { $<ctxt>$ = start_element(ELT_SUBN_TEMP,
1571 GEDCOM_MAKE_STRING($4));
1572 START(TEMP, $<ctxt>$)
1577 { end_element(ELT_SUBN_TEMP, PARENT, $<ctxt>5, NULL);
1582 subn_ance_sect : OPEN DELIM TAG_ANCE mand_line_item
1583 { $<ctxt>$ = start_element(ELT_SUBN_ANCE,
1585 GEDCOM_MAKE_STRING($4));
1586 START(ANCE, $<ctxt>$)
1591 { end_element(ELT_SUBN_ANCE, PARENT, $<ctxt>5, NULL);
1596 subn_desc_sect : OPEN DELIM TAG_DESC mand_line_item
1597 { $<ctxt>$ = start_element(ELT_SUBN_DESC,
1599 GEDCOM_MAKE_STRING($4));
1600 START(DESC, $<ctxt>$)
1605 { end_element(ELT_SUBN_DESC, PARENT, $<ctxt>5, NULL);
1610 subn_ordi_sect : OPEN DELIM TAG_ORDI mand_line_item
1611 { $<ctxt>$ = start_element(ELT_SUBN_ORDI,
1613 GEDCOM_MAKE_STRING($4));
1614 START(ORDI, $<ctxt>$)
1619 { end_element(ELT_SUBN_ORDI, PARENT, $<ctxt>5, NULL);
1624 subn_rin_sect : OPEN DELIM TAG_RIN mand_line_item
1625 { $<ctxt>$ = start_element(ELT_SUBN_RIN,
1627 GEDCOM_MAKE_STRING($4));
1628 START(RIN, $<ctxt>$)
1633 { end_element(ELT_SUBN_RIN, PARENT, $<ctxt>5, NULL);
1637 /*********************************************************************/
1638 /**** Submitter record ****/
1639 /*********************************************************************/
1640 submit_rec : OPEN DELIM POINTER DELIM TAG_SUBM
1641 { $<ctxt>$ = start_record(REC_SUBM, $1, $3, $5);
1642 START(SUBM, $<ctxt>$) }
1646 { end_record(REC_SUBM, $<ctxt>6); }
1649 subm_subs : /* empty */
1650 | subm_subs subm_sub
1653 subm_sub : subm_name_sect { OCCUR2(NAME, 0, 1) }
1654 | addr_struc_sub /* 0:1 */
1655 | multim_link_sub /* 0:M */
1656 | subm_lang_sect { OCCUR2(LANG, 0, 3) }
1657 | subm_rfn_sect { OCCUR2(RFN, 0, 1) }
1658 | subm_rin_sect { OCCUR2(RIN, 0, 1) }
1659 | change_date_sub /* 0:1 */
1664 subm_name_sect : OPEN DELIM TAG_NAME mand_line_item
1665 { $<ctxt>$ = start_element(ELT_SUBM_NAME,
1667 GEDCOM_MAKE_STRING($4));
1668 START(NAME, $<ctxt>$)
1673 { end_element(ELT_SUBM_NAME, PARENT, $<ctxt>5, NULL);
1678 subm_lang_sect : OPEN DELIM TAG_LANG mand_line_item
1679 { $<ctxt>$ = start_element(ELT_SUBM_LANG,
1681 GEDCOM_MAKE_STRING($4));
1682 START(LANG, $<ctxt>$)
1687 { end_element(ELT_SUBM_LANG, PARENT, $<ctxt>5, NULL);
1692 subm_rfn_sect : OPEN DELIM TAG_RFN mand_line_item
1693 { $<ctxt>$ = start_element(ELT_SUBM_RFN,
1695 GEDCOM_MAKE_STRING($4));
1696 START(RFN, $<ctxt>$)
1701 { end_element(ELT_SUBM_RFN, PARENT, $<ctxt>5, NULL);
1706 subm_rin_sect : OPEN DELIM TAG_RIN mand_line_item
1707 { $<ctxt>$ = start_element(ELT_SUBM_RIN,
1709 GEDCOM_MAKE_STRING($4));
1710 START(RIN, $<ctxt>$)
1715 { end_element(ELT_SUBM_RIN, PARENT, $<ctxt>5, NULL);
1719 /*********************************************************************/
1720 /**** Substructures ****/
1721 /*********************************************************************/
1723 /* ADDRESS STRUCTURE */
1724 addr_struc_sub : addr_sect { OCCUR2(ADDR, 0, 1) }
1725 | phon_sect { OCCUR2(PHON, 0, 3) }
1728 addr_sect : OPEN DELIM TAG_ADDR mand_line_item
1729 { $<ctxt>$ = start_element(ELT_SUB_ADDR,
1731 GEDCOM_MAKE_STRING($4));
1732 START(ADDR, $<ctxt>$)
1737 { end_element(ELT_SUB_ADDR, PARENT, $<ctxt>5, NULL);
1741 addr_subs : /* empty */
1742 | addr_subs addr_sub
1745 addr_sub : addr_cont_sect /* 0:M */
1746 | addr_adr1_sect { OCCUR2(ADR1, 0, 1) }
1747 | addr_adr2_sect { OCCUR2(ADR2, 0, 1) }
1748 | addr_city_sect { OCCUR2(CITY, 0, 1) }
1749 | addr_stae_sect { OCCUR2(STAE, 0, 1) }
1750 | addr_post_sect { OCCUR2(POST, 0, 1) }
1751 | addr_ctry_sect { OCCUR2(CTRY, 0, 1) }
1755 addr_cont_sect : OPEN DELIM TAG_CONT mand_line_item
1756 { $<ctxt>$ = start_element(ELT_SUB_ADDR_CONT,
1758 GEDCOM_MAKE_STRING($4));
1759 START(CONT, $<ctxt>$)
1764 { end_element(ELT_SUB_ADDR_CONT, PARENT, $<ctxt>5, NULL);
1767 addr_adr1_sect : OPEN DELIM TAG_ADR1 mand_line_item
1768 { $<ctxt>$ = start_element(ELT_SUB_ADDR_ADR1,
1770 GEDCOM_MAKE_STRING($4));
1771 START(ADR1, $<ctxt>$)
1776 { end_element(ELT_SUB_ADDR_ADR1, PARENT, $<ctxt>5, NULL);
1779 addr_adr2_sect : OPEN DELIM TAG_ADR2 mand_line_item
1780 { $<ctxt>$ = start_element(ELT_SUB_ADDR_ADR2,
1782 GEDCOM_MAKE_STRING($4));
1783 START(ADR2, $<ctxt>$)
1788 { end_element(ELT_SUB_ADDR_ADR2, PARENT, $<ctxt>5, NULL);
1791 addr_city_sect : OPEN DELIM TAG_CITY mand_line_item
1792 { $<ctxt>$ = start_element(ELT_SUB_ADDR_CITY,
1794 GEDCOM_MAKE_STRING($4));
1795 START(CITY, $<ctxt>$)
1800 { end_element(ELT_SUB_ADDR_CITY, PARENT, $<ctxt>5, NULL);
1803 addr_stae_sect : OPEN DELIM TAG_STAE mand_line_item
1804 { $<ctxt>$ = start_element(ELT_SUB_ADDR_STAE,
1806 GEDCOM_MAKE_STRING($4));
1807 START(STAE, $<ctxt>$)
1812 { end_element(ELT_SUB_ADDR_STAE, PARENT, $<ctxt>5, NULL);
1815 addr_post_sect : OPEN DELIM TAG_POST mand_line_item
1816 { $<ctxt>$ = start_element(ELT_SUB_ADDR_POST,
1818 GEDCOM_MAKE_STRING($4));
1819 START(POST, $<ctxt>$)
1824 { end_element(ELT_SUB_ADDR_POST, PARENT, $<ctxt>5, NULL);
1827 addr_ctry_sect : OPEN DELIM TAG_CTRY mand_line_item
1828 { $<ctxt>$ = start_element(ELT_SUB_ADDR_CTRY,
1830 GEDCOM_MAKE_STRING($4));
1831 START(CTRY, $<ctxt>$)
1836 { end_element(ELT_SUB_ADDR_CTRY, PARENT, $<ctxt>5, NULL);
1840 phon_sect : OPEN DELIM TAG_PHON mand_line_item
1841 { $<ctxt>$ = start_element(ELT_SUB_PHON,
1843 GEDCOM_MAKE_STRING($4));
1844 START(PHON, $<ctxt>$)
1849 { end_element(ELT_SUB_PHON, PARENT, $<ctxt>5, NULL);
1853 /* ASSOCIATION STRUCTURE */
1854 assoc_struc_sub : asso_sect /* 0:M */
1857 asso_sect : OPEN DELIM TAG_ASSO mand_pointer
1858 { $<ctxt>$ = start_element(ELT_SUB_ASSO,
1860 GEDCOM_MAKE_STRING($4));
1861 START(ASSO, $<ctxt>$)
1864 { CHECK2(TYPE,RELA) }
1866 { end_element(ELT_SUB_ASSO, PARENT, $<ctxt>5, NULL);
1870 asso_subs : /* empty */
1871 | asso_type_sect { OCCUR2(TYPE, 1, 1) }
1872 | asso_rela_sect { OCCUR2(RELA, 1, 1) }
1878 asso_type_sect : OPEN DELIM TAG_TYPE mand_line_item
1879 { $<ctxt>$ = start_element(ELT_SUB_ASSO_TYPE,
1881 GEDCOM_MAKE_STRING($4));
1882 START(TYPE, $<ctxt>$)
1887 { end_element(ELT_SUB_ASSO_TYPE, PARENT, $<ctxt>5, NULL);
1891 asso_rela_sect : OPEN DELIM TAG_RELA mand_line_item
1892 { $<ctxt>$ = start_element(ELT_SUB_ASSO_RELA,
1894 GEDCOM_MAKE_STRING($4));
1895 START(RELA, $<ctxt>$)
1900 { end_element(ELT_SUB_ASSO_RELA, PARENT, $<ctxt>5, NULL);
1905 change_date_sub : change_date_chan_sect { OCCUR2(CHAN, 0, 1) }
1908 change_date_chan_sect : OPEN DELIM TAG_CHAN
1909 { $<ctxt>$ = start_element(ELT_SUB_CHAN,
1910 PARENT, $1, $3, NULL,
1911 GEDCOM_MAKE_NULL());
1912 START(CHAN, $<ctxt>$)
1914 change_date_chan_subs
1917 { end_element(ELT_SUB_CHAN, PARENT, $<ctxt>4, NULL);
1921 change_date_chan_subs : /* empty */
1922 | change_date_chan_subs change_date_chan_sub
1925 change_date_chan_sub : change_date_date_sect { OCCUR2(DATE, 1, 1) }
1930 change_date_date_sect : OPEN DELIM TAG_DATE mand_line_item
1931 { struct date_value dv = gedcom_parse_date($4);
1932 $<ctxt>$ = start_element(ELT_SUB_CHAN_DATE,
1934 GEDCOM_MAKE_DATE(dv));
1935 START(DATE, $<ctxt>$) }
1936 change_date_date_subs
1939 { end_element(ELT_SUB_CHAN_DATE, PARENT, $<ctxt>5,
1944 change_date_date_subs : /* empty */
1945 | change_date_date_subs change_date_date_sub
1948 change_date_date_sub : change_date_date_time_sect { OCCUR2(TIME, 0, 1) }
1952 change_date_date_time_sect : OPEN DELIM TAG_TIME mand_line_item
1954 = start_element(ELT_SUB_CHAN_TIME,
1956 GEDCOM_MAKE_STRING($4));
1957 START(TIME, $<ctxt>$)
1962 { end_element(ELT_SUB_CHAN_TIME, PARENT, $<ctxt>5,
1967 /* CHILD TO FAMILY LINK */
1968 chi_fam_link_sub : famc_sect /* 0:M */
1971 famc_sect : OPEN DELIM TAG_FAMC mand_pointer
1972 { $<ctxt>$ = start_element(ELT_SUB_FAMC,
1974 GEDCOM_MAKE_STRING($4));
1975 START(FAMC, $<ctxt>$)
1980 { end_element(ELT_SUB_FAMC, PARENT, $<ctxt>5, NULL);
1984 famc_subs : /* empty */
1985 | famc_subs famc_sub
1988 famc_sub : famc_pedi_sect /* 0:M */
1993 famc_pedi_sect : OPEN DELIM TAG_PEDI mand_line_item
1994 { $<ctxt>$ = start_element(ELT_SUB_FAMC_PEDI,
1996 GEDCOM_MAKE_STRING($4));
1997 START(PEDI, $<ctxt>$)
2002 { end_element(ELT_SUB_FAMC_PEDI, PARENT, $<ctxt>5, NULL);
2006 /* CONTINUATION SUBSECTIONS */
2007 continuation_sub : cont_sect /* 0:M */
2008 | conc_sect /* 0:M */
2011 cont_sect : OPEN DELIM TAG_CONT mand_line_item
2012 { $<ctxt>$ = start_element(ELT_SUB_CONT,
2014 GEDCOM_MAKE_STRING($4));
2015 START(CONT, $<ctxt>$)
2020 { end_element(ELT_SUB_CONT, PARENT, $<ctxt>5, NULL);
2024 conc_sect : OPEN DELIM TAG_CONC mand_line_item
2025 { $<ctxt>$ = start_element(ELT_SUB_CONC,
2027 GEDCOM_MAKE_STRING($4));
2028 START(CONC, $<ctxt>$)
2033 { end_element(ELT_SUB_CONC, PARENT, $<ctxt>5, NULL);
2038 event_detail_sub : event_detail_type_sect { OCCUR2(TYPE, 0, 1) }
2039 | event_detail_date_sect { OCCUR2(DATE, 0, 1) }
2042 | event_detail_age_sect { OCCUR2(AGE, 0, 1) }
2043 | event_detail_agnc_sect { OCCUR2(AGNC, 0, 1) }
2044 | event_detail_caus_sect { OCCUR2(CAUS, 0, 1) }
2050 event_detail_type_sect : OPEN DELIM TAG_TYPE mand_line_item
2051 { $<ctxt>$ = start_element(ELT_SUB_EVT_TYPE,
2053 GEDCOM_MAKE_STRING($4));
2054 START(TYPE, $<ctxt>$)
2059 { end_element(ELT_SUB_EVT_TYPE, PARENT, $<ctxt>5,
2063 event_detail_date_sect : OPEN DELIM TAG_DATE mand_line_item
2064 { struct date_value dv = gedcom_parse_date($4);
2065 $<ctxt>$ = start_element(ELT_SUB_EVT_DATE,
2067 GEDCOM_MAKE_DATE(dv));
2068 START(DATE, $<ctxt>$)
2073 { end_element(ELT_SUB_EVT_DATE, PARENT, $<ctxt>5,
2077 event_detail_age_sect : OPEN DELIM TAG_AGE mand_line_item
2078 { $<ctxt>$ = start_element(ELT_SUB_EVT_AGE,
2080 GEDCOM_MAKE_STRING($4));
2081 START(AGE, $<ctxt>$)
2086 { end_element(ELT_SUB_EVT_AGE, PARENT, $<ctxt>5,
2090 event_detail_agnc_sect : OPEN DELIM TAG_AGNC mand_line_item
2091 { $<ctxt>$ = start_element(ELT_SUB_EVT_AGNC,
2093 GEDCOM_MAKE_STRING($4));
2094 START(AGNC, $<ctxt>$)
2099 { end_element(ELT_SUB_EVT_AGNC, PARENT, $<ctxt>5,
2103 event_detail_caus_sect : OPEN DELIM TAG_CAUS mand_line_item
2104 { $<ctxt>$ = start_element(ELT_SUB_EVT_CAUS,
2106 GEDCOM_MAKE_STRING($4));
2107 START(CAUS, $<ctxt>$)
2112 { end_element(ELT_SUB_EVT_CAUS, PARENT, $<ctxt>5,
2117 /* FAMILY EVENT STRUCTURE */
2118 fam_event_struc_sub : fam_event_sect
2119 | fam_gen_even_sect /* 0:M */
2122 fam_event_sect : OPEN DELIM fam_event_tag opt_value
2124 $<ctxt>$ = start_element(ELT_SUB_FAM_EVT,
2126 GEDCOM_MAKE_NULL_OR_STRING($4));
2127 /* set the parent context separately from START here */
2128 set_parentctxt($<ctxt>$);
2133 { end_element(ELT_SUB_FAM_EVT, PARENT, $<ctxt>5, NULL);
2137 fam_event_tag : TAG_ANUL { $$ = $1; START(ANUL, NULL) }
2138 | TAG_CENS { $$ = $1; START(CENS, NULL) }
2139 | TAG_DIV { $$ = $1; START(DIV, NULL) }
2140 | TAG_DIVF { $$ = $1; START(DIVF, NULL) }
2141 | TAG_ENGA { $$ = $1; START(ENGA, NULL) }
2142 | TAG_MARR { $$ = $1; START(MARR, NULL) }
2143 | TAG_MARB { $$ = $1; START(MARB, NULL) }
2144 | TAG_MARC { $$ = $1; START(MARC, NULL) }
2145 | TAG_MARL { $$ = $1; START(MARL, NULL) }
2146 | TAG_MARS { $$ = $1; START(MARS, NULL) }
2149 fam_event_subs : /* empty */
2150 | fam_event_subs fam_event_sub
2153 fam_event_sub : event_detail_sub
2154 | fam_even_husb_sect { OCCUR2(HUSB, 0, 1) }
2155 | fam_even_wife_sect { OCCUR2(WIFE, 0, 1) }
2159 fam_even_husb_sect : OPEN DELIM TAG_HUSB
2160 { $<ctxt>$ = start_element(ELT_SUB_FAM_EVT_HUSB,
2161 PARENT, $1, $3, NULL,
2162 GEDCOM_MAKE_NULL());
2163 START(HUSB, $<ctxt>$)
2168 { end_element(ELT_SUB_FAM_EVT_HUSB, PARENT, $<ctxt>4,
2173 fam_even_husb_subs : /* empty */
2174 | fam_even_husb_subs fam_even_husb_sub
2177 fam_even_husb_sub : fam_even_age_sect { OCCUR2(AGE, 1, 1) }
2181 fam_even_age_sect : OPEN DELIM TAG_AGE mand_line_item
2182 { $<ctxt>$ = start_element(ELT_SUB_FAM_EVT_AGE,
2184 GEDCOM_MAKE_STRING($4));
2185 START(AGE, $<ctxt>$)
2190 { end_element(ELT_SUB_FAM_EVT_AGE, PARENT, $<ctxt>5,
2195 fam_even_wife_sect : OPEN DELIM TAG_WIFE
2196 { $<ctxt>$ = start_element(ELT_SUB_FAM_EVT_WIFE,
2197 PARENT, $1, $3, NULL,
2198 GEDCOM_MAKE_NULL());
2199 START(WIFE, $<ctxt>$)
2204 { end_element(ELT_SUB_FAM_EVT_WIFE, PARENT, $<ctxt>4,
2209 fam_gen_even_sect : OPEN DELIM TAG_EVEN
2210 { $<ctxt>$ = start_element(ELT_SUB_FAM_EVT_EVEN,
2211 PARENT, $1, $3, NULL,
2212 GEDCOM_MAKE_NULL());
2213 START(EVEN, $<ctxt>$)
2218 { end_element(ELT_SUB_FAM_EVT_EVEN, PARENT, $<ctxt>4,
2223 fam_gen_even_subs : /* empty */
2224 | fam_gen_even_subs fam_gen_even_sub
2227 fam_gen_even_sub : event_detail_sub
2228 | fam_even_husb_sect { OCCUR2(HUSB, 0, 1) }
2229 | fam_even_wife_sect { OCCUR2(WIFE, 0, 1) }
2233 /* IDENTIFICATION STRUCTURE */
2234 ident_struc_sub : ident_refn_sect /* 0:M */
2235 | ident_rin_sect { OCCUR2(RIN, 0, 1) }
2238 ident_refn_sect : OPEN DELIM TAG_REFN mand_line_item
2239 { $<ctxt>$ = start_element(ELT_SUB_IDENT_REFN,
2241 GEDCOM_MAKE_STRING($4));
2242 START(REFN, $<ctxt>$)
2247 { end_element(ELT_SUB_IDENT_REFN, PARENT, $<ctxt>5,
2252 ident_refn_subs : /* empty */
2253 | ident_refn_subs ident_refn_sub
2256 ident_refn_sub : ident_refn_type_sect { OCCUR2(TYPE, 0, 1) }
2260 ident_refn_type_sect : OPEN DELIM TAG_TYPE mand_line_item
2261 { $<ctxt>$ = start_element(ELT_SUB_IDENT_REFN_TYPE,
2263 GEDCOM_MAKE_STRING($4));
2264 START(TYPE, $<ctxt>$)
2269 { end_element(ELT_SUB_IDENT_REFN_TYPE, PARENT, $<ctxt>5,
2274 ident_rin_sect : OPEN DELIM TAG_RIN mand_line_item
2275 { $<ctxt>$ = start_element(ELT_SUB_IDENT_RIN,
2277 GEDCOM_MAKE_STRING($4));
2278 START(RIN, $<ctxt>$)
2283 { end_element(ELT_SUB_IDENT_RIN, PARENT, $<ctxt>5,
2288 /* INDIVIDUAL ATTRIBUTE STRUCTURE */
2289 indiv_attr_struc_sub : indiv_attr_sect /* 0:M */
2290 | indiv_resi_sect /* 0:M */
2293 indiv_attr_sect : OPEN DELIM indiv_attr_tag mand_line_item
2294 { $<ctxt>$ = start_element(ELT_SUB_INDIV_ATTR,
2296 GEDCOM_MAKE_STRING($4));
2297 /* set the parent context separately from START here */
2298 set_parentctxt($<ctxt>$);
2300 indiv_attr_event_subs
2303 { end_element(ELT_SUB_INDIV_ATTR, PARENT, $<ctxt>5, NULL);
2306 indiv_attr_tag : TAG_CAST { $$ = $1; START(CAST, NULL) }
2307 | TAG_DSCR { $$ = $1; START(DSCR, NULL) }
2308 | TAG_EDUC { $$ = $1; START(EDUC, NULL) }
2309 | TAG_IDNO { $$ = $1; START(IDNO, NULL) }
2310 | TAG_NATI { $$ = $1; START(NATI, NULL) }
2311 | TAG_NCHI { $$ = $1; START(NCHI, NULL) }
2312 | TAG_NMR { $$ = $1; START(NMR, NULL) }
2313 | TAG_OCCU { $$ = $1; START(OCCU, NULL) }
2314 | TAG_PROP { $$ = $1; START(PROP, NULL) }
2315 | TAG_RELI { $$ = $1; START(RELI, NULL) }
2316 | TAG_SSN { $$ = $1; START(SSN, NULL) }
2317 | TAG_TITL { $$ = $1; START(TITL, NULL) }
2319 indiv_resi_sect : OPEN DELIM TAG_RESI
2320 { $<ctxt>$ = start_element(ELT_SUB_INDIV_RESI,
2321 PARENT, $1, $3, NULL,
2322 GEDCOM_MAKE_NULL());
2323 START(RESI, $<ctxt>$)
2325 indiv_attr_event_subs
2328 { end_element(ELT_SUB_INDIV_RESI, PARENT, $<ctxt>4, NULL);
2332 indiv_attr_event_subs : /* empty */
2333 | indiv_attr_event_subs indiv_attr_event_sub
2336 indiv_attr_event_sub : event_detail_sub
2340 /* INDIVIDUAL EVENT STRUCTURE */
2341 indiv_even_struc_sub : indiv_birt_sect
2343 | indiv_adop_sect /* 0:M */
2344 | indiv_even_sect /* 0:M */
2347 indiv_birt_sect : OPEN DELIM indiv_birt_tag opt_value
2348 { $<ctxt>$ = start_element(ELT_SUB_INDIV_BIRT,
2350 GEDCOM_MAKE_NULL_OR_STRING($4));
2351 /* set the parent context separately from START here */
2352 set_parentctxt($<ctxt>$);
2357 { end_element(ELT_SUB_INDIV_BIRT, PARENT, $<ctxt>5, NULL);
2361 indiv_birt_tag : TAG_BIRT { $$ = $1; START(BIRT, NULL) }
2362 | TAG_CHR { $$ = $1; START(CHR, NULL) }
2365 indiv_birt_subs : /* empty */
2366 | indiv_birt_subs indiv_birt_sub
2369 indiv_birt_sub : event_detail_sub
2370 | indiv_birt_famc_sect { OCCUR2(FAMC,0, 1) }
2374 indiv_birt_famc_sect : OPEN DELIM TAG_FAMC mand_pointer
2375 { $<ctxt>$ = start_element(ELT_SUB_INDIV_BIRT_FAMC,
2377 GEDCOM_MAKE_STRING($4));
2378 START(FAMC, $<ctxt>$)
2383 { end_element(ELT_SUB_INDIV_BIRT_FAMC, PARENT, $<ctxt>5,
2388 indiv_gen_sect : OPEN DELIM indiv_gen_tag opt_value
2389 { $<ctxt>$ = start_element(ELT_SUB_INDIV_GEN,
2391 GEDCOM_MAKE_NULL_OR_STRING($4));
2392 /* set the parent context separately from START here */
2393 set_parentctxt($<ctxt>$);
2398 { end_element(ELT_SUB_INDIV_GEN, PARENT, $<ctxt>5, NULL);
2402 indiv_gen_tag : TAG_DEAT { $$ = $1; START(DEAT, NULL) }
2403 | TAG_BURI { $$ = $1; START(BURI, NULL) }
2404 | TAG_CREM { $$ = $1; START(CREM, NULL) }
2405 | TAG_BAPM { $$ = $1; START(BAPM, NULL) }
2406 | TAG_BARM { $$ = $1; START(BARM, NULL) }
2407 | TAG_BASM { $$ = $1; START(BASM, NULL) }
2408 | TAG_BLES { $$ = $1; START(BLES, NULL) }
2409 | TAG_CHRA { $$ = $1; START(CHRA, NULL) }
2410 | TAG_CONF { $$ = $1; START(CONF, NULL) }
2411 | TAG_FCOM { $$ = $1; START(FCOM, NULL) }
2412 | TAG_ORDN { $$ = $1; START(ORDN, NULL) }
2413 | TAG_NATU { $$ = $1; START(NATU, NULL) }
2414 | TAG_EMIG { $$ = $1; START(EMIG, NULL) }
2415 | TAG_IMMI { $$ = $1; START(IMMI, NULL) }
2416 | TAG_CENS { $$ = $1; START(CENS, NULL) }
2417 | TAG_PROB { $$ = $1; START(PROB, NULL) }
2418 | TAG_WILL { $$ = $1; START(WILL, NULL) }
2419 | TAG_GRAD { $$ = $1; START(GRAD, NULL) }
2420 | TAG_RETI { $$ = $1; START(RETI, NULL) }
2423 indiv_gen_subs : /* empty */
2424 | indiv_gen_subs indiv_gen_sub
2427 indiv_gen_sub : event_detail_sub
2431 indiv_adop_sect : OPEN DELIM TAG_ADOP opt_value
2432 { $<ctxt>$ = start_element(ELT_SUB_INDIV_ADOP,
2434 GEDCOM_MAKE_NULL_OR_STRING($4));
2435 START(ADOP, $<ctxt>$) }
2439 { end_element(ELT_SUB_INDIV_ADOP, PARENT, $<ctxt>5, NULL);
2443 indiv_adop_subs : /* empty */
2444 | indiv_adop_subs indiv_adop_sub
2447 indiv_adop_sub : event_detail_sub
2448 | indiv_adop_famc_sect { OCCUR2(FAMC,0, 1) }
2452 indiv_adop_famc_sect : OPEN DELIM TAG_FAMC mand_pointer
2453 { $<ctxt>$ = start_element(ELT_SUB_INDIV_ADOP_FAMC,
2455 GEDCOM_MAKE_STRING($4));
2456 START(FAMC, $<ctxt>$) }
2457 indiv_adop_famc_subs
2460 { end_element(ELT_SUB_INDIV_ADOP_FAMC, PARENT, $<ctxt>5,
2465 indiv_adop_famc_subs : /* empty */
2466 | indiv_adop_famc_subs indiv_adop_famc_sub
2469 indiv_adop_famc_sub : indiv_adop_famc_adop_sect { OCCUR2(ADOP,0, 1) }
2473 indiv_adop_famc_adop_sect : OPEN DELIM TAG_ADOP mand_line_item
2475 = start_element(ELT_SUB_INDIV_ADOP_FAMC_ADOP,
2477 GEDCOM_MAKE_STRING($4));
2478 START(ADOP, $<ctxt>$) }
2482 { end_element(ELT_SUB_INDIV_ADOP_FAMC_ADOP,
2483 PARENT, $<ctxt>5, NULL);
2487 indiv_even_sect : OPEN DELIM TAG_EVEN
2488 { $<ctxt>$ = start_element(ELT_SUB_INDIV_EVEN,
2489 PARENT, $1, $3, NULL,
2490 GEDCOM_MAKE_NULL());
2491 START(EVEN, $<ctxt>$) }
2495 { end_element(ELT_SUB_INDIV_EVEN, PARENT, $<ctxt>4, NULL);
2499 /* LDS INDIVIDUAL ORDINANCE */
2500 lds_indiv_ord_sub : lio_bapl_sect /* 0:M */
2501 | lio_slgc_sect /* 0:M */
2504 lio_bapl_sect : OPEN DELIM lio_bapl_tag
2505 { $<ctxt>$ = start_element(ELT_SUB_LIO_BAPL,
2506 PARENT, $1, $3, NULL,
2507 GEDCOM_MAKE_NULL());
2508 /* set the parent context separately from START here */
2509 set_parentctxt($<ctxt>$);
2514 { end_element(ELT_SUB_LIO_BAPL, PARENT, $<ctxt>4, NULL);
2518 lio_bapl_tag : TAG_BAPL { $$ = $1; START(BAPL, NULL) }
2519 | TAG_CONL { $$ = $1; START(CONL, NULL) }
2520 | TAG_ENDL { $$ = $1; START(ENDL, NULL) }
2523 lio_bapl_subs : /* empty */
2524 | lio_bapl_subs lio_bapl_sub
2527 lio_bapl_sub : lio_bapl_stat_sect { OCCUR2(STAT, 0, 1) }
2528 | lio_bapl_date_sect { OCCUR2(DATE, 0, 1) }
2529 | lio_bapl_temp_sect { OCCUR2(TEMP, 0, 1) }
2530 | lio_bapl_plac_sect { OCCUR2(PLAC, 0, 1) }
2536 lio_bapl_stat_sect : OPEN DELIM TAG_STAT mand_line_item
2537 { $<ctxt>$ = start_element(ELT_SUB_LIO_BAPL_STAT,
2539 GEDCOM_MAKE_STRING($4));
2540 START(STAT, $<ctxt>$)
2545 { end_element(ELT_SUB_LIO_BAPL_STAT, PARENT, $<ctxt>5,
2549 lio_bapl_date_sect : OPEN DELIM TAG_DATE mand_line_item
2550 { struct date_value dv = gedcom_parse_date($4);
2551 $<ctxt>$ = start_element(ELT_SUB_LIO_BAPL_DATE,
2553 GEDCOM_MAKE_DATE(dv));
2554 START(DATE, $<ctxt>$)
2559 { end_element(ELT_SUB_LIO_BAPL_DATE, PARENT, $<ctxt>5,
2563 lio_bapl_temp_sect : OPEN DELIM TAG_TEMP mand_line_item
2564 { $<ctxt>$ = start_element(ELT_SUB_LIO_BAPL_TEMP,
2566 GEDCOM_MAKE_STRING($4));
2567 START(TEMP, $<ctxt>$)
2572 { end_element(ELT_SUB_LIO_BAPL_TEMP, PARENT, $<ctxt>5,
2576 lio_bapl_plac_sect : OPEN DELIM TAG_PLAC mand_line_item
2577 { $<ctxt>$ = start_element(ELT_SUB_LIO_BAPL_PLAC,
2579 GEDCOM_MAKE_STRING($4));
2580 START(PLAC, $<ctxt>$)
2585 { end_element(ELT_SUB_LIO_BAPL_PLAC, PARENT, $<ctxt>5,
2590 lio_slgc_sect : OPEN DELIM TAG_SLGC
2591 { $<ctxt>$ = start_element(ELT_SUB_LIO_SLGC,
2592 PARENT, $1, $3, NULL,
2593 GEDCOM_MAKE_NULL());
2594 START(SLGC, $<ctxt>$)
2599 { end_element(ELT_SUB_LIO_SLGC, PARENT, $<ctxt>4, NULL);
2603 lio_slgc_subs : /* empty */
2604 | lio_slgc_subs lio_slgc_sub
2607 lio_slgc_sub : lio_bapl_sub
2608 | lio_slgc_famc_sect { OCCUR2(FAMC, 1, 1) }
2611 lio_slgc_famc_sect : OPEN DELIM TAG_FAMC mand_pointer
2612 { $<ctxt>$ = start_element(ELT_SUB_LIO_SLGC_FAMC,
2614 GEDCOM_MAKE_STRING($4));
2615 START(FAMC, $<ctxt>$)
2620 { end_element(ELT_SUB_LIO_SLGC_FAMC, PARENT, $<ctxt>5,
2625 /* LDS SPOUSE SEALING */
2626 lds_spouse_seal_sub : lss_slgs_sect
2629 lss_slgs_sect : OPEN DELIM TAG_SLGS
2630 { $<ctxt>$ = start_element(ELT_SUB_LSS_SLGS,
2631 PARENT, $1, $3, NULL,
2632 GEDCOM_MAKE_NULL());
2633 START(SLGS, $<ctxt>$) }
2637 { end_element(ELT_SUB_LIO_SLGC, PARENT, $<ctxt>4, NULL);
2641 lss_slgs_subs : /* empty */
2642 | lss_slgs_subs lss_slgs_sub
2645 lss_slgs_sub : lss_slgs_stat_sect { OCCUR2(STAT, 0, 1) }
2646 | lss_slgs_date_sect { OCCUR2(DATE, 0, 1) }
2647 | lss_slgs_temp_sect { OCCUR2(TEMP, 0, 1) }
2648 | lss_slgs_plac_sect { OCCUR2(PLAC, 0, 1) }
2654 lss_slgs_stat_sect : OPEN DELIM TAG_STAT mand_line_item
2655 { $<ctxt>$ = start_element(ELT_SUB_LSS_SLGS_STAT,
2657 GEDCOM_MAKE_STRING($4));
2658 START(STAT, $<ctxt>$)
2663 { end_element(ELT_SUB_LSS_SLGS_STAT, PARENT, $<ctxt>5,
2667 lss_slgs_date_sect : OPEN DELIM TAG_DATE mand_line_item
2668 { struct date_value dv = gedcom_parse_date($4);
2669 $<ctxt>$ = start_element(ELT_SUB_LSS_SLGS_DATE,
2671 GEDCOM_MAKE_DATE(dv));
2672 START(DATE, $<ctxt>$)
2677 { end_element(ELT_SUB_LSS_SLGS_DATE, PARENT, $<ctxt>5,
2681 lss_slgs_temp_sect : OPEN DELIM TAG_TEMP mand_line_item
2682 { $<ctxt>$ = start_element(ELT_SUB_LSS_SLGS_TEMP,
2684 GEDCOM_MAKE_STRING($4));
2685 START(TEMP, $<ctxt>$)
2690 { end_element(ELT_SUB_LSS_SLGS_TEMP, PARENT, $<ctxt>5,
2694 lss_slgs_plac_sect : OPEN DELIM TAG_PLAC mand_line_item
2695 { $<ctxt>$ = start_element(ELT_SUB_LSS_SLGS_PLAC,
2697 GEDCOM_MAKE_STRING($4));
2698 START(PLAC, $<ctxt>$)
2703 { end_element(ELT_SUB_LSS_SLGS_PLAC, PARENT, $<ctxt>5,
2708 /* MULTIMEDIA LINK */
2709 multim_link_sub : multim_obje_link_sect
2710 | multim_obje_emb_sect
2713 multim_obje_link_sect : OPEN DELIM TAG_OBJE DELIM POINTER
2714 { $<ctxt>$ = start_element(ELT_SUB_MULTIM_OBJE,
2716 GEDCOM_MAKE_STRING($5));
2717 START(OBJE, $<ctxt>$)
2722 { end_element(ELT_SUB_MULTIM_OBJE, PARENT, $<ctxt>6,
2727 multim_obje_emb_sect : OPEN DELIM TAG_OBJE
2728 { $<ctxt>$ = start_element(ELT_SUB_MULTIM_OBJE,
2729 PARENT, $1, $3, NULL,
2730 GEDCOM_MAKE_NULL());
2731 START(OBJE, $<ctxt>$)
2733 multim_obje_emb_subs
2734 { CHECK2(FORM,FILE) }
2736 { end_element(ELT_SUB_MULTIM_OBJE, PARENT, $<ctxt>4,
2741 multim_obje_emb_subs : /* empty */
2742 | multim_obje_emb_subs multim_obje_emb_sub
2745 multim_obje_emb_sub : multim_obje_form_sect { OCCUR2(FORM, 1, 1) }
2746 | multim_obje_titl_sect { OCCUR2(TITL, 0, 1) }
2747 | multim_obje_file_sect { OCCUR2(FILE, 1, 1) }
2752 multim_obje_form_sect : OPEN DELIM TAG_FORM mand_line_item
2753 { $<ctxt>$ = start_element(ELT_SUB_MULTIM_OBJE_FORM,
2755 GEDCOM_MAKE_STRING($4));
2756 START(FORM, $<ctxt>$)
2761 { end_element(ELT_SUB_MULTIM_OBJE_FORM,
2762 PARENT, $<ctxt>5, NULL);
2765 multim_obje_titl_sect : OPEN DELIM TAG_TITL mand_line_item
2766 { $<ctxt>$ = start_element(ELT_SUB_MULTIM_OBJE_TITL,
2768 GEDCOM_MAKE_STRING($4));
2769 START(TITL, $<ctxt>$)
2774 { end_element(ELT_SUB_MULTIM_OBJE_TITL,
2775 PARENT, $<ctxt>5, NULL);
2778 multim_obje_file_sect : OPEN DELIM TAG_FILE mand_line_item
2779 { $<ctxt>$ = start_element(ELT_SUB_MULTIM_OBJE_FILE,
2781 GEDCOM_MAKE_STRING($4));
2782 START(FILE, $<ctxt>$)
2787 { end_element(ELT_SUB_MULTIM_OBJE_FILE,
2788 PARENT, $<ctxt>5, NULL);
2792 /* NOTE STRUCTURE */
2793 note_struc_sub : note_struc_link_sect /* 0:M */
2794 | note_struc_emb_sect /* 0:M */
2797 note_struc_link_sect : OPEN DELIM TAG_NOTE DELIM POINTER
2798 { $<ctxt>$ = start_element(ELT_SUB_NOTE,
2800 GEDCOM_MAKE_STRING($5));
2801 START(NOTE, $<ctxt>$)
2803 note_struc_link_subs
2806 { end_element(ELT_SUB_NOTE, PARENT, $<ctxt>6, NULL);
2810 note_struc_link_subs : /* empty */
2811 | note_struc_link_subs note_struc_link_sub
2814 note_struc_link_sub : source_cit_sub
2818 note_struc_emb_sect : OPEN DELIM TAG_NOTE opt_line_item
2820 = start_element(ELT_SUB_NOTE,
2822 GEDCOM_MAKE_NULL_OR_STRING($4));
2823 START(NOTE, $<ctxt>$)
2828 { end_element(ELT_SUB_NOTE, PARENT, $<ctxt>5, NULL);
2832 note_struc_emb_subs : /* empty */
2833 | note_struc_emb_subs note_struc_emb_sub
2836 note_struc_emb_sub : continuation_sub
2841 /* PERSONAL NAME STRUCTURE */
2842 pers_name_struc_sub : pers_name_sect /* 0:M */
2845 pers_name_sect : OPEN DELIM TAG_NAME mand_line_item
2846 { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME,
2848 GEDCOM_MAKE_STRING($4));
2849 START(NAME, $<ctxt>$)
2854 { end_element(ELT_SUB_PERS_NAME, PARENT, $<ctxt>5, NULL);
2858 pers_name_subs : /* empty */
2859 | pers_name_subs pers_name_sub
2862 pers_name_sub : pers_name_npfx_sect { OCCUR2(NPFX, 0, 1) }
2863 | pers_name_givn_sect { OCCUR2(GIVN, 0, 1) }
2864 | pers_name_nick_sect { OCCUR2(NICK, 0, 1) }
2865 | pers_name_spfx_sect { OCCUR2(SPFX, 0, 1) }
2866 | pers_name_surn_sect { OCCUR2(SURN, 0, 1) }
2867 | pers_name_nsfx_sect { OCCUR2(NSFX, 0, 1) }
2873 pers_name_npfx_sect : OPEN DELIM TAG_NPFX mand_line_item
2874 { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME_NPFX,
2876 GEDCOM_MAKE_STRING($4));
2877 START(NPFX, $<ctxt>$)
2882 { end_element(ELT_SUB_PERS_NAME_NPFX, PARENT, $<ctxt>5,
2886 pers_name_givn_sect : OPEN DELIM TAG_GIVN mand_line_item
2887 { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME_GIVN,
2889 GEDCOM_MAKE_STRING($4));
2890 START(GIVN, $<ctxt>$)
2895 { end_element(ELT_SUB_PERS_NAME_GIVN, PARENT, $<ctxt>5,
2899 pers_name_nick_sect : OPEN DELIM TAG_NICK mand_line_item
2900 { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME_NICK,
2902 GEDCOM_MAKE_STRING($4));
2903 START(NICK, $<ctxt>$)
2908 { end_element(ELT_SUB_PERS_NAME_NICK, PARENT, $<ctxt>5,
2912 pers_name_spfx_sect : OPEN DELIM TAG_SPFX mand_line_item
2913 { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME_SPFX,
2915 GEDCOM_MAKE_STRING($4));
2916 START(SPFX, $<ctxt>$)
2921 { end_element(ELT_SUB_PERS_NAME_SPFX, PARENT, $<ctxt>5,
2925 pers_name_surn_sect : OPEN DELIM TAG_SURN mand_line_item
2926 { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME_SURN,
2928 GEDCOM_MAKE_STRING($4));
2929 START(SURN, $<ctxt>$)
2934 { end_element(ELT_SUB_PERS_NAME_SURN, PARENT, $<ctxt>5,
2938 pers_name_nsfx_sect : OPEN DELIM TAG_NSFX mand_line_item
2939 { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME_NSFX,
2941 GEDCOM_MAKE_STRING($4));
2942 START(NSFX, $<ctxt>$)
2947 { end_element(ELT_SUB_PERS_NAME_NSFX, PARENT, $<ctxt>5,
2952 /* PLACE STRUCTURE */
2953 place_struc_sub : place_struc_plac_sect /* 0:M */
2956 place_struc_plac_sect : OPEN DELIM TAG_PLAC mand_line_item
2957 { $<ctxt>$ = start_element(ELT_SUB_PLAC,
2959 GEDCOM_MAKE_STRING($4));
2960 START(PLAC, $<ctxt>$)
2962 place_struc_plac_subs
2965 { end_element(ELT_SUB_PLAC, PARENT, $<ctxt>5, NULL);
2969 place_struc_plac_subs : /* empty */
2970 | place_struc_plac_subs place_struc_plac_sub
2973 place_struc_plac_sub : place_plac_form_sect { OCCUR2(FORM, 0, 1) }
2979 place_plac_form_sect : OPEN DELIM TAG_FORM mand_line_item
2980 { $<ctxt>$ = start_element(ELT_SUB_PLAC_FORM,
2982 GEDCOM_MAKE_STRING($4));
2983 START(FORM, $<ctxt>$)
2988 { end_element(ELT_SUB_PLAC_FORM, PARENT, $<ctxt>5,
2993 /* SOURCE_CITATION */
2994 source_cit_sub : source_cit_link_sect /* 0:M */
2995 | source_cit_emb_sect /* 0:M */
2998 source_cit_link_sect : OPEN DELIM TAG_SOUR DELIM POINTER
2999 { $<ctxt>$ = start_element(ELT_SUB_SOUR,
3001 GEDCOM_MAKE_STRING($5));
3002 START(SOUR, $<ctxt>$)
3004 source_cit_link_subs
3007 { end_element(ELT_SUB_SOUR, PARENT, $<ctxt>6, NULL);
3011 source_cit_link_subs : /* empty */
3012 | source_cit_link_subs source_cit_link_sub
3015 source_cit_link_sub : source_cit_page_sect { OCCUR2(PAGE, 0, 1) }
3016 | source_cit_even_sect { OCCUR2(EVEN, 0, 1) }
3017 | source_cit_data_sect { OCCUR2(DATA, 0, 1) }
3018 | source_cit_quay_sect { OCCUR2(QUAY, 0, 1) }
3024 source_cit_page_sect : OPEN DELIM TAG_PAGE mand_line_item
3025 { $<ctxt>$ = start_element(ELT_SUB_SOUR_PAGE,
3027 GEDCOM_MAKE_STRING($4));
3028 START(PAGE, $<ctxt>$)
3033 { end_element(ELT_SUB_SOUR_PAGE, PARENT, $<ctxt>5,
3038 source_cit_even_sect : OPEN DELIM TAG_EVEN mand_line_item
3039 { $<ctxt>$ = start_element(ELT_SUB_SOUR_EVEN,
3041 GEDCOM_MAKE_STRING($4));
3042 START(EVEN, $<ctxt>$)
3044 source_cit_even_subs
3047 { end_element(ELT_SUB_SOUR_EVEN, PARENT, $<ctxt>5,
3052 source_cit_even_subs : /* empty */
3053 | source_cit_even_subs source_cit_even_sub
3056 source_cit_even_sub : source_cit_even_role_sect { OCCUR2(ROLE, 0, 1) }
3060 source_cit_even_role_sect : OPEN DELIM TAG_ROLE mand_line_item
3061 { $<ctxt>$ = start_element(ELT_SUB_SOUR_EVEN_ROLE,
3063 GEDCOM_MAKE_STRING($4));
3064 START(ROLE, $<ctxt>$)
3069 { end_element(ELT_SUB_SOUR_EVEN_ROLE,
3070 PARENT, $<ctxt>5, NULL);
3074 source_cit_data_sect : OPEN DELIM TAG_DATA
3075 { $<ctxt>$ = start_element(ELT_SUB_SOUR_DATA,
3076 PARENT, $1, $3, NULL,
3077 GEDCOM_MAKE_NULL());
3078 START(DATA, $<ctxt>$)
3080 source_cit_data_subs
3083 { end_element(ELT_SUB_SOUR_DATA, PARENT, $<ctxt>4,
3088 source_cit_data_subs : /* empty */
3089 | source_cit_data_subs source_cit_data_sub
3092 source_cit_data_sub : source_cit_data_date_sect { OCCUR2(DATE, 0, 1) }
3093 | source_cit_text_sect /* 0:M */
3097 source_cit_data_date_sect : OPEN DELIM TAG_DATE mand_line_item
3098 { struct date_value dv = gedcom_parse_date($4);
3099 $<ctxt>$ = start_element(ELT_SUB_SOUR_DATA_DATE,
3101 GEDCOM_MAKE_DATE(dv));
3102 START(DATE, $<ctxt>$)
3107 { end_element(ELT_SUB_SOUR_DATA_DATE,
3108 PARENT, $<ctxt>5, NULL);
3112 source_cit_text_sect : OPEN DELIM TAG_TEXT mand_line_item
3113 { $<ctxt>$ = start_element(ELT_SUB_SOUR_TEXT,
3115 GEDCOM_MAKE_STRING($4));
3116 START(TEXT, $<ctxt>$)
3118 source_cit_text_subs
3121 { end_element(ELT_SUB_SOUR_TEXT, PARENT, $<ctxt>5,
3126 source_cit_text_subs : /* empty */
3127 | source_cit_text_subs source_cit_text_sub
3130 source_cit_text_sub : continuation_sub
3134 source_cit_quay_sect : OPEN DELIM TAG_QUAY mand_line_item
3135 { $<ctxt>$ = start_element(ELT_SUB_SOUR_QUAY,
3137 GEDCOM_MAKE_STRING($4));
3138 START(QUAY, $<ctxt>$)
3143 { end_element(ELT_SUB_SOUR_QUAY, PARENT, $<ctxt>5,
3148 source_cit_emb_sect : OPEN DELIM TAG_SOUR mand_line_item
3149 { $<ctxt>$ = start_element(ELT_SUB_SOUR,
3151 GEDCOM_MAKE_STRING($4));
3152 START(SOUR, $<ctxt>$)
3157 { end_element(ELT_SUB_SOUR, PARENT, $<ctxt>5, NULL);
3161 source_cit_emb_subs : /* empty */
3162 | source_cit_emb_subs source_cit_emb_sub
3165 source_cit_emb_sub : continuation_sub
3166 | source_cit_text_sect /* 0:M */
3171 /* SOURCE REPOSITORY CITATION */
3172 source_repos_cit_sub : source_repos_repo_sect { OCCUR2(REPO, 0, 1) }
3175 source_repos_repo_sect : OPEN DELIM TAG_REPO mand_pointer
3176 { $<ctxt>$ = start_element(ELT_SUB_REPO,
3178 GEDCOM_MAKE_STRING($4));
3179 START(REPO, $<ctxt>$)
3181 source_repos_repo_subs
3184 { end_element(ELT_SUB_REPO, PARENT, $<ctxt>5, NULL);
3188 source_repos_repo_subs : /* empty */
3189 | source_repos_repo_subs source_repos_repo_sub
3192 source_repos_repo_sub : note_struc_sub
3193 | caln_sect /* 0:M */
3197 caln_sect : OPEN DELIM TAG_CALN mand_line_item
3198 { $<ctxt>$ = start_element(ELT_SUB_REPO_CALN,
3200 GEDCOM_MAKE_STRING($4));
3201 START(CALN, $<ctxt>$)
3206 { end_element(ELT_SUB_REPO_CALN, PARENT, $<ctxt>5, NULL);
3210 caln_subs : /* empty */
3211 | caln_subs caln_sub
3214 caln_sub : caln_medi_sect { OCCUR2(MEDI, 0, 1) }
3218 caln_medi_sect : OPEN DELIM TAG_MEDI mand_line_item
3219 { $<ctxt>$ = start_element(ELT_SUB_REPO_CALN_MEDI,
3221 GEDCOM_MAKE_STRING($4));
3222 START(MEDI, $<ctxt>$)
3227 { end_element(ELT_SUB_REPO_CALN_MEDI, PARENT, $<ctxt>5, NULL);
3231 /* SPOUSE TO FAMILY LINK */
3232 spou_fam_link_sub : spou_fam_fams_sect /* 0:M */
3235 spou_fam_fams_sect : OPEN DELIM TAG_FAMS mand_pointer
3236 { $<ctxt>$ = start_element(ELT_SUB_FAMS,
3238 GEDCOM_MAKE_STRING($4));
3239 START(FAMS, $<ctxt>$)
3244 { end_element(ELT_SUB_FAMS, PARENT, $<ctxt>5, NULL);
3248 spou_fam_fams_subs : /* empty */
3249 | spou_fam_fams_subs spou_fam_fams_sub
3252 spou_fam_fams_sub : note_struc_sub
3256 /*********************************************************************/
3258 /*********************************************************************/
3260 no_std_subs : /* empty */
3261 | no_std_subs no_std_sub
3264 no_std_sub : user_sect /* 0:M */
3266 | error error_subs CLOSE { HANDLE_ERROR }
3269 no_std_rec : user_rec /* 0:M */
3271 | error error_subs CLOSE { HANDLE_ERROR }
3274 user_rec : OPEN DELIM opt_xref USERTAG
3275 { if ($4[0] != '_') {
3276 gedcom_error(_("Undefined tag (and not a valid user tag): %s"),
3282 { $<ctxt>$ = start_record(REC_USER, $1, $3, $4);
3288 { end_record(REC_USER, $<ctxt>7); }
3290 user_sect : OPEN DELIM opt_xref USERTAG
3291 { if ($4[0] != '_') {
3292 gedcom_error(_("Undefined tag (and not a valid user tag): %s"),
3298 { $<ctxt>$ = start_element(ELT_USER, PARENT, $1, $4, $6,
3299 GEDCOM_MAKE_NULL_OR_STRING($6));
3300 START($4, $<ctxt>$);
3305 { end_element(ELT_USER, PARENT, $<ctxt>7, NULL);
3309 user_sects : /* empty */ { }
3310 | user_sects user_sect { }
3313 opt_xref : /* empty */ { $$ = NULL; }
3314 | POINTER DELIM { $$ = $1; }
3317 opt_value : /* empty */ { $$ = NULL; }
3318 | DELIM line_value { $$ = $2; }
3321 line_value : POINTER { $$ = $1; }
3322 | line_item { $$ = $1; }
3325 mand_pointer : /* empty */ { gedcom_error(_("Missing pointer")); YYERROR; }
3326 | DELIM POINTER { gedcom_debug_print("==Ptr: %s==", $2);
3330 mand_line_item : /* empty */ { gedcom_error(_("Missing value")); YYERROR; }
3331 | DELIM line_item { gedcom_debug_print("==Val: %s==", $2);
3335 opt_line_item : /* empty */ { }
3336 | DELIM line_item { }
3339 line_item : anychar { size_t i;
3340 CLEAR_BUFFER(line_item_buf);
3341 line_item_buf_ptr = line_item_buf;
3342 /* The following also takes care of '@@' */
3343 if (!strncmp($1, "@@", 3))
3344 *line_item_buf_ptr++ = '@';
3346 for (i=0; i < strlen($1); i++)
3347 *line_item_buf_ptr++ = $1[i];
3350 | ESCAPE { size_t i;
3351 CLEAR_BUFFER(line_item_buf);
3352 line_item_buf_ptr = line_item_buf;
3353 for (i=0; i < strlen($1); i++)
3354 *line_item_buf_ptr++ = $1[i];
3359 /* The following also takes care of '@@' */
3360 if (!strncmp($2, "@@", 3))
3361 *line_item_buf_ptr++ = '@';
3363 for (i=0; i < strlen($2); i++)
3364 *line_item_buf_ptr++ = $2[i];
3369 for (i=0; i < strlen($2); i++)
3370 *line_item_buf_ptr++ = $2[i];
3375 anychar : ANYCHAR { }
3379 error_subs : /* empty */
3380 | error_subs error_sect
3383 error_sect : OPEN DELIM opt_xref anytag opt_value error_subs CLOSE { }
3385 gen_sect : OPEN DELIM opt_xref anystdtag
3386 { INVALID_TAG($4); }
3387 opt_value opt_sects CLOSE
3391 gen_rec : gen_rec_top
3395 gen_rec_norm : OPEN DELIM opt_xref anystdtag
3396 { INVALID_TOP_TAG($4) }
3397 opt_value opt_sects CLOSE
3401 gen_rec_top : OPEN DELIM anytoptag
3402 { gedcom_error(_("Missing cross-reference")); YYERROR; }
3403 opt_value opt_sects CLOSE
3407 opt_sects : /* empty */ { }
3408 | opt_sects gen_sect { }
3411 anytag : USERTAG { }
3425 anystdtag : TAG_ABBR
3555 /* Functions that handle the counting of subtags */
3557 int* count_arrays[MAXGEDCLEVEL+1];
3558 char tag_stack[MAXGEDCLEVEL+1][MAXSTDTAGLEN+1];
3559 Gedcom_ctxt ctxt_stack[MAXGEDCLEVEL+1];
3561 void push_countarray()
3564 if (count_level > MAXGEDCLEVEL) {
3565 gedcom_error(_("Internal error: count array overflow"));
3569 count = (int *)calloc(YYNTOKENS, sizeof(int));
3570 if (count == NULL) {
3571 gedcom_error(_("Internal error: count array calloc error"));
3575 count_arrays[count_level] = count;
3580 void set_parenttag(char* tag)
3582 strncpy(tag_stack[count_level], tag, MAXSTDTAGLEN+1);
3585 void set_parentctxt(Gedcom_ctxt ctxt)
3587 ctxt_stack[count_level] = ctxt;
3590 char* get_parenttag()
3592 return tag_stack[count_level];
3595 Gedcom_ctxt get_parentctxt()
3597 return ctxt_stack[count_level];
3600 int count_tag(int tag)
3602 int *count = count_arrays[count_level];
3603 return ++count[tag - GEDCOMTAGOFFSET];
3606 int check_occurrence(int tag)
3608 int *count = count_arrays[count_level];
3609 return (count[tag - GEDCOMTAGOFFSET] > 0);
3612 void pop_countarray()
3615 if (count_level < 0) {
3616 gedcom_error(_("Internal error: count array underflow"));
3620 count = count_arrays[count_level];
3622 count_arrays[count_level] = NULL;
3626 /* Enabling debug mode */
3627 /* level 0: no debugging */
3628 /* level 1: only internal */
3629 /* level 2: also bison */
3632 void gedcom_set_debug_level(int level, FILE* f)
3637 trace_output = stderr;
3639 gedcom_high_level_debug = 1;
3648 int gedcom_debug_print(char* s, ...)
3651 if (gedcom_high_level_debug) {
3654 res = vfprintf(trace_output, s, ap);
3656 fprintf(trace_output, "\n");
3661 /* Setting the error mechanism */
3662 void gedcom_set_error_handling(Gedcom_err_mech mechanism)
3664 error_mechanism = mechanism;
3667 /* Compatibility handling */
3669 void gedcom_set_compat_handling(int enable_compat)
3671 compat_enabled = enable_compat;
3674 void set_compatibility(char* program)
3676 if (compat_enabled) {
3677 if (! strncmp(program, "ftree", 6)) {
3678 gedcom_warning(_("Enabling compatibility with 'ftree'"));
3679 compatibility = C_FTREE;
3687 int compat_mode(int compat_flags)
3689 return (compat_flags & compatibility);