Esempio n. 1
0
        private static void famcProc(StructParseContext context, int linedex, char level)
        {
            string xref;
            string extra;

            StructParser.parseXrefExtra(context.Remain, out xref, out extra);
            // No observed hit on this codepath
            //if (string.IsNullOrWhiteSpace(xref))
            //{
            //    (context.Parent as IndiEvent).Famc = context.Remain;
            //}
            //else
            (context.Parent as IndiEvent).Famc = xref;
        }
Esempio n. 2
0
        // CHIL processing pulled out for _FREL/_MREL
        private void childProc(ParseContext2 context)
        {
            var fam = (context.Parent as FamRecord);

            LookAhead(context); // Any sub-lines (e.g. _FREL/_MREL)?

            string xref;
            string extra;

            StructParser.parseXrefExtra(context.Remain, out xref, out extra);
            if (string.IsNullOrEmpty(xref))
            {
                UnkRec err = new UnkRec();
                err.Error = UnkRec.ErrorCode.MissIdent; // TODO "Missing/unterminated identifier: " + context.Tag;
                err.Beg   = context.Begline + context.Parent.BegLine;
                err.End   = context.Endline + context.Parent.BegLine;
                err.Tag   = context.Tag;
                fam.Errors.Add(err);
                return;
            }
#if XREFTRACK
            int key = XrefTrack.Instance.StoreXref(xref);
#endif
            foreach (var child in fam.Childs)
            {
#if XREFTRACK
                if (child.Key == key)
#else
                if (child.Xref == xref)
#endif
                {
                    UnkRec err = new UnkRec();
                    err.Error = UnkRec.ErrorCode.MultCHIL; // TODO "CHIL ident used more than once (one person cannot be two children)";
                    err.Beg   = context.Begline + context.Parent.BegLine;
                    err.End   = context.Endline + context.Parent.BegLine;
                    fam.Errors.Add(err);
                    return;
                }
            }

            string mrel = null;
            string frel = null;
            if (context.Endline > context.Begline)
            {
                LineUtil.LineData ld = new LineUtil.LineData();
                //var gs = new GEDSplitter();
                //ParseContext2 ctx = new ParseContext2();
                int i = context.Begline + 1;
                while (i <= context.Endline)
                {
                    //LineUtil.LevelTagAndRemain(ld, context.Lines.GetLine(i));
                    context.gs.LevelTagAndRemain(context.Lines.GetLine(i), ld);
                    switch (ld.Tag)
                    {
                    case "_MREL":
                        if (!string.IsNullOrWhiteSpace(ld.Remain))     // FTA expects 'Natural' and I canna see why not && ld.Remain != "Natural")
                        {
                            mrel = ld.Remain;
                        }
                        break;

                    case "_FREL":
                        if (!string.IsNullOrWhiteSpace(ld.Remain))     // FTA expects 'Natural' and I canna see why not && ld.Remain != "Natural")
                        {
                            frel = ld.Remain;
                        }
                        break;

                    case "_PREF":
                    case "_STAT":
                        // TODO temporarily ignore: see 2524482.ged
                        break;

                    default:
                        UnkRec unk = new UnkRec(ld.Tag, i + context.Parent.BegLine, i + context.Parent.BegLine);
                        fam.Unknowns.Add(unk);
                        break;
                    }
                    i++;
                }
                //gs = null;
            }
            fam.AddChild(xref, frel, mrel);
        }