diff --git a/man/remind.1.in b/man/remind.1.in index 10911f08..09cfe478 100644 --- a/man/remind.1.in +++ b/man/remind.1.in @@ -2585,6 +2585,28 @@ by \fBREM\fR commands; triggers in \fBIFTRIG\fR commands do not affect it. .RE .TP +.B $ParseUntriggered +A flag indicating whether or not \fBRemind\fR should fully parse \fBREM\fR +statements that are not triggered. 0 means to skip parsing them and 1 +(the default) means to parse them. +.PP +.RS +For example, if we have the following \fBREM\fR statement: +.PP +.nf + REM 2020-01-01 MSG ["bad_expression" * 2] +.fi +.PP +Then by default, \fBRemind\fR will fully parse the line and issue +a "Type mismatch" error even if the reminder is not triggered. However, +if \fB$ParseUntriggered\fR is set to 0, then \fBRemind\fR will not +issue the error except on 2020-01-01, when the reminder is triggered. +.PP +Setting \fB$ParseUntriggered\fR to 0 may in some cases slightly +improve performance, at the risk of not catching errors until a +reminder is triggered. +.RE +.TP .B $PrefixLineNo (read-only) If non-zero, then the \fB\-l\fR option was supplied on the command line. .TP diff --git a/src/dorem.c b/src/dorem.c index c99a0fee..45dde869 100644 --- a/src/dorem.c +++ b/src/dorem.c @@ -199,9 +199,11 @@ int DoRem(ParsePtr p) } else { /* Parse the rest of the line to catch any potential expression-pasting errors */ - while (ParseChar(p, &r, 0)) { - if (r != 0) { - break; + if (ParseUntriggered) { + while (ParseChar(p, &r, 0)) { + if (r != 0) { + break; + } } } } diff --git a/src/globals.h b/src/globals.h index 19d9bcb3..20d62a23 100644 --- a/src/globals.h +++ b/src/globals.h @@ -79,6 +79,7 @@ EXTERN INIT( int SortByPrio, 0); EXTERN INIT( int UntimedBeforeTimed, 0); EXTERN INIT( int DefaultPrio, NO_PRIORITY); EXTERN INIT( long SysTime, -1L); +EXTERN INIT( int ParseUntriggered, 1); EXTERN char const *InitialFile; EXTERN int FileAccessDate; diff --git a/src/var.c b/src/var.c index eb48ee6b..91df423d 100644 --- a/src/var.c +++ b/src/var.c @@ -839,6 +839,7 @@ static SysVar SysVarArr[] = { {"NumTrig", 0, INT_TYPE, &NumTriggered, 0, 0 }, {"October", 1, STR_TYPE, &DynamicMonthName[9], 0, 0 }, {"On", 1, STR_TYPE, &DynamicOn, 0, 0 }, + {"ParseUntriggered", 1, INT_TYPE, &ParseUntriggered, 0, 1 }, {"Pm", 1, STR_TYPE, &DynamicPm, 0, 0 }, {"PrefixLineNo", 0, INT_TYPE, &DoPrefixLineNo, 0, 0 }, {"PSCal", 0, INT_TYPE, &PsCal, 0, 0 }, diff --git a/tests/test.cmp b/tests/test.cmp index 64589a0b..a8ae5239 100644 --- a/tests/test.cmp +++ b/tests/test.cmp @@ -2803,6 +2803,7 @@ Variable Value $NumTrig 41 $October "October" $On "on" +$ParseUntriggered 1 [0, 1] $Pm "pm" $PrefixLineNo 0 $PSCal 0 @@ -4821,6 +4822,16 @@ htmlstriptags("this is > whut foo") => "this is > whut foo" set a htmlstriptags("") htmlstriptags("") => "" +# $ParseUntriggered +REM 2 Jan 1990 MSG ["bad_expr" * 2] +../tests/test.rem(885): Expired +"bad_expr" * 2 => Type mismatch +../tests/test.rem(885): `*': Type mismatch +SET $ParseUntriggered 0 +REM 2 Jan 1990 MSG ["bad_expr" * 2] +../tests/test.rem(887): Expired +SET $ParseUntriggered 1 + # Don't want Remind to queue reminders EXIT diff --git a/tests/test.rem b/tests/test.rem index 08265ee5..b2365a39 100644 --- a/tests/test.rem +++ b/tests/test.rem @@ -881,6 +881,12 @@ set a htmlstriptags("This is whut foo") set a htmlstriptags("") +# $ParseUntriggered +REM 2 Jan 1990 MSG ["bad_expr" * 2] +SET $ParseUntriggered 0 +REM 2 Jan 1990 MSG ["bad_expr" * 2] +SET $ParseUntriggered 1 + # Don't want Remind to queue reminders EXIT