-- TTCN3 module extracted from ITU-T Z.167 (03/2011)
module nc
{
//***************************************************************************
//*
//* @desc Unconstrained charstring constants referenced from the
//* ISO8601 date/time patterns
//*
//* @remark Whatever components are possible, defined as constant strings
//* referenced in the patterns (e.g. the optional T designator in
//* time representations or the optional century expansion in dates)
//* to allow easy modification via changing the constants only
//* @remark No. of century expansion digits and digits of decimal fraction
//* are not limited; intentionally the "#(1,)" pattern is used
//* instead of "+" to allow adding digit number limitations easily
//* @remark Defined constants are: dash, colon, century, year,
//* centuryExpansion, month, monthDurAlt, week, dayOfWeek,
//* dayOfMonth, dayOfMonthDurAlt, dayOfYear, dayOfYearDurAlt,
//* hour, minute, second, fraction, endOfDay, endOfDayExt,
//* nums, timeZone, timeZoneExt, durTime
//* @remark Components used also as optional (i.e., followed by #(,1)
//* in any of the date/time patterns) shall have an external
//* enclosing bracket; other constants need not have this
//*
//* @status verified
//*
//***************************************************************************
const charstring
dash := "-",
colon := ":",
century := "[0-9]#2",
year := "[0-9]#4",
yearExpansion := "([\+\-][0-9]#(0,))", //also allows zero additional digits!
yearExpansionOpt := "([\+\-][0-9]#(0,))#(,1)", //also allows zero additional
month := "(0[1-9]|1[0-2])",//need outer brackets: optional in some patterns
monthDurAlt := "(0[0-9]|1[01])",
week := "(W(0[1-9]|[1-4][0-9]|5[0-3]))",//need outer brackets: optional
dayOfWeek := "[1-7]",
dayOfMonth := "(0[1-9]|[12][0-9]|3[01])",//need outer brackets: optional
dayOfMonthDurAlt := "[012][0-9]|30",
dayOfYear := "(0(0[1-9]|[1-9][0-9])|[12][0-9][0-9]|3([0-5][0-9]|6[0-5]))",//optional
dayOfYearDurAlt := "[012][0-9][0-9]|3([0-5][0-9]|6[0-4])",
hour := "([01][0-9]|2[0-3])",
minute := "([0-5][0-9])", //need outer brackets: optional
second := "([0-5][0-9])",
//differentiation of fractions used in hours, minutes and seconds and duration
//is needed to allow setting of different number of decimal digits & subtyping
hFraction := "([,.][0-9]#(1,))", //need outer brackets: optional
mFraction := nc.hFraction,
sFraction := nc.hFraction,
dFraction := nc.hFraction,
optionalT := "T#(,1)",
endOfDay := "24(00(00([,.]0#(1,))#(,1)|[,.]0#(1,))#(,1)|[,.]0#(1,))#(,1)",
endOfDayExt := "24:00(:00([,.]0#(1,))#(,1)|[,.]0#(1,))#(,1)",
nums := "[0-9]#(1,)",
timeZone := "[\+\-]([01][0-9]|2[0-3])([0-5][0-9])#(,1)",
optZorTimeZone := "(Z|[\+\-]([01][0-9]|2[0-3])([0-5][0-9])#(,1))#(,1)",
timeZoneExt := "[\+\-]([01][0-9]|2[0-3])(:[0-5][0-9])#(,1)",
optZorTimeZoneExt := "(Z|[\+\-]([01][0-9]|2[0-3])(:[0-5][0-9])#(,1))#(,1)",
durTime := "(T[0-9]#(1,)"&
"(H([0-9]#(1,)(M([0-9]#(1,)(S|[,.][0-9]#(1,)S))#(,1)|[,.][0-9]#(1,)" &
"[MS]|S))#(,1)|M([0-9]#(1,)(S|[,.][0-9]#(1,)S)|[,.][0-9]#(1,)M)#(,1)|" &
"S|[,.][0-9]#(1,)[HMS]))" //optional
//Used in atomic patterns only
,endOfDaywFraction := "24(00(00[,.]0#(1,)|[,.]0#(1,))|[,.]0#(1,))"
,endOfDaywFractionExt := "24:00(:00[,.]0#(1,)|[,.]0#(1,))"
}//end module