Compare commits

...

4 Commits

Author SHA1 Message Date
Dianne Skoll 5b7d4a07ec More explicit error messages.
Remind unit tests / tests (push) Successful in 47s
2024-09-07 13:25:31 -04:00
Dianne Skoll 8c3d2c4003 More specific error message. 2024-09-07 13:14:31 -04:00
Dianne Skoll f485d607ff Fix error message. 2024-09-07 10:16:57 -04:00
Dianne Skoll a0effa5f0b Update keyword/variable/function list in remind-conf-mode.el. 2024-09-07 10:15:02 -04:00
4 changed files with 76 additions and 50 deletions
+43 -35
View File
@@ -111,11 +111,11 @@
(sort
(list "ADDOMIT" "AFTER" "AT" "BANNER" "BEFORE"
"CAL" "CLEAR-OMIT-CONTEXT" "DEBUG" "DO" "DUMPVARS"
"DURATION" "ELSE" "ENDIF" "ERRMSG" "EXIT" "FIRST"
"FLUSH" "FOURTH" "FROM" "FSET" "IF" "IFTRIG" "IN"
"DURATION" "ELSE" "ENDIF" "ERRMSG" "EXIT" "EXPR" "FIRST"
"FLUSH" "FOURTH" "FROM" "FSET" "FUNSET" "IF" "IFTRIG" "IN"
"INCLUDE" "INCLUDECMD" "LAST" "LASTDAY"
"LASTWORKDAY" "MAYBE-UNCOMPUTABLE" "MSF"
"MSG" "OMIT" "OMITFUNC" "ONCE"
"MSG" "NOQUEUE" "OMIT" "OMITFUNC" "ONCE"
"POP-OMIT-CONTEXT" "PRESERVE" "PRIORITY" "PS" "PSFILE"
"PUSH-OMIT-CONTEXT" "REM" "RUN" "SATISFY" "SCANFROM"
"SCHED" "SECOND" "SET" "SKIP" "SPECIAL"
@@ -131,50 +131,58 @@
(defconst remind-builtin-variables
(sort
(list "$Ago" "$Am" "$And" "$April" "$At" "$August" "$CalcUTC" "$CalMode" "$Daemon" "$DateSep"
"$DateTimeSep" "$December" "$DefaultColor" "$DefaultPrio"
"$DefaultTDelta" "$DeltaOffset" "$DontFork" "$DontQueue"
"$DontTrigAts" "$EndSent" "$EndSentIg" "$February" "$FirstIndent"
"$FoldYear" "$FormWidth" "$Friday" "$Fromnow" "$Hour" "$Hplu" "$HushMode" "$IgnoreOnce"
"$InfDelta" "$IntMax" "$IntMin" "$Is" "$January" "$July" "$June" "$LatDeg"
"$Latitude" "$LatMin" "$LatSec" "$Location" "$LongDeg" "$Longitude"
"$LongMin" "$LongSec" "$March" "$MaxSatIter" "$MaxStringLen" "$May"
"$MinsFromUTC" "$Minute" "$Monday" "$Mplu" "$NextMode" "$November" "$Now" "$NumQueued"
"$NumTrig" "$October" "$On" "$Pm" "$PrefixLineNo" "$PSCal" "$RunOff" "$Saturday"
"$September" "$SimpleCal" "$SortByDate" "$SortByPrio" "$SortByTime"
"$SubsIndent" "$Sunday" "$SysInclude" "$T" "$Td" "$Thursday" "$TimeSep" "$Tm"
"$Today" "$Tomorrow" "$Tuesday" "$Tw" "$Ty" "$U" "$Ud" "$Um" "$UntimedFirst" "$Uw" "$Uy"
"$Was" "$Wednesday")
(list
"$AddBlankLines" "$Ago" "$Am" "$And" "$April" "$At" "$August"
"$CalMode" "$CalcUTC" "$Daemon" "$DateSep" "$DateTimeSep" "$December"
"$DefaultColor" "$DefaultPrio" "$DefaultTDelta" "$DeltaOverride"
"$DontFork" "$DontQueue" "$DontTrigAts" "$EndSent" "$EndSentIg"
"$ExpressionTimeLimit" "$February" "$FirstIndent" "$FoldYear"
"$FormWidth" "$Friday" "$Fromnow" "$Hour" "$Hplu" "$HushMode"
"$IgnoreOnce" "$InfDelta" "$IntMax" "$IntMin" "$Is" "$January" "$July"
"$June" "$LatDeg" "$LatMin" "$LatSec" "$Latitude" "$Location"
"$LongDeg" "$LongMin" "$LongSec" "$Longitude" "$March" "$MaxFullOmits"
"$MaxLateMinutes" "$MaxPartialOmits" "$MaxSatIter" "$MaxStringLen"
"$May" "$MinsFromUTC" "$Minute" "$Monday" "$Mplu" "$NextMode"
"$November" "$Now" "$NumFullOmits" "$NumPartialOmits" "$NumQueued"
"$NumTrig" "$October" "$On" "$OnceFile" "$PSCal" "$ParseUntriggered"
"$Pm" "$PrefixLineNo" "$RunOff" "$Saturday" "$September" "$SimpleCal"
"$SortByDate" "$SortByPrio" "$SortByTime" "$SubsIndent" "$Sunday"
"$SuppressLRM" "$SysInclude" "$T" "$Td" "$TerminalBackground"
"$Thursday" "$TimeSep" "$Tm" "$Today" "$Tomorrow" "$Tt" "$Tuesday"
"$Tw" "$Ty" "$U" "$Ud" "$Um" "$UntimedFirst" "$Use256Colors"
"$UseBGVTColors" "$UseTrueColors" "$UseVTColors" "$Uw" "$Uy" "$Was"
"$Wednesday")
#'(lambda (a b) (> (length a) (length b)))))
(defconst remind-time-words
(sort
(list "Jan" "January" "Feb" "Mar" "Apr" "Jun" "Jul" "Aug" "Sept" "Sep" "Oct" "Nov" "Dec"
(list
"Jan" "January" "Feb" "Mar" "Apr" "Jun" "Jul" "Aug" "Sept" "Sep" "Oct" "Nov" "Dec"
"February" "March" "April" "May" "June" "July" "August" "September" "October"
"November" "December" "Mon" "Monday" "Tue" "Tues" "Tuesday" "Wed" "Wednesday"
"Thu" "Thursday" "Thurs" "Fri" "Friday" "Saturday" "Sat" "Sun" "Sunday")
#'(lambda (a b) (> (length a) (length b)))))
(defconst remind-builtin-functions
(sort
(list "abs" "access" "adawn" "adusk" "ampm" "args" "asc" "baseyr" "char"
"choose" "coerce" "current" "date" "datepart" "datetime" "dawn" "day"
"daysinmon" "defined" "dosubst" "dusk" "easterdate" "evaltrig"
"filedate" "filedatetime" "filedir" "filename" "getenv" "hebdate"
"hebday" "hebmon" "hebyear" "hour" "iif" "index" "isany" "isdst"
"isleap" "isomitted" "language" "lower" "max" "min" "minsfromutc"
(list "abs" "access" "adawn" "adusk" "ampm" "ansicolor" "args" "asc"
"baseyr" "char" "choose" "coerce" "columns" "current" "date"
"datepart" "datetime" "dawn" "day" "daysinmon" "defined" "dosubst"
"dusk" "easterdate" "evaltrig" "filedate" "filedatetime" "filedir"
"filename" "getenv" "hebdate" "hebday" "hebmon" "hebyear" "hour"
"htmlescape" "htmlstriptags" "iif" "index" "isany" "isdst" "isleap"
"isomitted" "language" "localtoutc" "lower" "max" "min" "minsfromutc"
"minute" "mon" "monnum" "moondate" "moondatetime" "moonphase"
"moontime" "ndawn" "ndusk" "nonomitted" "now" "ord" "ostype" "pad" "plural"
"psmoon" "psshade" "realcurrent" "realnow" "realtoday" "sgn" "shell"
"shellescape" "slide" "strlen" "substr" "sunrise" "sunset" "time"
"timepart" "today" "trig" "trigback" "trigdate" "trigdatetime"
"trigdelta" "trigduration" "trigeventduration" "trigeventstart"
"trigfrom" "trigger" "trigpriority" "trigrep" "trigscanfrom"
"trigtime" "trigtimedelta" "trigtimerep" "triguntil" "trigvalid"
"typeof" "tzconvert" "upper" "value" "version" "weekno" "wkday"
"wkdaynum" "year")
"moontime" "multitrig" "ndawn" "ndusk" "nonomitted" "now" "ord"
"orthodoxeaster" "ostype" "pad" "plural" "psmoon" "psshade"
"realcurrent" "realnow" "realtoday" "rows" "sgn" "shell" "shellescape"
"slide" "soleq" "stdout" "strlen" "substr" "sunrise" "sunset" "time"
"timepart" "timezone" "today" "trig" "trigback" "trigdate"
"trigdatetime" "trigdelta" "trigduration" "trigeventduration"
"trigeventstart" "trigfrom" "trigger" "trigpriority" "trigrep"
"trigscanfrom" "trigtags" "trigtime" "trigtimedelta" "trigtimerep"
"triguntil" "trigvalid" "typeof" "tzconvert" "upper" "utctolocal"
"value" "version" "weekno" "wkday" "wkdaynum" "year")
#'(lambda (a b) (> (length a) (length b)))))
;;; faces
+1 -1
View File
@@ -32,7 +32,7 @@ RUN OFF
# Ensure required version of remind is used... #
################################################
IF version() < "03.04.02"
ERRMSG This file requires at least version 03.01.10 of Remind.%
ERRMSG This file requires at least version 03.04.02 of Remind.%
ERRMSG This version is version [version()].
EXIT
ENDIF
+24 -6
View File
@@ -1919,8 +1919,14 @@ static int set_constant_value(expr_node *atom)
return OK;
} else if (*s == '\'') { /* It's a literal date */
s++;
if ((r=ParseLiteralDate(&s, &dse, &tim)) != 0) return r;
if (*s != '\'') return E_BAD_DATE;
if ((r=ParseLiteralDate(&s, &dse, &tim)) != 0) {
Eprint("%s: %s", ErrMsg[r], DBufValue(&ExprBuf));
return r;
}
if (*s != '\'') {
Eprint("%s: %s", ErrMsg[E_BAD_DATE], DBufValue(&ExprBuf));
return E_BAD_DATE;
}
if (tim == NO_TIME) {
atom->u.value.type = DATE_TYPE;
atom->u.value.v.val = dse;
@@ -1944,7 +1950,10 @@ static int set_constant_value(expr_node *atom)
}
if (*s == ':' || *s == '.' || *s == TimeSep) { /* Must be a literal time */
s++;
if (!isdigit(*s)) return E_BAD_TIME;
if (!isdigit(*s)) {
Eprint("%s: `%s'", ErrMsg[E_BAD_TIME], DBufValue(&ExprBuf));
return E_BAD_TIME;
}
h = val;
m = 0;
while (isdigit(*s)) {
@@ -1960,9 +1969,15 @@ static int set_constant_value(expr_node *atom)
s++;
}
}
if (*s || h>23 || m>59) return E_BAD_TIME;
if (*s || h>23 || m>59) {
Eprint("%s: `%s'", ErrMsg[E_BAD_TIME], DBufValue(&ExprBuf));
return E_BAD_TIME;
}
if (ampm) {
if (h < 1 || h > 12) return E_BAD_TIME;
if (h < 1 || h > 12) {
Eprint("%s: `%s'", ErrMsg[E_BAD_TIME], DBufValue(&ExprBuf));
return E_BAD_TIME;
}
if (ampm == 'a') {
if (h == 12) {
h = 0;
@@ -1978,7 +1993,10 @@ static int set_constant_value(expr_node *atom)
return OK;
}
/* Not a time - must be a number */
if (*s) return E_BAD_NUMBER;
if (*s) {
Eprint("%s: `%s'", ErrMsg[E_BAD_NUMBER], DBufValue(&ExprBuf));
return E_BAD_NUMBER;
}
atom->u.value.type = INT_TYPE;
atom->u.value.v.val = val;
return OK;
+8 -8
View File
@@ -3486,7 +3486,7 @@ REM AT 13:00PM MSG foo 13p
DEBUG +x
SET x 0:00am + 0
../tests/test.rem(625): Ill-formed time
../tests/test.rem(625): Ill-formed time: `0:00am'
SET x 1:00AM + 0
01:00 + 0 => 01:00
SET x 2:00am + 0
@@ -3512,10 +3512,10 @@ SET x 11:00AM + 0
SET x 12:00am + 0
00:00 + 0 => 00:00
SET x 13:00AM + 0
../tests/test.rem(638): Ill-formed time
../tests/test.rem(638): Ill-formed time: `13:00AM'
SET x 0:00pm + 0
../tests/test.rem(640): Ill-formed time
../tests/test.rem(640): Ill-formed time: `0:00pm'
SET x 1:00PM + 0
13:00 + 0 => 13:00
SET x 2:00pm + 0
@@ -3541,10 +3541,10 @@ SET x 11:00PM + 0
SET x 12:00pm + 0
12:00 + 0 => 12:00
SET x 13:00PM + 0
../tests/test.rem(653): Ill-formed time
../tests/test.rem(653): Ill-formed time: `13:00PM'
SET x '2015-02-03@0:00am' + 0
../tests/test.rem(655): Ill-formed time
../tests/test.rem(655): Ill-formed time: '2015-02-03@0:00am'
SET x '2015-02-03@1:00AM' + 0
2015-02-03@01:00 + 0 => 2015-02-03@01:00
SET x '2015-02-03@2:00am' + 0
@@ -3570,10 +3570,10 @@ SET x '2015-02-03@11:00AM' + 0
SET x '2015-02-03@12:00am' + 0
2015-02-03@00:00 + 0 => 2015-02-03@00:00
SET x '2015-02-03@13:00AM' + 0
../tests/test.rem(668): Ill-formed time
../tests/test.rem(668): Ill-formed time: '2015-02-03@13:00AM'
SET x '2015-02-03@0:00pm' + 0
../tests/test.rem(670): Ill-formed time
../tests/test.rem(670): Ill-formed time: '2015-02-03@0:00pm'
SET x '2015-02-03@1:00PM' + 0
2015-02-03@13:00 + 0 => 2015-02-03@13:00
SET x '2015-02-03@2:00pm' + 0
@@ -3599,7 +3599,7 @@ SET x '2015-02-03@11:00PM' + 0
SET x '2015-02-03@12:00pm' + 0
2015-02-03@12:00 + 0 => 2015-02-03@12:00
SET x '2015-02-03@13:00PM' + 0
../tests/test.rem(683): Ill-formed time
../tests/test.rem(683): Ill-formed time: '2015-02-03@13:00PM'
# Test the ampm function
set x ampm(0:12) + ""