Allow literal dates and datetimes in REM and OMIT statements.

This lets us avoid cluttering up files with [trigger(expr)]; we can
use [expr] directly.
This commit is contained in:
David F. Skoll
2009-05-09 16:41:15 -04:00
parent b58ed62000
commit 516c4e2c39
4 changed files with 56 additions and 2 deletions
+18
View File
@@ -256,12 +256,30 @@ void FindToken(char const *s, Token *tok)
void FindNumericToken(char const *s, Token *t)
{
int mult = 1, hour, min;
char const *s_orig = s;
t->type = T_Illegal;
t->val = 0;
if (isdigit(*s)) {
PARSENUM(t->val, s);
/* If we hit a '-' or a '/', we may have a date or a datetime */
if (*s == '-' || *s == '/') {
char const *p = s_orig;
int jul, tim;
if (ParseLiteralDate(&p, &jul, &tim) == OK) {
if (*p) return;
if (tim == NO_TIME) {
t->type = T_Date;
t->val = jul;
return;
}
t->type = T_DateTime;
t->val = MINUTES_PER_DAY * jul + tim;
}
return;
}
/* If we hit a comma, swallow it. This allows stuff
like Jan 6, 1998 */
if (*s == ',') {