mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-25 02:32:57 +02:00
Compare commits
4 Commits
5b7d4a07ec
...
723aba9b7c
| Author | SHA1 | Date | |
|---|---|---|---|
| 723aba9b7c | |||
| 8a5b88338b | |||
| 7236441e02 | |||
| e4bab0dda4 |
+8
-4
@@ -468,6 +468,14 @@ case-sensitive:
|
||||
The \fB\-\-version\fR option causes \fBRemind\fR to print its version number
|
||||
to standard output and then exit.
|
||||
.TP
|
||||
.B \-\-print-tokens
|
||||
The \fB\-\-print-tokens\fR option causes \fBRemind\fR to print the tokens
|
||||
used by the parser, built-in function names, and system variable names
|
||||
to standard output and then exit. This output is designed to make it easy
|
||||
to create a syntax-highlighting file for various text editors. The output
|
||||
can be modified by hand or by a script into a syntax-highlighting file
|
||||
with relative ease.
|
||||
.TP
|
||||
.B \-\-max-execution-time\fR=\fIn\fR
|
||||
Limit the total execution time (as measured by the wall clock) to
|
||||
\fIn\fR seconds. This is useful if \fBRemind\fR is invoked on
|
||||
@@ -5837,10 +5845,6 @@ after the WEEK keyword.
|
||||
The following tokens can be abbreviated:
|
||||
.TP
|
||||
o
|
||||
\fBREM\fR can be omitted - it is implied if no other valid command
|
||||
is present.
|
||||
.TP
|
||||
o
|
||||
\fBCLEAR-OMIT-CONTEXT\fR --> \fBCLEAR\fR
|
||||
.TP
|
||||
o
|
||||
|
||||
+1
-1
@@ -208,7 +208,7 @@ int DoRem(ParsePtr p)
|
||||
DBufInit(&buf);
|
||||
|
||||
/* Parse the trigger date and time */
|
||||
if ( (r=ParseRem(p, &trig, &tim)) ) {
|
||||
if ( (r=ParseRem(p, &trig, &tim)) != OK ) {
|
||||
FreeTrig(&trig);
|
||||
return r;
|
||||
}
|
||||
|
||||
+10
@@ -4005,3 +4005,13 @@ BuiltinFunc *FindBuiltinFunc(char const *name)
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
print_builtinfunc_tokens(void)
|
||||
{
|
||||
int i;
|
||||
printf("\n# Built-in Functions\n\n");
|
||||
for (i=0; i<NumFuncs; i++) {
|
||||
printf("%s\n", Func[i].name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1067,6 +1067,12 @@ ProcessLongOption(char const *arg)
|
||||
printf("%s\n", VERSION);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
if (!strcmp(arg, "print-tokens")) {
|
||||
print_remind_tokens();
|
||||
print_builtinfunc_tokens();
|
||||
print_sysvar_tokens();
|
||||
exit(0);
|
||||
}
|
||||
if (sscanf(arg, "max-execution-time=%d", &t) == 1) {
|
||||
if (t < 0) {
|
||||
fprintf(ErrFp, "%s: --max-execution-time must be non-negative\n", ArgV[0]);
|
||||
|
||||
@@ -242,3 +242,8 @@ void PutWideChar(wchar_t const wc, DynamicBuffer *output);
|
||||
extern int _private_mul_overflow(int a, int b);
|
||||
extern int _private_add_overflow(int a, int b);
|
||||
extern int _private_sub_overflow(int a, int b);
|
||||
|
||||
/* Utility functions for dumping tokens */
|
||||
void print_sysvar_tokens(void);
|
||||
void print_builtinfunc_tokens(void);
|
||||
void print_remind_tokens(void);
|
||||
|
||||
+47
-7
@@ -39,19 +39,19 @@ while (isdigit(*(string))) { \
|
||||
Token TokArray[] = {
|
||||
/* NAME MINLEN TYPE VALUE */
|
||||
{ "addomit", 7, T_AddOmit, 0 },
|
||||
{ "after", 3, T_Skip, AFTER_SKIP },
|
||||
{ "after", 5, T_Skip, AFTER_SKIP },
|
||||
{ "april", 3, T_Month, 3 },
|
||||
{ "at", 2, T_At, 0 },
|
||||
{ "august", 3, T_Month, 7 },
|
||||
{ "banner", 3, T_Banner, 0 },
|
||||
{ "before", 3, T_Skip, BEFORE_SKIP },
|
||||
{ "before", 6, T_Skip, BEFORE_SKIP },
|
||||
{ "cal", 3, T_RemType, CAL_TYPE },
|
||||
{ "clear-omit-context", 5, T_Clr, 0 },
|
||||
{ "debug", 5, T_Debug, 0 },
|
||||
{ "december", 3, T_Month, 11 },
|
||||
{ "do", 2, T_IncludeR, 0 },
|
||||
{ "dumpvars", 4, T_Dumpvars, 0 },
|
||||
{ "duration", 3, T_Duration, 0 },
|
||||
{ "duration", 8, T_Duration, 0 },
|
||||
{ "else", 4, T_Else, 0 },
|
||||
{ "endif", 5, T_EndIf, 0 },
|
||||
{ "errmsg", 6, T_ErrMsg, 0 },
|
||||
@@ -85,9 +85,9 @@ Token TokArray[] = {
|
||||
{ "noqueue", 7, T_NoQueue, 0 },
|
||||
{ "november", 3, T_Month, 10 },
|
||||
{ "october", 3, T_Month, 9 },
|
||||
{ "omit", 3, T_Omit, 0 },
|
||||
{ "omit", 4, T_Omit, 0 },
|
||||
{ "omitfunc", 8, T_OmitFunc, 0 },
|
||||
{ "once", 3, T_Once, 0 },
|
||||
{ "once", 4, T_Once, 0 },
|
||||
{ "pop-omit-context", 3, T_Pop, 0 },
|
||||
{ "preserve", 8, T_Preserve, 0 },
|
||||
{ "priority", 8, T_Priority, 0 },
|
||||
@@ -103,7 +103,7 @@ Token TokArray[] = {
|
||||
{ "second", 6, T_Ordinal, 1 },
|
||||
{ "september", 3, T_Month, 8 },
|
||||
{ "set", 3, T_Set, 0 },
|
||||
{ "skip", 3, T_Skip, SKIP_SKIP },
|
||||
{ "skip", 4, T_Skip, SKIP_SKIP },
|
||||
{ "special", 7, T_RemType, PASSTHRU_TYPE },
|
||||
{ "sunday", 3, T_WkDay, 6 },
|
||||
{ "tag", 3, T_Tag, 0 },
|
||||
@@ -112,7 +112,7 @@ Token TokArray[] = {
|
||||
{ "thursday", 3, T_WkDay, 3 },
|
||||
{ "tuesday", 3, T_WkDay, 1 },
|
||||
{ "unset", 5, T_UnSet, 0 },
|
||||
{ "until", 3, T_Until, 0 },
|
||||
{ "until", 5, T_Until, 0 },
|
||||
{ "warn", 4, T_Warn, 0 },
|
||||
{ "wednesday", 3, T_WkDay, 2 }
|
||||
};
|
||||
@@ -368,3 +368,43 @@ static int TokStrCmp(Token const *t, char const *s)
|
||||
if (!*s || (*s == ',' && !*(s+1))) return 0;
|
||||
return (*tk - tolower(*s));
|
||||
}
|
||||
|
||||
static void
|
||||
print_token(Token *tok)
|
||||
{
|
||||
if (tok->MinLen < (int) strlen(tok->name)) {
|
||||
printf("%.*s\n", tok->MinLen, tok->name);
|
||||
}
|
||||
printf("%s\n", tok->name);
|
||||
}
|
||||
|
||||
void
|
||||
print_remind_tokens(void)
|
||||
{
|
||||
int i;
|
||||
Token *tok;
|
||||
int num = (int) (sizeof(TokArray) / sizeof(TokArray[0]));
|
||||
printf("# Remind Tokens\n\n");
|
||||
for (i=0; i<num; i++) {
|
||||
tok = &TokArray[i];
|
||||
if (tok->type != T_Month && tok->type != T_WkDay) {
|
||||
print_token(tok);
|
||||
}
|
||||
}
|
||||
|
||||
printf("\n# Month Names\n\n");
|
||||
for (i=0; i<num; i++) {
|
||||
tok = &TokArray[i];
|
||||
if (tok->type == T_Month) {
|
||||
print_token(tok);
|
||||
}
|
||||
}
|
||||
|
||||
printf("\n# Weekdays\n\n");
|
||||
for (i=0; i<num; i++) {
|
||||
tok = &TokArray[i];
|
||||
if (tok->type == T_WkDay) {
|
||||
print_token(tok);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1198,3 +1198,12 @@ set_components_from_lat_and_long(void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
print_sysvar_tokens(void)
|
||||
{
|
||||
int i;
|
||||
printf("\n# System Variables\n\n");
|
||||
for (i=0; i< (int) NUMSYSVARS; i++) {
|
||||
printf("$%s\n", SysVarArr[i].name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -597,6 +597,9 @@ if test $? = 0 ; then
|
||||
done
|
||||
fi
|
||||
|
||||
# Test --print-tokens long option
|
||||
../src/remind --print-tokens < /dev/null >> ../tests/test.out 2>&1
|
||||
|
||||
cmp -s ../tests/test.out ../tests/test.cmp
|
||||
if [ "$?" = "0" ]; then
|
||||
echo "Remind: Acceptance test PASSED"
|
||||
|
||||
+341
@@ -13235,3 +13235,344 @@ No reminders.
|
||||
| | | | | | | |
|
||||
+----------+----------+----------+----------+----------+----------+----------+
|
||||
|
||||
# Remind Tokens
|
||||
|
||||
addomit
|
||||
after
|
||||
at
|
||||
ban
|
||||
banner
|
||||
before
|
||||
cal
|
||||
clear
|
||||
clear-omit-context
|
||||
debug
|
||||
do
|
||||
dump
|
||||
dumpvars
|
||||
duration
|
||||
else
|
||||
endif
|
||||
errmsg
|
||||
exit
|
||||
expr
|
||||
first
|
||||
flush
|
||||
fourth
|
||||
from
|
||||
fset
|
||||
funset
|
||||
if
|
||||
iftrig
|
||||
in
|
||||
inc
|
||||
include
|
||||
includecmd
|
||||
last
|
||||
lastday
|
||||
lastworkday
|
||||
maybe
|
||||
maybe-uncomputable
|
||||
msf
|
||||
msg
|
||||
noqueue
|
||||
omit
|
||||
omitfunc
|
||||
once
|
||||
pop
|
||||
pop-omit-context
|
||||
preserve
|
||||
priority
|
||||
ps
|
||||
psfile
|
||||
push
|
||||
push-omit-context
|
||||
rem
|
||||
run
|
||||
satisfy
|
||||
scan
|
||||
scanfrom
|
||||
sched
|
||||
second
|
||||
set
|
||||
skip
|
||||
special
|
||||
tag
|
||||
third
|
||||
through
|
||||
unset
|
||||
until
|
||||
warn
|
||||
|
||||
# Month Names
|
||||
|
||||
apr
|
||||
april
|
||||
aug
|
||||
august
|
||||
dec
|
||||
december
|
||||
feb
|
||||
february
|
||||
jan
|
||||
january
|
||||
jul
|
||||
july
|
||||
jun
|
||||
june
|
||||
mar
|
||||
march
|
||||
may
|
||||
nov
|
||||
november
|
||||
oct
|
||||
october
|
||||
sep
|
||||
september
|
||||
|
||||
# Weekdays
|
||||
|
||||
fri
|
||||
friday
|
||||
mon
|
||||
monday
|
||||
sat
|
||||
saturday
|
||||
sun
|
||||
sunday
|
||||
thu
|
||||
thursday
|
||||
tue
|
||||
tuesday
|
||||
wed
|
||||
wednesday
|
||||
|
||||
# Built-in Functions
|
||||
|
||||
abs
|
||||
access
|
||||
adawn
|
||||
adusk
|
||||
ampm
|
||||
ansicolor
|
||||
args
|
||||
asc
|
||||
baseyr
|
||||
char
|
||||
choose
|
||||
coerce
|
||||
columns
|
||||
current
|
||||
date
|
||||
datepart
|
||||
datetime
|
||||
dawn
|
||||
day
|
||||
daysinmon
|
||||
defined
|
||||
dosubst
|
||||
dusk
|
||||
easterdate
|
||||
evaltrig
|
||||
filedate
|
||||
filedatetime
|
||||
filedir
|
||||
filename
|
||||
getenv
|
||||
hebdate
|
||||
hebday
|
||||
hebmon
|
||||
hebyear
|
||||
hour
|
||||
htmlescape
|
||||
htmlstriptags
|
||||
iif
|
||||
index
|
||||
isany
|
||||
isdst
|
||||
isleap
|
||||
isomitted
|
||||
language
|
||||
localtoutc
|
||||
lower
|
||||
max
|
||||
min
|
||||
minsfromutc
|
||||
minute
|
||||
mon
|
||||
monnum
|
||||
moondate
|
||||
moondatetime
|
||||
moonphase
|
||||
moontime
|
||||
multitrig
|
||||
ndawn
|
||||
ndusk
|
||||
nonomitted
|
||||
now
|
||||
ord
|
||||
orthodoxeaster
|
||||
ostype
|
||||
pad
|
||||
plural
|
||||
psmoon
|
||||
psshade
|
||||
realcurrent
|
||||
realnow
|
||||
realtoday
|
||||
rows
|
||||
sgn
|
||||
shell
|
||||
shellescape
|
||||
slide
|
||||
soleq
|
||||
stdout
|
||||
strlen
|
||||
substr
|
||||
sunrise
|
||||
sunset
|
||||
time
|
||||
timepart
|
||||
timezone
|
||||
today
|
||||
trig
|
||||
trigback
|
||||
trigdate
|
||||
trigdatetime
|
||||
trigdelta
|
||||
trigduration
|
||||
trigeventduration
|
||||
trigeventstart
|
||||
trigfrom
|
||||
trigger
|
||||
trigpriority
|
||||
trigrep
|
||||
trigscanfrom
|
||||
trigtags
|
||||
trigtime
|
||||
trigtimedelta
|
||||
trigtimerep
|
||||
triguntil
|
||||
trigvalid
|
||||
typeof
|
||||
tzconvert
|
||||
upper
|
||||
utctolocal
|
||||
value
|
||||
version
|
||||
weekno
|
||||
wkday
|
||||
wkdaynum
|
||||
year
|
||||
|
||||
# System Variables
|
||||
|
||||
$AddBlankLines
|
||||
$Ago
|
||||
$Am
|
||||
$And
|
||||
$April
|
||||
$At
|
||||
$August
|
||||
$CalcUTC
|
||||
$CalMode
|
||||
$Daemon
|
||||
$DateSep
|
||||
$DateTimeSep
|
||||
$December
|
||||
$DefaultColor
|
||||
$DefaultPrio
|
||||
$DefaultTDelta
|
||||
$DeltaOverride
|
||||
$DontFork
|
||||
$DontQueue
|
||||
$DontTrigAts
|
||||
$EndSent
|
||||
$EndSentIg
|
||||
$ExpressionTimeLimit
|
||||
$February
|
||||
$FirstIndent
|
||||
$FoldYear
|
||||
$FormWidth
|
||||
$Friday
|
||||
$Fromnow
|
||||
$Hour
|
||||
$Hplu
|
||||
$HushMode
|
||||
$IgnoreOnce
|
||||
$InfDelta
|
||||
$IntMax
|
||||
$IntMin
|
||||
$Is
|
||||
$January
|
||||
$July
|
||||
$June
|
||||
$LatDeg
|
||||
$Latitude
|
||||
$LatMin
|
||||
$LatSec
|
||||
$Location
|
||||
$LongDeg
|
||||
$Longitude
|
||||
$LongMin
|
||||
$LongSec
|
||||
$March
|
||||
$MaxFullOmits
|
||||
$MaxLateMinutes
|
||||
$MaxPartialOmits
|
||||
$MaxSatIter
|
||||
$MaxStringLen
|
||||
$May
|
||||
$MinsFromUTC
|
||||
$Minute
|
||||
$Monday
|
||||
$Mplu
|
||||
$NextMode
|
||||
$November
|
||||
$Now
|
||||
$NumFullOmits
|
||||
$NumPartialOmits
|
||||
$NumQueued
|
||||
$NumTrig
|
||||
$October
|
||||
$On
|
||||
$OnceFile
|
||||
$ParseUntriggered
|
||||
$Pm
|
||||
$PrefixLineNo
|
||||
$PSCal
|
||||
$RunOff
|
||||
$Saturday
|
||||
$September
|
||||
$SimpleCal
|
||||
$SortByDate
|
||||
$SortByPrio
|
||||
$SortByTime
|
||||
$SubsIndent
|
||||
$Sunday
|
||||
$SuppressLRM
|
||||
$SysInclude
|
||||
$T
|
||||
$Td
|
||||
$TerminalBackground
|
||||
$Thursday
|
||||
$TimeSep
|
||||
$Tm
|
||||
$Today
|
||||
$Tomorrow
|
||||
$Tt
|
||||
$Tuesday
|
||||
$Tw
|
||||
$Ty
|
||||
$U
|
||||
$Ud
|
||||
$Um
|
||||
$UntimedFirst
|
||||
$Use256Colors
|
||||
$UseBGVTColors
|
||||
$UseTrueColors
|
||||
$UseVTColors
|
||||
$Uw
|
||||
$Uy
|
||||
$Was
|
||||
$Wednesday
|
||||
|
||||
Reference in New Issue
Block a user