/// <summary>
/// Add the values
/// </summary>
/// <param name="tag">The tag to populate</param>
/// <param name="toks">The token list to use</param>
/// <param name="tpos">Where to start</param>
/// <returns>The position at the end of the value list</returns>
private int AddTagValues(Tag tag, List<Token> toks, int tpos) {
int size=toks.Count, i=tpos;
for(;i<size;i++) {
Token t = toks[i];
if(t.literal) {
// if a DATE token is followed by a TIME token combine them
if(t.type==Type.DATE && (i+1)<size &&
toks[i+1].type==Type.TIME) {
SDLDateTime dt = (SDLDateTime)t.GetObjectForLiteral();
TimeSpanWithZone tswz = (TimeSpanWithZone)
toks[i+1].GetObjectForLiteral();
if(tswz.Days!=0) {
tag.AddValue(dt);
tag.AddValue(new TimeSpan(tswz.Days, tswz.Hours,
tswz.Minutes, tswz.Seconds, tswz.Milliseconds));
if(tswz.TimeZone!=null)
ParseException("TimeSpan cannot have a " +
"timezone", t.line, t.position);
} else {
tag.AddValue(Combine(dt,tswz));
}
i++;
} else {
object v = t.GetObjectForLiteral();
if(v is TimeSpanWithZone) {
TimeSpanWithZone tswz = (TimeSpanWithZone)v;
if(tswz.TimeZone!=null)
ExpectingButGot("TIME SPAN",
"TIME (component of date/time)", t.line,
t.position);
tag.AddValue(new TimeSpan(
tswz.Days, tswz.Hours,
tswz.Minutes, tswz.Seconds,
tswz.Milliseconds
));
} else {
tag.AddValue(v);
}
}
} else if(t.type==Type.IDENTIFIER) {
break;
} else {
ExpectingButGot("LITERAL or IDENTIFIER", t.type, t.line,
t.position);
}
}
return i;
}