コード例 #1
0
ファイル: AskSize.cs プロジェクト: sengithub/SenSourcecode
            public static Size Parse(Parser parser, int startindent)
            {
                var i = new Size();

                if (parser.curr.kw != Parser.RegKeywords.None)
                {
                    throw parser.GetException("unexpected line in Size");
                }
                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)
                {
                    if (parser.curr.kw != Parser.RegKeywords.SmallGroup)
                    {
                        throw parser.GetException("unexpected line in Size");
                    }
                    i.SmallGroup = parser.GetString(i.Description);
                }
                return(i);
            }
コード例 #2
0
ファイル: AskSize.cs プロジェクト: sengithub/SenSourcecode
        public static List <Size> ParseShirtSizes(Parser parser)
        {
            parser.lineno++;
            var list = new List <Size>();

            if (parser.curr.indent == 0)
            {
                return(list);
            }
            var startindent = parser.curr.indent;

            while (parser.curr.indent == startindent)
            {
                var shirtsize = new Size();
                if (parser.curr.kw != Parser.RegKeywords.None)
                {
                    throw parser.GetException("unexpected line");
                }
                shirtsize.Description = parser.GetLine();
                shirtsize.SmallGroup  = shirtsize.Description;
                if (parser.curr.indent > startindent)
                {
                    if (parser.curr.kw != Parser.RegKeywords.SmallGroup)
                    {
                        throw parser.GetException("expected SmallGroup keyword");
                    }
                    shirtsize.SmallGroup = parser.GetString(shirtsize.SmallGroup);
                }
                list.Add(shirtsize);
            }
            return(list);
        }
コード例 #3
0
            public static GradeOption Parse(Parser parser, int startindent)
            {
                if (parser.curr.kw != Parser.RegKeywords.None)
                {
                    throw parser.GetException("expected description only");
                }
                var option = new GradeOption();

                option.Description = parser.GetLine();
                if (parser.curr.indent <= startindent)
                {
                    throw parser.GetException("expected greater indent");
                }
                if (parser.curr.kw != Parser.RegKeywords.Code)
                {
                    throw parser.GetException("expected Code");
                }
                var code = parser.GetNullInt();

                if (!code.HasValue)
                {
                    parser.lineno--;
                    throw parser.GetException("expected integer code");
                }
                option.Code = code.Value;
                return(option);
            }
コード例 #4
0
 public static ExtraQuestion Parse(Parser parser, int startindent)
 {
     if (parser.curr.kw != Parser.RegKeywords.None)
     {
         throw parser.GetException("unexpected line");
     }
     return(new ExtraQuestion {
         Question = parser.GetLine()
     });
 }
コード例 #5
0
ファイル: Settings.cs プロジェクト: sengithub/SenSourcecode
        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);
            }
        }
コード例 #6
0
ファイル: AskDropdown.cs プロジェクト: davidbwire/bvcms
            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);
            }
コード例 #7
0
ファイル: AskMenu.cs プロジェクト: sengithub/SenSourcecode
            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);
            }
コード例 #8
0
ファイル: TimeSlots.cs プロジェクト: sengithub/SenSourcecode
            public static TimeSlot Parse(Parser parser, int startindent)
            {
                var timeslot = new TimeSlot();

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

                while (parser.curr.indent == ind)
                {
                    switch (parser.curr.kw)
                    {
                    case Parser.RegKeywords.Time:
                        timeslot.Time = parser.GetTime();
                        break;

                    case Parser.RegKeywords.DayOfWeek:
                        timeslot.DayOfWeek = parser.GetInt();
                        break;

                    case Parser.RegKeywords.Limit:
                        timeslot.Limit = parser.GetInt();
                        break;

                    default:
                        throw parser.GetException("unexpected line in TimeSlot");
                    }
                }
                return(timeslot);
            }
コード例 #9
0
            public static YesNoQuestion Parse(Parser parser, int startindent)
            {
                var q = new YesNoQuestion();

                if (parser.curr.kw != Parser.RegKeywords.None)
                {
                    throw parser.GetException("unexpected line");
                }
                q.Question = parser.GetLine();
                if (parser.curr.indent <= startindent)
                {
                    throw parser.GetException("Expected SmallGroup indented");
                }
                if (parser.curr.kw != Parser.RegKeywords.SmallGroup)
                {
                    throw parser.GetException("Expected SmallGroup keyword");
                }
                if (!parser.curr.value.HasValue())
                {
                    throw parser.GetException("Expected SmallGroup value");
                }
                q.SmallGroup = parser.GetString();
                return(q);
            }
コード例 #10
0
ファイル: AskSize.cs プロジェクト: rossspoon/bvcms
 public static List<Size> ParseShirtSizes(Parser parser)
 {
     parser.lineno++;
     var list = new List<Size>();
     if (parser.curr.indent == 0)
         return list;
     var startindent = parser.curr.indent;
     while (parser.curr.indent == startindent)
     {
         var shirtsize = new Size();
         if (parser.curr.kw != Parser.RegKeywords.None)
             throw parser.GetException("unexpected line");
         shirtsize.Description = parser.GetLine();
         shirtsize.SmallGroup = shirtsize.Description;
         if (parser.curr.indent > startindent)
         {
             if (parser.curr.kw != Parser.RegKeywords.SmallGroup)
                 throw parser.GetException("expected SmallGroup keyword");
             shirtsize.SmallGroup = parser.GetString(shirtsize.SmallGroup);
         }
         list.Add(shirtsize);
     }
     return list;
 }
コード例 #11
0
ファイル: AskYesNoQuestions.cs プロジェクト: rossspoon/bvcms
 public static YesNoQuestion Parse(Parser parser, int startindent)
 {
     var q = new YesNoQuestion();
     if (parser.curr.kw != Parser.RegKeywords.None)
         throw parser.GetException("unexpected line");
     q.Question = parser.GetLine();
     if (parser.curr.indent <= startindent)
         throw parser.GetException("Expected SmallGroup indented");
     if (parser.curr.kw != Parser.RegKeywords.SmallGroup)
         throw parser.GetException("Expected SmallGroup keyword");
     if (!parser.curr.value.HasValue())
         throw parser.GetException("Expected SmallGroup value");
     q.SmallGroup = parser.GetString();
     return q;
 }
コード例 #12
0
ファイル: TimeSlots.cs プロジェクト: rossspoon/bvcms
 public static TimeSlot Parse(Parser parser, int startindent)
 {
     var timeslot = new TimeSlot();
     if (parser.curr.kw != Parser.RegKeywords.None)
         throw parser.GetException("unexpected line in TimeSlots");
     timeslot.Description = parser.GetLine();
     if (parser.curr.indent <= startindent)
         return timeslot;
     var ind = parser.curr.indent;
     while (parser.curr.indent == ind)
     {
         switch (parser.curr.kw)
         {
             case Parser.RegKeywords.Time:
                 timeslot.Time = parser.GetTime();
                 break;
             case Parser.RegKeywords.DayOfWeek:
                 timeslot.DayOfWeek = parser.GetInt();
                 break;
             case Parser.RegKeywords.Limit:
                 timeslot.Limit = parser.GetInt();
                 break;
             default:
                 throw parser.GetException("unexpected line in TimeSlot");
         }
     }
     return timeslot;
 }
コード例 #13
0
ファイル: AskGradeOptions.cs プロジェクト: rossspoon/bvcms
 public static GradeOption Parse(Parser parser, int startindent)
 {
     if (parser.curr.kw != Parser.RegKeywords.None)
         throw parser.GetException("expected description only");
     var option = new GradeOption();
     option.Description = parser.GetLine();
     if (parser.curr.indent <= startindent)
         throw parser.GetException("expected greater indent");
     if (parser.curr.kw != Parser.RegKeywords.Code)
         throw parser.GetException("expected Code");
     var code = parser.GetNullInt();
     if (!code.HasValue)
     {
         parser.lineno--;
         throw parser.GetException("expected integer code");
     }
     option.Code = code.Value;
     return option;
 }
コード例 #14
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);
     }
 }
コード例 #15
0
ファイル: AskSize.cs プロジェクト: rossspoon/bvcms
 public static Size Parse(Parser parser, int startindent)
 {
     var i = new Size();
     if (parser.curr.kw != Parser.RegKeywords.None)
         throw parser.GetException("unexpected line in Size");
     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)
     {
         if (parser.curr.kw != Parser.RegKeywords.SmallGroup)
             throw parser.GetException("unexpected line in Size");
         i.SmallGroup = parser.GetString(i.Description);
     }
     return i;
 }
コード例 #16
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;
 }
コード例 #17
0
ファイル: AskExtraQuestions.cs プロジェクト: rossspoon/bvcms
 public static ExtraQuestion Parse(Parser parser, int startindent)
 {
     if (parser.curr.kw != Parser.RegKeywords.None)
         throw parser.GetException("unexpected line");
     return new ExtraQuestion { Question = parser.GetLine() };
 }
コード例 #18
0
ファイル: AskDropdown.cs プロジェクト: rossspoon/bvcms
 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;
 }