Exemplo n.º 1
0
 private bool TryParseEndTime(ITokenStream ts, ref Slot resultSlot)
 {
     if (ts.CurrentToken().IsTime() && ts.PreviousToken().Value() == "-")
     {
         resultSlot.EndTime = Time.CreateTime_12HourFormat(ts.CurrentToken().Value(), ts.NextToken().Value());
         return(true);
     }
     return(false);
 }
Exemplo n.º 2
0
 private bool TryParseSlotType(ITokenStream ts, ref Slot resultSlot)
 {
     if (ts.CurrentToken().IsSlotType())
     {
         resultSlot.Type = ts.CurrentToken().Value();
         return(true);
     }
     return(false);
 }
Exemplo n.º 3
0
 private bool TryParseSubjectCode(ITokenStream ts, ref Slot resultSlot)
 {
     if (ts.CurrentToken().IsPossiblySubjectCode() && ts.NextToken().Value() == "-")
     {
         resultSlot.Code = ts.CurrentToken().Value();
         return(true);
     }
     return(false);
 }
Exemplo n.º 4
0
 private bool TryParseDay(ITokenStream ts, ref Slot resultSlot)
 {
     if (ts.CurrentToken().IsDay())
     {
         resultSlot.Day = Day.Parse(ts.CurrentToken().Value());
         //resultSlot.Day = new Day( ts.CurrentToken().Value());
         return(true);
     }
     return(false);
 }
Exemplo n.º 5
0
 private bool TryParseStartTime(ITokenStream ts, ref Slot resultSlot)
 {
     if (!ts.CurrentToken().IsTime())
     {
         return(false);
     }
     if (!ts.PreviousToken().IsDay())
     {
         return(false);
     }
     resultSlot.StartTime = Time.CreateTime_12HourFormat(ts.CurrentToken().Value(), ts.NextToken().Value());
     return(true);
 }
Exemplo n.º 6
0
 private bool TryParseSlotNumber(ITokenStream ts, ref Slot resultSlot)
 {
     if (!ts.CurrentToken().IsPositiveInteger())
     {
         return(false);
     }
     if (!ts.PreviousToken().IsSlotType())
     {
         return(false);
     }
     resultSlot.Number = ts.CurrentToken().Value();
     return(true);
 }
Exemplo n.º 7
0
 protected override void ExtractToken(ITokenStream tokenStream)
 {
     tokenStream.GoToNextToken();
     _startDate = ParseDate(tokenStream.CurrentToken().Value());
     tokenStream.GoToNextToken();
     _endDate = ParseDate(tokenStream.NextToken().Value());
 }
Exemplo n.º 8
0
 private bool TryParseWeekAndVenue(ITokenStream ts, ref Slot resultSlot)
 {
     if (!ts.PreviousToken().IsPositiveNumberThatContainDecimalPoint() || !ts.NextToken().IsPossiblyVenuValue())
     {
         return(false);
     }
     resultSlot.WeekNumber = WeekNumber.Parse(ts.CurrentToken().Value());
     resultSlot.Venue      = ts.NextToken().Value();
     return(true);
 }
Exemplo n.º 9
0
        private bool TryParseSubjectName(ITokenStream ts, ref Slot resultSlot, ref bool isReadingSubjectName)
        {
            if (isReadingSubjectName)
            {
                if (ts.CurrentToken().Value().Length != 0 && ts.CurrentToken().Value()[0] == '[')
                {
                    isReadingSubjectName = false;
                    return(true);
                }
                resultSlot.SubjectName += " " + ts.CurrentToken().Value();
                return(true);
            }

            if (ts.CurrentToken().Value() == "-" && ts.PreviousToken().IsPossiblySubjectCode())
            {
                isReadingSubjectName   = true;
                resultSlot.SubjectName = "";
                return(true);
            }

            return(false);
        }
Exemplo n.º 10
0
 protected override bool HaltingCondition(ITokenStream tokenStream)
 {
     return(tokenStream.CurrentToken().Value().ToLower() == "(weeks)");
 }
Exemplo n.º 11
0
 protected override bool HaltingCondition(ITokenStream ts)
 {
     return
         (ts.CurrentToken().Value().ToLower() == "user" &&
          ts.NextToken().Value().ToLower() == "guide");
 }