Skip to content

Commit 8579970

Browse files
committed
fix: allow multiple spaces between schedule and command, closing #52
1 parent a3dbe22 commit 8579970

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

playground/1.cron

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ PWD = '/my/dir/2'
3737
*/4 * 2/2 1-10/1 * /usr/local/bin/php
3838
*/4 * 2/2 Mon-Fri jan /usr/local/bin/php
3939

40-
1,2 * * * *
41-
40+
1,2 * * * * q
4241

42+
@reboot root /bin/bash echo
43+
@reboot root /bin/bash echo

src/main/kotlin/com/github/xepozz/crontab/language/parser/Crontab.flex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ MONTH_PATTERN = (JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)
6060
([^]|\/\D) { yypushback(1); yybegin(COMMAND); }
6161
}
6262
<COMMAND> {
63-
([^\s][^\n]*) { yybegin(YYINITIAL); return CrontabTypes.CONTENT; }
63+
[^\s][^\n]* { yybegin(YYINITIAL); return CrontabTypes.CONTENT; }
6464
}
6565
<SIMPLE_SYNTAX> {
6666
[^\s]+ { return CrontabTypes.CONTENT; }
6767
{WHITESPACE} { return TokenType.WHITE_SPACE; }
68-
([\s][^]) { yypushback(yylength()); yybegin(COMMAND); }
68+
[\s]+[^] { yypushback(yylength()); yybegin(COMMAND); }
6969
}
7070

7171
{WHITESPACE} { return TokenType.WHITE_SPACE; }

0 commit comments

Comments
 (0)