예제 #1
0
            public static OrgFee Parse(Parser parser, int startindent)
            {
                if (parser.curr.kw != Parser.RegKeywords.None)
                {
                    throw parser.GetException("expected orgid only");
                }
                var oid = parser.GetInt();

                if (oid == 0)
                {
                    parser.lineno--;
                    throw parser.GetException("invalid orgid");
                }
                var f = new OrgFee {
                    OrgId = oid
                };

                if (parser.curr.indent > startindent)
                {
                    if (parser.curr.kw != Parser.RegKeywords.Fee)
                    {
                        throw parser.GetException("expected fee");
                    }
                    f.Fee = parser.GetDecimal();
                }
                return(f);
            }
예제 #2
0
        public static AskSize Parse(Parser parser)
        {
            var r = new AskSize();

            parser.lineno++;
            r.Label = parser.GetLabel("Size");
            if (parser.curr.kw == Parser.RegKeywords.Fee)
            {
                r.Fee = parser.GetDecimal();
            }
            if (parser.curr.kw == Parser.RegKeywords.AllowLastYear)
            {
                r.AllowLastYear = parser.GetBool();
            }
            r.list = new List <Size>();
            if (parser.curr.indent == 0)
            {
                return(r);
            }
            var startindent = parser.curr.indent;

            while (parser.curr.indent == startindent)
            {
                var m = Size.Parse(parser, startindent);
                r.list.Add(m);
            }
            var q = r.list.GroupBy(mi => mi.SmallGroup).Where(g => g.Count() > 1).Select(g => g.Key).ToList();

            if (q.Any())
            {
                throw parser.GetException("Duplicate SmallGroup in Sizes: " + string.Join(",", q));
            }
            return(r);
        }
예제 #3
0
        private void ParseAgeGroups(Parser parser)
        {
            parser.lineno++;
            if (parser.curr.indent == 0)
            {
                return;
            }
            var startindent = parser.curr.indent;

            while (parser.curr.indent == startindent)
            {
                var agegroup = new AgeGroup();
                if (parser.curr.kw != Parser.RegKeywords.None)
                {
                    throw parser.GetException("unexpected line");
                }
                agegroup.SmallGroup = parser.GetLine();
                var m = parser.agerange.Match(agegroup.SmallGroup);
                if (!m.Success)
                {
                    parser.lineno--;
                    throw parser.GetException("expected age range like 0-12");
                }
                agegroup.StartAge = m.Groups["start"].Value.ToInt();
                agegroup.EndAge   = m.Groups["end"].Value.ToInt();
                if (parser.curr.indent <= startindent)
                {
                    throw parser.GetException("expected either indented SmallGroup or Fee");
                }
                var ind = parser.curr.indent;
                while (parser.curr.indent == ind)
                {
                    switch (parser.curr.kw)
                    {
                    case Parser.RegKeywords.SmallGroup:
                        agegroup.SmallGroup = parser.GetString(agegroup.SmallGroup);
                        break;

                    case Parser.RegKeywords.Fee:
                        agegroup.Fee = parser.GetDecimal();
                        break;

                    default:
                        throw parser.GetException("unexpected line");
                    }
                }
                AgeGroups.Add(agegroup);
            }
        }
예제 #4
0
            public static MenuItem Parse(Parser parser, int startindent)
            {
                var menuitem = new MenuItem();

                if (parser.curr.kw != Parser.RegKeywords.None)
                {
                    throw parser.GetException("unexpected line in MenuItem");
                }
                menuitem.Description = parser.GetLine();
                menuitem.SmallGroup  = menuitem.Description;
                if (parser.curr.indent <= startindent)
                {
                    return(menuitem);
                }
                var ind = parser.curr.indent;

                while (parser.curr.indent == ind)
                {
                    switch (parser.curr.kw)
                    {
                    case Parser.RegKeywords.SmallGroup:
                        menuitem.SmallGroup = parser.GetString(menuitem.Description);
                        break;

                    case Parser.RegKeywords.Fee:
                        menuitem.Fee = parser.GetDecimal();
                        break;

                    case Parser.RegKeywords.Limit:
                        menuitem.Limit = parser.GetNullInt();
                        break;

                    case Parser.RegKeywords.Time:
                        menuitem.MeetingTime = parser.GetDateTime();
                        break;

                    default:
                        throw parser.GetException("unexpected line in MenuItem");
                    }
                }
                return(menuitem);
            }
예제 #5
0
            public static DropdownItem Parse(Parser parser, int startindent)
            {
                var i = new DropdownItem();

                if (parser.curr.kw != Parser.RegKeywords.None)
                {
                    throw parser.GetException("unexpected line in Dropdown");
                }
                i.Description = parser.GetLine();
                i.SmallGroup  = i.Description;
                if (parser.curr.indent <= startindent)
                {
                    return(i);
                }
                var ind = parser.curr.indent;

                while (parser.curr.indent == ind)
                {
                    switch (parser.curr.kw)
                    {
                    case Parser.RegKeywords.SmallGroup:
                        i.SmallGroup = parser.GetString(i.Description);
                        break;

                    case Parser.RegKeywords.Fee:
                        i.Fee = parser.GetDecimal();
                        break;

                    case Parser.RegKeywords.Limit:
                        i.Limit = parser.GetNullInt();
                        break;

                    case Parser.RegKeywords.Time:
                        i.MeetingTime = parser.GetDateTime();
                        break;

                    default:
                        throw parser.GetException("unexpected line in DropdownItem");
                    }
                }
                return(i);
            }
예제 #6
0
파일: AskSize.cs 프로젝트: rossspoon/bvcms
 public static AskSize Parse(Parser parser)
 {
     var r = new AskSize();
     parser.lineno++;
     r.Label = parser.GetLabel("Size");
     if (parser.curr.kw == Parser.RegKeywords.Fee)
         r.Fee = parser.GetDecimal();
     if (parser.curr.kw == Parser.RegKeywords.AllowLastYear)
         r.AllowLastYear = parser.GetBool();
     r.list = new List<Size>();
     if (parser.curr.indent == 0)
         return r;
     var startindent = parser.curr.indent;
     while (parser.curr.indent == startindent)
     {
         var m = Size.Parse(parser, startindent);
         r.list.Add(m);
     }
     var q = r.list.GroupBy(mi => mi.SmallGroup).Where(g => g.Count() > 1).Select(g => g.Key).ToList();
     if (q.Any())
         throw parser.GetException("Duplicate SmallGroup in Sizes: " + string.Join(",", q));
     return r;
 }
예제 #7
0
        private AskSize asksize;         // To support old Registration Documents

        void ParseSection(Parser parser)
        {
            switch (parser.curr.kw)
            {
            case Parser.RegKeywords.AskParents:
            case Parser.RegKeywords.AnswersNotRequired:
            case Parser.RegKeywords.AskSMS:
            case Parser.RegKeywords.AskDoctor:
            case Parser.RegKeywords.AskInsurance:
            case Parser.RegKeywords.AskEmContact:
            case Parser.RegKeywords.AskAllergies:
            case Parser.RegKeywords.AskChurch:
            case Parser.RegKeywords.AskTylenolEtc:
            case Parser.RegKeywords.AskCoaching:
                AskItems.Add(Ask.ParseAsk(parser));
                break;

            case Parser.RegKeywords.SpecialScript:
                SpecialScript = parser.GetString();
                break;

            case Parser.RegKeywords.AskSuggestedFee:
                AskItems.Add(AskSuggestedFee.Parse(parser));
                break;

            case Parser.RegKeywords.AskTickets:
                AskItems.Add(AskTickets.Parse(parser));
                break;

            case Parser.RegKeywords.AskRequest:
                AskItems.Add(AskRequest.Parse(parser));
                break;

            case Parser.RegKeywords.AskHeader:
                AskItems.Add(AskHeader.Parse(parser));
                break;

            case Parser.RegKeywords.AskInstruction:
                AskItems.Add(AskInstruction.Parse(parser));
                break;

            case Parser.RegKeywords.Dropdown:
            case Parser.RegKeywords.AskOptions:
            case Parser.RegKeywords.ExtraOptions:
            case Parser.RegKeywords.Dropdown1:
            case Parser.RegKeywords.Dropdown2:
            case Parser.RegKeywords.Dropdown3:
                AskItems.Add(AskDropdown.Parse(parser));
                break;

            case Parser.RegKeywords.MenuItems:
                AskItems.Add(AskMenu.Parse(parser));
                break;

            case Parser.RegKeywords.ExtraQuestions:
                AskItems.Add(AskExtraQuestions.Parse(parser));
                break;

            case Parser.RegKeywords.Text:
                AskItems.Add(AskText.Parse(parser));
                break;

            case Parser.RegKeywords.Checkboxes:
            case Parser.RegKeywords.Checkboxes2:
                AskItems.Add(AskCheckboxes.Parse(parser));
                break;

            case Parser.RegKeywords.YesNoQuestions:
                AskItems.Add(AskYesNoQuestions.Parse(parser));
                break;

            case Parser.RegKeywords.AskGradeOptions:
            case Parser.RegKeywords.GradeOptions:
                AskItems.Add(AskGradeOptions.Parse(parser));
                break;

            case Parser.RegKeywords.AskSize:
                AskItems.Add(AskSize.Parse(parser));
                break;

            case Parser.RegKeywords.MemberOnly:
                MemberOnly = parser.GetBool();
                break;

            case Parser.RegKeywords.AskMedical:
                parser.GetBool();
                break;

            case Parser.RegKeywords.AskDonation:
                AskDonation = parser.GetBool();
                break;

            case Parser.RegKeywords.NoReqBirthYear:
                NoReqBirthYear = parser.GetBool();
                break;

            case Parser.RegKeywords.NotReqDOB:
                NotReqDOB = parser.GetBool();
                break;

            case Parser.RegKeywords.NotReqAddr:
                NotReqAddr = parser.GetBool();
                break;

            case Parser.RegKeywords.NotReqPhone:
                NotReqPhone = parser.GetBool();
                break;

            case Parser.RegKeywords.NotReqGender:
                NotReqGender = parser.GetBool();
                break;

            case Parser.RegKeywords.NotReqMarital:
                NotReqMarital = parser.GetBool();
                break;

            case Parser.RegKeywords.NotReqZip:
                NotReqZip = parser.GetBool();
                break;

            case Parser.RegKeywords.DonationFundId:
                DonationFundId = parser.GetNullInt();
                break;

            case Parser.RegKeywords.AccountingCode:
                AccountingCode = parser.GetString();
                break;

            case Parser.RegKeywords.DonationLabel:
                DonationLabel = parser.GetString();
                break;

            case Parser.RegKeywords.ExtraValueFeeName:
                ExtraValueFeeName = parser.GetString();
                break;

            case Parser.RegKeywords.GroupToJoin:
                GroupToJoin = parser.GetString();
                break;

            case Parser.RegKeywords.AddAsProspect:
                AddAsProspect = parser.GetBool();
                break;

            case Parser.RegKeywords.LinkGroupsFromOrgs:
                LinkGroupsFromOrgs = (from i in parser.curr.value.Split(',')
                                      where i.ToInt() > 0
                                      select i.ToInt()).ToList();
                parser.lineno++;
                break;

            case Parser.RegKeywords.ValidateOrgs:
                ValidateOrgs = parser.curr.value;
                parser.lineno++;
                break;

            case Parser.RegKeywords.Terms:
                ParseTerms(parser);
                break;

            case Parser.RegKeywords.Instructions:
                ParseInstructions(parser);
                break;

            case Parser.RegKeywords.Confirmation:
                ParseConfirmation(parser);
                break;

            case Parser.RegKeywords.ConfirmationTrackingCode:
                ParseTrackingCode(parser);
                break;

            case Parser.RegKeywords.Reminder:
                ParseReminder(parser);
                break;

            case Parser.RegKeywords.SupportEmail:
                ParseSupport(parser);
                break;

            case Parser.RegKeywords.SenderEmail:
                ParseSender(parser);
                break;

            case Parser.RegKeywords.AgeGroups:
                ParseAgeGroups(parser);
                break;

            case Parser.RegKeywords.OrgMemberFees:
            case Parser.RegKeywords.OrgFees:
                OrgFees = OrgFees.Parse(parser);
                break;

            case Parser.RegKeywords.VoteTags:
                ParseVoteTags(parser);
                break;

            case Parser.RegKeywords.Title:
                Title = parser.GetString();
                break;

            case Parser.RegKeywords.Shell:
                Shell = parser.GetString();
                break;

            case Parser.RegKeywords.ShellBs:
                ShellBs = parser.GetString();
                break;

            case Parser.RegKeywords.Fee:
                Fee = parser.GetDecimal();
                break;


// BEGIN support for old Registration Documents
            case Parser.RegKeywords.GiveOrgMembAccess:
                parser.GetBool();
                break;

            case Parser.RegKeywords.UseBootstrap:
                parser.GetBool();
                break;

            case Parser.RegKeywords.AskGrade:
                parser.GetBool();
                parser.GetLabel("Grade");
                break;

            case Parser.RegKeywords.AskShirtSize:
                parser.GetBool();
                asksize = new AskSize();
                AskItems.Add(asksize);
                break;

            case Parser.RegKeywords.ShirtSizes:
                asksize.list = AskSize.ParseShirtSizes(parser);
                break;

            case Parser.RegKeywords.AllowLastYearShirt:
                asksize.AllowLastYear = parser.GetBool();
                break;

            case Parser.RegKeywords.ShirtFee:
                if (asksize == null)
                {
                    asksize = new AskSize();
                    AskItems.Add(asksize);
                }
                asksize.Fee = parser.GetDecimal();
                break;
// END support for old Registration Documents

            case Parser.RegKeywords.Deposit:
                Deposit = parser.GetDecimal();
                break;

            case Parser.RegKeywords.ExtraFee:
                ExtraFee = parser.GetDecimal();
                break;

            case Parser.RegKeywords.MaximumFee:
                MaximumFee = parser.GetDecimal();
                break;

            case Parser.RegKeywords.AllowOnlyOne:
                AllowOnlyOne = parser.GetBool();
                break;

            case Parser.RegKeywords.OtherFeesAdded:
            case Parser.RegKeywords.OtherFeesAddedToOrgFee:
                OtherFeesAddedToOrgFee = parser.GetBool();
                break;

            case Parser.RegKeywords.IncludeOtherFeesWithDeposit:
                IncludeOtherFeesWithDeposit = parser.GetBool();
                break;

            case Parser.RegKeywords.ApplyMaxToOtherFees:
                ApplyMaxToOtherFees = parser.GetBool();
                break;

            case Parser.RegKeywords.AllowReRegister:
                AllowReRegister = parser.GetBool();
                break;

            case Parser.RegKeywords.AllowSaveProgress:
                AllowSaveProgress = parser.GetBool();
                break;

            case Parser.RegKeywords.TargetExtraValues:
                TargetExtraValues = parser.GetBool();
                break;

            case Parser.RegKeywords.TimeSlotLockDays:
                TimeSlotLockDays = parser.GetNullInt();
                break;

            case Parser.RegKeywords.TimeSlots:
                TimeSlots = TimeSlots.Parse(parser);
                if (TimeSlotLockDays.HasValue)
                {
                    TimeSlots.TimeSlotLockDays = TimeSlotLockDays;
                }
                break;
            }
        }
예제 #8
0
파일: OrgFees.cs 프로젝트: rossspoon/bvcms
 public static OrgFee Parse(Parser parser, int startindent)
 {
     if (parser.curr.kw != Parser.RegKeywords.None)
         throw parser.GetException("expected orgid only");
     var oid = parser.GetInt();
     if (oid == 0)
     {
         parser.lineno--;
         throw parser.GetException("invalid orgid");
     }
     var f = new OrgFee { OrgId = oid };
     if (parser.curr.indent > startindent)
     {
         if (parser.curr.kw != Parser.RegKeywords.Fee)
             throw parser.GetException("expected fee");
         f.Fee = parser.GetDecimal();
     }
     return f;
 }
예제 #9
0
 public static DropdownItem Parse(Parser parser, int startindent)
 {
     var i = new DropdownItem();
     if (parser.curr.kw != Parser.RegKeywords.None)
         throw parser.GetException("unexpected line in Dropdown");
     i.Description = parser.GetLine();
     i.SmallGroup = i.Description;
     if (parser.curr.indent <= startindent)
         return i;
     var ind = parser.curr.indent;
     while (parser.curr.indent == ind)
     {
         switch (parser.curr.kw)
         {
             case Parser.RegKeywords.SmallGroup:
                 i.SmallGroup = parser.GetString(i.Description);
                 break;
             case Parser.RegKeywords.Fee:
                 i.Fee = parser.GetDecimal();
                 break;
             case Parser.RegKeywords.Limit:
                 i.Limit = parser.GetNullInt();
                 break;
             case Parser.RegKeywords.Time:
                 i.MeetingTime = parser.GetDateTime();
                 break;
             default:
                 throw parser.GetException("unexpected line in DropdownItem");
         }
     }
     return i;
 }
예제 #10
0
파일: Settings.cs 프로젝트: rossspoon/bvcms
        void ParseSection(Parser parser)
        {
            switch (parser.curr.kw)
            {
                case Parser.RegKeywords.AskParents:
                case Parser.RegKeywords.AskDoctor:
                case Parser.RegKeywords.AskInsurance:
                case Parser.RegKeywords.AskEmContact:
                case Parser.RegKeywords.AskAllergies:
                case Parser.RegKeywords.AskChurch:
                case Parser.RegKeywords.AskTylenolEtc:
                case Parser.RegKeywords.AskCoaching:
                    AskItems.Add(Ask.ParseAsk(parser));
                    break;
                case Parser.RegKeywords.AskSuggestedFee:
                    AskItems.Add(AskSuggestedFee.Parse(parser));
                    break;
                case Parser.RegKeywords.AskTickets:
                    AskItems.Add(AskTickets.Parse(parser));
                    break;
                case Parser.RegKeywords.AskRequest:
                    AskItems.Add(AskRequest.Parse(parser));
                    break;
                case Parser.RegKeywords.AskHeader:
                    AskItems.Add(AskHeader.Parse(parser));
                    break;
                case Parser.RegKeywords.AskInstruction:
                    AskItems.Add(AskInstruction.Parse(parser));
                    break;
                case Parser.RegKeywords.Dropdown:
                case Parser.RegKeywords.AskOptions:
                case Parser.RegKeywords.ExtraOptions:
                case Parser.RegKeywords.Dropdown1:
                case Parser.RegKeywords.Dropdown2:
                case Parser.RegKeywords.Dropdown3:
                    AskItems.Add(AskDropdown.Parse(parser));
                    break;
                case Parser.RegKeywords.MenuItems:
                    AskItems.Add(AskMenu.Parse(parser));
                    break;
                case Parser.RegKeywords.ExtraQuestions:
                    AskItems.Add(AskExtraQuestions.Parse(parser));
                    break;
                case Parser.RegKeywords.Checkboxes:
                case Parser.RegKeywords.Checkboxes2:
                    AskItems.Add(AskCheckboxes.Parse(parser));
                    break;
                case Parser.RegKeywords.YesNoQuestions:
                    AskItems.Add(AskYesNoQuestions.Parse(parser));
                    break;
                case Parser.RegKeywords.AskGradeOptions:
                case Parser.RegKeywords.GradeOptions:
                    AskItems.Add(AskGradeOptions.Parse(parser));
                    break;
                case Parser.RegKeywords.AskSize:
                    AskItems.Add(AskSize.Parse(parser));
                    break;

                case Parser.RegKeywords.MemberOnly:
                    MemberOnly = parser.GetBool();
                    break;
                case Parser.RegKeywords.AskMedical:
                    parser.GetBool();
                    break;
                case Parser.RegKeywords.AskDonation:
                    AskDonation = parser.GetBool();
                    break;
                case Parser.RegKeywords.NotReqDOB:
                    NotReqDOB = parser.GetBool();
                    break;
                case Parser.RegKeywords.NotReqAddr:
                    NotReqAddr = parser.GetBool();
                    break;
                case Parser.RegKeywords.NotReqPhone:
                    NotReqPhone = parser.GetBool();
                    break;
                case Parser.RegKeywords.NotReqGender:
                    NotReqGender = parser.GetBool();
                    break;
                case Parser.RegKeywords.NotReqMarital:
                    NotReqMarital = parser.GetBool();
                    break;
                case Parser.RegKeywords.NotReqZip:
                    NotReqZip = parser.GetBool();
                    break;
                case Parser.RegKeywords.DonationFundId:
                    DonationFundId = parser.GetNullInt();
                    break;
                case Parser.RegKeywords.AccountingCode:
                    AccountingCode = parser.GetString();
                    break;
                case Parser.RegKeywords.DonationLabel:
                    DonationLabel = parser.GetString();
                    break;
                case Parser.RegKeywords.ExtraValueFeeName:
                    ExtraValueFeeName = parser.GetString();
                    break;
                case Parser.RegKeywords.GroupToJoin:
                    GroupToJoin = parser.GetString();
                    break;
                case Parser.RegKeywords.GiveOrgMembAccess:
                    GiveOrgMembAccess = parser.GetBool();
                    break;
                case Parser.RegKeywords.LinkGroupsFromOrgs:
                    LinkGroupsFromOrgs = (from i in parser.curr.value.Split(',')
                                          where i.ToInt() > 0
                                          select i.ToInt()).ToList();
                    parser.lineno++;
                    break;
                case Parser.RegKeywords.ValidateOrgs:
                    ValidateOrgs = parser.curr.value;
                    parser.lineno++;
                    break;
                case Parser.RegKeywords.Terms:
                    ParseTerms(parser);
                    break;
                case Parser.RegKeywords.Instructions:
                    ParseInstructions(parser);
                    break;
                case Parser.RegKeywords.Confirmation:
                    ParseConfirmation(parser);
                    break;
                case Parser.RegKeywords.Reminder:
                    ParseReminder(parser);
                    break;
                case Parser.RegKeywords.AgeGroups:
                    ParseAgeGroups(parser);
                    break;
                case Parser.RegKeywords.OrgMemberFees:
                case Parser.RegKeywords.OrgFees:
                    OrgFees = OrgFees.Parse(parser);
                    break;
                case Parser.RegKeywords.VoteTags:
                    ParseVoteTags(parser);
                    break;
                case Parser.RegKeywords.Title:
                    Title = parser.GetString();
                    break;
                case Parser.RegKeywords.Shell:
                    Shell = parser.GetString();
                    break;
                case Parser.RegKeywords.Fee:
                    Fee = parser.GetDecimal();
                    break;

            // BEGIN support for old Registration Documents
                case Parser.RegKeywords.AskGrade:
                    parser.GetBool();
                    parser.GetLabel("Grade");
                    break;

                case Parser.RegKeywords.AskShirtSize:
                    parser.GetBool();
                    asksize = new AskSize();
                    AskItems.Add(asksize);
                    break;
                case Parser.RegKeywords.ShirtSizes:
                    asksize.list = AskSize.ParseShirtSizes(parser);
                    break;
                case Parser.RegKeywords.AllowLastYearShirt:
                    asksize.AllowLastYear = parser.GetBool();
                    break;
                case Parser.RegKeywords.ShirtFee:
                    if (asksize == null)
                    {
                        asksize = new AskSize();
                        AskItems.Add(asksize);
                    }
                    asksize.Fee = parser.GetDecimal();
                    break;
            // END support for old Registration Documents

                case Parser.RegKeywords.Deposit:
                    Deposit = parser.GetDecimal();
                    break;
                case Parser.RegKeywords.ExtraFee:
                    ExtraFee = parser.GetDecimal();
                    break;
                case Parser.RegKeywords.MaximumFee:
                    MaximumFee = parser.GetDecimal();
                    break;
                case Parser.RegKeywords.AllowOnlyOne:
                    AllowOnlyOne = parser.GetBool();
                    break;
                case Parser.RegKeywords.OtherFeesAdded:
                case Parser.RegKeywords.OtherFeesAddedToOrgFee:
                    OtherFeesAddedToOrgFee = parser.GetBool();
                    break;
                case Parser.RegKeywords.IncludeOtherFeesWithDeposit:
                    IncludeOtherFeesWithDeposit = parser.GetBool();
                    break;
                case Parser.RegKeywords.ApplyMaxToOtherFees:
                    ApplyMaxToOtherFees = parser.GetBool();
                    break;
                case Parser.RegKeywords.AllowReRegister:
                    AllowReRegister = parser.GetBool();
                    break;
                case Parser.RegKeywords.TargetExtraValues:
                    TargetExtraValues = parser.GetBool();
                    break;
                case Parser.RegKeywords.TimeSlotLockDays:
                    TimeSlotLockDays = parser.GetNullInt();
                    break;
                case Parser.RegKeywords.TimeSlots:
                    TimeSlots = TimeSlots.Parse(parser);
                    if (TimeSlotLockDays.HasValue)
                        TimeSlots.TimeSlotLockDays = TimeSlotLockDays;
                    break;
            }
        }
예제 #11
0
파일: Settings.cs 프로젝트: rossspoon/bvcms
 private void ParseAgeGroups(Parser parser)
 {
     parser.lineno++;
     if (parser.curr.indent == 0)
         return;
     var startindent = parser.curr.indent;
     while (parser.curr.indent == startindent)
     {
         var agegroup = new AgeGroup();
         if (parser.curr.kw != Parser.RegKeywords.None)
             throw parser.GetException("unexpected line");
         agegroup.SmallGroup = parser.GetLine();
         var m = parser.agerange.Match(agegroup.SmallGroup);
         if (!m.Success)
         {
             parser.lineno--;
             throw parser.GetException("expected age range like 0-12");
         }
         agegroup.StartAge = m.Groups["start"].Value.ToInt();
         agegroup.EndAge = m.Groups["end"].Value.ToInt();
         if (parser.curr.indent <= startindent)
             throw parser.GetException("expected either indented SmallGroup or Fee");
         var ind = parser.curr.indent;
         while (parser.curr.indent == ind)
         {
             switch (parser.curr.kw)
             {
                 case Parser.RegKeywords.SmallGroup:
                     agegroup.SmallGroup = parser.GetString(agegroup.SmallGroup);
                     break;
                 case Parser.RegKeywords.Fee:
                     agegroup.Fee = parser.GetDecimal();
                     break;
                 default:
                     throw parser.GetException("unexpected line");
             }
         }
         AgeGroups.Add(agegroup);
     }
 }
예제 #12
0
파일: AskMenu.cs 프로젝트: rossspoon/bvcms
 public static MenuItem Parse(Parser parser, int startindent)
 {
     var menuitem = new MenuItem();
     if (parser.curr.kw != Parser.RegKeywords.None)
         throw parser.GetException("unexpected line in MenuItem");
     menuitem.Description = parser.GetLine();
     menuitem.SmallGroup = menuitem.Description;
     if (parser.curr.indent <= startindent)
         return menuitem;
     var ind = parser.curr.indent;
     while (parser.curr.indent == ind)
     {
         switch (parser.curr.kw)
         {
             case Parser.RegKeywords.SmallGroup:
                 menuitem.SmallGroup = parser.GetString(menuitem.Description);
                 break;
             case Parser.RegKeywords.Fee:
                 menuitem.Fee = parser.GetDecimal();
                 break;
             case Parser.RegKeywords.Limit:
                 menuitem.Limit = parser.GetNullInt();
                 break;
             case Parser.RegKeywords.Time:
                 menuitem.MeetingTime = parser.GetDateTime();
                 break;
             default:
                 throw parser.GetException("unexpected line in MenuItem");
         }
     }
     return menuitem;
 }