Skip to content

Commit 6c360a8

Browse files
committed
support variables
1 parent f219110 commit 6c360a8

17 files changed

+414
-79
lines changed

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

Lines changed: 102 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ class CrontabLexer implements FlexLexer {
2020
/** lexical states */
2121
public static final int YYINITIAL = 0;
2222
public static final int EXPRESSION = 2;
23+
public static final int SCHEDULE = 4;
24+
public static final int VARIABLE = 6;
2325

2426
/**
2527
* ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l
@@ -28,7 +30,7 @@ class CrontabLexer implements FlexLexer {
2830
* l is of the form l = 2*k, k a non negative integer
2931
*/
3032
private static final int ZZ_LEXSTATE[] = {
31-
0, 0, 1, 1
33+
0, 0, 1, 1, 2, 2, 3, 3
3234
};
3335

3436
/**
@@ -38,12 +40,13 @@ class CrontabLexer implements FlexLexer {
3840

3941
private static final String ZZ_CMAP_TOP_PACKED_0 =
4042
"\1\0\5\u0100\1\u0200\1\u0300\1\u0100\5\u0400\1\u0500\1\u0600"+
41-
"\1\u0700\6\u0100\1\u0800\1\u0900\1\u0a00\1\u0b00\1\u0c00\1\u0d00"+
42-
"\211\u0100\1\u0600\1\u0100\1\u0e00\1\u0f00\1\u1000\1\u1100\123\u0100"+
43-
"\1\u0900\4\u0100\1\u1200\10\u0100\1\u1300\2\u0100\1\u1400\1\u1500"+
44-
"\1\u1100\1\u0100\1\u0500\1\u0100\1\u1600\1\u1300\1\u0800\3\u0100"+
45-
"\1\u1000\1\u1700\114\u0100\1\u1800\1\u1000\153\u0100\1\u1900\11\u0100"+
46-
"\1\u1a00\1\u1100\6\u0100\1\u1000\u0f16\u0100";
43+
"\1\u0700\5\u0100\1\u0800\1\u0900\1\u0a00\1\u0b00\1\u0c00\1\u0d00"+
44+
"\1\u0e00\3\u0100\1\u0f00\17\u0100\1\u1000\165\u0100\1\u0600\1\u0100"+
45+
"\1\u1100\1\u1200\1\u1300\1\u1400\123\u0100\1\u0a00\4\u0100\1\u1500"+
46+
"\10\u0100\1\u1600\2\u0100\1\u1700\1\u1800\1\u1400\1\u0100\1\u0500"+
47+
"\1\u0100\1\u1900\1\u1600\1\u0900\3\u0100\1\u1300\1\u1a00\114\u0100"+
48+
"\1\u1b00\1\u1300\153\u0100\1\u1c00\11\u0100\1\u1d00\1\u1400\6\u0100"+
49+
"\1\u1300\u0f16\u0100";
4750

4851
private static int [] zzUnpackcmap_top() {
4952
int [] result = new int[4352];
@@ -71,21 +74,25 @@ private static int zzUnpackcmap_top(String packed, int offset, int [] result) {
7174
private static final int [] ZZ_CMAP_BLOCKS = zzUnpackcmap_blocks();
7275

7376
private static final String ZZ_CMAP_BLOCKS_PACKED_0 =
74-
"\11\0\1\1\1\2\2\0\1\3\22\0\1\4\2\0"+
75-
"\1\5\6\0\1\6\1\0\1\7\1\10\1\0\1\11"+
76-
"\12\12\u0226\0\12\13\206\0\12\13\306\0\12\13\234\0"+
77-
"\12\13\166\0\12\13\140\0\12\13\166\0\12\13\106\0"+
78-
"\12\13\u0116\0\12\13\106\0\12\13\u0146\0\12\13\46\0"+
79-
"\12\13\u012c\0\12\13\200\0\12\13\246\0\12\13\6\0"+
80-
"\12\13\266\0\12\13\126\0\12\13\206\0\12\13\6\0"+
81-
"\12\13\u0176\0\12\13\46\0\12\13\306\0\12\13\26\0"+
82-
"\12\13\126\0\12\13\u0196\0\12\13\246\0\12\13\206\0"+
83-
"\12\13\u012c\0\12\13\200\0\12\13\74\0\12\13\220\0"+
84-
"\12\13\166\0\12\13\146\0\12\13\206\0\12\13\106\0"+
85-
"\12\13\266\0\12\13\u0164\0\62\13\100\0\12\13\266\0";
77+
"\11\0\1\1\1\2\2\3\1\4\22\0\1\5\1\0"+
78+
"\1\6\1\7\3\0\1\10\2\0\1\11\1\0\1\12"+
79+
"\1\13\1\0\1\14\12\15\3\0\1\16\3\0\32\17"+
80+
"\1\0\1\20\2\0\1\21\1\0\32\17\12\0\1\3"+
81+
"\32\0\1\3\u01bf\0\12\22\206\0\12\22\306\0\12\22"+
82+
"\234\0\12\22\166\0\12\22\140\0\12\22\166\0\12\22"+
83+
"\106\0\12\22\u0116\0\12\22\106\0\12\22\346\0\1\3"+
84+
"\u015f\0\12\22\46\0\12\22\u012c\0\12\22\200\0\12\22"+
85+
"\246\0\12\22\6\0\12\22\266\0\12\22\126\0\12\22"+
86+
"\206\0\12\22\6\0\12\22\246\0\13\3\35\0\2\3"+
87+
"\5\0\1\3\57\0\1\3\240\0\1\3\u01cf\0\12\22"+
88+
"\46\0\12\22\306\0\12\22\26\0\12\22\126\0\12\22"+
89+
"\u0196\0\12\22\246\0\12\22\206\0\12\22\u012c\0\12\22"+
90+
"\200\0\12\22\74\0\12\22\220\0\12\22\166\0\12\22"+
91+
"\146\0\12\22\206\0\12\22\106\0\12\22\266\0\12\22"+
92+
"\u0164\0\62\22\100\0\12\22\266\0";
8693

8794
private static int [] zzUnpackcmap_blocks() {
88-
int [] result = new int[6912];
95+
int [] result = new int[7680];
8996
int offset = 0;
9097
offset = zzUnpackcmap_blocks(ZZ_CMAP_BLOCKS_PACKED_0, offset, result);
9198
return result;
@@ -109,11 +116,12 @@ private static int zzUnpackcmap_blocks(String packed, int offset, int [] result)
109116
private static final int [] ZZ_ACTION = zzUnpackAction();
110117

111118
private static final String ZZ_ACTION_PACKED_0 =
112-
"\2\0\1\1\1\2\1\3\1\1\1\2\1\4\1\5"+
113-
"\1\6\1\7\1\10\1\11\1\12\1\3";
119+
"\4\0\1\1\1\2\2\3\1\4\1\5\1\6\1\7"+
120+
"\2\10\1\11\1\12\1\13\1\14\1\15\3\16\1\17"+
121+
"\1\0\1\16\1\0\2\16\2\0\2\16";
114122

115123
private static int [] zzUnpackAction() {
116-
int [] result = new int[15];
124+
int [] result = new int[32];
117125
int offset = 0;
118126
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
119127
return result;
@@ -138,11 +146,13 @@ private static int zzUnpackAction(String packed, int offset, int [] result) {
138146
private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
139147

140148
private static final String ZZ_ROWMAP_PACKED_0 =
141-
"\0\0\0\14\0\30\0\44\0\60\0\74\0\110\0\124"+
142-
"\0\60\0\60\0\60\0\60\0\140\0\60\0\154";
149+
"\0\0\0\23\0\46\0\71\0\114\0\137\0\114\0\162"+
150+
"\0\205\0\114\0\230\0\253\0\276\0\321\0\114\0\114"+
151+
"\0\114\0\114\0\344\0\367\0\u010a\0\u011d\0\114\0\u0130"+
152+
"\0\u0143\0\u0156\0\u0169\0\114\0\u017c\0\u018f\0\u0130\0\u0156";
143153

144154
private static int [] zzUnpackRowMap() {
145-
int [] result = new int[15];
155+
int [] result = new int[32];
146156
int offset = 0;
147157
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
148158
return result;
@@ -165,15 +175,28 @@ private static int zzUnpackRowMap(String packed, int offset, int [] result) {
165175
private static final int [] ZZ_TRANS = zzUnpacktrans();
166176

167177
private static final String ZZ_TRANS_PACKED_0 =
168-
"\1\3\1\4\1\5\1\6\1\7\1\10\1\11\1\12"+
169-
"\1\13\1\14\1\15\2\16\1\7\1\5\1\17\1\7"+
170-
"\7\16\2\3\1\0\12\3\1\4\1\0\1\3\1\4"+
171-
"\7\3\14\0\2\3\1\5\11\3\1\0\1\7\2\0"+
172-
"\1\7\7\0\2\10\1\0\11\10\12\0\1\15\3\0"+
173-
"\1\5\11\0";
178+
"\1\5\1\6\1\7\1\5\1\10\1\6\1\5\1\11"+
179+
"\1\5\1\12\3\5\1\13\1\5\1\14\4\5\1\6"+
180+
"\1\7\1\5\1\10\1\6\15\5\2\15\1\7\1\15"+
181+
"\1\16\1\6\3\15\1\17\1\20\1\21\1\22\1\23"+
182+
"\4\15\1\5\1\24\1\6\1\7\1\5\1\10\1\6"+
183+
"\1\25\1\24\1\26\5\24\1\27\4\24\24\0\1\6"+
184+
"\3\0\1\6\17\0\1\7\20\0\2\11\1\0\20\11"+
185+
"\15\0\1\13\20\0\1\14\1\0\1\14\1\0\1\14"+
186+
"\1\0\1\14\1\0\2\15\1\0\22\15\1\7\20\15"+
187+
"\15\0\1\23\5\0\1\24\5\0\10\24\1\0\4\24"+
188+
"\1\25\1\30\1\0\3\30\1\24\7\25\1\30\1\25"+
189+
"\1\31\2\25\1\26\1\32\1\0\3\32\2\26\1\24"+
190+
"\5\26\1\32\1\26\1\33\2\26\2\30\1\0\3\30"+
191+
"\1\34\11\30\1\35\2\30\1\25\1\30\1\0\3\30"+
192+
"\10\25\1\30\1\25\1\31\2\25\2\32\1\0\5\32"+
193+
"\1\34\7\32\1\36\2\32\1\26\1\32\1\0\3\32"+
194+
"\10\26\1\32\1\26\1\33\2\26\2\30\1\0\3\30"+
195+
"\1\37\11\30\1\35\2\30\2\32\1\0\5\32\1\40"+
196+
"\7\32\1\36\2\32";
174197

175198
private static int [] zzUnpacktrans() {
176-
int [] result = new int[120];
199+
int [] result = new int[418];
177200
int offset = 0;
178201
offset = zzUnpacktrans(ZZ_TRANS_PACKED_0, offset, result);
179202
return result;
@@ -211,10 +234,12 @@ private static int zzUnpacktrans(String packed, int offset, int [] result) {
211234
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
212235

213236
private static final String ZZ_ATTRIBUTE_PACKED_0 =
214-
"\2\0\2\1\1\11\3\1\4\11\1\1\1\11\1\1";
237+
"\4\0\1\11\1\1\1\11\2\1\1\11\4\1\4\11"+
238+
"\4\1\1\11\1\0\1\1\1\0\1\1\1\11\2\0"+
239+
"\2\1";
215240

216241
private static int [] zzUnpackAttribute() {
217-
int [] result = new int[15];
242+
int [] result = new int[32];
218243
int offset = 0;
219244
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
220245
return result;
@@ -536,55 +561,80 @@ else if (zzAtEOF) {
536561
else {
537562
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
538563
case 1:
539-
{ return CrontabTypes.CONTENT;
564+
{ return TokenType.BAD_CHARACTER;
540565
}
541566
// fall through
542-
case 11: break;
567+
case 16: break;
543568
case 2:
544569
{ return TokenType.WHITE_SPACE;
545570
}
546571
// fall through
547-
case 12: break;
572+
case 17: break;
548573
case 3:
549574
{ yybegin(YYINITIAL); return CrontabTypes.NEWLINE;
550575
}
551576
// fall through
552-
case 13: break;
577+
case 18: break;
553578
case 4:
554579
{ return CrontabTypes.COMMENT;
555580
}
556581
// fall through
557-
case 14: break;
582+
case 19: break;
558583
case 5:
559-
{ return CrontabTypes.STAR;
584+
{ yybegin(SCHEDULE); return CrontabTypes.STAR;
560585
}
561586
// fall through
562-
case 15: break;
587+
case 20: break;
563588
case 6:
564-
{ return CrontabTypes.COMMA;
589+
{ yybegin(SCHEDULE); return CrontabTypes.NUMBER;
565590
}
566591
// fall through
567-
case 16: break;
592+
case 21: break;
568593
case 7:
569-
{ return CrontabTypes.HYPHEN;
594+
{ yybegin(VARIABLE); return CrontabTypes.IDENTIFIER;
570595
}
571596
// fall through
572-
case 17: break;
597+
case 22: break;
573598
case 8:
574-
{ return CrontabTypes.SLASH;
599+
{ yybegin(YYINITIAL); return CrontabTypes.CONTENT;
575600
}
576601
// fall through
577-
case 18: break;
602+
case 23: break;
578603
case 9:
579-
{ return CrontabTypes.NUMBER;
604+
{ return CrontabTypes.STAR;
580605
}
581606
// fall through
582-
case 19: break;
607+
case 24: break;
583608
case 10:
584-
{ throw new Error("Illegal character <"+yytext()+">");
609+
{ return CrontabTypes.COMMA;
585610
}
586611
// fall through
587-
case 20: break;
612+
case 25: break;
613+
case 11:
614+
{ return CrontabTypes.HYPHEN;
615+
}
616+
// fall through
617+
case 26: break;
618+
case 12:
619+
{ return CrontabTypes.SLASH;
620+
}
621+
// fall through
622+
case 27: break;
623+
case 13:
624+
{ return CrontabTypes.NUMBER;
625+
}
626+
// fall through
627+
case 28: break;
628+
case 14:
629+
{ return CrontabTypes.CONTENT;
630+
}
631+
// fall through
632+
case 29: break;
633+
case 15:
634+
{ return CrontabTypes.EQUAL_SIGN;
635+
}
636+
// fall through
637+
case 30: break;
588638
default:
589639
zzScanError(ZZ_NO_MATCH);
590640
}

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

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

src/main/gen/com/github/xepozz/crontab/language/psi/CrontabTypes.java

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/gen/com/github/xepozz/crontab/language/psi/CrontabVariableDefinition.java

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/gen/com/github/xepozz/crontab/language/psi/CrontabVariableName.java

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/gen/com/github/xepozz/crontab/language/psi/CrontabVariableValue.java

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)