Add $ParseUntriggered system variable.

This commit is contained in:
Dianne Skoll
2023-07-20 09:21:37 -04:00
parent 15a5d9a876
commit 85b0348fa7
6 changed files with 46 additions and 3 deletions

View File

@@ -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

View File

@@ -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;
}
}
}
}

View File

@@ -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;

View File

@@ -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 },

View File

@@ -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 <b>foo</b>") => "this is > whut foo"
set a htmlstriptags("<img src=\"foo\">")
htmlstriptags("<img src=\"foo\">") => ""
# $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

View File

@@ -881,6 +881,12 @@ set a htmlstriptags("This is <unclosed whut?")
set a htmlstriptags("this is > whut <b>foo</b>")
set a htmlstriptags("<img src=\"foo\">")
# $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