mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-16 06:18:47 +02:00
Test for fix of parse error.
Try REALLY hard to detect constant expressions...
This commit is contained in:
15
src/expr.c
15
src/expr.c
@@ -374,8 +374,10 @@ int Evaluate(char const **s, Var *locals, ParsePtr p)
|
||||
}
|
||||
args = 0;
|
||||
if (PeekChar(s) == ')') { /* Function has no arguments */
|
||||
if (f) r = CallFunc(f, 0);
|
||||
else {
|
||||
if (f) {
|
||||
if (!f->is_constant && (p != NULL)) p->nonconst_expr = 1;
|
||||
r = CallFunc(f, 0);
|
||||
} else {
|
||||
r = CallUserFunc(ufname, 0, p);
|
||||
free((char *) ufname);
|
||||
}
|
||||
@@ -399,8 +401,10 @@ int Evaluate(char const **s, Var *locals, ParsePtr p)
|
||||
return E_EXPECT_COMMA;
|
||||
}
|
||||
}
|
||||
if (f) r = CallFunc(f, args);
|
||||
else {
|
||||
if (f) {
|
||||
if (!f->is_constant && (p != NULL)) p->nonconst_expr = 1;
|
||||
r = CallFunc(f, args);
|
||||
} else {
|
||||
r = CallUserFunc(ufname, args, p);
|
||||
free((char *) ufname);
|
||||
}
|
||||
@@ -553,11 +557,10 @@ static int MakeValue(char const *s, Value *v, Var *locals, ParsePtr p)
|
||||
}
|
||||
return r;
|
||||
} else { /* Must be a symbol */
|
||||
if (p) p->nonconst_expr = 1;
|
||||
if (DebugFlag & DB_PRTEXPR)
|
||||
fprintf(ErrFp, "%s => ", s);
|
||||
}
|
||||
r = GetVarValue(s, v, locals);
|
||||
r = GetVarValue(s, v, locals, p);
|
||||
if (! (DebugFlag & DB_PRTEXPR)) return r;
|
||||
if (r == OK) {
|
||||
PrintValue(v, ErrFp);
|
||||
|
||||
166
src/funcs.c
166
src/funcs.c
@@ -184,89 +184,89 @@ extern int ValStackPtr;
|
||||
|
||||
/* The array holding the built-in functions. */
|
||||
BuiltinFunc Func[] = {
|
||||
/* Name minargs maxargs func */
|
||||
/* Name minargs maxargs is_constant func */
|
||||
|
||||
{ "abs", 1, 1, FAbs },
|
||||
{ "access", 2, 2, FAccess },
|
||||
{ "args", 1, 1, FArgs },
|
||||
{ "asc", 1, 1, FAsc },
|
||||
{ "baseyr", 0, 0, FBaseyr },
|
||||
{ "char", 1, NO_MAX, FChar },
|
||||
{ "choose", 2, NO_MAX, FChoose },
|
||||
{ "coerce", 2, 2, FCoerce },
|
||||
{ "current", 0, 0, FCurrent },
|
||||
{ "date", 3, 3, FDate },
|
||||
{ "datepart", 1, 1, FDatepart },
|
||||
{ "datetime", 2, 5, FDateTime },
|
||||
{ "dawn", 0, 1, FDawn},
|
||||
{ "day", 1, 1, FDay },
|
||||
{ "daysinmon", 2, 2, FDaysinmon },
|
||||
{ "defined", 1, 1, FDefined },
|
||||
{ "dosubst", 1, 3, FDosubst },
|
||||
{ "dusk", 0, 1, FDusk },
|
||||
{ "easterdate", 1, 1, FEasterdate },
|
||||
{ "evaltrig", 1, 2, FEvalTrig },
|
||||
{ "filedate", 1, 1, FFiledate },
|
||||
{ "filedatetime", 1, 1, FFiledatetime },
|
||||
{ "filedir", 0, 0, FFiledir },
|
||||
{ "filename", 0, 0, FFilename },
|
||||
{ "getenv", 1, 1, FGetenv },
|
||||
{ "hebdate", 2, 5, FHebdate },
|
||||
{ "hebday", 1, 1, FHebday },
|
||||
{ "hebmon", 1, 1, FHebmon },
|
||||
{ "hebyear", 1, 1, FHebyear },
|
||||
{ "hour", 1, 1, FHour },
|
||||
{ "iif", 1, NO_MAX, FIif },
|
||||
{ "index", 2, 3, FIndex },
|
||||
{ "isdst", 0, 2, FIsdst },
|
||||
{ "isleap", 1, 1, FIsleap },
|
||||
{ "isomitted", 1, 1, FIsomitted },
|
||||
{ "language", 0, 0, FLanguage },
|
||||
{ "lower", 1, 1, FLower },
|
||||
{ "max", 1, NO_MAX, FMax },
|
||||
{ "min", 1, NO_MAX, FMin },
|
||||
{ "minsfromutc", 0, 2, FMinsfromutc },
|
||||
{ "minute", 1, 1, FMinute },
|
||||
{ "mon", 1, 1, FMon },
|
||||
{ "monnum", 1, 1, FMonnum },
|
||||
{ "moondate", 1, 3, FMoondate },
|
||||
{ "moondatetime", 1, 3, FMoondatetime },
|
||||
{ "moonphase", 0, 2, FMoonphase },
|
||||
{ "moontime", 1, 3, FMoontime },
|
||||
{ "nonomitted", 2, NO_MAX, FNonomitted },
|
||||
{ "now", 0, 0, FNow },
|
||||
{ "ord", 1, 1, FOrd },
|
||||
{ "ostype", 0, 0, FOstype },
|
||||
{ "plural", 1, 3, FPlural },
|
||||
{ "psmoon", 1, 4, FPsmoon},
|
||||
{ "psshade", 1, 3, FPsshade},
|
||||
{ "realcurrent", 0, 0, FRealCurrent},
|
||||
{ "realnow", 0, 0, FRealnow},
|
||||
{ "realtoday", 0, 0, FRealtoday },
|
||||
{ "sgn", 1, 1, FSgn },
|
||||
{ "shell", 1, 2, FShell },
|
||||
{ "slide", 2, NO_MAX, FSlide },
|
||||
{ "strlen", 1, 1, FStrlen },
|
||||
{ "substr", 2, 3, FSubstr },
|
||||
{ "sunrise", 0, 1, FSunrise},
|
||||
{ "sunset", 0, 1, FSunset },
|
||||
{ "time", 2, 2, FTime },
|
||||
{ "timepart", 1, 1, FTimepart },
|
||||
{ "today", 0, 0, FToday },
|
||||
{ "trigdate", 0, 0, FTrigdate },
|
||||
{ "trigdatetime", 0, 0, FTrigdatetime },
|
||||
{ "trigger", 1, 3, FTrigger },
|
||||
{ "trigtime", 0, 0, FTrigtime },
|
||||
{ "trigvalid", 0, 0, FTrigvalid },
|
||||
{ "typeof", 1, 1, FTypeof },
|
||||
{ "tzconvert", 2, 3, FTzconvert },
|
||||
{ "upper", 1, 1, FUpper },
|
||||
{ "value", 1, 2, FValue },
|
||||
{ "version", 0, 0, FVersion },
|
||||
{ "weekno", 0, 3, FWeekno },
|
||||
{ "wkday", 1, 1, FWkday },
|
||||
{ "wkdaynum", 1, 1, FWkdaynum },
|
||||
{ "year", 1, 1, FYear }
|
||||
{ "abs", 1, 1, 1, FAbs },
|
||||
{ "access", 2, 2, 0, FAccess },
|
||||
{ "args", 1, 1, 0, FArgs },
|
||||
{ "asc", 1, 1, 1, FAsc },
|
||||
{ "baseyr", 0, 0, 1, FBaseyr },
|
||||
{ "char", 1, NO_MAX, 1, FChar },
|
||||
{ "choose", 2, NO_MAX, 1, FChoose },
|
||||
{ "coerce", 2, 2, 1, FCoerce },
|
||||
{ "current", 0, 0, 0, FCurrent },
|
||||
{ "date", 3, 3, 1, FDate },
|
||||
{ "datepart", 1, 1, 1, FDatepart },
|
||||
{ "datetime", 2, 5, 1, FDateTime },
|
||||
{ "dawn", 0, 1, 0, FDawn},
|
||||
{ "day", 1, 1, 1, FDay },
|
||||
{ "daysinmon", 2, 2, 1, FDaysinmon },
|
||||
{ "defined", 1, 1, 0, FDefined },
|
||||
{ "dosubst", 1, 3, 0, FDosubst },
|
||||
{ "dusk", 0, 1, 0, FDusk },
|
||||
{ "easterdate", 1, 1, 0, FEasterdate },
|
||||
{ "evaltrig", 1, 2, 0, FEvalTrig },
|
||||
{ "filedate", 1, 1, 0, FFiledate },
|
||||
{ "filedatetime", 1, 1, 0, FFiledatetime },
|
||||
{ "filedir", 0, 0, 0, FFiledir },
|
||||
{ "filename", 0, 0, 0, FFilename },
|
||||
{ "getenv", 1, 1, 0, FGetenv },
|
||||
{ "hebdate", 2, 5, 0, FHebdate },
|
||||
{ "hebday", 1, 1, 0, FHebday },
|
||||
{ "hebmon", 1, 1, 0, FHebmon },
|
||||
{ "hebyear", 1, 1, 0, FHebyear },
|
||||
{ "hour", 1, 1, 1, FHour },
|
||||
{ "iif", 1, NO_MAX, 1, FIif },
|
||||
{ "index", 2, 3, 1, FIndex },
|
||||
{ "isdst", 0, 2, 0, FIsdst },
|
||||
{ "isleap", 1, 1, 1, FIsleap },
|
||||
{ "isomitted", 1, 1, 0, FIsomitted },
|
||||
{ "language", 0, 0, 1, FLanguage },
|
||||
{ "lower", 1, 1, 1, FLower },
|
||||
{ "max", 1, NO_MAX, 1, FMax },
|
||||
{ "min", 1, NO_MAX, 1, FMin },
|
||||
{ "minsfromutc", 0, 2, 0, FMinsfromutc },
|
||||
{ "minute", 1, 1, 1, FMinute },
|
||||
{ "mon", 1, 1, 1, FMon },
|
||||
{ "monnum", 1, 1, 1, FMonnum },
|
||||
{ "moondate", 1, 3, 0, FMoondate },
|
||||
{ "moondatetime", 1, 3, 0, FMoondatetime },
|
||||
{ "moonphase", 0, 2, 0, FMoonphase },
|
||||
{ "moontime", 1, 3, 0, FMoontime },
|
||||
{ "nonomitted", 2, NO_MAX, 0, FNonomitted },
|
||||
{ "now", 0, 0, 0, FNow },
|
||||
{ "ord", 1, 1, 1, FOrd },
|
||||
{ "ostype", 0, 0, 1, FOstype },
|
||||
{ "plural", 1, 3, 1, FPlural },
|
||||
{ "psmoon", 1, 4, 1, FPsmoon},
|
||||
{ "psshade", 1, 3, 1, FPsshade},
|
||||
{ "realcurrent", 0, 0, 0, FRealCurrent},
|
||||
{ "realnow", 0, 0, 0, FRealnow},
|
||||
{ "realtoday", 0, 0, 0, FRealtoday },
|
||||
{ "sgn", 1, 1, 1, FSgn },
|
||||
{ "shell", 1, 2, 0, FShell },
|
||||
{ "slide", 2, NO_MAX, 0, FSlide },
|
||||
{ "strlen", 1, 1, 1, FStrlen },
|
||||
{ "substr", 2, 3, 1, FSubstr },
|
||||
{ "sunrise", 0, 1, 0, FSunrise},
|
||||
{ "sunset", 0, 1, 0, FSunset },
|
||||
{ "time", 2, 2, 1, FTime },
|
||||
{ "timepart", 1, 1, 1, FTimepart },
|
||||
{ "today", 0, 0, 0, FToday },
|
||||
{ "trigdate", 0, 0, 0, FTrigdate },
|
||||
{ "trigdatetime", 0, 0, 0, FTrigdatetime },
|
||||
{ "trigger", 1, 3, 0, FTrigger },
|
||||
{ "trigtime", 0, 0, 0, FTrigtime },
|
||||
{ "trigvalid", 0, 0, 0, FTrigvalid },
|
||||
{ "typeof", 1, 1, 1, FTypeof },
|
||||
{ "tzconvert", 2, 3, 0, FTzconvert },
|
||||
{ "upper", 1, 1, 1, FUpper },
|
||||
{ "value", 1, 2, 0, FValue },
|
||||
{ "version", 0, 0, 1, FVersion },
|
||||
{ "weekno", 0, 3, 1, FWeekno },
|
||||
{ "wkday", 1, 1, 1, FWkday },
|
||||
{ "wkdaynum", 1, 1, 1, FWkdaynum },
|
||||
{ "year", 1, 1, 1, FYear }
|
||||
};
|
||||
|
||||
/* Need a variable here - Func[] array not really visible to outside. */
|
||||
@@ -1076,7 +1076,7 @@ static int FValue(func_info *info)
|
||||
ASSERT_TYPE(0, STR_TYPE);
|
||||
switch(Nargs) {
|
||||
case 1:
|
||||
return GetVarValue(ARGSTR(0), &RetVal, NULL);
|
||||
return GetVarValue(ARGSTR(0), &RetVal, NULL, NULL);
|
||||
|
||||
case 2:
|
||||
v = FindVar(ARGSTR(0), 0);
|
||||
|
||||
@@ -95,7 +95,7 @@ int StrCmpi (char const *s1, char const *s2);
|
||||
Var *FindVar (char const *str, int create);
|
||||
int DeleteVar (char const *str);
|
||||
int SetVar (char const *str, Value *val);
|
||||
int GetVarValue (char const *str, Value *val, Var *locals);
|
||||
int GetVarValue (char const *str, Value *val, Var *locals, ParsePtr p);
|
||||
int DoSet (Parser *p);
|
||||
int DoUnset (Parser *p);
|
||||
int DoDump (ParsePtr p);
|
||||
|
||||
@@ -41,6 +41,7 @@ typedef struct {
|
||||
char const *name;
|
||||
char minargs;
|
||||
char maxargs;
|
||||
char is_constant;
|
||||
int (*func)(func_info *);
|
||||
} BuiltinFunc;
|
||||
|
||||
|
||||
@@ -290,7 +290,7 @@ int SetVar(char const *str, Value *val)
|
||||
/* Get a copy of the value of the variable. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
int GetVarValue(char const *str, Value *val, Var *locals)
|
||||
int GetVarValue(char const *str, Value *val, Var *locals, ParsePtr p)
|
||||
{
|
||||
Var *v;
|
||||
|
||||
@@ -302,6 +302,8 @@ int GetVarValue(char const *str, Value *val, Var *locals)
|
||||
v = v->next;
|
||||
}
|
||||
|
||||
/* Global variable... mark expression as non-constant */
|
||||
if (p) p->nonconst_expr = 1;
|
||||
v=FindVar(str, 0);
|
||||
|
||||
if (!v) {
|
||||
|
||||
@@ -16,6 +16,21 @@ IFTRIG 1991
|
||||
REM MSG wookie
|
||||
ENDIF
|
||||
|
||||
# More complex conditional statements
|
||||
IF 1
|
||||
IF 0
|
||||
REM 1991 MSG wookie
|
||||
ELSE
|
||||
REM 1991 MSG wookie
|
||||
ENDIF
|
||||
ELSE
|
||||
IF 1
|
||||
REM 1991 MSG wookie
|
||||
ELSE
|
||||
REM 1991 MSG wookie
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
REM [1990+1] MSG old-with-constant-expression
|
||||
|
||||
REM [1990+1] \
|
||||
@@ -42,6 +57,16 @@ OMIT 24 Dec
|
||||
OMIT 1 Jan 1992 MSG woaaahah... expired
|
||||
OMIT 2 Jan 1992
|
||||
|
||||
# Complicated expressions
|
||||
SET a 3
|
||||
FSET const(x) x+3
|
||||
FSET nonconst(x) x+a
|
||||
|
||||
REM [const(5)] Jan 1992 MSG expired... should be commented out
|
||||
REM [const(a)] Jan 1992 MSG nonconstant expression
|
||||
REM [nonconst(5)] Jan 1992 MSG nonconstant expression
|
||||
REM [value("a")] Jan 1992 MSG nonconstant expression
|
||||
|
||||
IF 0
|
||||
# A comment in a false IF block
|
||||
#!P This should be nuked
|
||||
|
||||
217
tests/test.cmp
217
tests/test.cmp
@@ -274,217 +274,221 @@ hebdate(29, "Adar A", 1991-02-16, 5756) => ../tests/test.rem(46): No Adar A in 5
|
||||
Invalid Hebrew date
|
||||
Leaving UserFN _i() => Invalid Hebrew date
|
||||
|
||||
# This causes a parse error on version 03.01.01
|
||||
REM 1990-01-01 SATISFY 1
|
||||
../tests/test.rem(49): Expired
|
||||
|
||||
# Test each possible case of the basic reminders.
|
||||
|
||||
REM MSG Every Day
|
||||
../tests/test.rem(50): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(53): Trig = Saturday, 16 February, 1991
|
||||
Every Day
|
||||
|
||||
|
||||
REM 18 MSG Every 18th
|
||||
../tests/test.rem(52): Trig = Monday, 18 February, 1991
|
||||
../tests/test.rem(55): Trig = Monday, 18 February, 1991
|
||||
REM 15 MSG Every 15th
|
||||
../tests/test.rem(53): Trig = Friday, 15 March, 1991
|
||||
../tests/test.rem(56): Trig = Friday, 15 March, 1991
|
||||
|
||||
REM Feb MSG February
|
||||
../tests/test.rem(55): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(58): Trig = Saturday, 16 February, 1991
|
||||
February
|
||||
|
||||
REM Jan MSG January
|
||||
../tests/test.rem(56): Trig = Wednesday, 1 January, 1992
|
||||
../tests/test.rem(59): Trig = Wednesday, 1 January, 1992
|
||||
REM March MSG March
|
||||
../tests/test.rem(57): Trig = Friday, 1 March, 1991
|
||||
../tests/test.rem(60): Trig = Friday, 1 March, 1991
|
||||
|
||||
REM 13 Jan MSG 13 Jan
|
||||
../tests/test.rem(59): Trig = Monday, 13 January, 1992
|
||||
../tests/test.rem(62): Trig = Monday, 13 January, 1992
|
||||
REM 15 Feb MSG 15 Feb
|
||||
../tests/test.rem(60): Trig = Saturday, 15 February, 1992
|
||||
../tests/test.rem(63): Trig = Saturday, 15 February, 1992
|
||||
REM 28 Feb MSG 28 Feb
|
||||
../tests/test.rem(61): Trig = Thursday, 28 February, 1991
|
||||
../tests/test.rem(64): Trig = Thursday, 28 February, 1991
|
||||
REM 29 Feb MSG 29 Feb
|
||||
../tests/test.rem(62): Trig = Saturday, 29 February, 1992
|
||||
../tests/test.rem(65): Trig = Saturday, 29 February, 1992
|
||||
REM 5 Mar MSG 5 Mar
|
||||
../tests/test.rem(63): Trig = Tuesday, 5 March, 1991
|
||||
../tests/test.rem(66): Trig = Tuesday, 5 March, 1991
|
||||
|
||||
REM 1990 MSG 1990
|
||||
../tests/test.rem(65): Expired
|
||||
../tests/test.rem(68): Expired
|
||||
REM 1991 MSG 1991
|
||||
../tests/test.rem(66): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(69): Trig = Saturday, 16 February, 1991
|
||||
1991
|
||||
|
||||
REM 1992 MSG 1991
|
||||
../tests/test.rem(67): Trig = Wednesday, 1 January, 1992
|
||||
../tests/test.rem(70): Trig = Wednesday, 1 January, 1992
|
||||
|
||||
REM 1 1990 MSG 1 1990
|
||||
../tests/test.rem(69): Expired
|
||||
../tests/test.rem(72): Expired
|
||||
REM 29 1991 MSG 29 1991
|
||||
../tests/test.rem(70): Trig = Friday, 29 March, 1991
|
||||
../tests/test.rem(73): Trig = Friday, 29 March, 1991
|
||||
REM 29 1992 MSG 29 1992
|
||||
../tests/test.rem(71): Trig = Wednesday, 29 January, 1992
|
||||
../tests/test.rem(74): Trig = Wednesday, 29 January, 1992
|
||||
REM 16 1991 MSG 16 1991
|
||||
../tests/test.rem(72): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(75): Trig = Saturday, 16 February, 1991
|
||||
16 1991
|
||||
|
||||
|
||||
REM Jan 1990 MSG Jan 1990
|
||||
../tests/test.rem(74): Expired
|
||||
../tests/test.rem(77): Expired
|
||||
REM Feb 1991 MSG Feb 1991
|
||||
../tests/test.rem(75): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(78): Trig = Saturday, 16 February, 1991
|
||||
Feb 1991
|
||||
|
||||
REM Dec 1991 MSG Dec 1991
|
||||
../tests/test.rem(76): Trig = Sunday, 1 December, 1991
|
||||
../tests/test.rem(79): Trig = Sunday, 1 December, 1991
|
||||
REM May 1992 MSG May 1992
|
||||
../tests/test.rem(77): Trig = Friday, 1 May, 1992
|
||||
../tests/test.rem(80): Trig = Friday, 1 May, 1992
|
||||
|
||||
REM 1 Jan 1991 MSG 1 Jan 1991
|
||||
../tests/test.rem(79): Expired
|
||||
../tests/test.rem(82): Expired
|
||||
REM 16 Feb 1991 MSG 16 Feb 1991
|
||||
../tests/test.rem(80): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(83): Trig = Saturday, 16 February, 1991
|
||||
16 Feb 1991
|
||||
|
||||
REM 29 Dec 1992 MSG 29 Dec 1992
|
||||
../tests/test.rem(81): Trig = Tuesday, 29 December, 1992
|
||||
../tests/test.rem(84): Trig = Tuesday, 29 December, 1992
|
||||
|
||||
REM Sun MSG Sun
|
||||
../tests/test.rem(83): Trig = Sunday, 17 February, 1991
|
||||
../tests/test.rem(86): Trig = Sunday, 17 February, 1991
|
||||
REM Fri Sat Tue MSG Fri Sat Tue
|
||||
../tests/test.rem(84): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(87): Trig = Saturday, 16 February, 1991
|
||||
Fri Sat Tue
|
||||
|
||||
|
||||
REM Sun 16 MSG Sun 16
|
||||
../tests/test.rem(86): Trig = Sunday, 17 February, 1991
|
||||
../tests/test.rem(89): Trig = Sunday, 17 February, 1991
|
||||
REM Mon Tue Wed Thu Fri 1 MSG Mon Tue Wed Thu Fri 1
|
||||
../tests/test.rem(87): Trig = Friday, 1 March, 1991
|
||||
../tests/test.rem(90): Trig = Friday, 1 March, 1991
|
||||
|
||||
REM Sun Feb MSG Sun Feb
|
||||
../tests/test.rem(89): Trig = Sunday, 17 February, 1991
|
||||
../tests/test.rem(92): Trig = Sunday, 17 February, 1991
|
||||
REM Mon Tue March MSG Mon Tue March
|
||||
../tests/test.rem(90): Trig = Monday, 4 March, 1991
|
||||
../tests/test.rem(93): Trig = Monday, 4 March, 1991
|
||||
|
||||
REM Sun 16 Feb MSG Sun 16 Feb
|
||||
../tests/test.rem(92): Trig = Sunday, 17 February, 1991
|
||||
../tests/test.rem(95): Trig = Sunday, 17 February, 1991
|
||||
REM Mon Tue 10 March MSG Mon Tue 10 March
|
||||
../tests/test.rem(93): Trig = Monday, 11 March, 1991
|
||||
../tests/test.rem(96): Trig = Monday, 11 March, 1991
|
||||
|
||||
REM Sat Sun 1991 MSG Sat Sun 1991
|
||||
../tests/test.rem(95): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(98): Trig = Saturday, 16 February, 1991
|
||||
Sat Sun 1991
|
||||
|
||||
REM Mon Tue 1992 MSG Mon Tue 1992
|
||||
../tests/test.rem(96): Trig = Monday, 6 January, 1992
|
||||
../tests/test.rem(99): Trig = Monday, 6 January, 1992
|
||||
|
||||
REM Sun 16 1991 MSG Sun 16 1991
|
||||
../tests/test.rem(98): Trig = Sunday, 17 February, 1991
|
||||
../tests/test.rem(101): Trig = Sunday, 17 February, 1991
|
||||
REM Mon Tue Wed Thu Fri 1 1992 MSG Mon Tue Wed Thu Fri 1 1992
|
||||
../tests/test.rem(99): Trig = Wednesday, 1 January, 1992
|
||||
../tests/test.rem(102): Trig = Wednesday, 1 January, 1992
|
||||
|
||||
REM Mon Feb 1991 MSG Mon Feb 1991
|
||||
../tests/test.rem(101): Trig = Monday, 18 February, 1991
|
||||
../tests/test.rem(104): Trig = Monday, 18 February, 1991
|
||||
REM Tue Jan 1992 MSG Tue Jan 1992
|
||||
../tests/test.rem(102): Trig = Tuesday, 7 January, 1992
|
||||
../tests/test.rem(105): Trig = Tuesday, 7 January, 1992
|
||||
|
||||
REM Sun Mon 16 Feb 1991 MSG Sun Mon 16 Feb 1991
|
||||
../tests/test.rem(104): Trig = Sunday, 17 February, 1991
|
||||
../tests/test.rem(107): Trig = Sunday, 17 February, 1991
|
||||
REM Tue 28 Jan 1992 MSG Tue 28 Jan 1992
|
||||
../tests/test.rem(105): Trig = Tuesday, 28 January, 1992
|
||||
../tests/test.rem(108): Trig = Tuesday, 28 January, 1992
|
||||
|
||||
# Try some Backs
|
||||
CLEAR-OMIT-CONTEXT
|
||||
REM 1 -1 OMIT sat sun MSG 1 -1 OMIT Sat Sun
|
||||
../tests/test.rem(109): Trig = Thursday, 28 February, 1991
|
||||
../tests/test.rem(112): Trig = Thursday, 28 February, 1991
|
||||
REM 1 --1 OMIT sat sun MSG 1 --1 OMIT Sat Sun
|
||||
../tests/test.rem(110): Trig = Thursday, 28 February, 1991
|
||||
../tests/test.rem(113): Trig = Thursday, 28 February, 1991
|
||||
|
||||
OMIT 28 Feb
|
||||
REM 1 -1 OMIT sat sun MSG 1 -1 OMIT Sat Sun (28 Feb omitted)
|
||||
../tests/test.rem(113): Trig = Wednesday, 27 February, 1991
|
||||
../tests/test.rem(116): Trig = Wednesday, 27 February, 1991
|
||||
REM 1 --1 OMIT sat sun MSG 1 --1 OMIT Sat Sun (28 Feb omitted)
|
||||
../tests/test.rem(114): Trig = Thursday, 28 February, 1991
|
||||
../tests/test.rem(117): Trig = Thursday, 28 February, 1991
|
||||
|
||||
CLEAR-OMIT-CONTEXT
|
||||
|
||||
# Try out UNTIL
|
||||
REM Wed UNTIL 21 Feb 1991 MSG Wed UNTIL 21 Feb 1991
|
||||
../tests/test.rem(119): Trig = Wednesday, 20 February, 1991
|
||||
../tests/test.rem(122): Trig = Wednesday, 20 February, 1991
|
||||
|
||||
# Try playing with the OMIT context
|
||||
|
||||
OMIT 28 Feb 1991
|
||||
REM 1 Mar -1 MSG 1 mar -1 (28feb91 omitted)
|
||||
../tests/test.rem(124): Trig = Wednesday, 27 February, 1991
|
||||
../tests/test.rem(127): Trig = Wednesday, 27 February, 1991
|
||||
REM 1 Mar --1 MSG 1 mar --1 (28Feb91 omitted)
|
||||
../tests/test.rem(125): Trig = Thursday, 28 February, 1991
|
||||
../tests/test.rem(128): Trig = Thursday, 28 February, 1991
|
||||
REM 28 Feb BEFORE MSG 28 Feb BEFORE (28Feb91 omitted)
|
||||
../tests/test.rem(126): Trig = Wednesday, 27 February, 1991
|
||||
../tests/test.rem(129): Trig = Wednesday, 27 February, 1991
|
||||
REM 28 Feb SKIP MSG 28 Feb SKIP (28Feb91 omitted)
|
||||
../tests/test.rem(127): Trig = Friday, 28 February, 1992
|
||||
../tests/test.rem(130): Trig = Friday, 28 February, 1992
|
||||
REM 28 Feb AFTER MSG 28 Feb AFTER (28Feb91 omitted)
|
||||
../tests/test.rem(128): Trig = Friday, 1 March, 1991
|
||||
../tests/test.rem(131): Trig = Friday, 1 March, 1991
|
||||
|
||||
PUSH-OMIT-CONTEXT
|
||||
CLEAR-OMIT-CONTEXT
|
||||
REM 1 Mar -1 MSG 1 mar -1
|
||||
../tests/test.rem(132): Trig = Thursday, 28 February, 1991
|
||||
REM 1 Mar --1 MSG 1 mar --1
|
||||
../tests/test.rem(133): Trig = Thursday, 28 February, 1991
|
||||
REM 28 Feb BEFORE MSG 28 Feb BEFORE
|
||||
../tests/test.rem(134): Trig = Thursday, 28 February, 1991
|
||||
REM 28 Feb SKIP MSG 28 Feb SKIP
|
||||
../tests/test.rem(135): Trig = Thursday, 28 February, 1991
|
||||
REM 28 Feb AFTER MSG 28 Feb AFTER
|
||||
REM 1 Mar --1 MSG 1 mar --1
|
||||
../tests/test.rem(136): Trig = Thursday, 28 February, 1991
|
||||
REM 28 Feb BEFORE MSG 28 Feb BEFORE
|
||||
../tests/test.rem(137): Trig = Thursday, 28 February, 1991
|
||||
REM 28 Feb SKIP MSG 28 Feb SKIP
|
||||
../tests/test.rem(138): Trig = Thursday, 28 February, 1991
|
||||
REM 28 Feb AFTER MSG 28 Feb AFTER
|
||||
../tests/test.rem(139): Trig = Thursday, 28 February, 1991
|
||||
|
||||
POP-OMIT-CONTEXT
|
||||
REM 1 Mar -1 MSG 1 mar -1 (28feb91 omitted)
|
||||
../tests/test.rem(139): Trig = Wednesday, 27 February, 1991
|
||||
../tests/test.rem(142): Trig = Wednesday, 27 February, 1991
|
||||
REM 1 Mar --1 MSG 1 mar --1 (28Feb91 omitted)
|
||||
../tests/test.rem(140): Trig = Thursday, 28 February, 1991
|
||||
../tests/test.rem(143): Trig = Thursday, 28 February, 1991
|
||||
REM 28 Feb BEFORE MSG 28 Feb BEFORE (28Feb91 omitted)
|
||||
../tests/test.rem(141): Trig = Wednesday, 27 February, 1991
|
||||
../tests/test.rem(144): Trig = Wednesday, 27 February, 1991
|
||||
REM 28 Feb SKIP MSG 28 Feb SKIP (28Feb91 omitted)
|
||||
../tests/test.rem(142): Trig = Friday, 28 February, 1992
|
||||
../tests/test.rem(145): Trig = Friday, 28 February, 1992
|
||||
REM 28 Feb AFTER MSG 28 Feb AFTER (28Feb91 omitted)
|
||||
../tests/test.rem(143): Trig = Friday, 1 March, 1991
|
||||
../tests/test.rem(146): Trig = Friday, 1 March, 1991
|
||||
|
||||
|
||||
REM 13 March 1991 *1 UNTIL 19 March 1991 MSG 13-19 Mar 91
|
||||
../tests/test.rem(146): Trig = Wednesday, 13 March, 1991
|
||||
../tests/test.rem(149): Trig = Wednesday, 13 March, 1991
|
||||
|
||||
# Test BACK
|
||||
CLEAR-OMIT-CONTEXT
|
||||
REM 18 Feb 1991 +1 MSG 18 Feb 1991 +1
|
||||
../tests/test.rem(150): Trig = Monday, 18 February, 1991
|
||||
../tests/test.rem(153): Trig = Monday, 18 February, 1991
|
||||
|
||||
OMIT 17 Feb 1991
|
||||
REM 18 Feb 1991 +1 MSG 18 Feb 1991 +1 (17Feb91 omitted)
|
||||
../tests/test.rem(153): Trig = Monday, 18 February, 1991
|
||||
../tests/test.rem(156): Trig = Monday, 18 February, 1991
|
||||
18 Feb 1991 +1 (17Feb91 omitted)
|
||||
|
||||
REM 18 Feb 1991 ++1 MSG 18 Feb 1991 ++1 (17Feb91 omitted)
|
||||
../tests/test.rem(154): Trig = Monday, 18 February, 1991
|
||||
../tests/test.rem(157): Trig = Monday, 18 February, 1991
|
||||
|
||||
CLEAR-OMIT-CONTEXT
|
||||
# Test the scanfrom clause
|
||||
REM Fri SATISFY 1
|
||||
../tests/test.rem(158): Trig = Friday, 22 February, 1991
|
||||
../tests/test.rem(161): Trig = Friday, 22 February, 1991
|
||||
OMIT [trigger(trigdate())]
|
||||
trigdate() => 1991-02-22
|
||||
trigger(1991-02-22) => "22 February 1991"
|
||||
REM Fri after MSG 23 Feb 1991
|
||||
../tests/test.rem(160): Trig = Saturday, 23 February, 1991
|
||||
../tests/test.rem(163): Trig = Saturday, 23 February, 1991
|
||||
CLEAR-OMIT-CONTEXT
|
||||
REM Fri SCANFROM [trigger(today()-7)] SATISFY 1
|
||||
today() => 1991-02-16
|
||||
1991-02-16 - 7 => 1991-02-09
|
||||
trigger(1991-02-09) => "9 February 1991"
|
||||
../tests/test.rem(162): Trig = Friday, 15 February, 1991
|
||||
../tests/test.rem(165): Trig = Friday, 15 February, 1991
|
||||
OMIT [trigger(trigdate())]
|
||||
trigdate() => 1991-02-15
|
||||
trigger(1991-02-15) => "15 February 1991"
|
||||
REM Fri after MSG 16 Feb 1991
|
||||
../tests/test.rem(164): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(167): Trig = Saturday, 16 February, 1991
|
||||
16 Feb 1991
|
||||
|
||||
CLEAR-OMIT-CONTEXT
|
||||
@@ -582,7 +586,7 @@ day(1991-03-08) => 8
|
||||
8 % 2 => 0
|
||||
0 || 0 => 0
|
||||
Leaving UserFN _ofunc() => 0
|
||||
../tests/test.rem(169): Trig = Friday, 8 March, 1991
|
||||
../tests/test.rem(172): Trig = Friday, 8 March, 1991
|
||||
REM 8 March OMITFUNC _ofunc -1 MSG OmitFunc Test 2
|
||||
Entering UserFN _ofunc(1991-03-07)
|
||||
x => 1991-03-07
|
||||
@@ -656,31 +660,31 @@ day(1991-02-28) => 28
|
||||
28 % 2 => 0
|
||||
0 || 0 => 0
|
||||
Leaving UserFN _ofunc() => 0
|
||||
../tests/test.rem(170): Trig = Thursday, 28 February, 1991
|
||||
../tests/test.rem(173): Trig = Thursday, 28 February, 1991
|
||||
|
||||
# omitfunc ignores local/global omits
|
||||
fset _ofunc(x) 0
|
||||
OMIT 1 March
|
||||
OMIT 2 March 1991
|
||||
REM 1 March OMIT Sun OMITFUNC _ofunc AFTER MSG Should trigger 1 March
|
||||
../tests/test.rem(176): Warning: OMIT is ignored if you use OMITFUNC
|
||||
../tests/test.rem(179): Warning: OMIT is ignored if you use OMITFUNC
|
||||
Entering UserFN _ofunc(1991-02-15)
|
||||
Leaving UserFN _ofunc() => 0
|
||||
Entering UserFN _ofunc(1991-03-01)
|
||||
Leaving UserFN _ofunc() => 0
|
||||
../tests/test.rem(176): Trig = Friday, 1 March, 1991
|
||||
../tests/test.rem(179): Trig = Friday, 1 March, 1991
|
||||
REM 1 March OMIT Sun AFTER MSG Should trigger 4 March
|
||||
../tests/test.rem(177): Trig = Monday, 4 March, 1991
|
||||
../tests/test.rem(180): Trig = Monday, 4 March, 1991
|
||||
|
||||
# Test shorthand reminders
|
||||
REM 1991-02-28 MSG Feb 28
|
||||
../tests/test.rem(180): Trig = Thursday, 28 February, 1991
|
||||
../tests/test.rem(183): Trig = Thursday, 28 February, 1991
|
||||
REM 1991/02/28@14:45 MSG Feb 28
|
||||
../tests/test.rem(181): Trig = Thursday, 28 February, 1991
|
||||
../tests/test.rem(184): Trig = Thursday, 28 February, 1991
|
||||
REM Wed UNTIL 1991-01-01 MSG Expired
|
||||
../tests/test.rem(182): Expired
|
||||
../tests/test.rem(185): Expired
|
||||
REM Wed SCANFROM 1991-02-26 MSG SCANFROM
|
||||
../tests/test.rem(183): Trig = Wednesday, 27 February, 1991
|
||||
../tests/test.rem(186): Trig = Wednesday, 27 February, 1991
|
||||
|
||||
set a000 abs(1)
|
||||
abs(1) => 1
|
||||
@@ -704,7 +708,7 @@ set a008 coerce("string", 11:44)
|
||||
coerce("string", 11:44) => "11:44"
|
||||
set a009 coerce("int", "badnews")
|
||||
coerce("int", "badnews") => Can't coerce
|
||||
../tests/test.rem(194): Can't coerce
|
||||
../tests/test.rem(197): Can't coerce
|
||||
set a010 coerce("int", "12")
|
||||
coerce("int", "12") => 12
|
||||
set a011 coerce("int", 11:44)
|
||||
@@ -716,7 +720,7 @@ set a013 date(1992, 2, 2)
|
||||
date(1992, 2, 2) => 1992-02-02
|
||||
set a014 date(1993, 2, 29)
|
||||
date(1993, 2, 29) => Bad date specification
|
||||
../tests/test.rem(199): Bad date specification
|
||||
../tests/test.rem(202): Bad date specification
|
||||
set a015 day(today())
|
||||
today() => 1991-02-16
|
||||
day(1991-02-16) => 16
|
||||
@@ -811,15 +815,15 @@ strlen("sadjflkhsldkfhsdlfjhk") => 21
|
||||
set a050 substr(a049, 2)
|
||||
a049 => 21
|
||||
substr(21, 2) => Type mismatch
|
||||
../tests/test.rem(237): Type mismatch
|
||||
../tests/test.rem(240): Type mismatch
|
||||
set a051 substr(a050, 2, 6)
|
||||
a050 => ../tests/test.rem(238): Undefined variable: a050
|
||||
a050 => ../tests/test.rem(241): Undefined variable: a050
|
||||
set a052 time(1+2, 3+4)
|
||||
1 + 2 => 3
|
||||
3 + 4 => 7
|
||||
time(3, 7) => 03:07
|
||||
rem 10 jan 1992 AT 11:22 CAL
|
||||
../tests/test.rem(240): Trig = Friday, 10 January, 1992
|
||||
../tests/test.rem(243): Trig = Friday, 10 January, 1992
|
||||
set a053 trigdate()
|
||||
trigdate() => 1992-01-10
|
||||
set a054 trigtime()
|
||||
@@ -911,31 +915,31 @@ y => 11:33
|
||||
x => "foo"
|
||||
y => 11:33
|
||||
"foo" * 11:33 => Type mismatch
|
||||
../tests/test.rem(263): `*': Type mismatch
|
||||
../tests/test.rem(266): `*': Type mismatch
|
||||
Leaving UserFN h() => Type mismatch
|
||||
set a074 dosubst("%a %b %c %d %e %f %g %h", '1992/5/5')
|
||||
dosubst("%a %b %c %d %e %f %g %h", 1992-05-05) => "on Tuesday, 5 May, 1992 in 444 days' tim"...
|
||||
msg [a074]%
|
||||
../tests/test.rem(265): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(268): Trig = Saturday, 16 February, 1991
|
||||
a074 => "on Tuesday, 5 May, 1992 in 444 days' tim"...
|
||||
on Tuesday, 5 May, 1992 in 444 days' time on Tuesday 5 on 05-05-1992 on 05-05-1992 on Tuesday, 5 May on 05-05
|
||||
set a075 dosubst("%i %j %k %l %m %n %o %p", '1992/5/5')
|
||||
dosubst("%i %j %k %l %m %n %o %p", 1992-05-05) => "on 05-05 on Tuesday, May 5th, 1992 on Tu"...
|
||||
msg [a075]%
|
||||
../tests/test.rem(267): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(270): Trig = Saturday, 16 February, 1991
|
||||
a075 => "on 05-05 on Tuesday, May 5th, 1992 on Tu"...
|
||||
on 05-05 on Tuesday, May 5th, 1992 on Tuesday, May 5th on 1992-05-05 May 5 s
|
||||
set a076 dosubst("%q %r %s %t %u %v %w %x", '1992/5/5')
|
||||
dosubst("%q %r %s %t %u %v %w %x", 1992-05-05) => "s' 05 th 05 on Tuesday, 5th May, 1992 on"...
|
||||
msg [a076]%
|
||||
../tests/test.rem(269): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(272): Trig = Saturday, 16 February, 1991
|
||||
a076 => "s' 05 th 05 on Tuesday, 5th May, 1992 on"...
|
||||
s' 05 th 05 on Tuesday, 5th May, 1992 on Tuesday, 5th May Tuesday 444
|
||||
set a077 dosubst("%y %z", '1992/5/5')
|
||||
dosubst("%y %z", 1992-05-05) => "1992 92
|
||||
"
|
||||
msg [a077]%
|
||||
../tests/test.rem(271): Trig = Saturday, 16 February, 1991
|
||||
../tests/test.rem(274): Trig = Saturday, 16 February, 1991
|
||||
a077 => "1992 92
|
||||
"
|
||||
1992 92
|
||||
@@ -2190,6 +2194,25 @@ IFTRIG 1991
|
||||
REM MSG wookie
|
||||
ENDIF
|
||||
|
||||
# More complex conditional statements
|
||||
IF 1
|
||||
#!P: The next IF evaluated false...
|
||||
#!P: REM statements in IF block not checked for purging.
|
||||
IF 0
|
||||
REM 1991 MSG wookie
|
||||
ELSE
|
||||
#!P: Expired: REM 1991 MSG wookie
|
||||
ENDIF
|
||||
#!P: The previous IF evaluated true.
|
||||
#!P: REM statements in ELSE block not checked for purging
|
||||
ELSE
|
||||
IF 1
|
||||
REM 1991 MSG wookie
|
||||
ELSE
|
||||
REM 1991 MSG wookie
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
#!P: Next line has expired, but contains expression... please verify
|
||||
#!P: Expired: REM [1990+1] MSG old-with-constant-expression
|
||||
|
||||
@@ -2218,6 +2241,20 @@ OMIT 24 Dec
|
||||
#!P: Expired: OMIT 1 Jan 1992 MSG woaaahah... expired
|
||||
OMIT 2 Jan 1992
|
||||
|
||||
# Complicated expressions
|
||||
SET a 3
|
||||
FSET const(x) x+3
|
||||
FSET nonconst(x) x+a
|
||||
|
||||
#!P: Next line has expired, but contains expression... please verify
|
||||
#!P: Expired: REM [const(5)] Jan 1992 MSG expired... should be commented out
|
||||
#!P: Next line may have expired, but contains non-constant expression
|
||||
REM [const(a)] Jan 1992 MSG nonconstant expression
|
||||
#!P: Next line may have expired, but contains non-constant expression
|
||||
REM [nonconst(5)] Jan 1992 MSG nonconstant expression
|
||||
#!P: Next line may have expired, but contains non-constant expression
|
||||
REM [value("a")] Jan 1992 MSG nonconstant expression
|
||||
|
||||
#!P: The next IF evaluated false...
|
||||
#!P: REM statements in IF block not checked for purging.
|
||||
IF 0
|
||||
|
||||
@@ -45,6 +45,9 @@ fset _i(x,y,z,a) trigger(hebdate(x,y,z,a))
|
||||
[_i(29, "Adar A", today(), 5755)] MSG Leap
|
||||
[_i(29, "Adar A", today(), 5756)] MSG Illegal
|
||||
|
||||
# This causes a parse error on version 03.01.01
|
||||
REM 1990-01-01 SATISFY 1
|
||||
|
||||
# Test each possible case of the basic reminders.
|
||||
|
||||
REM MSG Every Day
|
||||
|
||||
Reference in New Issue
Block a user