public ICalendarProperty property(
ISerializationContext ctx,
ICalendarPropertyListContainer c
) //throws RecognitionException, TokenStreamException
{
ICalendarProperty p = null;;
IToken n = null;
IToken m = null;
string v;
{
switch ( LA(1) )
{
case IANA_TOKEN:
{
n = LT(1);
match(IANA_TOKEN);
p = new CalendarProperty(n.getLine(), n.getColumn());
p.Name = n.getText().ToUpper();
break;
}
case X_NAME:
{
m = LT(1);
match(X_NAME);
p = new CalendarProperty(m.getLine(), m.getColumn());
p.Name = m.getText().ToUpper();
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
ISerializationProcessor<ICalendarProperty> processor = ctx.GetService(typeof(ISerializationProcessor<ICalendarProperty>)) as ISerializationProcessor<ICalendarProperty>;
// Do some pre-processing on the property
if (processor != null)
processor.PreDeserialization(p);
if (c != null)
{
// Add the property to the container, as the parent object(s)
// may be needed during deserialization.
c.Properties.Add(p);
}
// Push the property onto the serialization context stack
ctx.Push(p);
IStringSerializer dataMapSerializer = new DataMapSerializer(ctx);
{ // ( ... )*
for (;;)
{
if ((LA(1)==SEMICOLON))
{
match(SEMICOLON);
parameter(ctx, p);
}
else
{
goto _loop24_breakloop;
}
}
_loop24_breakloop: ;
} // ( ... )*
match(COLON);
v=value();
// Deserialize the value of the property
// into a concrete iCalendar data type,
// a list of concrete iCalendar data types,
// or string value.
object deserialized = dataMapSerializer.Deserialize(new StringReader(v));
if (deserialized != null)
{
// Try to determine if this is was deserialized as a *list*
// of concrete types.
Type targetType = dataMapSerializer.TargetType;
Type listOfTargetType = typeof(IList<>).MakeGenericType(targetType);
if (listOfTargetType.IsAssignableFrom(deserialized.GetType()))
{
// We deserialized a list - add each value to the
// resulting object.
foreach (var item in (IEnumerable)deserialized)
p.AddValue(item);
}
else
{
// We deserialized a single value - add it to the object.
p.AddValue(deserialized);
}
}
{ // ( ... )*
for (;;)
{
if ((LA(1)==CRLF))
{
match(CRLF);
}
else
{
goto _loop26_breakloop;
}
}
_loop26_breakloop: ;
} // ( ... )*
// Do some final processing on the property:
if (processor != null)
processor.PostDeserialization(p);
// Notify that the property has been loaded
p.OnLoaded();
// Pop the property off the serialization context stack
ctx.Pop();
return p;
}