embulk-filter-row 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/CHANGELOG.md +6 -0
  4. data/README.md +124 -4
  5. data/build.gradle +15 -4
  6. data/classpath/embulk-filter-row-0.3.0.jar +0 -0
  7. data/example/and.yml +0 -7
  8. data/example/example.yml +0 -7
  9. data/example/where.yml +28 -0
  10. data/script/byaccj.sh +29 -0
  11. data/src/main/java/org/embulk/filter/row/{AbstractColumnVisitor.java → AbstractGuardColumnVisitor.java} +9 -17
  12. data/src/main/java/org/embulk/filter/row/BuildColumnVisitorImpl.java +98 -0
  13. data/src/main/java/org/embulk/filter/row/{ColumnVisitorAndImpl.java → GuardColumnVisitorAndImpl.java} +11 -45
  14. data/src/main/java/org/embulk/filter/row/{ColumnVisitorOrImpl.java → GuardColumnVisitorOrImpl.java} +11 -45
  15. data/src/main/java/org/embulk/filter/row/GuardColumnVisitorWhereImpl.java +28 -0
  16. data/src/main/java/org/embulk/filter/row/RowFilterPlugin.java +49 -16
  17. data/src/main/java/org/embulk/filter/row/where/Parser.java +831 -0
  18. data/src/main/java/org/embulk/filter/row/where/ParserExp.java +290 -0
  19. data/src/main/java/org/embulk/filter/row/where/ParserLiteral.java +277 -0
  20. data/src/main/java/org/embulk/filter/row/where/ParserNode.java +6 -0
  21. data/src/main/java/org/embulk/filter/row/where/ParserVal.java +78 -0
  22. data/src/main/java/org/embulk/filter/row/where/Yylex.java +833 -0
  23. data/src/main/java/org/embulk/filter/row/where/_lexer.l +108 -0
  24. data/src/main/java/org/embulk/filter/row/where/_parser.y +137 -0
  25. data/src/test/java/org/embulk/filter/row/where/TestParser.java +383 -0
  26. data/src/test/java/org/embulk/filter/row/where/TestYylex.java +256 -0
  27. metadata +19 -5
  28. data/classpath/embulk-filter-row-0.2.2.jar +0 -0
@@ -0,0 +1,833 @@
1
+ /* The following code was generated by JFlex 1.6.1 */
2
+
3
+ package org.embulk.filter.row.where;
4
+
5
+ import org.embulk.spi.Schema;
6
+
7
+ /**
8
+ * This class is a scanner generated by
9
+ * <a href="http://www.jflex.de/">JFlex</a> 1.6.1
10
+ * from the specification file <tt>src/main/java/org/embulk/filter/row/where/_lexer.l</tt>
11
+ */
12
+ class Yylex {
13
+
14
+ /** This character denotes the end of file */
15
+ public static final int YYEOF = -1;
16
+
17
+ /** initial size of the lookahead buffer */
18
+ private static final int ZZ_BUFFERSIZE = 16384;
19
+
20
+ /** lexical states */
21
+ public static final int YYINITIAL = 0;
22
+ public static final int STRING = 2;
23
+ public static final int IDENTIFIER = 4;
24
+
25
+ /**
26
+ * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l
27
+ * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l
28
+ * at the beginning of a line
29
+ * l is of the form l = 2*k, k a non negative integer
30
+ */
31
+ private static final int ZZ_LEXSTATE[] = {
32
+ 0, 0, 1, 1, 2, 2
33
+ };
34
+
35
+ /**
36
+ * Translates characters to character classes
37
+ */
38
+ private static final String ZZ_CMAP_PACKED =
39
+ "\11\0\1\53\1\13\1\54\1\54\1\12\22\0\1\53\1\25\1\4"+
40
+ "\1\0\1\5\2\0\1\11\1\14\1\14\3\0\1\1\1\3\1\0"+
41
+ "\12\2\2\0\1\23\1\22\1\24\2\0\1\15\1\10\1\35\1\17"+
42
+ "\1\34\1\52\1\10\1\33\1\32\2\10\1\36\1\40\1\16\1\20"+
43
+ "\1\41\1\10\1\21\1\26\1\27\1\37\1\10\1\31\3\10\1\6"+
44
+ "\1\7\2\6\1\30\1\6\1\47\1\55\2\10\1\45\1\46\5\10"+
45
+ "\1\50\1\10\1\56\3\10\1\43\1\51\1\42\1\44\5\10\12\0"+
46
+ "\1\54\u1fa2\0\1\54\1\54\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\udfe6\0";
47
+
48
+ /**
49
+ * Translates characters to character classes
50
+ */
51
+ private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
52
+
53
+ /**
54
+ * Translates DFA states to action switch labels.
55
+ */
56
+ private static final int [] ZZ_ACTION = zzUnpackAction();
57
+
58
+ private static final String ZZ_ACTION_PACKED_0 =
59
+ "\3\0\2\1\1\2\1\3\1\4\1\5\2\6\1\7"+
60
+ "\3\4\1\10\1\11\1\12\1\1\7\4\1\6\1\13"+
61
+ "\1\1\1\14\1\13\1\15\1\1\1\0\3\4\1\16"+
62
+ "\1\17\1\20\1\21\4\4\1\22\4\4\1\23\1\24"+
63
+ "\1\25\1\26\1\27\1\30\1\31\1\32\1\33\1\2"+
64
+ "\1\34\1\35\11\4\1\36\1\4\1\37\11\4\1\40"+
65
+ "\6\4\1\41\3\4\1\42\1\4\1\43\1\44";
66
+
67
+ private static int [] zzUnpackAction() {
68
+ int [] result = new int[98];
69
+ int offset = 0;
70
+ offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
71
+ return result;
72
+ }
73
+
74
+ private static int zzUnpackAction(String packed, int offset, int [] result) {
75
+ int i = 0; /* index in packed string */
76
+ int j = offset; /* index in unpacked array */
77
+ int l = packed.length();
78
+ while (i < l) {
79
+ int count = packed.charAt(i++);
80
+ int value = packed.charAt(i++);
81
+ do result[j++] = value; while (--count > 0);
82
+ }
83
+ return j;
84
+ }
85
+
86
+
87
+ /**
88
+ * Translates a state to a row index in the transition table
89
+ */
90
+ private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
91
+
92
+ private static final String ZZ_ROWMAP_PACKED_0 =
93
+ "\0\0\0\57\0\136\0\215\0\274\0\353\0\215\0\u011a"+
94
+ "\0\215\0\u0149\0\215\0\215\0\u0178\0\u01a7\0\u01d6\0\215"+
95
+ "\0\u0205\0\u0234\0\u0263\0\u0292\0\u02c1\0\u02f0\0\u031f\0\u034e"+
96
+ "\0\u037d\0\u03ac\0\u03db\0\u040a\0\u0439\0\215\0\u0468\0\215"+
97
+ "\0\u0497\0\u04c6\0\u04f5\0\u0524\0\u0553\0\u011a\0\215\0\215"+
98
+ "\0\215\0\u0582\0\u05b1\0\u05e0\0\u060f\0\u011a\0\u063e\0\u066d"+
99
+ "\0\u069c\0\u06cb\0\215\0\215\0\215\0\215\0\215\0\215"+
100
+ "\0\215\0\215\0\215\0\u04c6\0\u011a\0\u011a\0\u06fa\0\u0729"+
101
+ "\0\u0758\0\u0787\0\u07b6\0\u07e5\0\u0814\0\u0843\0\u0872\0\u011a"+
102
+ "\0\u08a1\0\u011a\0\u08d0\0\u08ff\0\u092e\0\u095d\0\u098c\0\u09bb"+
103
+ "\0\u09ea\0\u0a19\0\u0a48\0\u011a\0\u0a77\0\u0aa6\0\u0ad5\0\u0b04"+
104
+ "\0\u0b33\0\u0b62\0\u011a\0\u0b91\0\u0bc0\0\u0bef\0\u011a\0\u0c1e"+
105
+ "\0\u011a\0\u011a";
106
+
107
+ private static int [] zzUnpackRowMap() {
108
+ int [] result = new int[98];
109
+ int offset = 0;
110
+ offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
111
+ return result;
112
+ }
113
+
114
+ private static int zzUnpackRowMap(String packed, int offset, int [] result) {
115
+ int i = 0; /* index in packed string */
116
+ int j = offset; /* index in unpacked array */
117
+ int l = packed.length();
118
+ while (i < l) {
119
+ int high = packed.charAt(i++) << 16;
120
+ result[j++] = high | packed.charAt(i++);
121
+ }
122
+ return j;
123
+ }
124
+
125
+ /**
126
+ * The transition table of the DFA
127
+ */
128
+ private static final int [] ZZ_TRANS = zzUnpackTrans();
129
+
130
+ private static final String ZZ_TRANS_PACKED_0 =
131
+ "\1\4\1\5\1\6\1\4\1\7\1\10\2\4\1\10"+
132
+ "\1\11\1\12\1\13\1\14\1\15\1\16\1\10\1\17"+
133
+ "\1\10\1\20\1\21\1\22\1\23\1\24\1\25\1\4"+
134
+ "\1\10\1\26\1\10\1\27\5\10\1\30\3\10\1\31"+
135
+ "\3\10\1\32\1\33\1\4\2\10\7\34\1\35\1\34"+
136
+ "\1\36\2\4\43\34\4\37\1\40\2\37\1\41\2\37"+
137
+ "\2\4\43\37\61\0\1\6\56\0\1\6\1\42\54\0"+
138
+ "\3\10\2\0\3\10\4\0\5\10\4\0\25\10\2\0"+
139
+ "\2\10\13\0\1\13\44\0\3\10\2\0\3\10\4\0"+
140
+ "\1\10\1\43\3\10\4\0\25\10\2\0\2\10\1\0"+
141
+ "\3\10\2\0\3\10\4\0\3\10\1\44\1\10\4\0"+
142
+ "\11\10\1\45\13\10\2\0\2\10\1\0\3\10\2\0"+
143
+ "\3\10\4\0\4\10\1\46\4\0\25\10\2\0\2\10"+
144
+ "\22\0\1\47\1\0\1\50\54\0\1\51\56\0\1\50"+
145
+ "\35\0\3\10\2\0\3\10\4\0\5\10\4\0\1\10"+
146
+ "\1\52\23\10\2\0\2\10\1\0\3\10\2\0\3\10"+
147
+ "\4\0\4\10\1\53\4\0\4\10\1\54\20\10\2\0"+
148
+ "\2\10\1\0\3\10\2\0\3\10\4\0\1\10\1\55"+
149
+ "\3\10\4\0\1\56\24\10\2\0\2\10\1\0\3\10"+
150
+ "\2\0\3\10\4\0\1\10\1\57\3\10\4\0\25\10"+
151
+ "\2\0\2\10\1\0\3\10\2\0\3\10\4\0\5\10"+
152
+ "\4\0\15\10\1\60\7\10\2\0\2\10\1\0\3\10"+
153
+ "\2\0\3\10\4\0\5\10\4\0\21\10\1\61\3\10"+
154
+ "\2\0\2\10\1\0\3\10\2\0\3\10\4\0\1\62"+
155
+ "\4\10\4\0\25\10\2\0\2\10\53\0\1\33\3\0"+
156
+ "\7\34\1\0\1\34\3\0\43\34\4\63\1\64\2\63"+
157
+ "\1\65\1\63\1\66\2\0\26\63\1\67\1\70\2\63"+
158
+ "\1\71\5\63\1\0\1\72\1\73\4\37\1\0\2\37"+
159
+ "\1\0\2\37\2\0\43\37\4\63\1\64\2\63\1\65"+
160
+ "\1\63\1\66\2\0\40\63\1\0\2\63\2\0\1\74"+
161
+ "\55\0\3\10\2\0\3\10\4\0\2\10\1\75\2\10"+
162
+ "\4\0\25\10\2\0\2\10\1\0\3\10\2\0\3\10"+
163
+ "\4\0\5\10\4\0\1\10\1\76\23\10\2\0\2\10"+
164
+ "\1\0\3\10\2\0\3\10\4\0\5\10\4\0\10\10"+
165
+ "\1\77\14\10\2\0\2\10\1\0\3\10\2\0\3\10"+
166
+ "\4\0\1\100\4\10\4\0\25\10\2\0\2\10\1\0"+
167
+ "\3\10\2\0\3\10\4\0\5\10\4\0\11\10\1\101"+
168
+ "\13\10\2\0\2\10\1\0\3\10\2\0\3\10\4\0"+
169
+ "\5\10\4\0\12\10\1\102\12\10\2\0\2\10\1\0"+
170
+ "\3\10\2\0\3\10\4\0\5\10\4\0\7\10\1\103"+
171
+ "\15\10\2\0\2\10\1\0\3\10\2\0\3\10\4\0"+
172
+ "\2\10\1\104\2\10\4\0\25\10\2\0\2\10\1\0"+
173
+ "\3\10\2\0\3\10\4\0\5\10\4\0\16\10\1\105"+
174
+ "\6\10\2\0\2\10\1\0\3\10\2\0\3\10\4\0"+
175
+ "\5\10\4\0\22\10\1\106\2\10\2\0\2\10\1\0"+
176
+ "\3\10\2\0\3\10\4\0\5\10\4\0\10\10\1\107"+
177
+ "\14\10\2\0\2\10\1\0\3\10\2\0\3\10\4\0"+
178
+ "\5\10\4\0\10\10\1\110\14\10\2\0\2\10\1\0"+
179
+ "\3\10\2\0\3\10\4\0\4\10\1\111\4\0\25\10"+
180
+ "\2\0\2\10\1\0\3\10\2\0\3\10\4\0\5\10"+
181
+ "\4\0\6\10\1\112\16\10\2\0\2\10\1\0\3\10"+
182
+ "\2\0\3\10\4\0\5\10\4\0\6\10\1\113\16\10"+
183
+ "\2\0\2\10\1\0\3\10\2\0\3\10\4\0\5\10"+
184
+ "\4\0\10\10\1\114\14\10\2\0\2\10\1\0\3\10"+
185
+ "\2\0\3\10\4\0\5\10\4\0\2\10\1\115\22\10"+
186
+ "\2\0\2\10\1\0\3\10\2\0\3\10\4\0\5\10"+
187
+ "\4\0\17\10\1\112\5\10\2\0\2\10\1\0\3\10"+
188
+ "\2\0\3\10\4\0\5\10\4\0\23\10\1\116\1\10"+
189
+ "\2\0\2\10\1\0\3\10\2\0\3\10\4\0\5\10"+
190
+ "\4\0\1\117\24\10\2\0\2\10\1\0\3\10\2\0"+
191
+ "\3\10\4\0\5\10\4\0\1\10\1\120\23\10\2\0"+
192
+ "\2\10\1\0\3\10\2\0\3\10\4\0\5\10\4\0"+
193
+ "\1\121\24\10\2\0\2\10\1\0\3\10\2\0\3\10"+
194
+ "\4\0\5\10\4\0\11\10\1\122\13\10\2\0\2\10"+
195
+ "\1\0\3\10\2\0\3\10\4\0\5\10\4\0\3\10"+
196
+ "\1\123\21\10\2\0\2\10\1\0\3\10\2\0\3\10"+
197
+ "\4\0\5\10\4\0\17\10\1\124\5\10\2\0\2\10"+
198
+ "\1\0\3\10\2\0\3\10\4\0\5\10\4\0\6\10"+
199
+ "\1\124\16\10\2\0\2\10\1\0\3\10\2\0\3\10"+
200
+ "\4\0\5\10\4\0\2\10\1\125\22\10\2\0\2\10"+
201
+ "\1\0\3\10\2\0\3\10\4\0\5\10\4\0\1\10"+
202
+ "\1\126\23\10\2\0\2\10\1\0\3\10\2\0\3\10"+
203
+ "\4\0\2\10\1\127\2\10\4\0\25\10\2\0\2\10"+
204
+ "\1\0\3\10\2\0\3\10\4\0\5\10\4\0\4\10"+
205
+ "\1\130\20\10\2\0\2\10\1\0\3\10\2\0\3\10"+
206
+ "\4\0\5\10\4\0\3\10\1\131\21\10\2\0\2\10"+
207
+ "\1\0\3\10\2\0\3\10\4\0\1\132\4\10\4\0"+
208
+ "\25\10\2\0\2\10\1\0\3\10\2\0\3\10\4\0"+
209
+ "\5\10\4\0\6\10\1\133\16\10\2\0\2\10\1\0"+
210
+ "\3\10\2\0\3\10\4\0\5\10\4\0\1\10\1\134"+
211
+ "\23\10\2\0\2\10\1\0\3\10\2\0\3\10\4\0"+
212
+ "\5\10\4\0\4\10\1\135\20\10\2\0\2\10\1\0"+
213
+ "\3\10\2\0\3\10\4\0\5\10\4\0\12\10\1\136"+
214
+ "\12\10\2\0\2\10\1\0\3\10\2\0\3\10\4\0"+
215
+ "\5\10\4\0\5\10\1\137\17\10\2\0\2\10\1\0"+
216
+ "\3\10\2\0\3\10\4\0\5\10\4\0\1\10\1\140"+
217
+ "\23\10\2\0\2\10\1\0\3\10\2\0\3\10\4\0"+
218
+ "\5\10\4\0\13\10\1\141\11\10\2\0\2\10\1\0"+
219
+ "\3\10\2\0\3\10\4\0\5\10\4\0\5\10\1\142"+
220
+ "\17\10\2\0\2\10";
221
+
222
+ private static int [] zzUnpackTrans() {
223
+ int [] result = new int[3149];
224
+ int offset = 0;
225
+ offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
226
+ return result;
227
+ }
228
+
229
+ private static int zzUnpackTrans(String packed, int offset, int [] result) {
230
+ int i = 0; /* index in packed string */
231
+ int j = offset; /* index in unpacked array */
232
+ int l = packed.length();
233
+ while (i < l) {
234
+ int count = packed.charAt(i++);
235
+ int value = packed.charAt(i++);
236
+ value--;
237
+ do result[j++] = value; while (--count > 0);
238
+ }
239
+ return j;
240
+ }
241
+
242
+
243
+ /* error codes */
244
+ private static final int ZZ_UNKNOWN_ERROR = 0;
245
+ private static final int ZZ_NO_MATCH = 1;
246
+ private static final int ZZ_PUSHBACK_2BIG = 2;
247
+
248
+ /* error messages for the codes above */
249
+ private static final String ZZ_ERROR_MSG[] = {
250
+ "Unknown internal scanner error",
251
+ "Error: could not match input",
252
+ "Error: pushback value was too large"
253
+ };
254
+
255
+ /**
256
+ * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
257
+ */
258
+ private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
259
+
260
+ private static final String ZZ_ATTRIBUTE_PACKED_0 =
261
+ "\3\0\1\11\2\1\1\11\1\1\1\11\1\1\2\11"+
262
+ "\3\1\1\11\15\1\1\11\1\1\1\11\1\1\1\0"+
263
+ "\4\1\3\11\11\1\11\11\47\1";
264
+
265
+ private static int [] zzUnpackAttribute() {
266
+ int [] result = new int[98];
267
+ int offset = 0;
268
+ offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
269
+ return result;
270
+ }
271
+
272
+ private static int zzUnpackAttribute(String packed, int offset, int [] result) {
273
+ int i = 0; /* index in packed string */
274
+ int j = offset; /* index in unpacked array */
275
+ int l = packed.length();
276
+ while (i < l) {
277
+ int count = packed.charAt(i++);
278
+ int value = packed.charAt(i++);
279
+ do result[j++] = value; while (--count > 0);
280
+ }
281
+ return j;
282
+ }
283
+
284
+ /** the input device */
285
+ private java.io.Reader zzReader;
286
+
287
+ /** the current state of the DFA */
288
+ private int zzState;
289
+
290
+ /** the current lexical state */
291
+ private int zzLexicalState = YYINITIAL;
292
+
293
+ /** this buffer contains the current text to be matched and is
294
+ the source of the yytext() string */
295
+ private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
296
+
297
+ /** the textposition at the last accepting state */
298
+ private int zzMarkedPos;
299
+
300
+ /** the current text position in the buffer */
301
+ private int zzCurrentPos;
302
+
303
+ /** startRead marks the beginning of the yytext() string in the buffer */
304
+ private int zzStartRead;
305
+
306
+ /** endRead marks the last character in the buffer, that has been read
307
+ from input */
308
+ private int zzEndRead;
309
+
310
+ /** number of newlines encountered up to the start of the matched text */
311
+ private int yyline;
312
+
313
+ /** the number of characters up to the start of the matched text */
314
+ private int yychar;
315
+
316
+ /**
317
+ * the number of characters from the last newline up to the start of the
318
+ * matched text
319
+ */
320
+ private int yycolumn;
321
+
322
+ /**
323
+ * zzAtBOL == true <=> the scanner is currently at the beginning of a line
324
+ */
325
+ private boolean zzAtBOL = true;
326
+
327
+ /** zzAtEOF == true <=> the scanner is at the EOF */
328
+ private boolean zzAtEOF;
329
+
330
+ /** denotes if the user-EOF-code has already been executed */
331
+ private boolean zzEOFDone;
332
+
333
+ /**
334
+ * The number of occupied positions in zzBuffer beyond zzEndRead.
335
+ * When a lead/high surrogate has been read from the input stream
336
+ * into the final zzBuffer position, this will have a value of 1;
337
+ * otherwise, it will have a value of 0.
338
+ */
339
+ private int zzFinalHighSurrogate = 0;
340
+
341
+ /* user code: */
342
+ private StringBuffer string = new StringBuffer();
343
+
344
+ protected Parser yyparser;
345
+ protected Schema schema;
346
+
347
+ public Yylex(String str, Parser yyparser) {
348
+ this(new java.io.StringReader(str));
349
+ this.yyparser = yyparser;
350
+ this.schema = yyparser.schema;
351
+ }
352
+
353
+
354
+ /**
355
+ * Creates a new scanner
356
+ *
357
+ * @param in the java.io.Reader to read input from.
358
+ */
359
+ Yylex(java.io.Reader in) {
360
+ this.zzReader = in;
361
+ }
362
+
363
+
364
+ /**
365
+ * Unpacks the compressed character translation table.
366
+ *
367
+ * @param packed the packed character translation table
368
+ * @return the unpacked character translation table
369
+ */
370
+ private static char [] zzUnpackCMap(String packed) {
371
+ char [] map = new char[0x110000];
372
+ int i = 0; /* index in packed string */
373
+ int j = 0; /* index in unpacked array */
374
+ while (i < 182) {
375
+ int count = packed.charAt(i++);
376
+ char value = packed.charAt(i++);
377
+ do map[j++] = value; while (--count > 0);
378
+ }
379
+ return map;
380
+ }
381
+
382
+
383
+ /**
384
+ * Refills the input buffer.
385
+ *
386
+ * @return <code>false</code>, iff there was new input.
387
+ *
388
+ * @exception java.io.IOException if any I/O-Error occurs
389
+ */
390
+ private boolean zzRefill() throws java.io.IOException {
391
+
392
+ /* first: make room (if you can) */
393
+ if (zzStartRead > 0) {
394
+ zzEndRead += zzFinalHighSurrogate;
395
+ zzFinalHighSurrogate = 0;
396
+ System.arraycopy(zzBuffer, zzStartRead,
397
+ zzBuffer, 0,
398
+ zzEndRead-zzStartRead);
399
+
400
+ /* translate stored positions */
401
+ zzEndRead-= zzStartRead;
402
+ zzCurrentPos-= zzStartRead;
403
+ zzMarkedPos-= zzStartRead;
404
+ zzStartRead = 0;
405
+ }
406
+
407
+ /* is the buffer big enough? */
408
+ if (zzCurrentPos >= zzBuffer.length - zzFinalHighSurrogate) {
409
+ /* if not: blow it up */
410
+ char newBuffer[] = new char[zzBuffer.length*2];
411
+ System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
412
+ zzBuffer = newBuffer;
413
+ zzEndRead += zzFinalHighSurrogate;
414
+ zzFinalHighSurrogate = 0;
415
+ }
416
+
417
+ /* fill the buffer with new input */
418
+ int requested = zzBuffer.length - zzEndRead;
419
+ int numRead = zzReader.read(zzBuffer, zzEndRead, requested);
420
+
421
+ /* not supposed to occur according to specification of java.io.Reader */
422
+ if (numRead == 0) {
423
+ throw new java.io.IOException("Reader returned 0 characters. See JFlex examples for workaround.");
424
+ }
425
+ if (numRead > 0) {
426
+ zzEndRead += numRead;
427
+ /* If numRead == requested, we might have requested to few chars to
428
+ encode a full Unicode character. We assume that a Reader would
429
+ otherwise never return half characters. */
430
+ if (numRead == requested) {
431
+ if (Character.isHighSurrogate(zzBuffer[zzEndRead - 1])) {
432
+ --zzEndRead;
433
+ zzFinalHighSurrogate = 1;
434
+ }
435
+ }
436
+ /* potentially more input available */
437
+ return false;
438
+ }
439
+
440
+ /* numRead < 0 ==> end of stream */
441
+ return true;
442
+ }
443
+
444
+
445
+ /**
446
+ * Closes the input stream.
447
+ */
448
+ public final void yyclose() throws java.io.IOException {
449
+ zzAtEOF = true; /* indicate end of file */
450
+ zzEndRead = zzStartRead; /* invalidate buffer */
451
+
452
+ if (zzReader != null)
453
+ zzReader.close();
454
+ }
455
+
456
+
457
+ /**
458
+ * Resets the scanner to read from a new input stream.
459
+ * Does not close the old reader.
460
+ *
461
+ * All internal variables are reset, the old input stream
462
+ * <b>cannot</b> be reused (internal buffer is discarded and lost).
463
+ * Lexical state is set to <tt>ZZ_INITIAL</tt>.
464
+ *
465
+ * Internal scan buffer is resized down to its initial length, if it has grown.
466
+ *
467
+ * @param reader the new input stream
468
+ */
469
+ public final void yyreset(java.io.Reader reader) {
470
+ zzReader = reader;
471
+ zzAtBOL = true;
472
+ zzAtEOF = false;
473
+ zzEOFDone = false;
474
+ zzEndRead = zzStartRead = 0;
475
+ zzCurrentPos = zzMarkedPos = 0;
476
+ zzFinalHighSurrogate = 0;
477
+ yyline = yychar = yycolumn = 0;
478
+ zzLexicalState = YYINITIAL;
479
+ if (zzBuffer.length > ZZ_BUFFERSIZE)
480
+ zzBuffer = new char[ZZ_BUFFERSIZE];
481
+ }
482
+
483
+
484
+ /**
485
+ * Returns the current lexical state.
486
+ */
487
+ public final int yystate() {
488
+ return zzLexicalState;
489
+ }
490
+
491
+
492
+ /**
493
+ * Enters a new lexical state
494
+ *
495
+ * @param newState the new lexical state
496
+ */
497
+ public final void yybegin(int newState) {
498
+ zzLexicalState = newState;
499
+ }
500
+
501
+
502
+ /**
503
+ * Returns the text matched by the current regular expression.
504
+ */
505
+ public final String yytext() {
506
+ return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
507
+ }
508
+
509
+
510
+ /**
511
+ * Returns the character at position <tt>pos</tt> from the
512
+ * matched text.
513
+ *
514
+ * It is equivalent to yytext().charAt(pos), but faster
515
+ *
516
+ * @param pos the position of the character to fetch.
517
+ * A value from 0 to yylength()-1.
518
+ *
519
+ * @return the character at position pos
520
+ */
521
+ public final char yycharat(int pos) {
522
+ return zzBuffer[zzStartRead+pos];
523
+ }
524
+
525
+
526
+ /**
527
+ * Returns the length of the matched text region.
528
+ */
529
+ public final int yylength() {
530
+ return zzMarkedPos-zzStartRead;
531
+ }
532
+
533
+
534
+ /**
535
+ * Reports an error that occured while scanning.
536
+ *
537
+ * In a wellformed scanner (no or only correct usage of
538
+ * yypushback(int) and a match-all fallback rule) this method
539
+ * will only be called with things that "Can't Possibly Happen".
540
+ * If this method is called, something is seriously wrong
541
+ * (e.g. a JFlex bug producing a faulty scanner etc.).
542
+ *
543
+ * Usual syntax/scanner level error handling should be done
544
+ * in error fallback rules.
545
+ *
546
+ * @param errorCode the code of the errormessage to display
547
+ */
548
+ private void zzScanError(int errorCode) {
549
+ String message;
550
+ try {
551
+ message = ZZ_ERROR_MSG[errorCode];
552
+ }
553
+ catch (ArrayIndexOutOfBoundsException e) {
554
+ message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
555
+ }
556
+
557
+ throw new Error(message);
558
+ }
559
+
560
+
561
+ /**
562
+ * Pushes the specified amount of characters back into the input stream.
563
+ *
564
+ * They will be read again by then next call of the scanning method
565
+ *
566
+ * @param number the number of characters to be read again.
567
+ * This number must not be greater than yylength()!
568
+ */
569
+ public void yypushback(int number) {
570
+ if ( number > yylength() )
571
+ zzScanError(ZZ_PUSHBACK_2BIG);
572
+
573
+ zzMarkedPos -= number;
574
+ }
575
+
576
+
577
+ /**
578
+ * Contains user EOF-code, which will be executed exactly once,
579
+ * when the end of file is reached
580
+ */
581
+ private void zzDoEOF() throws java.io.IOException {
582
+ if (!zzEOFDone) {
583
+ zzEOFDone = true;
584
+ yyclose();
585
+ }
586
+ }
587
+
588
+
589
+ /**
590
+ * Resumes scanning until the next regular expression is matched,
591
+ * the end of input is encountered or an I/O-Error occurs.
592
+ *
593
+ * @return the next token
594
+ * @exception java.io.IOException if any I/O-Error occurs
595
+ */
596
+ public int yylex() throws java.io.IOException {
597
+ int zzInput;
598
+ int zzAction;
599
+
600
+ // cached fields:
601
+ int zzCurrentPosL;
602
+ int zzMarkedPosL;
603
+ int zzEndReadL = zzEndRead;
604
+ char [] zzBufferL = zzBuffer;
605
+ char [] zzCMapL = ZZ_CMAP;
606
+
607
+ int [] zzTransL = ZZ_TRANS;
608
+ int [] zzRowMapL = ZZ_ROWMAP;
609
+ int [] zzAttrL = ZZ_ATTRIBUTE;
610
+
611
+ while (true) {
612
+ zzMarkedPosL = zzMarkedPos;
613
+
614
+ zzAction = -1;
615
+
616
+ zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
617
+
618
+ zzState = ZZ_LEXSTATE[zzLexicalState];
619
+
620
+ // set up zzAction for empty match case:
621
+ int zzAttributes = zzAttrL[zzState];
622
+ if ( (zzAttributes & 1) == 1 ) {
623
+ zzAction = zzState;
624
+ }
625
+
626
+
627
+ zzForAction: {
628
+ while (true) {
629
+
630
+ if (zzCurrentPosL < zzEndReadL) {
631
+ zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL, zzEndReadL);
632
+ zzCurrentPosL += Character.charCount(zzInput);
633
+ }
634
+ else if (zzAtEOF) {
635
+ zzInput = YYEOF;
636
+ break zzForAction;
637
+ }
638
+ else {
639
+ // store back cached positions
640
+ zzCurrentPos = zzCurrentPosL;
641
+ zzMarkedPos = zzMarkedPosL;
642
+ boolean eof = zzRefill();
643
+ // get translated positions and possibly new buffer
644
+ zzCurrentPosL = zzCurrentPos;
645
+ zzMarkedPosL = zzMarkedPos;
646
+ zzBufferL = zzBuffer;
647
+ zzEndReadL = zzEndRead;
648
+ if (eof) {
649
+ zzInput = YYEOF;
650
+ break zzForAction;
651
+ }
652
+ else {
653
+ zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL, zzEndReadL);
654
+ zzCurrentPosL += Character.charCount(zzInput);
655
+ }
656
+ }
657
+ int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
658
+ if (zzNext == -1) break zzForAction;
659
+ zzState = zzNext;
660
+
661
+ zzAttributes = zzAttrL[zzState];
662
+ if ( (zzAttributes & 1) == 1 ) {
663
+ zzAction = zzState;
664
+ zzMarkedPosL = zzCurrentPosL;
665
+ if ( (zzAttributes & 8) == 8 ) break zzForAction;
666
+ }
667
+
668
+ }
669
+ }
670
+
671
+ // store back cached position
672
+ zzMarkedPos = zzMarkedPosL;
673
+
674
+ if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
675
+ zzAtEOF = true;
676
+ zzDoEOF();
677
+ { return 0; }
678
+ }
679
+ else {
680
+ switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
681
+ case 1:
682
+ { throw new RuntimeException("yylex: Unexpected character '"+yytext()+"'");
683
+ }
684
+ case 37: break;
685
+ case 2:
686
+ { yyparser.yylval = new ParserVal(new NumberLiteral(yytext())); return Parser.NUMBER;
687
+ }
688
+ case 38: break;
689
+ case 3:
690
+ { yybegin(IDENTIFIER); string.setLength(0);
691
+ }
692
+ case 39: break;
693
+ case 4:
694
+ { yyparser.yylval = new ParserVal(new IdentifierLiteral(yytext(), schema)); return Parser.IDENTIFIER;
695
+ }
696
+ case 40: break;
697
+ case 5:
698
+ { yybegin(STRING); string.setLength(0);
699
+ }
700
+ case 41: break;
701
+ case 6:
702
+ {
703
+ }
704
+ case 42: break;
705
+ case 7:
706
+ { return (int) yycharat(0);
707
+ }
708
+ case 43: break;
709
+ case 8:
710
+ { return Parser.EQ;
711
+ }
712
+ case 44: break;
713
+ case 9:
714
+ { return Parser.LT;
715
+ }
716
+ case 45: break;
717
+ case 10:
718
+ { return Parser.GT;
719
+ }
720
+ case 46: break;
721
+ case 11:
722
+ { string.append( yytext() );
723
+ }
724
+ case 47: break;
725
+ case 12:
726
+ { yybegin(YYINITIAL); yyparser.yylval = new ParserVal(new StringLiteral(string.toString())); return Parser.STRING;
727
+ }
728
+ case 48: break;
729
+ case 13:
730
+ { yybegin(YYINITIAL); yyparser.yylval = new ParserVal(new IdentifierLiteral(string.toString(), schema)); return Parser.IDENTIFIER;
731
+ }
732
+ case 49: break;
733
+ case 14:
734
+ { return Parser.OR;
735
+ }
736
+ case 50: break;
737
+ case 15:
738
+ { return Parser.LE;
739
+ }
740
+ case 51: break;
741
+ case 16:
742
+ { return Parser.NEQ;
743
+ }
744
+ case 52: break;
745
+ case 17:
746
+ { return Parser.GE;
747
+ }
748
+ case 53: break;
749
+ case 18:
750
+ { return Parser.IS;
751
+ }
752
+ case 54: break;
753
+ case 19:
754
+ { throw new RuntimeException("yylex: Illegal escape sequence \""+yytext()+"\"");
755
+ }
756
+ case 55: break;
757
+ case 20:
758
+ { string.append( '\"' );
759
+ }
760
+ case 56: break;
761
+ case 21:
762
+ { string.append( '\\' );
763
+ }
764
+ case 57: break;
765
+ case 22:
766
+ { string.append( '\'' );
767
+ }
768
+ case 58: break;
769
+ case 23:
770
+ { string.append( '\t' );
771
+ }
772
+ case 59: break;
773
+ case 24:
774
+ { string.append( '\r' );
775
+ }
776
+ case 60: break;
777
+ case 25:
778
+ { string.append( '\f' );
779
+ }
780
+ case 61: break;
781
+ case 26:
782
+ { string.append( '\b' );
783
+ }
784
+ case 62: break;
785
+ case 27:
786
+ { string.append( '\n' );
787
+ }
788
+ case 63: break;
789
+ case 28:
790
+ { return Parser.AND;
791
+ }
792
+ case 64: break;
793
+ case 29:
794
+ { return Parser.NOT;
795
+ }
796
+ case 65: break;
797
+ case 30:
798
+ { return Parser.NULL;
799
+ }
800
+ case 66: break;
801
+ case 31:
802
+ { yyparser.yylval = new ParserVal(new BooleanLiteral(true)); return Parser.BOOLEAN;
803
+ }
804
+ case 67: break;
805
+ case 32:
806
+ { yyparser.yylval = new ParserVal(new BooleanLiteral(false)); return Parser.BOOLEAN;
807
+ }
808
+ case 68: break;
809
+ case 33:
810
+ { return Parser.INCLUDE;
811
+ }
812
+ case 69: break;
813
+ case 34:
814
+ { return Parser.END_WITH;
815
+ }
816
+ case 70: break;
817
+ case 35:
818
+ { return Parser.TIMESTAMP;
819
+ }
820
+ case 71: break;
821
+ case 36:
822
+ { return Parser.START_WITH;
823
+ }
824
+ case 72: break;
825
+ default:
826
+ zzScanError(ZZ_NO_MATCH);
827
+ }
828
+ }
829
+ }
830
+ }
831
+
832
+
833
+ }