Пример #1
0
        public ICalendarParameter  parameter(

            ISerializationContext ctx,
            ICalendarParameterCollectionContainer container

            ) //throws RecognitionException, TokenStreamException
        {
            ICalendarParameter p = null;;

            IToken n = null;
            IToken m = null;

            string        v;
            List <string> values = new List <string>();


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

                case X_NAME:
                {
                    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);
            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);

            if (container != null)
            {
                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);
        }
        /// <summary>
        /// Adds a parameter to the iCalendar object.
        /// </summary>
        virtual public void AddParameter(string name, string value)
        {
            CalendarParameter p = new CalendarParameter(name, value);

            AddParameter(p);
        }