Skip to content

Commit 9cd8aff

Browse files
committed
feat: count newlines
1 parent 507cbbc commit 9cd8aff

4 files changed

Lines changed: 81 additions & 76 deletions

File tree

src/main/gen/com/github/xepozz/crontab/language/parser/CrontabLexer.java

Lines changed: 75 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -75,29 +75,29 @@ private static int zzUnpackcmap_top(String packed, int offset, int [] result) {
7575
private static final int [] ZZ_CMAP_BLOCKS = zzUnpackcmap_blocks();
7676

7777
private static final String ZZ_CMAP_BLOCKS_PACKED_0 =
78-
"\11\0\1\1\1\2\2\3\1\4\22\0\1\1\1\0"+
79-
"\1\5\1\6\3\0\1\7\2\0\1\10\1\0\1\11"+
80-
"\1\12\1\0\1\13\12\14\3\0\1\15\2\0\1\16"+
81-
"\1\17\1\20\1\21\1\22\1\23\1\24\1\25\1\26"+
78+
"\11\0\1\1\1\2\1\3\1\1\1\4\22\0\1\1"+
79+
"\1\0\1\5\1\6\3\0\1\7\2\0\1\10\1\0"+
80+
"\1\11\1\12\1\0\1\13\12\14\3\0\1\15\2\0"+
81+
"\1\16\1\17\1\20\1\21\1\22\1\23\1\24\1\25"+
82+
"\1\26\1\27\1\30\1\31\1\32\1\33\1\34\1\35"+
83+
"\1\36\1\31\1\37\1\40\1\41\1\42\1\43\1\44"+
84+
"\1\31\1\45\1\31\1\0\1\46\2\0\1\47\1\0"+
85+
"\1\17\1\20\1\21\1\22\1\23\1\24\1\25\1\50"+
8286
"\1\27\1\30\1\31\1\32\1\33\1\34\1\35\1\36"+
8387
"\1\31\1\37\1\40\1\41\1\42\1\43\1\44\1\31"+
84-
"\1\45\1\31\1\0\1\46\2\0\1\47\1\0\1\17"+
85-
"\1\20\1\21\1\22\1\23\1\24\1\25\1\26\1\27"+
86-
"\1\30\1\31\1\32\1\33\1\34\1\35\1\36\1\31"+
87-
"\1\37\1\40\1\41\1\42\1\43\1\44\1\31\1\45"+
88-
"\1\31\12\0\1\3\32\0\1\3\217\0\2\50\115\0"+
89-
"\1\51\u01e0\0\12\52\206\0\12\52\306\0\12\52\234\0"+
90-
"\12\52\166\0\12\52\140\0\12\52\166\0\12\52\106\0"+
91-
"\12\52\u0116\0\12\52\106\0\12\52\346\0\1\3\u015f\0"+
92-
"\12\52\46\0\12\52\u012c\0\12\52\200\0\12\52\246\0"+
93-
"\12\52\6\0\12\52\266\0\12\52\126\0\12\52\206\0"+
94-
"\12\52\6\0\12\52\246\0\13\3\35\0\2\3\5\0"+
95-
"\1\3\57\0\1\3\240\0\1\3\u01cf\0\12\52\46\0"+
96-
"\12\52\306\0\12\52\26\0\12\52\126\0\12\52\u0196\0"+
97-
"\12\52\246\0\12\52\206\0\12\52\u012c\0\12\52\200\0"+
98-
"\12\52\74\0\12\52\220\0\12\52\166\0\12\52\146\0"+
99-
"\12\52\206\0\12\52\106\0\12\52\266\0\12\52\u0164\0"+
100-
"\62\52\100\0\12\52\266\0";
88+
"\1\45\1\31\12\0\1\3\32\0\1\3\217\0\2\51"+
89+
"\115\0\1\52\u01e0\0\12\53\206\0\12\53\306\0\12\53"+
90+
"\234\0\12\53\166\0\12\53\140\0\12\53\166\0\12\53"+
91+
"\106\0\12\53\u0116\0\12\53\106\0\12\53\346\0\1\3"+
92+
"\u015f\0\12\53\46\0\12\53\u012c\0\12\53\200\0\12\53"+
93+
"\246\0\12\53\6\0\12\53\266\0\12\53\126\0\12\53"+
94+
"\206\0\12\53\6\0\12\53\246\0\13\3\35\0\2\3"+
95+
"\5\0\1\3\57\0\1\3\240\0\1\3\u01cf\0\12\53"+
96+
"\46\0\12\53\306\0\12\53\26\0\12\53\126\0\12\53"+
97+
"\u0196\0\12\53\246\0\12\53\206\0\12\53\u012c\0\12\53"+
98+
"\200\0\12\53\74\0\12\53\220\0\12\53\166\0\12\53"+
99+
"\146\0\12\53\206\0\12\53\106\0\12\53\266\0\12\53"+
100+
"\u0164\0\62\53\100\0\12\53\266\0";
101101

102102
private static int [] zzUnpackcmap_blocks() {
103103
int [] result = new int[7936];
@@ -125,13 +125,13 @@ private static int zzUnpackcmap_blocks(String packed, int offset, int [] result)
125125

126126
private static final String ZZ_ACTION_PACKED_0 =
127127
"\5\0\1\1\1\2\2\3\1\4\1\5\1\6\1\7"+
128-
"\1\10\1\11\2\12\1\13\1\14\1\15\1\16\1\17"+
129-
"\12\12\3\20\1\21\1\20\1\2\1\3\1\1\22\0"+
130-
"\1\20\1\0\1\20\1\22\1\23\1\24\1\20\2\0"+
131-
"\2\20";
128+
"\2\10\1\11\2\12\1\13\1\14\1\15\1\16\1\17"+
129+
"\12\12\3\20\1\21\2\20\1\2\1\3\1\1\1\20"+
130+
"\22\0\1\20\1\0\1\20\1\22\1\23\1\24\1\20"+
131+
"\2\0\2\20";
132132

133133
private static int [] zzUnpackAction() {
134-
int [] result = new int[69];
134+
int [] result = new int[72];
135135
int offset = 0;
136136
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
137137
return result;
@@ -156,18 +156,18 @@ private static int zzUnpackAction(String packed, int offset, int [] result) {
156156
private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
157157

158158
private static final String ZZ_ROWMAP_PACKED_0 =
159-
"\0\0\0\53\0\126\0\201\0\254\0\327\0\u0102\0\327"+
160-
"\0\u012d\0\u0158\0\327\0\u0183\0\327\0\u01ae\0\u01d9\0\327"+
161-
"\0\u012d\0\327\0\327\0\327\0\u0204\0\u022f\0\u025a\0\u0285"+
162-
"\0\u02b0\0\u02db\0\u0306\0\u0331\0\u035c\0\u0387\0\u03b2\0\u03dd"+
163-
"\0\u0408\0\u0433\0\u045e\0\327\0\u0489\0\u04b4\0\u04df\0\u04df"+
164-
"\0\u050a\0\u0535\0\u0560\0\u058b\0\u05b6\0\u05e1\0\u060c\0\u0637"+
165-
"\0\u0662\0\u068d\0\u06b8\0\u06e3\0\u070e\0\u0739\0\u0764\0\u078f"+
166-
"\0\u07ba\0\u07e5\0\u0810\0\u083b\0\u0866\0\327\0\327\0\327"+
167-
"\0\327\0\u0891\0\u08bc\0\u07e5\0\u083b";
159+
"\0\0\0\54\0\130\0\204\0\260\0\334\0\u0108\0\334"+
160+
"\0\u0134\0\u0160\0\334\0\u018c\0\334\0\u01b8\0\u01e4\0\u0210"+
161+
"\0\334\0\u0134\0\334\0\334\0\334\0\u023c\0\u0268\0\u0294"+
162+
"\0\u02c0\0\u02ec\0\u0318\0\u0344\0\u0370\0\u039c\0\u03c8\0\u03f4"+
163+
"\0\u0420\0\u044c\0\u0478\0\u04a4\0\334\0\u04d0\0\u04fc\0\u0528"+
164+
"\0\u0554\0\u0554\0\u0580\0\u05ac\0\u05d8\0\u0604\0\u0630\0\u065c"+
165+
"\0\u0688\0\u06b4\0\u06e0\0\u070c\0\u0738\0\u0764\0\u0790\0\u07bc"+
166+
"\0\u07e8\0\u0814\0\u0840\0\u086c\0\u0898\0\u08c4\0\u08f0\0\u091c"+
167+
"\0\334\0\334\0\334\0\334\0\u0948\0\u0974\0\u0898\0\u08f0";
168168

169169
private static int [] zzUnpackRowMap() {
170-
int [] result = new int[69];
170+
int [] result = new int[72];
171171
int offset = 0;
172172
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
173173
return result;
@@ -191,40 +191,44 @@ private static int zzUnpackRowMap(String packed, int offset, int [] result) {
191191

192192
private static final String ZZ_TRANS_PACKED_0 =
193193
"\1\6\1\7\1\10\1\6\1\11\1\6\1\12\1\6"+
194-
"\1\13\3\6\1\14\1\6\1\15\27\16\5\6\1\17"+
195-
"\1\7\1\10\1\6\1\11\46\17\1\20\1\7\2\20"+
196-
"\1\21\3\20\1\22\1\23\1\24\1\25\1\26\2\20"+
197-
"\1\27\2\20\1\30\1\20\1\31\3\20\1\32\2\20"+
198-
"\1\33\1\34\1\35\2\20\1\36\1\37\2\20\1\40"+
199-
"\4\20\1\36\1\20\1\41\1\7\1\10\1\6\1\11"+
200-
"\1\42\1\41\1\43\5\41\1\44\35\41\1\45\1\46"+
201-
"\1\47\1\50\1\47\46\45\54\0\1\7\53\0\1\10"+
202-
"\50\0\2\12\1\51\50\12\14\0\1\14\50\0\1\16"+
203-
"\1\0\1\16\2\0\27\16\1\0\1\16\3\0\2\17"+
204-
"\1\0\50\17\14\20\1\0\35\20\15\0\1\26\74\0"+
205-
"\1\52\3\0\1\53\33\0\1\54\52\0\1\55\13\0"+
206-
"\1\56\32\0\1\57\22\0\1\60\27\0\1\61\15\0"+
207-
"\1\62\52\0\1\63\36\0\1\64\50\0\1\65\3\0"+
208-
"\1\66\16\0\1\62\36\0\1\67\13\0\1\70\33\0"+
209-
"\1\71\27\0\1\41\4\0\10\41\1\0\35\41\1\42"+
210-
"\1\72\1\0\2\72\1\41\7\42\1\72\30\42\1\73"+
211-
"\4\42\1\43\1\74\1\0\2\74\2\43\1\41\5\43"+
212-
"\1\74\30\43\1\75\4\43\1\45\4\0\46\45\1\76"+
213-
"\1\7\124\76\6\0\1\12\103\0\1\77\40\0\1\77"+
214-
"\46\0\1\77\51\0\1\77\61\0\1\100\20\0\1\100"+
215-
"\36\0\1\77\50\0\1\77\1\0\1\77\55\0\1\77"+
216-
"\5\0\1\77\41\0\1\100\61\0\1\77\50\0\1\77"+
217-
"\52\0\1\100\47\0\1\77\56\0\1\100\33\0\1\100"+
218-
"\51\0\1\100\30\0\2\72\1\0\2\72\1\101\40\72"+
219-
"\1\102\4\72\1\42\1\72\1\0\2\72\10\42\1\72"+
220-
"\30\42\1\73\4\42\2\74\1\0\4\74\1\101\36\74"+
221-
"\1\103\4\74\1\43\1\74\1\0\2\74\10\43\1\74"+
222-
"\30\43\1\75\4\43\2\72\1\0\2\72\1\104\40\72"+
223-
"\1\102\4\72\2\74\1\0\4\74\1\105\36\74\1\103"+
224-
"\4\74";
194+
"\1\13\3\6\1\14\1\6\1\15\27\16\2\6\1\17"+
195+
"\3\6\1\20\1\7\1\10\1\6\1\11\47\20\1\21"+
196+
"\1\7\2\21\1\22\3\21\1\23\1\24\1\25\1\26"+
197+
"\1\27\2\21\1\30\2\21\1\31\1\21\1\32\3\21"+
198+
"\1\33\2\21\1\34\1\35\1\36\2\21\1\37\1\40"+
199+
"\2\21\1\41\3\21\1\7\1\21\1\37\1\21\1\42"+
200+
"\1\7\1\10\1\6\1\11\1\43\1\42\1\44\5\42"+
201+
"\1\45\32\42\1\46\3\42\1\47\1\50\1\51\1\52"+
202+
"\1\51\43\47\1\53\3\47\55\0\1\7\46\0\1\7"+
203+
"\5\0\1\10\51\0\2\12\1\54\51\12\14\0\1\14"+
204+
"\51\0\1\16\1\0\1\16\2\0\27\16\1\0\2\16"+
205+
"\4\0\1\7\10\0\1\16\1\0\1\16\2\0\27\16"+
206+
"\1\0\1\16\1\17\3\0\2\20\1\0\51\20\14\21"+
207+
"\1\0\36\21\15\0\1\27\75\0\1\55\3\0\1\56"+
208+
"\34\0\1\57\53\0\1\60\13\0\1\61\33\0\1\62"+
209+
"\22\0\1\63\30\0\1\64\15\0\1\65\53\0\1\66"+
210+
"\37\0\1\67\51\0\1\70\3\0\1\71\16\0\1\65"+
211+
"\37\0\1\72\13\0\1\73\5\0\1\72\26\0\1\74"+
212+
"\30\0\1\42\4\0\10\42\1\0\36\42\1\43\1\75"+
213+
"\1\0\2\75\1\42\7\43\1\75\30\43\1\76\5\43"+
214+
"\1\44\1\77\1\0\2\77\2\44\1\42\5\44\1\77"+
215+
"\30\44\1\100\5\44\1\42\1\7\3\0\10\42\1\0"+
216+
"\32\42\1\46\3\42\1\47\4\0\47\47\1\101\1\7"+
217+
"\46\101\1\7\57\101\1\47\1\7\3\0\43\47\1\53"+
218+
"\3\47\6\0\1\12\104\0\1\102\41\0\1\102\47\0"+
219+
"\1\102\52\0\1\102\62\0\1\103\21\0\1\103\36\0"+
220+
"\1\102\51\0\1\102\1\0\1\102\56\0\1\102\5\0"+
221+
"\1\102\42\0\1\103\62\0\1\102\51\0\1\102\53\0"+
222+
"\1\103\50\0\1\102\57\0\1\103\34\0\1\103\52\0"+
223+
"\1\103\31\0\2\75\1\0\2\75\1\104\40\75\1\105"+
224+
"\5\75\1\43\1\75\1\0\2\75\10\43\1\75\30\43"+
225+
"\1\76\5\43\2\77\1\0\4\77\1\104\36\77\1\106"+
226+
"\5\77\1\44\1\77\1\0\2\77\10\44\1\77\30\44"+
227+
"\1\100\5\44\2\75\1\0\2\75\1\107\40\75\1\105"+
228+
"\5\75\2\77\1\0\4\77\1\110\36\77\1\106\5\77";
225229

226230
private static int [] zzUnpacktrans() {
227-
int [] result = new int[2279];
231+
int [] result = new int[2464];
228232
int offset = 0;
229233
offset = zzUnpacktrans(ZZ_TRANS_PACKED_0, offset, result);
230234
return result;
@@ -263,11 +267,11 @@ private static int zzUnpacktrans(String packed, int offset, int [] result) {
263267

264268
private static final String ZZ_ATTRIBUTE_PACKED_0 =
265269
"\5\0\1\11\1\1\1\11\2\1\1\11\1\1\1\11"+
266-
"\2\1\1\11\1\1\3\11\17\1\1\11\4\1\22\0"+
270+
"\3\1\1\11\1\1\3\11\17\1\1\11\6\1\22\0"+
267271
"\1\1\1\0\1\1\4\11\2\0\2\1";
268272

269273
private static int [] zzUnpackAttribute() {
270-
int [] result = new int[69];
274+
int [] result = new int[72];
271275
int offset = 0;
272276
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
273277
return result;
@@ -599,7 +603,7 @@ else if (zzAtEOF) {
599603
// fall through
600604
case 22: break;
601605
case 3:
602-
{ yybegin(YYINITIAL); return TokenType.WHITE_SPACE;
606+
{ yybegin(YYINITIAL); return CrontabTypes.NEWLINE;
603607
}
604608
// fall through
605609
case 23: break;

src/main/gen/com/github/xepozz/crontab/language/parser/CrontabParser.java

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
crontabFile ::= item_*
1919

20-
private item_ ::= (cronExpression | variableDefinition | COMMENT)
20+
private item_ ::= cronExpression | variableDefinition | COMMENT | NEWLINE
2121

22-
cronExpression ::= (SCHEDULE COMMAND)
22+
cronExpression ::= SCHEDULE COMMAND
2323
{
2424
pin=1
2525
implements=["com.intellij.psi.NavigatablePsiElement"]

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
@@ -18,7 +18,7 @@ import com.intellij.psi.TokenType;
1818
SINGLE_COMMENT=#[^\n]*
1919

2020
NUMBER=[0-9]+
21-
WHITESPACE=[ \t]+
21+
WHITESPACE=[ \h\f\t]+
2222
NEWLINE=\r|\n|\r\n
2323
STAR="*"
2424
COMMA=","
@@ -77,7 +77,7 @@ KEYWORD_REBOOT = "reboot"
7777

7878

7979
{WHITESPACE} { return TokenType.WHITE_SPACE; }
80-
{NEWLINE} { yybegin(YYINITIAL); return TokenType.WHITE_SPACE; }
80+
{NEWLINE} { yybegin(YYINITIAL); return CrontabTypes.NEWLINE; }
8181

8282
[^] { return TokenType.BAD_CHARACTER; }
8383
//[^] { throw new Error("Illegal character <"+yytext()+">"); }

0 commit comments

Comments
 (0)