Ejemplo n.º 1
0
        public override void ExitNumberedweekday(GoldenFoxLanguageParser.NumberedweekdayContext context)
        {
            var index = 0;
            if (context.numberedDay() != null)
            {
                index = context.numberedDay().INT().AsInt();
                if (context.Last() != null)
                {
                    index = 7 - index + 1;
                }

                index = index % 7;
            }

            var constraints = new List<IConstraint>();
            while (Current.Constraints.Any())
            {
                constraints.Add(Current.Constraints.Pop());
            }

            while (Current.Timestamps.Any())
            {
                var interval = new Weekday((DayOfWeek)index, Current.Timestamps.Pop());
                interval.AddConstraints(constraints);
                _stack.Push(interval);
            }
        }