Allow OMIT ... THROUGH ... to be re-parsed as a REM command.

This commit is contained in:
David F. Skoll
2010-08-31 13:51:13 -04:00
parent 1d13d0ee07
commit 21d4faa26f
3 changed files with 16 additions and 6 deletions

View File

@@ -1366,9 +1366,12 @@ are equivalent:
OMIT 3 Jan 2011 THROUGH 5 Jan 2011
.fi
.PP
Note that if you use the \fBTHROUGH\fR keyword, then you can't add a
\fBMSG\fR keyword to make the \fBOMIT\fR command do double-duty as a
\fBREM\fR command.
You can make a THROUGH \fBOMIT\fR do double-duty as a \fBREM\fR command:
.PP
.nf
OMIT 6 Sep 2010 THROUGH 10 Sep 2010 MSG Vacation
.fi
.PP
You can debug your global OMITs with the following command:
.PP

View File

@@ -378,7 +378,7 @@ int DoOmit(ParsePtr p)
NumFullOmits++;
}
}
if (tok.type == T_RemType || tok.type == T_Priority) return E_PARSE_AS_REM;
if (tok.type == T_Tag || tok.type == T_Duration || tok.type == T_RemType || tok.type == T_Priority) return E_PARSE_AS_REM;
return OK;
}
@@ -428,6 +428,10 @@ DoThroughOmit(ParsePtr p, int ystart, int mstart, int dstart)
case T_Empty:
case T_Comment:
case T_RemType:
case T_Priority:
case T_Tag:
case T_Duration:
DBufFree(&buf);
parsing = 0;
break;
@@ -463,6 +467,7 @@ DoThroughOmit(ParsePtr p, int ystart, int mstart, int dstart)
NumFullOmits++;
}
}
if (tok.type == T_Tag || tok.type == T_Duration || tok.type == T_RemType || tok.type == T_Priority) return E_PARSE_AS_REM;
return OK;
}

View File

@@ -1051,9 +1051,9 @@ OMIT December 25 MSG X
../tests/test.rem(286): Trig = Wednesday, 25 December, 1991
# Next should give a parse error
OMIT 26 Dec 2010 THROUGH 27 Dec 2010 MSG This is not legal
../tests/test.rem(288): Unknown token: `MSG' (OMIT)
../tests/test.rem(288): Trig = Sunday, 26 December, 2010
OMIT DUMP
Global Full OMITs (14 of maximum allowed 500):
Global Full OMITs (16 of maximum allowed 500):
1991-03-11
2010-09-03
2010-09-04
@@ -1068,6 +1068,8 @@ Global Full OMITs (14 of maximum allowed 500):
2010-09-13
2010-09-14
2010-09-15
2010-12-26
2010-12-27
Global Partial OMITs (1 of maximum allowed 366):
12-25