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); }
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); }
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); }
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); }
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); } }
public static AskDropdown Parse(Parser parser) { var dd = new AskDropdown(); dd.Label = parser.GetString("Dropdown"); dd.list = new List <DropdownItem>(); if (parser.curr.indent == 0) { return(dd); } var startindent = parser.curr.indent; while (parser.curr.indent == startindent) { var m = DropdownItem.Parse(parser, startindent); dd.list.Add(m); } var q = (from i in dd.list group i by i.SmallGroup into g where g.Count() > 1 select g.Key).ToList(); if (q.Any()) { throw parser.GetException("Duplicate SmallGroup in Dropdown: {0}".Fmt(string.Join(",", q))); } return(dd); }
private void ParseTrackingCode(Parser parser) { ConfirmationTrackingCode = parser.GetString(); if (ConfirmationTrackingCode.HasValue() || parser.curr.indent == 0) { return; } var startindent = parser.curr.indent; while (parser.curr.indent == startindent) { switch (parser.curr.kw) { case Parser.RegKeywords.Html: parser.lineno++; break; case Parser.RegKeywords.Body: ConfirmationTrackingCode = parser.GetString(); break; default: throw parser.GetException("unexpected line"); } } }
private void ParseSender(Parser parser) { parser.lineno++; var startindent = parser.curr.indent; while (parser.curr.indent == startindent) { switch (parser.curr.kw) { case Parser.RegKeywords.Html: parser.lineno++; break; case Parser.RegKeywords.SenderSubject: SenderSubject = parser.GetString(); break; case Parser.RegKeywords.SenderBody: SenderBody = parser.GetString(); break; default: throw parser.GetException("unexpected line in SenderConfirmation"); } } }
public static AskCheckboxes Parse(Parser parser) { var cb = new AskCheckboxes(); cb.Label = parser.GetString("CheckBoxes"); cb.Min = parser.GetInt(Parser.RegKeywords.Minimum); cb.Max = parser.GetInt(Parser.RegKeywords.Maximum); cb.Cols = parser.GetInt(Parser.RegKeywords.Columns) ?? 1; cb.list = new List<CheckboxItem>(); if (parser.curr.indent == 0) return cb; var startindent = parser.curr.indent; while (parser.curr.indent == startindent) { var m = CheckboxItem.Parse(parser, startindent); cb.list.Add(m); } var q = (from i in cb.list where i.SmallGroup != "nocheckbox" where i.SmallGroup != "comment" group i by i.SmallGroup into g where g.Count() > 1 select g.Key).ToList(); if (q.Any()) throw parser.GetException("Duplicate SmallGroup in Checkboxes: {0}".Fmt(string.Join(",", q))); return cb; }
public static AskCheckboxes Parse(Parser parser) { var cb = new AskCheckboxes(); cb.Label = parser.GetString("CheckBoxes"); cb.Min = parser.GetInt(Parser.RegKeywords.Minimum); cb.Max = parser.GetInt(Parser.RegKeywords.Maximum); cb.Cols = parser.GetInt(Parser.RegKeywords.Columns) ?? 1; cb.list = new List <CheckboxItem>(); if (parser.curr.indent == 0) { return(cb); } var startindent = parser.curr.indent; while (parser.curr.indent == startindent) { var m = CheckboxItem.Parse(parser, startindent); cb.list.Add(m); } var q = (from i in cb.list where i.SmallGroup != "nocheckbox" where i.SmallGroup != "comment" group i by i.SmallGroup into g where g.Count() > 1 select g.Key).ToList(); if (q.Any()) { throw parser.GetException("Duplicate SmallGroup in Checkboxes: {0}".Fmt(string.Join(",", q))); } return(cb); }
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); }
public Settings(string s, CMSDataContext Db, int OrgId) : this() { this.Db = Db; this.OrgId = OrgId; org = Db.LoadOrganizationById(OrgId); var parser = new Parser(s); while (parser.NextSection()) { ParseSection(parser); } SetUniqueIds("AskDropdown"); SetUniqueIds("AskExtraQuestions"); SetUniqueIds("AskCheckboxes"); SetUniqueIds("AskText"); SetUniqueIds("AskMenu"); var sglist = new List <string>(); AskItems.ForEach(a => sglist.AddRange(a.SmallGroups())); var q = sglist.GroupBy(mi => mi).Where(g => g.Count() > 1).Select(g => g.Key).ToList(); if (q.Any()) { throw parser.GetException("Duplicate SmallGroup: " + string.Join(",", q)); } parser.data = null; }
public static AskMenu Parse(Parser parser) { var mi = new AskMenu(); mi.Label = parser.GetString("Menu"); mi.list = new List <MenuItem>(); if (parser.curr.indent == 0) { return(mi); } var startindent = parser.curr.indent; while (parser.curr.indent == startindent) { var m = MenuItem.Parse(parser, startindent); mi.list.Add(m); } var q = (from i in mi.list group i by i.SmallGroup into g where g.Count() > 1 select g.Key).ToList(); if (q.Any()) { throw parser.GetException("Duplicate SmallGroup in MenuItems: {0}".Fmt(string.Join(",", q))); } return(mi); }
private void ParseInstructions(Parser parser) { parser.lineno++; if (parser.curr.indent == 0) { return; } var startindent = parser.curr.indent; while (parser.curr.indent == startindent) { switch (parser.curr.kw) { case Parser.RegKeywords.Html: parser.lineno++; break; case Parser.RegKeywords.Select: InstructionSelect = parser.GetString(); break; case Parser.RegKeywords.Find: InstructionFind = parser.GetString(); break; case Parser.RegKeywords.Options: InstructionOptions = parser.GetString(); break; case Parser.RegKeywords.Special: InstructionSpecial = parser.GetString(); break; case Parser.RegKeywords.Login: InstructionLogin = parser.GetString(); break; case Parser.RegKeywords.Submit: InstructionSubmit = parser.GetString(); break; case Parser.RegKeywords.Sorry: InstructionSorry = parser.GetString(); break; case Parser.RegKeywords.Thanks: ThankYouMessage = parser.GetString(); break; case Parser.RegKeywords.Body: InstructionAll = parser.GetString(); break; default: throw parser.GetException("unexpected line"); } } }
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() }); }
private void ParseVoteTags(Parser parser) { parser.lineno++; if (parser.curr.indent == 0) { return; } var startindent = parser.curr.indent; while (parser.curr.indent == startindent) { if (parser.curr.kw != Parser.RegKeywords.Display) { throw parser.GetException("unexpected line"); } parser.GetString(); if (parser.curr.indent <= startindent) { throw parser.GetException("expected indented Message,Confirm, or SmallGroup"); } var ind = parser.curr.indent; while (parser.curr.indent == ind) { switch (parser.curr.kw) { case Parser.RegKeywords.Message: parser.GetString(); break; case Parser.RegKeywords.Confirm: parser.GetBool(); break; case Parser.RegKeywords.SmallGroup: parser.GetString(); break; default: throw parser.GetException("unexpected line"); } } } }
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); }
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); }
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); }
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); }
public static AskGradeOptions Parse(Parser parser) { var go = new AskGradeOptions(); go.Label = parser.GetString("AskGradeOptions"); if (parser.curr.indent == 0) throw parser.GetException("expected indented Options"); var startindent = parser.curr.indent; while (parser.curr.indent == startindent) { var option = GradeOption.Parse(parser, startindent); if(go.list.All(gg => gg.Code != option.Code)) go.list.Add(option); } return go; }
public static AskMenu Parse(Parser parser) { var mi = new AskMenu(); mi.Label = parser.GetString("Menu"); mi.list = new List<MenuItem>(); if (parser.curr.indent == 0) return mi; var startindent = parser.curr.indent; while (parser.curr.indent == startindent) { var m = MenuItem.Parse(parser, startindent); mi.list.Add(m); } var q = (from i in mi.list group i by i.SmallGroup into g where g.Count() > 1 select g.Key).ToList(); if (q.Any()) throw parser.GetException("Duplicate SmallGroup in MenuItems: {0}".Fmt(string.Join(",", q))); return mi; }
public static AskDropdown Parse(Parser parser) { var dd = new AskDropdown(); dd.Label = parser.GetString("Dropdown"); dd.list = new List<DropdownItem>(); if (parser.curr.indent == 0) return dd; var startindent = parser.curr.indent; while (parser.curr.indent == startindent) { var m = DropdownItem.Parse(parser, startindent); dd.list.Add(m); } var q = (from i in dd.list group i by i.SmallGroup into g where g.Count() > 1 select g.Key).ToList(); if (q.Any()) throw parser.GetException("Duplicate SmallGroup in Dropdown: {0}".Fmt(string.Join(",", q))); return dd; }
public static AskGradeOptions Parse(Parser parser) { var go = new AskGradeOptions(); go.Label = parser.GetString("AskGradeOptions"); if (parser.curr.indent == 0) { throw parser.GetException("expected indented Options"); } var startindent = parser.curr.indent; while (parser.curr.indent == startindent) { var option = GradeOption.Parse(parser, startindent); if (go.list.All(gg => gg.Code != option.Code)) { go.list.Add(option); } } return(go); }
public Settings(string s, CMSDataContext Db, int OrgId) : this() { this.Db = Db; this.OrgId = OrgId; org = Db.LoadOrganizationById(OrgId); var parser = new Parser(s); while (parser.NextSection()) ParseSection(parser); SetUniqueIds("AskDropdown"); SetUniqueIds("AskExtraQuestions"); SetUniqueIds("AskCheckboxes"); SetUniqueIds("AskMenu"); var sglist = new List<string>(); AskItems.ForEach(a => sglist.AddRange(a.SmallGroups())); var q = sglist.GroupBy(mi => mi).Where(g => g.Count() > 1).Select(g => g.Key).ToList(); if (q.Any()) throw parser.GetException("Duplicate SmallGroup: " + string.Join(",", q)); parser.data = null; }
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; }
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; }
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; }
private void ParseTerms(Parser parser) { Terms = parser.GetString(); if (Terms.HasValue() || parser.curr.indent == 0) return; var startindent = parser.curr.indent; while (parser.curr.indent == startindent) { switch (parser.curr.kw) { case Parser.RegKeywords.Html: parser.lineno++; break; case Parser.RegKeywords.Body: Terms = parser.GetString(); break; default: throw parser.GetException("unexpected line"); } } }
private void ParseReminder(Parser parser) { parser.lineno++; var startindent = parser.curr.indent; while (parser.curr.indent == startindent) { switch (parser.curr.kw) { case Parser.RegKeywords.Html: parser.lineno++; break; case Parser.RegKeywords.ReminderSubject: ReminderSubject = parser.GetString(); break; case Parser.RegKeywords.ReminderBody: ReminderBody = parser.GetString(); break; default: throw parser.GetException("unexpected line in Reminder"); } } }
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() }; }
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; }
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; }
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; }
private void ParseInstructions(Parser parser) { parser.lineno++; if (parser.curr.indent == 0) return; var startindent = parser.curr.indent; while (parser.curr.indent == startindent) { switch (parser.curr.kw) { case Parser.RegKeywords.Html: parser.lineno++; break; case Parser.RegKeywords.Select: InstructionSelect = parser.GetString(); break; case Parser.RegKeywords.Find: InstructionFind = parser.GetString(); break; case Parser.RegKeywords.Options: InstructionOptions = parser.GetString(); break; case Parser.RegKeywords.Special: InstructionSpecial = parser.GetString(); break; case Parser.RegKeywords.Login: InstructionLogin = parser.GetString(); break; case Parser.RegKeywords.Submit: InstructionSubmit = parser.GetString(); break; case Parser.RegKeywords.Sorry: InstructionSorry = parser.GetString(); break; case Parser.RegKeywords.Body: InstructionAll = parser.GetString(); break; default: throw parser.GetException("unexpected line"); } } }
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; }
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; }
private void ParseVoteTags(Parser parser) { parser.lineno++; if (parser.curr.indent == 0) return; var startindent = parser.curr.indent; while (parser.curr.indent == startindent) { if (parser.curr.kw != Parser.RegKeywords.Display) throw parser.GetException("unexpected line"); parser.GetString(); if (parser.curr.indent <= startindent) throw parser.GetException("expected indented Message,Confirm, or SmallGroup"); var ind = parser.curr.indent; while (parser.curr.indent == ind) { switch (parser.curr.kw) { case Parser.RegKeywords.Message: parser.GetString(); break; case Parser.RegKeywords.Confirm: parser.GetBool(); break; case Parser.RegKeywords.SmallGroup: parser.GetString(); break; default: throw parser.GetException("unexpected line"); } } } }
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); } }
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; }
private void ParseSupport(Parser parser) { parser.lineno++; var startindent = parser.curr.indent; while (parser.curr.indent == startindent) { switch (parser.curr.kw) { case Parser.RegKeywords.Html: parser.lineno++; break; case Parser.RegKeywords.SupportSubject: SupportSubject = parser.GetString(); break; case Parser.RegKeywords.SupportBody: SupportBody = parser.GetString(); break; default: throw parser.GetException("unexpected line in SupportEmail"); } } }