Exemplo n.º 1
0
        private static void SetPropertyParameters(CalendarProperty property, CaptureCollection paramNames, CaptureCollection paramValues)
        {
            var paramValueIndex = 0;

            for (var paramNameIndex = 0; paramNameIndex < paramNames.Count; paramNameIndex++)
            {
                var paramName      = paramNames[paramNameIndex].Value;
                var parameter      = new CalendarParameter(paramName);
                var nextParamIndex = paramNameIndex + 1 < paramNames.Count ? paramNames[paramNameIndex + 1].Index : int.MaxValue;
                while (paramValueIndex < paramValues.Count && paramValues[paramValueIndex].Index < nextParamIndex)
                {
                    var paramValue = paramValues[paramValueIndex].Value;
                    parameter.AddValue(paramValue);
                    paramValueIndex++;
                }
                property.AddParameter(parameter);
            }
        }
Exemplo n.º 2
0
        public CalendarParameter parameter(SerializationContext ctx, ICalendarParameterCollectionContainer container)
        {
            CalendarParameter p;
            var values = new List <string>(128);

            switch (LA(1))
            {
            case IANA_TOKEN:
            {
                var n = LT(1);
                match(IANA_TOKEN);
                p = new CalendarParameter(n.getText());
                break;
            }

            case X_NAME:
            {
                var m = LT(1);
                match(X_NAME);
                p = new CalendarParameter(m.getText());
                break;
            }

            default:
            {
                throw new NoViableAltException(LT(1), getFilename());
            }
            }

            // Push the parameter onto the serialization context stack
            ctx.Push(p);

            match(EQUAL);
            var v = param_value();

            values.Add(v);
            { // ( ... )*
                for (;;)
                {
                    if ((LA(1) == COMMA))
                    {
                        match(COMMA);
                        v = param_value();
                        values.Add(v);
                    }
                    else
                    {
                        goto _loop30_breakloop;
                    }
                }
_loop30_breakloop:
                ;
            } // ( ... )*

            p.SetValue(values);

            container?.Parameters.Add(p);

            // Notify that the parameter has been loaded
            p.OnLoaded();

            // Pop the parameter off the serialization context stack
            ctx.Pop();

            return(p);
        }