1
/* The following code was generated by JFlex 1.5.0-SNAPSHOT on 9/30/11 1:23 PM */
3
package org.apache.lucene.analysis.wikipedia;
6
* Licensed to the Apache Software Foundation (ASF) under one or more
7
* contributor license agreements. See the NOTICE file distributed with
8
* this work for additional information regarding copyright ownership.
9
* The ASF licenses this file to You under the Apache License, Version 2.0
10
* (the "License"); you may not use this file except in compliance with
11
* the License. You may obtain a copy of the License at
13
* http://www.apache.org/licenses/LICENSE-2.0
15
* Unless required by applicable law or agreed to in writing, software
16
* distributed under the License is distributed on an "AS IS" BASIS,
17
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
* See the License for the specific language governing permissions and
19
* limitations under the License.
22
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
26
* This class is a scanner generated by
27
* <a href="http://www.jflex.de/">JFlex</a> 1.5.0-SNAPSHOT
28
* on 9/30/11 1:23 PM from the specification file
29
* <tt>/lucene/3x/lucene/contrib/analyzers/common/src/java/org/apache/lucene/analysis/wikipedia/WikipediaTokenizerImpl.jflex</tt>
31
class WikipediaTokenizerImpl {
33
/** This character denotes the end of file */
34
public static final int YYEOF = -1;
36
/** initial size of the lookahead buffer */
37
private static final int ZZ_BUFFERSIZE = 16384;
40
public static final int THREE_SINGLE_QUOTES_STATE = 10;
41
public static final int EXTERNAL_LINK_STATE = 6;
42
public static final int DOUBLE_EQUALS_STATE = 14;
43
public static final int INTERNAL_LINK_STATE = 4;
44
public static final int DOUBLE_BRACE_STATE = 16;
45
public static final int CATEGORY_STATE = 2;
46
public static final int YYINITIAL = 0;
47
public static final int STRING = 18;
48
public static final int FIVE_SINGLE_QUOTES_STATE = 12;
49
public static final int TWO_SINGLE_QUOTES_STATE = 8;
52
* ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l
53
* ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l
54
* at the beginning of a line
55
* l is of the form l = 2*k, k a non negative integer
57
private static final int ZZ_LEXSTATE[] = {
58
0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7,
63
* Translates characters to character classes
65
private static final String ZZ_CMAP_PACKED =
66
"\11\0\1\24\1\23\1\0\1\24\1\22\22\0\1\24\1\0\1\12"+
67
"\1\53\2\0\1\3\1\1\4\0\1\14\1\5\1\2\1\10\12\16"+
68
"\1\27\1\0\1\7\1\11\1\13\1\53\1\4\2\15\1\30\5\15"+
69
"\1\41\21\15\1\25\1\0\1\26\1\0\1\6\1\0\1\31\1\43"+
70
"\2\15\1\33\1\40\1\34\1\50\1\41\4\15\1\42\1\35\1\51"+
71
"\1\15\1\36\1\52\1\32\3\15\1\44\1\37\1\15\1\45\1\47"+
72
"\1\46\102\0\27\15\1\0\37\15\1\0\u0568\15\12\17\206\15\12\17"+
73
"\u026c\15\12\17\166\15\12\17\166\15\12\17\166\15\12\17\166\15\12\17"+
74
"\167\15\11\17\166\15\12\17\166\15\12\17\166\15\12\17\340\15\12\17"+
75
"\166\15\12\17\u0166\15\12\17\266\15\u0100\15\u0e00\15\u1040\0\u0150\21\140\0"+
76
"\20\21\u0100\0\200\21\200\0\u19c0\21\100\0\u5200\21\u0c00\0\u2bb0\20\u2150\0"+
77
"\u0200\21\u0465\0\73\21\75\15\43\0";
80
* Translates characters to character classes
82
private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
85
* Translates DFA states to action switch labels.
87
private static final int [] ZZ_ACTION = zzUnpackAction();
89
private static final String ZZ_ACTION_PACKED_0 =
90
"\12\0\4\1\4\2\1\3\1\1\1\4\1\1\2\5"+
91
"\1\6\2\5\1\7\1\5\2\10\1\11\1\12\1\11"+
92
"\1\13\1\14\1\10\1\15\1\16\1\15\1\17\1\20"+
93
"\1\10\1\21\1\10\4\22\1\23\1\22\1\24\1\25"+
94
"\1\26\3\0\1\27\14\0\1\30\1\31\1\32\1\33"+
95
"\1\11\1\0\1\34\1\35\1\36\1\0\1\37\1\0"+
96
"\1\40\3\0\1\41\1\42\2\43\1\42\2\44\2\0"+
97
"\1\43\1\0\14\43\1\42\3\0\1\11\1\45\3\0"+
98
"\1\46\1\47\5\0\1\50\4\0\1\50\2\0\2\50"+
99
"\2\0\1\11\5\0\1\31\1\42\1\43\1\51\3\0"+
100
"\1\11\2\0\1\52\30\0\1\53\2\0\1\54\1\55"+
103
private static int [] zzUnpackAction() {
104
int [] result = new int[184];
106
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
110
private static int zzUnpackAction(String packed, int offset, int [] result) {
111
int i = 0; /* index in packed string */
112
int j = offset; /* index in unpacked array */
113
int l = packed.length();
115
int count = packed.charAt(i++);
116
int value = packed.charAt(i++);
117
do result[j++] = value; while (--count > 0);
124
* Translates a state to a row index in the transition table
126
private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
128
private static final String ZZ_ROWMAP_PACKED_0 =
129
"\0\0\0\54\0\130\0\204\0\260\0\334\0\u0108\0\u0134"+
130
"\0\u0160\0\u018c\0\u01b8\0\u01e4\0\u0210\0\u023c\0\u0268\0\u0294"+
131
"\0\u02c0\0\u02ec\0\u01b8\0\u0318\0\u0344\0\u0370\0\u01b8\0\u039c"+
132
"\0\u03c8\0\u03f4\0\u0420\0\u044c\0\u0478\0\u01b8\0\u039c\0\u04a4"+
133
"\0\u01b8\0\u04d0\0\u04fc\0\u0528\0\u0554\0\u0580\0\u05ac\0\u05d8"+
134
"\0\u0604\0\u0630\0\u065c\0\u0688\0\u06b4\0\u01b8\0\u06e0\0\u039c"+
135
"\0\u070c\0\u0738\0\u0764\0\u0790\0\u01b8\0\u01b8\0\u07bc\0\u07e8"+
136
"\0\u0814\0\u01b8\0\u0840\0\u086c\0\u0898\0\u08c4\0\u08f0\0\u091c"+
137
"\0\u0948\0\u0974\0\u09a0\0\u09cc\0\u09f8\0\u0a24\0\u0a50\0\u0a7c"+
138
"\0\u01b8\0\u01b8\0\u0aa8\0\u0ad4\0\u0b00\0\u0b00\0\u01b8\0\u0b2c"+
139
"\0\u0b58\0\u0b84\0\u0bb0\0\u0bdc\0\u0c08\0\u0c34\0\u0c60\0\u0c8c"+
140
"\0\u0cb8\0\u0ce4\0\u0d10\0\u0898\0\u0d3c\0\u0d68\0\u0d94\0\u0dc0"+
141
"\0\u0dec\0\u0e18\0\u0e44\0\u0e70\0\u0e9c\0\u0ec8\0\u0ef4\0\u0f20"+
142
"\0\u0f4c\0\u0f78\0\u0fa4\0\u0fd0\0\u0ffc\0\u1028\0\u1054\0\u1080"+
143
"\0\u10ac\0\u10d8\0\u01b8\0\u1104\0\u1130\0\u115c\0\u1188\0\u01b8"+
144
"\0\u11b4\0\u11e0\0\u120c\0\u1238\0\u1264\0\u1290\0\u12bc\0\u12e8"+
145
"\0\u1314\0\u1340\0\u136c\0\u1398\0\u13c4\0\u086c\0\u09f8\0\u13f0"+
146
"\0\u141c\0\u1448\0\u1474\0\u14a0\0\u14cc\0\u14f8\0\u1524\0\u01b8"+
147
"\0\u1550\0\u157c\0\u15a8\0\u15d4\0\u1600\0\u162c\0\u1658\0\u1684"+
148
"\0\u16b0\0\u01b8\0\u16dc\0\u1708\0\u1734\0\u1760\0\u178c\0\u17b8"+
149
"\0\u17e4\0\u1810\0\u183c\0\u1868\0\u1894\0\u18c0\0\u18ec\0\u1918"+
150
"\0\u1944\0\u1970\0\u199c\0\u19c8\0\u19f4\0\u1a20\0\u1a4c\0\u1a78"+
151
"\0\u1aa4\0\u1ad0\0\u1afc\0\u1b28\0\u1b54\0\u01b8\0\u01b8\0\u01b8";
153
private static int [] zzUnpackRowMap() {
154
int [] result = new int[184];
156
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
160
private static int zzUnpackRowMap(String packed, int offset, int [] result) {
161
int i = 0; /* index in packed string */
162
int j = offset; /* index in unpacked array */
163
int l = packed.length();
165
int high = packed.charAt(i++) << 16;
166
result[j++] = high | packed.charAt(i++);
172
* The transition table of the DFA
174
private static final int [] ZZ_TRANS = zzUnpackTrans();
176
private static final String ZZ_TRANS_PACKED_0 =
177
"\1\13\1\14\5\13\1\15\1\13\1\16\3\13\1\17"+
178
"\1\20\1\21\1\22\1\23\1\24\2\13\1\25\2\13"+
179
"\15\17\1\26\2\13\3\17\1\13\7\27\1\30\5\27"+
180
"\4\31\1\27\1\32\3\27\1\33\1\27\15\31\3\27"+
181
"\3\31\10\27\1\30\5\27\4\34\1\27\1\32\3\27"+
182
"\1\35\1\27\15\34\3\27\3\34\1\27\7\36\1\37"+
183
"\5\36\4\40\1\36\1\32\2\27\1\36\1\41\1\36"+
184
"\15\40\3\36\1\42\2\40\2\36\1\43\5\36\1\37"+
185
"\5\36\4\44\1\36\1\45\2\36\1\46\2\36\15\44"+
186
"\3\36\3\44\10\36\1\37\5\36\4\47\1\36\1\45"+
187
"\2\36\1\46\2\36\15\47\3\36\3\47\10\36\1\37"+
188
"\5\36\4\47\1\36\1\45\2\36\1\50\2\36\15\47"+
189
"\3\36\3\47\10\36\1\37\1\36\1\51\3\36\4\52"+
190
"\1\36\1\45\5\36\15\52\3\36\3\52\10\36\1\53"+
191
"\5\36\4\54\1\36\1\45\5\36\15\54\1\36\1\55"+
192
"\1\36\3\54\1\36\1\56\1\57\5\56\1\60\1\56"+
193
"\1\61\3\56\4\62\1\56\1\63\2\56\1\64\2\56"+
194
"\15\62\2\56\1\65\3\62\1\56\55\0\1\66\62\0"+
195
"\1\67\4\0\4\70\7\0\6\70\1\71\6\70\3\0"+
196
"\3\70\12\0\1\72\43\0\1\73\1\74\1\75\1\76"+
197
"\2\77\1\0\1\100\3\0\1\100\1\17\1\20\1\21"+
198
"\1\22\7\0\15\17\3\0\3\17\3\0\1\101\1\0"+
199
"\1\102\2\103\1\0\1\104\3\0\1\104\3\20\1\22"+
200
"\7\0\15\20\3\0\3\20\2\0\1\73\1\105\1\75"+
201
"\1\76\2\103\1\0\1\104\3\0\1\104\1\21\1\20"+
202
"\1\21\1\22\7\0\15\21\3\0\3\21\3\0\1\106"+
203
"\1\0\1\102\2\77\1\0\1\100\3\0\1\100\4\22"+
204
"\7\0\15\22\3\0\3\22\24\0\1\13\55\0\1\107"+
205
"\73\0\1\110\16\0\1\67\4\0\4\70\7\0\15\70"+
206
"\3\0\3\70\16\0\4\31\7\0\15\31\3\0\3\31"+
207
"\24\0\1\27\56\0\1\111\42\0\4\34\7\0\15\34"+
208
"\3\0\3\34\27\0\1\112\42\0\4\40\7\0\15\40"+
209
"\3\0\3\40\16\0\4\40\7\0\2\40\1\113\12\40"+
210
"\3\0\3\40\2\0\1\114\67\0\4\44\7\0\15\44"+
211
"\3\0\3\44\24\0\1\36\55\0\1\115\43\0\4\47"+
212
"\7\0\15\47\3\0\3\47\26\0\1\116\37\0\1\117"+
213
"\57\0\4\52\7\0\15\52\3\0\3\52\11\0\1\120"+
214
"\4\0\4\70\7\0\15\70\3\0\3\70\16\0\4\54"+
215
"\7\0\15\54\3\0\3\54\47\0\1\117\6\0\1\121"+
216
"\63\0\1\122\57\0\4\62\7\0\15\62\3\0\3\62"+
217
"\24\0\1\56\55\0\1\123\43\0\4\70\7\0\15\70"+
218
"\3\0\3\70\14\0\1\36\1\0\4\124\1\0\3\125"+
219
"\3\0\15\124\3\0\3\124\14\0\1\36\1\0\4\124"+
220
"\1\0\3\125\3\0\3\124\1\126\11\124\3\0\3\124"+
221
"\16\0\1\127\1\0\1\127\10\0\15\127\3\0\3\127"+
222
"\16\0\1\130\1\131\1\132\1\133\7\0\15\130\3\0"+
223
"\3\130\16\0\1\134\1\0\1\134\10\0\15\134\3\0"+
224
"\3\134\16\0\1\135\1\136\1\135\1\136\7\0\15\135"+
225
"\3\0\3\135\16\0\1\137\2\140\1\141\7\0\15\137"+
226
"\3\0\3\137\16\0\1\100\2\142\10\0\15\100\3\0"+
227
"\3\100\16\0\1\143\2\144\1\145\7\0\15\143\3\0"+
228
"\3\143\16\0\4\136\7\0\15\136\3\0\3\136\16\0"+
229
"\1\146\2\147\1\150\7\0\15\146\3\0\3\146\16\0"+
230
"\1\151\2\152\1\153\7\0\15\151\3\0\3\151\16\0"+
231
"\1\154\1\144\1\155\1\145\7\0\15\154\3\0\3\154"+
232
"\16\0\1\156\2\131\1\133\7\0\15\156\3\0\3\156"+
233
"\30\0\1\157\1\160\64\0\1\161\27\0\4\40\7\0"+
234
"\2\40\1\162\12\40\3\0\3\40\2\0\1\163\101\0"+
235
"\1\164\1\165\40\0\4\70\7\0\6\70\1\166\6\70"+
236
"\3\0\3\70\2\0\1\167\63\0\1\170\71\0\1\171"+
237
"\1\172\34\0\1\173\1\0\1\36\1\0\4\124\1\0"+
238
"\3\125\3\0\15\124\3\0\3\124\16\0\4\174\1\0"+
239
"\3\125\3\0\15\174\3\0\3\174\12\0\1\173\1\0"+
240
"\1\36\1\0\4\124\1\0\3\125\3\0\10\124\1\175"+
241
"\4\124\3\0\3\124\2\0\1\73\13\0\1\127\1\0"+
242
"\1\127\10\0\15\127\3\0\3\127\3\0\1\176\1\0"+
243
"\1\102\2\177\6\0\1\130\1\131\1\132\1\133\7\0"+
244
"\15\130\3\0\3\130\3\0\1\200\1\0\1\102\2\201"+
245
"\1\0\1\202\3\0\1\202\3\131\1\133\7\0\15\131"+
246
"\3\0\3\131\3\0\1\203\1\0\1\102\2\201\1\0"+
247
"\1\202\3\0\1\202\1\132\1\131\1\132\1\133\7\0"+
248
"\15\132\3\0\3\132\3\0\1\204\1\0\1\102\2\177"+
249
"\6\0\4\133\7\0\15\133\3\0\3\133\3\0\1\205"+
250
"\2\0\1\205\7\0\1\135\1\136\1\135\1\136\7\0"+
251
"\15\135\3\0\3\135\3\0\1\205\2\0\1\205\7\0"+
252
"\4\136\7\0\15\136\3\0\3\136\3\0\1\177\1\0"+
253
"\1\102\2\177\6\0\1\137\2\140\1\141\7\0\15\137"+
254
"\3\0\3\137\3\0\1\201\1\0\1\102\2\201\1\0"+
255
"\1\202\3\0\1\202\3\140\1\141\7\0\15\140\3\0"+
256
"\3\140\3\0\1\177\1\0\1\102\2\177\6\0\4\141"+
257
"\7\0\15\141\3\0\3\141\3\0\1\202\2\0\2\202"+
258
"\1\0\1\202\3\0\1\202\3\142\10\0\15\142\3\0"+
259
"\3\142\3\0\1\106\1\0\1\102\2\77\1\0\1\100"+
260
"\3\0\1\100\1\143\2\144\1\145\7\0\15\143\3\0"+
261
"\3\143\3\0\1\101\1\0\1\102\2\103\1\0\1\104"+
262
"\3\0\1\104\3\144\1\145\7\0\15\144\3\0\3\144"+
263
"\3\0\1\106\1\0\1\102\2\77\1\0\1\100\3\0"+
264
"\1\100\4\145\7\0\15\145\3\0\3\145\3\0\1\77"+
265
"\1\0\1\102\2\77\1\0\1\100\3\0\1\100\1\146"+
266
"\2\147\1\150\7\0\15\146\3\0\3\146\3\0\1\103"+
267
"\1\0\1\102\2\103\1\0\1\104\3\0\1\104\3\147"+
268
"\1\150\7\0\15\147\3\0\3\147\3\0\1\77\1\0"+
269
"\1\102\2\77\1\0\1\100\3\0\1\100\4\150\7\0"+
270
"\15\150\3\0\3\150\3\0\1\100\2\0\2\100\1\0"+
271
"\1\100\3\0\1\100\1\151\2\152\1\153\7\0\15\151"+
272
"\3\0\3\151\3\0\1\104\2\0\2\104\1\0\1\104"+
273
"\3\0\1\104\3\152\1\153\7\0\15\152\3\0\3\152"+
274
"\3\0\1\100\2\0\2\100\1\0\1\100\3\0\1\100"+
275
"\4\153\7\0\15\153\3\0\3\153\3\0\1\206\1\0"+
276
"\1\102\2\77\1\0\1\100\3\0\1\100\1\154\1\144"+
277
"\1\155\1\145\7\0\15\154\3\0\3\154\3\0\1\207"+
278
"\1\0\1\102\2\103\1\0\1\104\3\0\1\104\1\155"+
279
"\1\144\1\155\1\145\7\0\15\155\3\0\3\155\3\0"+
280
"\1\204\1\0\1\102\2\177\6\0\1\156\2\131\1\133"+
281
"\7\0\15\156\3\0\3\156\31\0\1\160\54\0\1\210"+
282
"\64\0\1\211\26\0\4\40\7\0\15\40\3\0\1\40"+
283
"\1\212\1\40\31\0\1\165\54\0\1\213\35\0\1\36"+
284
"\1\0\4\124\1\0\3\125\3\0\3\124\1\214\11\124"+
285
"\3\0\3\124\2\0\1\215\102\0\1\172\54\0\1\216"+
286
"\34\0\1\217\52\0\1\173\3\0\4\174\7\0\15\174"+
287
"\3\0\3\174\12\0\1\173\1\0\1\220\1\0\4\124"+
288
"\1\0\3\125\3\0\15\124\3\0\3\124\16\0\1\221"+
289
"\1\133\1\221\1\133\7\0\15\221\3\0\3\221\16\0"+
290
"\4\141\7\0\15\141\3\0\3\141\16\0\4\145\7\0"+
291
"\15\145\3\0\3\145\16\0\4\150\7\0\15\150\3\0"+
292
"\3\150\16\0\4\153\7\0\15\153\3\0\3\153\16\0"+
293
"\1\222\1\145\1\222\1\145\7\0\15\222\3\0\3\222"+
294
"\16\0\4\133\7\0\15\133\3\0\3\133\16\0\4\223"+
295
"\7\0\15\223\3\0\3\223\33\0\1\224\61\0\1\225"+
296
"\30\0\4\40\6\0\1\226\15\40\3\0\2\40\1\227"+
297
"\33\0\1\230\32\0\1\173\1\0\1\36\1\0\4\124"+
298
"\1\0\3\125\3\0\10\124\1\231\4\124\3\0\3\124"+
299
"\2\0\1\232\104\0\1\233\36\0\4\234\7\0\15\234"+
300
"\3\0\3\234\3\0\1\176\1\0\1\102\2\177\6\0"+
301
"\1\221\1\133\1\221\1\133\7\0\15\221\3\0\3\221"+
302
"\3\0\1\206\1\0\1\102\2\77\1\0\1\100\3\0"+
303
"\1\100\1\222\1\145\1\222\1\145\7\0\15\222\3\0"+
304
"\3\222\3\0\1\205\2\0\1\205\7\0\4\223\7\0"+
305
"\15\223\3\0\3\223\34\0\1\235\55\0\1\236\26\0"+
306
"\1\237\60\0\4\40\6\0\1\226\15\40\3\0\3\40"+
307
"\34\0\1\240\31\0\1\173\1\0\1\117\1\0\4\124"+
308
"\1\0\3\125\3\0\15\124\3\0\3\124\34\0\1\241"+
309
"\32\0\1\242\2\0\4\234\7\0\15\234\3\0\3\234"+
310
"\35\0\1\243\62\0\1\244\20\0\1\245\77\0\1\246"+
311
"\53\0\1\247\32\0\1\36\1\0\4\174\1\0\3\125"+
312
"\3\0\15\174\3\0\3\174\36\0\1\250\53\0\1\251"+
313
"\33\0\4\252\7\0\15\252\3\0\3\252\36\0\1\253"+
314
"\53\0\1\254\54\0\1\255\61\0\1\256\11\0\1\257"+
315
"\12\0\4\252\7\0\15\252\3\0\3\252\37\0\1\260"+
316
"\53\0\1\261\54\0\1\262\22\0\1\13\62\0\4\263"+
317
"\7\0\15\263\3\0\3\263\40\0\1\264\53\0\1\265"+
318
"\43\0\1\266\26\0\2\263\1\0\2\263\1\0\2\263"+
319
"\2\0\5\263\7\0\15\263\3\0\4\263\27\0\1\267"+
322
private static int [] zzUnpackTrans() {
323
int [] result = new int[7040];
325
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
329
private static int zzUnpackTrans(String packed, int offset, int [] result) {
330
int i = 0; /* index in packed string */
331
int j = offset; /* index in unpacked array */
332
int l = packed.length();
334
int count = packed.charAt(i++);
335
int value = packed.charAt(i++);
337
do result[j++] = value; while (--count > 0);
344
private static final int ZZ_UNKNOWN_ERROR = 0;
345
private static final int ZZ_NO_MATCH = 1;
346
private static final int ZZ_PUSHBACK_2BIG = 2;
348
/* error messages for the codes above */
349
private static final String ZZ_ERROR_MSG[] = {
350
"Unkown internal scanner error",
351
"Error: could not match input",
352
"Error: pushback value was too large"
356
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
358
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
360
private static final String ZZ_ATTRIBUTE_PACKED_0 =
361
"\12\0\1\11\7\1\1\11\3\1\1\11\6\1\1\11"+
362
"\2\1\1\11\14\1\1\11\6\1\2\11\3\0\1\11"+
363
"\14\0\2\1\2\11\1\1\1\0\2\1\1\11\1\0"+
364
"\1\1\1\0\1\1\3\0\7\1\2\0\1\1\1\0"+
365
"\15\1\3\0\1\1\1\11\3\0\1\1\1\11\5\0"+
366
"\1\1\4\0\1\1\2\0\2\1\2\0\1\1\5\0"+
367
"\1\11\3\1\3\0\1\1\2\0\1\11\30\0\1\1"+
370
private static int [] zzUnpackAttribute() {
371
int [] result = new int[184];
373
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
377
private static int zzUnpackAttribute(String packed, int offset, int [] result) {
378
int i = 0; /* index in packed string */
379
int j = offset; /* index in unpacked array */
380
int l = packed.length();
382
int count = packed.charAt(i++);
383
int value = packed.charAt(i++);
384
do result[j++] = value; while (--count > 0);
389
/** the input device */
390
private java.io.Reader zzReader;
392
/** the current state of the DFA */
395
/** the current lexical state */
396
private int zzLexicalState = YYINITIAL;
398
/** this buffer contains the current text to be matched and is
399
the source of the yytext() string */
400
private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
402
/** the textposition at the last accepting state */
403
private int zzMarkedPos;
405
/** the current text position in the buffer */
406
private int zzCurrentPos;
408
/** startRead marks the beginning of the yytext() string in the buffer */
409
private int zzStartRead;
411
/** endRead marks the last character in the buffer, that has been read
413
private int zzEndRead;
415
/** number of newlines encountered up to the start of the matched text */
418
/** the number of characters up to the start of the matched text */
422
* the number of characters from the last newline up to the start of the
425
private int yycolumn;
428
* zzAtBOL == true <=> the scanner is currently at the beginning of a line
430
private boolean zzAtBOL = true;
432
/** zzAtEOF == true <=> the scanner is at the EOF */
433
private boolean zzAtEOF;
435
/** denotes if the user-EOF-code has already been executed */
436
private boolean zzEOFDone;
440
public static final int ALPHANUM = WikipediaTokenizer.ALPHANUM_ID;
441
public static final int APOSTROPHE = WikipediaTokenizer.APOSTROPHE_ID;
442
public static final int ACRONYM = WikipediaTokenizer.ACRONYM_ID;
443
public static final int COMPANY = WikipediaTokenizer.COMPANY_ID;
444
public static final int EMAIL = WikipediaTokenizer.EMAIL_ID;
445
public static final int HOST = WikipediaTokenizer.HOST_ID;
446
public static final int NUM = WikipediaTokenizer.NUM_ID;
447
public static final int CJ = WikipediaTokenizer.CJ_ID;
448
public static final int INTERNAL_LINK = WikipediaTokenizer.INTERNAL_LINK_ID;
449
public static final int EXTERNAL_LINK = WikipediaTokenizer.EXTERNAL_LINK_ID;
450
public static final int CITATION = WikipediaTokenizer.CITATION_ID;
451
public static final int CATEGORY = WikipediaTokenizer.CATEGORY_ID;
452
public static final int BOLD = WikipediaTokenizer.BOLD_ID;
453
public static final int ITALICS = WikipediaTokenizer.ITALICS_ID;
454
public static final int BOLD_ITALICS = WikipediaTokenizer.BOLD_ITALICS_ID;
455
public static final int HEADING = WikipediaTokenizer.HEADING_ID;
456
public static final int SUB_HEADING = WikipediaTokenizer.SUB_HEADING_ID;
457
public static final int EXTERNAL_LINK_URL = WikipediaTokenizer.EXTERNAL_LINK_URL_ID;
460
private int currentTokType;
461
private int numBalanced = 0;
462
private int positionInc = 1;
463
private int numLinkToks = 0;
464
//Anytime we start a new on a Wiki reserved token (category, link, etc.) this value will be 0, otherwise it will be the number of tokens seen
465
//this can be useful for detecting when a new reserved token is encountered
466
//see https://issues.apache.org/jira/browse/LUCENE-1133
467
private int numWikiTokensSeen = 0;
469
public static final String [] TOKEN_TYPES = WikipediaTokenizer.TOKEN_TYPES;
472
Returns the number of tokens seen inside a category or link, etc.
473
@return the number of tokens seen inside the context of wiki syntax.
475
public final int getNumWikiTokensSeen(){
476
return numWikiTokensSeen;
479
public final int yychar()
484
public final int getPositionIncrement(){
489
* Fills Lucene token with the current token text.
491
final void getText(CharTermAttribute t) {
492
t.copyBuffer(zzBuffer, zzStartRead, zzMarkedPos-zzStartRead);
495
final int setText(StringBuilder buffer){
496
int length = zzMarkedPos - zzStartRead;
497
buffer.append(zzBuffer, zzStartRead, length);
505
* Creates a new scanner
506
* There is also a java.io.InputStream version of this constructor.
508
* @param in the java.io.Reader to read input from.
510
WikipediaTokenizerImpl(java.io.Reader in) {
515
* Creates a new scanner.
516
* There is also java.io.Reader version of this constructor.
518
* @param in the java.io.Inputstream to read input from.
520
WikipediaTokenizerImpl(java.io.InputStream in) {
521
this(new java.io.InputStreamReader(in));
525
* Unpacks the compressed character translation table.
527
* @param packed the packed character translation table
528
* @return the unpacked character translation table
530
private static char [] zzUnpackCMap(String packed) {
531
char [] map = new char[0x10000];
532
int i = 0; /* index in packed string */
533
int j = 0; /* index in unpacked array */
535
int count = packed.charAt(i++);
536
char value = packed.charAt(i++);
537
do map[j++] = value; while (--count > 0);
544
* Refills the input buffer.
546
* @return <code>false</code>, iff there was new input.
548
* @exception java.io.IOException if any I/O-Error occurs
550
private boolean zzRefill() throws java.io.IOException {
552
/* first: make room (if you can) */
553
if (zzStartRead > 0) {
554
System.arraycopy(zzBuffer, zzStartRead,
556
zzEndRead-zzStartRead);
558
/* translate stored positions */
559
zzEndRead-= zzStartRead;
560
zzCurrentPos-= zzStartRead;
561
zzMarkedPos-= zzStartRead;
565
/* is the buffer big enough? */
566
if (zzCurrentPos >= zzBuffer.length) {
567
/* if not: blow it up */
568
char newBuffer[] = new char[zzCurrentPos*2];
569
System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
570
zzBuffer = newBuffer;
573
/* finally: fill the buffer with new input */
574
int numRead = zzReader.read(zzBuffer, zzEndRead,
575
zzBuffer.length-zzEndRead);
581
// unlikely but not impossible: read 0 characters, but not at end of stream
583
int c = zzReader.read();
587
zzBuffer[zzEndRead++] = (char) c;
598
* Closes the input stream.
600
public final void yyclose() throws java.io.IOException {
601
zzAtEOF = true; /* indicate end of file */
602
zzEndRead = zzStartRead; /* invalidate buffer */
604
if (zzReader != null)
610
* Resets the scanner to read from a new input stream.
611
* Does not close the old reader.
613
* All internal variables are reset, the old input stream
614
* <b>cannot</b> be reused (internal buffer is discarded and lost).
615
* Lexical state is set to <tt>ZZ_INITIAL</tt>.
617
* Internal scan buffer is resized down to its initial length, if it has grown.
619
* @param reader the new input stream
621
public final void yyreset(java.io.Reader reader) {
626
zzEndRead = zzStartRead = 0;
627
zzCurrentPos = zzMarkedPos = 0;
628
yyline = yychar = yycolumn = 0;
629
zzLexicalState = YYINITIAL;
630
if (zzBuffer.length > ZZ_BUFFERSIZE)
631
zzBuffer = new char[ZZ_BUFFERSIZE];
636
* Returns the current lexical state.
638
public final int yystate() {
639
return zzLexicalState;
644
* Enters a new lexical state
646
* @param newState the new lexical state
648
public final void yybegin(int newState) {
649
zzLexicalState = newState;
654
* Returns the text matched by the current regular expression.
656
public final String yytext() {
657
return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
662
* Returns the character at position <tt>pos</tt> from the
665
* It is equivalent to yytext().charAt(pos), but faster
667
* @param pos the position of the character to fetch.
668
* A value from 0 to yylength()-1.
670
* @return the character at position pos
672
public final char yycharat(int pos) {
673
return zzBuffer[zzStartRead+pos];
678
* Returns the length of the matched text region.
680
public final int yylength() {
681
return zzMarkedPos-zzStartRead;
686
* Reports an error that occured while scanning.
688
* In a wellformed scanner (no or only correct usage of
689
* yypushback(int) and a match-all fallback rule) this method
690
* will only be called with things that "Can't Possibly Happen".
691
* If this method is called, something is seriously wrong
692
* (e.g. a JFlex bug producing a faulty scanner etc.).
694
* Usual syntax/scanner level error handling should be done
695
* in error fallback rules.
697
* @param errorCode the code of the errormessage to display
699
private void zzScanError(int errorCode) {
702
message = ZZ_ERROR_MSG[errorCode];
704
catch (ArrayIndexOutOfBoundsException e) {
705
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
708
throw new Error(message);
713
* Pushes the specified amount of characters back into the input stream.
715
* They will be read again by then next call of the scanning method
717
* @param number the number of characters to be read again.
718
* This number must not be greater than yylength()!
720
public void yypushback(int number) {
721
if ( number > yylength() )
722
zzScanError(ZZ_PUSHBACK_2BIG);
724
zzMarkedPos -= number;
729
* Resumes scanning until the next regular expression is matched,
730
* the end of input is encountered or an I/O-Error occurs.
732
* @return the next token
733
* @exception java.io.IOException if any I/O-Error occurs
735
public int getNextToken() throws java.io.IOException {
742
int zzEndReadL = zzEndRead;
743
char [] zzBufferL = zzBuffer;
744
char [] zzCMapL = ZZ_CMAP;
746
int [] zzTransL = ZZ_TRANS;
747
int [] zzRowMapL = ZZ_ROWMAP;
748
int [] zzAttrL = ZZ_ATTRIBUTE;
751
zzMarkedPosL = zzMarkedPos;
753
yychar+= zzMarkedPosL-zzStartRead;
757
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
759
zzState = ZZ_LEXSTATE[zzLexicalState];
761
// set up zzAction for empty match case:
762
int zzAttributes = zzAttrL[zzState];
763
if ( (zzAttributes & 1) == 1 ) {
771
if (zzCurrentPosL < zzEndReadL)
772
zzInput = zzBufferL[zzCurrentPosL++];
778
// store back cached positions
779
zzCurrentPos = zzCurrentPosL;
780
zzMarkedPos = zzMarkedPosL;
781
boolean eof = zzRefill();
782
// get translated positions and possibly new buffer
783
zzCurrentPosL = zzCurrentPos;
784
zzMarkedPosL = zzMarkedPos;
785
zzBufferL = zzBuffer;
786
zzEndReadL = zzEndRead;
792
zzInput = zzBufferL[zzCurrentPosL++];
795
int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
796
if (zzNext == -1) break zzForAction;
799
zzAttributes = zzAttrL[zzState];
800
if ( (zzAttributes & 1) == 1 ) {
802
zzMarkedPosL = zzCurrentPosL;
803
if ( (zzAttributes & 8) == 8 ) break zzForAction;
809
// store back cached position
810
zzMarkedPos = zzMarkedPosL;
812
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
814
{ numWikiTokensSeen = 0; positionInc = 1; currentTokType = CATEGORY; yybegin(CATEGORY_STATE);/* Break so we don't hit fall-through warning: */ break;
818
{ currentTokType = BOLD_ITALICS; yybegin(FIVE_SINGLE_QUOTES_STATE); /* Break so we don't hit fall-through warning: */ break;
822
{ currentTokType = HEADING; yybegin(DOUBLE_EQUALS_STATE); numWikiTokensSeen++; return currentTokType;
826
{ numBalanced = 0; numWikiTokensSeen = 0; currentTokType = EXTERNAL_LINK;yybegin(EXTERNAL_LINK_STATE); /* Break so we don't hit fall-through warning: */ break;
830
{ positionInc = 1; return ACRONYM;
834
{ positionInc = 1; /* Break so we don't hit fall-through warning: */ break;
838
{ positionInc = 1; return COMPANY;
842
{ numLinkToks = 0; positionInc = 0; yybegin(YYINITIAL); /* Break so we don't hit fall-through warning: */ break;
846
{ currentTokType = SUB_HEADING; numWikiTokensSeen = 0; yybegin(STRING); /* Break so we don't hit fall-through warning: */ break;
850
{ numWikiTokensSeen = 0; positionInc = 1; if (numBalanced == 0){numBalanced++;yybegin(TWO_SINGLE_QUOTES_STATE);} else{numBalanced = 0;}/* Break so we don't hit fall-through warning: */ break;
854
{ positionInc = 1; return NUM;
858
{ positionInc = 1; return APOSTROPHE;
862
{ yybegin(STRING); return currentTokType;/*pipe*/
866
{ /* Break so we don't hit fall-through warning: */ break;/* ignore STRING */
870
{ positionInc = 1; return ALPHANUM;
874
{ numWikiTokensSeen = 0; positionInc = 1; /* Break so we don't hit fall-through warning: */ break;
878
{ yybegin(DOUBLE_BRACE_STATE); numWikiTokensSeen = 0; return currentTokType;
882
{ numBalanced = 0;currentTokType = ALPHANUM; yybegin(YYINITIAL); /* Break so we don't hit fall-through warning: */ break;/*end sub header*/
886
{ currentTokType = INTERNAL_LINK; numWikiTokensSeen = 0; yybegin(INTERNAL_LINK_STATE); /* Break so we don't hit fall-through warning: */ break;
890
{ numBalanced = 0; numWikiTokensSeen = 0; currentTokType = CATEGORY;yybegin(CATEGORY_STATE); /* Break so we don't hit fall-through warning: */ break;
894
{ numLinkToks = 0; yybegin(YYINITIAL); /* Break so we don't hit fall-through warning: */ break;
898
{ numWikiTokensSeen = 0; positionInc = 1; currentTokType = EXTERNAL_LINK_URL; yybegin(EXTERNAL_LINK_STATE);/* Break so we don't hit fall-through warning: */ break;
902
{ numBalanced = 0;currentTokType = ALPHANUM;yybegin(YYINITIAL); /* Break so we don't hit fall-through warning: */ break;/*end bold*/
906
{ currentTokType = EXTERNAL_LINK; numWikiTokensSeen = 0; yybegin(EXTERNAL_LINK_STATE); /* Break so we don't hit fall-through warning: */ break;
910
{ positionInc = 1; return CJ;
914
{ currentTokType = CATEGORY; numWikiTokensSeen = 0; yybegin(CATEGORY_STATE); /* Break so we don't hit fall-through warning: */ break;
918
{ yybegin(CATEGORY_STATE); numWikiTokensSeen++; return currentTokType;
922
{ currentTokType = BOLD; yybegin(THREE_SINGLE_QUOTES_STATE); /* Break so we don't hit fall-through warning: */ break;
926
{ numWikiTokensSeen = 0; positionInc = 1; currentTokType = CITATION; yybegin(DOUBLE_BRACE_STATE);/* Break so we don't hit fall-through warning: */ break;
930
{ /* Break so we don't hit fall-through warning: */ break;/* ignore */
934
{ yybegin(STRING); numWikiTokensSeen++; return currentTokType;/* STRING ALPHANUM*/
938
{ positionInc = 1; numWikiTokensSeen++; yybegin(EXTERNAL_LINK_STATE); return currentTokType;
942
{ numBalanced = 0;currentTokType = ALPHANUM; yybegin(YYINITIAL); /* Break so we don't hit fall-through warning: */ break;/*end bold italics*/
946
{ yybegin(YYINITIAL); /* Break so we don't hit fall-through warning: */ break;
950
{ yybegin(STRING); numWikiTokensSeen++; return currentTokType;
954
{ if (numLinkToks == 0){positionInc = 0;} else{positionInc = 1;} numWikiTokensSeen++; currentTokType = EXTERNAL_LINK; yybegin(EXTERNAL_LINK_STATE); numLinkToks++; return currentTokType;
958
{ yybegin(INTERNAL_LINK_STATE); numWikiTokensSeen++; return currentTokType;
962
{ positionInc = 1; return EMAIL;
966
{ currentTokType = INTERNAL_LINK; numWikiTokensSeen = 0; yybegin(INTERNAL_LINK_STATE); /* Break so we don't hit fall-through warning: */ break;
970
{ numWikiTokensSeen = 0; positionInc = 1; yybegin(DOUBLE_EQUALS_STATE);/* Break so we don't hit fall-through warning: */ break;
974
{ positionInc = 1; return HOST;
978
{ numBalanced = 0; numWikiTokensSeen = 0; currentTokType = INTERNAL_LINK;yybegin(INTERNAL_LINK_STATE); /* Break so we don't hit fall-through warning: */ break;
982
{ currentTokType = ITALICS; numWikiTokensSeen++; yybegin(STRING); return currentTokType;/*italics*/
986
{ numWikiTokensSeen = 0; positionInc = 1; currentTokType = INTERNAL_LINK; yybegin(INTERNAL_LINK_STATE);/* Break so we don't hit fall-through warning: */ break;
990
{ numBalanced = 0;currentTokType = ALPHANUM; yybegin(YYINITIAL); /* Break so we don't hit fall-through warning: */ break;/*end italics*/
994
{ yybegin(YYINITIAL);/* Break so we don't hit fall-through warning: */ break;
998
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
1003
zzScanError(ZZ_NO_MATCH);