Example #1
0
        private static void textProc(StructParseContext context, int linedex, char level)
        {
            string    val = GedRecParse.extendedText(context);
            SourceCit cit = (context.Parent as SourceCit);

            cit.Text.Add(val);
        }
Example #2
0
        public static void ChanProc(ParseContext2 ctx)
        {
            ChangeRec chan = ctx.Parent.CHAN;

            if (chan.Date != null)
            {
                UnkRec err = new UnkRec();
                err.Error = UnkRec.ErrorCode.MultChan;
                GedRecParse.LookAhead(ctx);
                err.Beg = ctx.Begline + ctx.Parent.BegLine;
                err.End = ctx.Endline + ctx.Parent.BegLine;
                ctx.Parent.Errors.Add(err);
                return;
            }

            ChanParse(ctx, chan);
            if (chan.Date == null)
            {
                UnkRec err = new UnkRec();
                err.Error = UnkRec.ErrorCode.ChanDate;
                err.Beg   = ctx.Begline + ctx.Parent.BegLine;
                err.End   = ctx.Endline + ctx.Parent.BegLine;
                ctx.Parent.Errors.Add(err);
            }
        }
Example #3
0
 public Repository(GedRecord lines, string ident, string remain) : base(lines, ident)
 {
     GedRecParse.NonStandardRemain(remain, this);
 }
Example #4
0
 public SourceRecord(GedRecord lines, string ident, string remain) : base(lines, ident)
 {
     GedRecParse.NonStandardRemain(remain, this);
 }
Example #5
0
        protected static void StructParse(StructParseContext ctx, Dictionary <string, TagProc> tagSet)
        {
            LineUtil.LineData ld = new LineUtil.LineData();
            //GEDSplitter gs = new GEDSplitter();

            int i   = ctx.Begline + 1;
            int max = ctx.Lines.Max;

            for (; i < max; i++)
            {
                try
                {
                    ctx.gs.LevelTagAndRemain(ctx.Lines.GetLine(i), ld);
                    //LineUtil.LevelTagAndRemain(ld, ctx.Lines.GetLine(i));
                }
                catch (Exception)
                {
                    UnkRec exc = new UnkRec();
                    exc.Beg   = exc.End = i;
                    exc.Error = UnkRec.ErrorCode.Exception;
                    // TODO exc.Error = "Exception during parse, skipping line";
                    ctx.Record.Errors.Add(exc); // TODO is Record only for errors?
                    continue;
                }

                if (ld.Level <= ctx.Level)
                {
                    break; // end of sub-record
                }
                ctx.Remain1 = ld.Remain1;

                if (ld.Tag == null)
                {
                    UnkRec exc = new UnkRec();
                    exc.Beg   = exc.End = i;
                    exc.Error = UnkRec.ErrorCode.MissTag;
                    // TODO exc.Error = "Exception during parse, skipping line";
                    // TODO not exception - missing tag / invalid linebreak
                    ctx.Record.Errors.Add(exc); // TODO is Record only for errors?
                    continue;
                }

                TagProc tagproc;
                if (tagSet.TryGetValue(ld.Tag, out tagproc))
                {
                    ctx.Begline = i;
                    ctx.Tag     = ld.Tag;
                    tagproc(ctx, i, ld.Level);
                }
                else
                {
                    LineSet extra    = new LineSet();
                    char    oldLevel = ctx.Level;
                    ctx.Begline = i;
                    ctx.Level   = ld.Level;
                    GedRecParse.LookAhead(ctx);
                    extra.Beg = ctx.Begline + ctx.Lines.Beg; // Make line #s relative to file
                    extra.End = ctx.Endline + ctx.Lines.Beg;
                    ctx.Parent.OtherLines.Add(extra);
                    ctx.Level = oldLevel;
                }
                i = Math.Max(ctx.Endline, i); // HACK: extendedText() may have advanced ctx.Endline further
            }
            ctx.Endline = i - 1;
            ld          = null;
            //gs = null;
        }
Example #6
0
 internal IndiRecord(GedRecord lines, string ident, string remain) : base(lines, ident)
 {
     GedRecParse.NonStandardRemain(remain, this);
     Sex = 'U';
 }
Example #7
0
 internal MediaRecord(GedRecord lines, string ident, string remain) : base(lines, ident)
 {
     GedRecParse.NonStandardRemain(remain, this);
 }
Example #8
0
 internal FamRecord(GedRecord lines, string ident, string remain) : base(lines, ident)
 {
     ChildCount = -1;
     GedRecParse.NonStandardRemain(remain, this);
 }