source: other-projects/rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/modes/PythonTokenMaker.java@ 25584

Last change on this file since 25584 was 25584, checked in by davidb, 12 years ago

Initial cut an a text edit area for GLI that supports color syntax highlighting

File size: 37.5 KB
Line 
1/* The following code was generated by JFlex 1.4.1 on 10/16/06 10:31 AM */
2
3/*
4 * 12/06/2005
5 *
6 * PythonTokenMaker.java - Token maker for the Python programming language.
7 *
8 * This library is distributed under a modified BSD license. See the included
9 * RSyntaxTextArea.License.txt file for details.
10 */
11package org.fife.ui.rsyntaxtextarea.modes;
12
13import java.io.*;
14import javax.swing.text.Segment;
15
16import org.fife.ui.rsyntaxtextarea.AbstractJFlexTokenMaker;
17import org.fife.ui.rsyntaxtextarea.DefaultToken;
18import org.fife.ui.rsyntaxtextarea.Token;
19import org.fife.ui.rsyntaxtextarea.TokenMaker;
20
21
22/**
23 * Scanner for the Python programming language.
24 *
25 * @author Robert Futrell
26 * @version 0.3
27 */
28
29public class PythonTokenMaker extends AbstractJFlexTokenMaker implements TokenMaker {
30
31 /** This character denotes the end of file */
32 public static final int YYEOF = -1;
33
34 /** lexical states */
35 public static final int YYINITIAL = 0;
36 public static final int LONG_STRING_2 = 2;
37 public static final int LONG_STRING_1 = 1;
38
39 /**
40 * Translates characters to character classes
41 */
42 private static final String ZZ_CMAP_PACKED =
43 "\11\0\1\34\1\12\1\0\1\34\1\32\22\0\1\34\1\64\1\11"+
44 "\1\33\1\0\1\63\1\67\1\10\1\57\1\57\1\62\1\61\1\64"+
45 "\1\27\1\24\1\63\1\16\7\21\2\3\1\64\1\72\1\65\1\60"+
46 "\1\66\1\64\1\71\4\23\1\26\1\23\3\2\1\31\1\2\1\15"+
47 "\5\2\1\6\2\2\1\7\2\2\1\20\2\2\1\57\1\13\1\57"+
48 "\1\64\1\1\1\0\1\35\1\42\1\44\1\37\1\25\1\22\1\52"+
49 "\1\54\1\46\1\30\1\43\1\14\1\51\1\36\1\45\1\47\1\2"+
50 "\1\4\1\40\1\41\1\5\1\55\1\53\1\17\1\50\1\56\1\57"+
51 "\1\70\1\57\1\64\uff81\0";
52
53 /**
54 * Translates characters to character classes
55 */
56 private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
57
58 /**
59 * Translates DFA states to action switch labels.
60 */
61 private static final int [] ZZ_ACTION = zzUnpackAction();
62
63 private static final String ZZ_ACTION_PACKED_0 =
64 "\3\0\1\1\1\2\1\3\4\2\2\4\1\5\1\2"+
65 "\1\3\2\2\1\6\1\2\1\6\1\7\1\10\21\2"+
66 "\1\11\10\6\1\2\2\12\2\4\1\13\1\3\1\14"+
67 "\1\13\1\14\4\2\2\4\1\0\2\4\1\0\4\2"+
68 "\1\13\1\3\1\13\12\2\1\15\27\2\1\15\3\2"+
69 "\2\15\1\16\1\15\15\2\3\0\2\14\1\0\12\2"+
70 "\1\4\1\17\1\20\3\2\1\3\15\2\1\15\22\2"+
71 "\1\21\14\2\1\22\1\23\1\14\6\2\1\21\3\2"+
72 "\1\15\36\2\1\15\17\2\1\15\6\2";
73
74 private static int [] zzUnpackAction() {
75 int [] result = new int[265];
76 int offset = 0;
77 offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
78 return result;
79 }
80
81 private static int zzUnpackAction(String packed, int offset, int [] result) {
82 int i = 0; /* index in packed string */
83 int j = offset; /* index in unpacked array */
84 int l = packed.length();
85 while (i < l) {
86 int count = packed.charAt(i++);
87 int value = packed.charAt(i++);
88 do result[j++] = value; while (--count > 0);
89 }
90 return j;
91 }
92
93
94 /**
95 * Translates a state to a row index in the transition table
96 */
97 private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
98
99 private static final String ZZ_ROWMAP_PACKED_0 =
100 "\0\0\0\73\0\166\0\261\0\354\0\u0127\0\u0162\0\u019d"+
101 "\0\u01d8\0\u0213\0\u024e\0\u0289\0\261\0\u02c4\0\u02ff\0\u033a"+
102 "\0\u0375\0\u03b0\0\u03eb\0\u0426\0\u0461\0\u049c\0\u04d7\0\u0512"+
103 "\0\u054d\0\u0588\0\u05c3\0\u05fe\0\u0639\0\u0674\0\u06af\0\u06ea"+
104 "\0\u0725\0\u0760\0\u079b\0\u07d6\0\u0811\0\u084c\0\u0887\0\261"+
105 "\0\u08c2\0\u08fd\0\u0938\0\261\0\u0973\0\u09ae\0\u09e9\0\u0a24"+
106 "\0\261\0\u0a5f\0\u0a9a\0\u0ad5\0\u0b10\0\u0b4b\0\u0b4b\0\u0b86"+
107 "\0\u0bc1\0\u0b4b\0\u0bfc\0\u0c37\0\u0c72\0\u0cad\0\u0ce8\0\u0d23"+
108 "\0\u0d5e\0\u0d99\0\u0dd4\0\u0e0f\0\u0e4a\0\u0e85\0\u0ec0\0\u0efb"+
109 "\0\u0f36\0\u0f71\0\u0fac\0\u0fe7\0\u1022\0\u105d\0\u1098\0\u10d3"+
110 "\0\u110e\0\u1149\0\u1184\0\u11bf\0\u11fa\0\u1235\0\u1270\0\u12ab"+
111 "\0\u12e6\0\u1321\0\u135c\0\u1397\0\u13d2\0\u140d\0\u1448\0\u1483"+
112 "\0\u14be\0\u14f9\0\u1534\0\u156f\0\u15aa\0\u15e5\0\u1620\0\u165b"+
113 "\0\u1696\0\u16d1\0\u170c\0\u1747\0\u1782\0\u17bd\0\u17f8\0\u1833"+
114 "\0\u186e\0\354\0\u18a9\0\354\0\u18e4\0\u191f\0\u195a\0\u1995"+
115 "\0\u19d0\0\u1a0b\0\u1a46\0\u1a81\0\u1abc\0\u1af7\0\u1b32\0\u1b6d"+
116 "\0\u1ba8\0\u1be3\0\u1c1e\0\u1c59\0\u1c94\0\261\0\u1ccf\0\u1d0a"+
117 "\0\u1d45\0\u1d80\0\u1dbb\0\u1df6\0\u1e31\0\u1e6c\0\u1ea7\0\u1ee2"+
118 "\0\u1f1d\0\u1f58\0\261\0\261\0\261\0\u1f93\0\u1fce\0\u2009"+
119 "\0\u2044\0\u207f\0\u20ba\0\u20f5\0\u2130\0\u216b\0\u21a6\0\u21e1"+
120 "\0\u221c\0\u2257\0\u2292\0\u22cd\0\u2308\0\u2343\0\u237e\0\u23b9"+
121 "\0\u23f4\0\u242f\0\u237e\0\u246a\0\u24a5\0\u24e0\0\u251b\0\u2556"+
122 "\0\u2591\0\u25cc\0\u2607\0\u2642\0\u267d\0\u26b8\0\u26f3\0\u272e"+
123 "\0\u2769\0\u27a4\0\u27df\0\u281a\0\u2855\0\u2890\0\u28cb\0\u2906"+
124 "\0\u2941\0\u297c\0\u29b7\0\u29f2\0\u2a2d\0\u2a68\0\261\0\261"+
125 "\0\u2aa3\0\u2ade\0\u2b19\0\u2b54\0\u17bd\0\u2b8f\0\u2bca\0\354"+
126 "\0\u2c05\0\u2c40\0\u2c7b\0\u2cb6\0\u2cf1\0\u2d2c\0\u2d67\0\u2da2"+
127 "\0\u2ddd\0\u2e18\0\u2e53\0\u2e8e\0\u2ec9\0\u2f04\0\u2f3f\0\u2f7a"+
128 "\0\u2fb5\0\u2ff0\0\u302b\0\u3066\0\u30a1\0\u30dc\0\u3117\0\u3152"+
129 "\0\u318d\0\u31c8\0\u3203\0\u323e\0\u3279\0\u32b4\0\u32ef\0\u332a"+
130 "\0\u3365\0\u33a0\0\u33db\0\u3416\0\u3451\0\u348c\0\u34c7\0\u3502"+
131 "\0\u353d\0\u3578\0\u35b3\0\u35ee\0\u33db\0\u3629\0\u3664\0\u369f"+
132 "\0\u36da\0\u3715\0\u1270\0\u3750\0\u378b\0\u37c6\0\u3801\0\u383c"+
133 "\0\u3877";
134
135 private static int [] zzUnpackRowMap() {
136 int [] result = new int[265];
137 int offset = 0;
138 offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
139 return result;
140 }
141
142 private static int zzUnpackRowMap(String packed, int offset, int [] result) {
143 int i = 0; /* index in packed string */
144 int j = offset; /* index in unpacked array */
145 int l = packed.length();
146 while (i < l) {
147 int high = packed.charAt(i++) << 16;
148 result[j++] = high | packed.charAt(i++);
149 }
150 return j;
151 }
152
153 /**
154 * The transition table of the DFA
155 */
156 private static final int [] ZZ_TRANS = zzUnpackTrans();
157
158 private static final String ZZ_TRANS_PACKED_0 =
159 "\1\4\2\5\1\6\1\7\1\10\1\11\1\12\1\13"+
160 "\1\14\1\15\1\4\1\16\1\5\1\17\1\20\1\5"+
161 "\1\6\1\21\1\5\1\22\1\23\1\5\1\24\2\5"+
162 "\1\4\1\25\1\26\1\27\1\30\1\31\1\32\1\33"+
163 "\1\34\1\5\1\35\1\36\1\37\1\40\1\41\1\42"+
164 "\1\43\1\44\1\45\1\46\1\47\1\50\1\51\1\52"+
165 "\1\53\1\51\1\54\1\55\1\56\1\57\1\60\2\61"+
166 "\10\62\1\63\62\62\11\64\1\65\61\64\74\0\7\5"+
167 "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\22\5"+
168 "\14\0\3\66\1\6\4\66\3\0\1\66\2\67\1\6"+
169 "\2\66\1\6\2\66\1\70\2\71\1\0\2\72\1\0"+
170 "\1\66\1\0\22\66\12\0\1\66\2\0\7\5\1\13"+
171 "\1\14\2\0\10\5\1\0\1\73\1\5\1\0\2\5"+
172 "\3\0\1\74\7\5\1\75\11\5\15\0\3\5\1\11"+
173 "\1\5\1\11\1\5\1\13\1\14\2\0\10\5\1\0"+
174 "\2\5\1\0\2\5\3\0\1\5\1\76\20\5\15\0"+
175 "\7\5\1\13\1\14\2\0\10\5\1\0\2\5\1\0"+
176 "\2\5\3\0\22\5\15\0\3\5\1\11\1\5\1\11"+
177 "\1\5\1\13\1\14\2\0\10\5\1\0\2\5\1\0"+
178 "\2\5\3\0\22\5\14\0\10\77\1\100\1\77\1\0"+
179 "\1\101\57\77\11\102\1\103\1\0\1\104\57\102\1\0"+
180 "\7\5\4\0\10\5\1\0\1\105\1\5\1\0\2\5"+
181 "\3\0\1\106\7\5\1\107\1\110\10\5\14\0\3\66"+
182 "\1\111\4\66\3\0\1\66\2\67\1\112\2\113\1\112"+
183 "\2\66\1\70\2\71\1\0\2\72\1\0\1\66\1\0"+
184 "\22\66\12\0\1\66\2\0\3\5\1\114\3\5\4\0"+
185 "\10\5\1\0\2\5\1\0\2\5\3\0\22\5\15\0"+
186 "\3\5\1\115\3\5\4\0\1\116\7\5\1\0\2\5"+
187 "\1\0\2\5\3\0\10\5\1\117\1\120\10\5\17\0"+
188 "\1\70\12\0\1\70\2\0\1\70\52\0\7\5\4\0"+
189 "\1\121\2\5\1\122\4\5\1\0\2\5\1\0\2\5"+
190 "\3\0\1\5\1\123\16\5\1\124\1\5\43\0\1\54"+
191 "\30\0\1\54\12\0\12\25\1\0\60\25\34\0\1\26"+
192 "\37\0\7\5\4\0\10\5\1\0\2\5\1\0\2\5"+
193 "\3\0\1\5\1\125\1\5\1\126\1\5\1\127\4\5"+
194 "\1\130\7\5\15\0\7\5\4\0\10\5\1\0\2\5"+
195 "\1\0\2\5\3\0\10\5\1\131\11\5\15\0\7\5"+
196 "\4\0\10\5\1\0\1\132\1\5\1\0\2\5\3\0"+
197 "\10\5\1\133\1\134\10\5\15\0\4\5\1\135\2\5"+
198 "\4\0\1\136\7\5\1\0\1\137\1\5\1\0\2\5"+
199 "\3\0\4\5\1\140\4\5\1\141\5\5\1\142\2\5"+
200 "\15\0\3\5\1\143\1\144\2\5\4\0\10\5\1\0"+
201 "\2\5\1\0\2\5\3\0\13\5\1\145\6\5\15\0"+
202 "\3\5\1\146\1\147\2\5\4\0\10\5\1\0\2\5"+
203 "\1\0\2\5\3\0\10\5\1\150\11\5\15\0\7\5"+
204 "\4\0\1\151\7\5\1\0\2\5\1\0\2\5\3\0"+
205 "\1\152\7\5\1\153\3\5\1\154\2\5\1\155\2\5"+
206 "\15\0\3\5\1\156\3\5\4\0\10\5\1\0\2\5"+
207 "\1\0\2\5\3\0\5\5\1\157\1\5\1\160\2\5"+
208 "\1\161\7\5\15\0\7\5\4\0\6\5\1\162\1\5"+
209 "\1\0\2\5\1\0\2\5\3\0\1\5\1\163\1\164"+
210 "\1\165\1\166\7\5\1\167\5\5\15\0\3\5\1\170"+
211 "\3\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0"+
212 "\1\171\7\5\1\172\11\5\15\0\7\5\4\0\10\5"+
213 "\1\0\2\5\1\0\2\5\3\0\11\5\1\173\10\5"+
214 "\15\0\7\5\4\0\10\5\1\0\2\5\1\0\2\5"+
215 "\3\0\1\174\10\5\1\105\10\5\15\0\7\5\4\0"+
216 "\1\175\7\5\1\0\1\137\1\5\1\0\2\5\3\0"+
217 "\22\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0"+
218 "\2\5\3\0\17\5\1\176\2\5\15\0\7\5\4\0"+
219 "\10\5\1\0\1\177\1\5\1\0\2\5\3\0\1\200"+
220 "\21\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0"+
221 "\2\5\3\0\1\201\7\5\1\202\11\5\15\0\7\5"+
222 "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\11\5"+
223 "\1\154\10\5\74\0\1\54\72\0\2\54\71\0\1\54"+
224 "\1\0\1\54\75\0\1\51\73\0\1\51\73\0\1\54"+
225 "\73\0\1\54\2\0\10\62\1\0\62\62\10\0\1\203"+
226 "\62\0\11\64\1\0\61\64\11\0\1\204\61\0\10\66"+
227 "\3\0\11\66\1\0\2\66\1\0\2\66\1\0\1\66"+
228 "\1\0\22\66\12\0\1\66\4\0\1\70\12\0\1\70"+
229 "\2\0\1\70\3\0\2\205\1\0\2\206\41\0\3\66"+
230 "\1\207\4\66\3\0\3\66\1\207\2\66\1\207\2\66"+
231 "\1\0\2\66\1\210\2\66\1\0\1\66\1\0\22\66"+
232 "\2\0\1\210\7\0\1\66\2\0\7\5\4\0\1\211"+
233 "\7\5\1\0\2\5\1\0\2\5\3\0\2\5\1\212"+
234 "\1\5\1\213\5\5\1\214\7\5\15\0\7\5\4\0"+
235 "\10\5\1\0\2\5\1\0\2\5\3\0\1\5\1\215"+
236 "\7\5\1\216\4\5\1\217\3\5\15\0\4\5\1\220"+
237 "\2\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0"+
238 "\22\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0"+
239 "\2\5\3\0\3\5\1\221\5\5\1\222\10\5\14\0"+
240 "\10\77\1\223\1\77\1\0\1\101\57\77\10\0\1\224"+
241 "\62\0\12\77\1\0\60\77\11\102\1\223\1\0\1\104"+
242 "\57\102\11\0\1\225\61\0\12\102\1\0\60\102\1\0"+
243 "\7\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0"+
244 "\1\5\1\164\20\5\15\0\7\5\4\0\10\5\1\0"+
245 "\2\5\1\0\2\5\3\0\14\5\1\226\5\5\15\0"+
246 "\7\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0"+
247 "\1\5\1\227\5\5\1\230\12\5\15\0\7\5\4\0"+
248 "\10\5\1\0\2\5\1\0\2\5\3\0\3\5\1\160"+
249 "\16\5\14\0\3\66\1\111\4\66\3\0\3\66\1\111"+
250 "\2\66\1\111\2\66\1\70\2\71\1\0\2\72\1\0"+
251 "\1\66\1\0\22\66\12\0\1\66\1\0\3\66\1\111"+
252 "\4\66\3\0\1\66\2\67\1\112\2\66\1\112\2\66"+
253 "\1\70\2\71\1\0\2\72\1\0\1\66\1\0\22\66"+
254 "\12\0\1\66\1\0\3\66\1\231\4\66\3\0\3\66"+
255 "\1\231\2\66\3\231\1\0\2\231\1\0\2\66\1\0"+
256 "\1\66\1\0\1\231\1\66\1\231\2\66\1\231\1\66"+
257 "\1\231\12\66\12\0\1\66\2\0\7\5\4\0\10\5"+
258 "\1\0\2\5\1\0\2\5\3\0\1\232\21\5\15\0"+
259 "\7\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0"+
260 "\10\5\1\233\11\5\15\0\7\5\4\0\10\5\1\0"+
261 "\2\5\1\0\2\5\3\0\10\5\1\234\11\5\15\0"+
262 "\3\5\1\162\3\5\4\0\10\5\1\0\2\5\1\0"+
263 "\2\5\3\0\22\5\15\0\7\5\4\0\1\235\7\5"+
264 "\1\0\2\5\1\0\2\5\3\0\1\5\1\236\20\5"+
265 "\15\0\7\5\4\0\10\5\1\0\2\5\1\0\2\5"+
266 "\3\0\3\5\1\237\5\5\1\240\10\5\15\0\7\5"+
267 "\4\0\10\5\1\0\1\241\1\5\1\0\2\5\3\0"+
268 "\7\5\1\242\12\5\15\0\4\5\1\243\2\5\4\0"+
269 "\10\5\1\0\2\5\1\0\2\5\3\0\22\5\15\0"+
270 "\7\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0"+
271 "\1\244\21\5\15\0\7\5\4\0\10\5\1\0\2\5"+
272 "\1\0\2\5\3\0\2\5\1\162\17\5\15\0\7\5"+
273 "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\3\5"+
274 "\1\245\16\5\15\0\7\5\4\0\10\5\1\0\2\5"+
275 "\1\0\2\5\3\0\3\5\1\164\16\5\15\0\7\5"+
276 "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\12\5"+
277 "\1\246\7\5\15\0\7\5\4\0\10\5\1\0\2\5"+
278 "\1\0\2\5\3\0\4\5\1\162\15\5\15\0\7\5"+
279 "\4\0\1\247\5\5\1\162\1\5\1\0\2\5\1\0"+
280 "\2\5\3\0\22\5\15\0\4\5\1\250\2\5\4\0"+
281 "\10\5\1\0\2\5\1\0\2\5\3\0\22\5\15\0"+
282 "\3\5\1\164\3\5\4\0\10\5\1\0\2\5\1\0"+
283 "\2\5\3\0\7\5\1\160\10\5\1\251\1\5\15\0"+
284 "\7\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0"+
285 "\12\5\1\166\1\5\1\164\5\5\15\0\7\5\4\0"+
286 "\10\5\1\0\2\5\1\0\2\5\3\0\11\5\1\252"+
287 "\10\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0"+
288 "\2\5\3\0\4\5\1\253\15\5\15\0\3\5\1\164"+
289 "\3\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0"+
290 "\1\254\21\5\15\0\7\5\4\0\10\5\1\0\2\5"+
291 "\1\0\2\5\3\0\15\5\1\255\4\5\15\0\7\5"+
292 "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\10\5"+
293 "\1\256\11\5\15\0\7\5\4\0\10\5\1\0\2\5"+
294 "\1\0\2\5\3\0\13\5\1\162\6\5\15\0\7\5"+
295 "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\12\5"+
296 "\1\257\7\5\15\0\7\5\4\0\10\5\1\0\2\5"+
297 "\1\0\2\5\3\0\12\5\1\260\7\5\15\0\7\5"+
298 "\4\0\10\5\1\0\1\261\1\5\1\0\2\5\3\0"+
299 "\22\5\15\0\7\5\4\0\6\5\1\262\1\5\1\0"+
300 "\2\5\1\0\2\5\3\0\22\5\15\0\7\5\4\0"+
301 "\10\5\1\0\2\5\1\0\2\5\3\0\10\5\1\244"+
302 "\11\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0"+
303 "\2\5\3\0\1\263\21\5\15\0\7\5\4\0\1\264"+
304 "\7\5\1\0\2\5\1\0\2\5\3\0\22\5\15\0"+
305 "\7\5\4\0\10\5\1\0\1\265\1\5\1\0\2\5"+
306 "\3\0\1\5\1\266\12\5\1\267\5\5\15\0\7\5"+
307 "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\12\5"+
308 "\1\164\7\5\15\0\3\5\1\164\3\5\4\0\10\5"+
309 "\1\0\2\5\1\0\2\5\3\0\1\270\21\5\15\0"+
310 "\7\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0"+
311 "\2\5\1\164\17\5\15\0\7\5\4\0\10\5\1\0"+
312 "\2\5\1\0\1\271\1\5\3\0\22\5\15\0\7\5"+
313 "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\4\5"+
314 "\1\164\15\5\15\0\7\5\4\0\10\5\1\0\1\105"+
315 "\1\5\1\0\2\5\3\0\22\5\15\0\7\5\4\0"+
316 "\10\5\1\0\2\5\1\0\2\5\3\0\4\5\1\272"+
317 "\5\5\1\273\7\5\15\0\7\5\4\0\10\5\1\0"+
318 "\2\5\1\0\2\5\3\0\3\5\1\274\5\5\1\275"+
319 "\10\5\15\0\7\5\4\0\10\5\1\0\1\214\1\5"+
320 "\1\0\2\5\3\0\22\5\15\0\7\5\4\0\10\5"+
321 "\1\0\2\5\1\0\2\5\3\0\12\5\1\276\7\5"+
322 "\15\0\7\5\4\0\10\5\1\0\2\5\1\0\2\5"+
323 "\3\0\10\5\1\277\1\300\10\5\15\0\7\5\4\0"+
324 "\10\5\1\0\2\5\1\0\2\5\3\0\3\5\1\301"+
325 "\16\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0"+
326 "\2\5\3\0\16\5\1\164\3\5\15\0\7\5\4\0"+
327 "\10\5\1\0\1\302\1\5\1\0\2\5\3\0\22\5"+
328 "\15\0\7\5\4\0\3\5\1\164\4\5\1\0\2\5"+
329 "\1\0\2\5\3\0\12\5\1\164\7\5\15\0\7\5"+
330 "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\10\5"+
331 "\1\303\11\5\15\0\7\5\4\0\10\5\1\0\2\5"+
332 "\1\0\2\5\3\0\11\5\1\304\10\5\15\0\7\5"+
333 "\4\0\3\5\1\164\4\5\1\0\2\5\1\0\2\5"+
334 "\3\0\22\5\15\0\7\5\4\0\10\5\1\0\2\5"+
335 "\1\0\2\5\3\0\3\5\1\305\16\5\15\0\3\5"+
336 "\1\127\3\5\4\0\10\5\1\0\2\5\1\0\2\5"+
337 "\3\0\22\5\15\0\7\5\4\0\10\5\1\0\2\5"+
338 "\1\0\2\5\3\0\11\5\1\306\10\5\24\0\1\307"+
339 "\73\0\1\310\64\0\1\311\12\0\1\311\2\0\1\311"+
340 "\5\0\1\210\31\0\1\210\11\0\3\66\1\207\4\66"+
341 "\3\0\3\66\1\207\2\66\1\207\2\66\1\0\2\66"+
342 "\1\0\2\72\1\0\1\66\1\0\22\66\12\0\1\66"+
343 "\4\0\1\311\12\0\1\311\2\0\1\311\52\0\7\5"+
344 "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\10\5"+
345 "\1\312\11\5\15\0\4\5\1\252\2\5\4\0\10\5"+
346 "\1\0\2\5\1\0\2\5\3\0\22\5\15\0\4\5"+
347 "\1\313\2\5\4\0\10\5\1\0\2\5\1\0\2\5"+
348 "\3\0\22\5\15\0\3\5\1\164\3\5\4\0\10\5"+
349 "\1\0\2\5\1\0\2\5\3\0\22\5\15\0\7\5"+
350 "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\15\5"+
351 "\1\260\4\5\15\0\7\5\4\0\10\5\1\0\2\5"+
352 "\1\0\2\5\3\0\3\5\1\237\16\5\15\0\1\314"+
353 "\6\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0"+
354 "\22\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0"+
355 "\2\5\3\0\1\5\1\315\20\5\15\0\7\5\4\0"+
356 "\10\5\1\0\2\5\1\0\2\5\3\0\11\5\1\141"+
357 "\10\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0"+
358 "\2\5\3\0\7\5\1\316\12\5\15\0\7\5\4\0"+
359 "\10\5\1\0\2\5\1\0\2\5\3\0\5\5\1\317"+
360 "\14\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0"+
361 "\2\5\3\0\15\5\1\320\4\5\15\0\7\5\4\0"+
362 "\10\5\1\0\2\5\1\0\2\5\3\0\1\321\21\5"+
363 "\14\0\3\66\1\231\4\66\3\0\1\66\2\67\1\231"+
364 "\2\66\3\231\1\0\2\231\1\0\2\66\1\0\1\66"+
365 "\1\0\1\231\1\66\1\231\2\66\1\231\1\66\1\231"+
366 "\12\66\12\0\1\66\2\0\7\5\4\0\10\5\1\0"+
367 "\2\5\1\0\2\5\3\0\1\5\1\215\20\5\15\0"+
368 "\7\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0"+
369 "\14\5\1\162\5\5\15\0\7\5\4\0\10\5\1\0"+
370 "\2\5\1\0\2\5\3\0\1\322\21\5\15\0\7\5"+
371 "\4\0\10\5\1\0\1\164\1\5\1\0\2\5\3\0"+
372 "\4\5\1\166\15\5\15\0\7\5\4\0\10\5\1\0"+
373 "\2\5\1\0\2\5\3\0\1\323\21\5\15\0\7\5"+
374 "\4\0\10\5\1\0\1\162\1\5\1\0\2\5\3\0"+
375 "\22\5\15\0\7\5\4\0\6\5\1\162\1\5\1\0"+
376 "\2\5\1\0\2\5\3\0\22\5\15\0\7\5\4\0"+
377 "\10\5\1\0\2\5\1\0\2\5\3\0\7\5\1\324"+
378 "\12\5\15\0\7\5\4\0\10\5\1\0\1\325\1\5"+
379 "\1\0\2\5\3\0\22\5\15\0\7\5\4\0\10\5"+
380 "\1\0\2\5\1\0\2\5\3\0\14\5\1\326\5\5"+
381 "\15\0\7\5\4\0\1\164\7\5\1\0\2\5\1\0"+
382 "\2\5\3\0\22\5\15\0\7\5\4\0\10\5\1\0"+
383 "\1\327\1\5\1\0\2\5\3\0\22\5\15\0\7\5"+
384 "\4\0\1\330\7\5\1\0\2\5\1\0\2\5\3\0"+
385 "\22\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0"+
386 "\2\5\3\0\1\331\21\5\15\0\7\5\4\0\10\5"+
387 "\1\0\2\5\1\0\2\5\3\0\5\5\1\332\14\5"+
388 "\15\0\7\5\4\0\10\5\1\0\2\5\1\0\2\5"+
389 "\3\0\14\5\1\333\5\5\15\0\7\5\4\0\10\5"+
390 "\1\0\2\5\1\0\2\5\3\0\7\5\1\260\12\5"+
391 "\15\0\7\5\4\0\10\5\1\0\2\5\1\0\2\5"+
392 "\3\0\4\5\1\334\15\5\15\0\7\5\4\0\10\5"+
393 "\1\0\2\5\1\0\2\5\3\0\1\5\1\335\20\5"+
394 "\15\0\3\5\1\322\3\5\4\0\10\5\1\0\2\5"+
395 "\1\0\2\5\3\0\22\5\15\0\7\5\4\0\1\260"+
396 "\7\5\1\0\2\5\1\0\2\5\3\0\22\5\15\0"+
397 "\7\5\4\0\10\5\1\0\1\164\1\5\1\0\2\5"+
398 "\3\0\22\5\15\0\7\5\4\0\10\5\1\0\2\5"+
399 "\1\0\2\5\3\0\1\336\21\5\15\0\7\5\4\0"+
400 "\6\5\1\166\1\5\1\0\2\5\1\0\2\5\3\0"+
401 "\22\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0"+
402 "\2\5\3\0\3\5\1\337\16\5\15\0\7\5\4\0"+
403 "\1\340\7\5\1\0\2\5\1\0\2\5\3\0\22\5"+
404 "\15\0\3\5\1\252\3\5\4\0\10\5\1\0\2\5"+
405 "\1\0\2\5\3\0\22\5\15\0\7\5\4\0\10\5"+
406 "\1\0\2\5\1\0\2\5\3\0\4\5\1\341\15\5"+
407 "\15\0\7\5\4\0\10\5\1\0\2\5\1\0\2\5"+
408 "\3\0\12\5\1\342\7\5\15\0\3\5\1\320\3\5"+
409 "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\22\5"+
410 "\15\0\7\5\4\0\10\5\1\0\1\343\1\5\1\0"+
411 "\2\5\3\0\22\5\15\0\7\5\4\0\10\5\1\0"+
412 "\1\344\1\5\1\0\2\5\3\0\22\5\15\0\4\5"+
413 "\1\160\2\5\4\0\10\5\1\0\2\5\1\0\2\5"+
414 "\3\0\22\5\15\0\4\5\1\345\2\5\4\0\10\5"+
415 "\1\0\2\5\1\0\2\5\3\0\22\5\15\0\7\5"+
416 "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\1\5"+
417 "\1\346\20\5\15\0\7\5\4\0\10\5\1\0\2\5"+
418 "\1\0\2\5\3\0\10\5\1\327\11\5\15\0\7\5"+
419 "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\12\5"+
420 "\1\347\7\5\15\0\7\5\4\0\10\5\1\0\2\5"+
421 "\1\0\2\5\3\0\1\5\1\131\20\5\15\0\7\5"+
422 "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\3\5"+
423 "\1\162\16\5\15\0\7\5\4\0\1\125\7\5\1\0"+
424 "\2\5\1\0\2\5\3\0\22\5\15\0\7\5\4\0"+
425 "\10\5\1\0\2\5\1\0\2\5\3\0\5\5\1\350"+
426 "\14\5\15\0\7\5\4\0\1\237\7\5\1\0\2\5"+
427 "\1\0\2\5\3\0\22\5\15\0\7\5\4\0\10\5"+
428 "\1\0\2\5\1\0\2\5\3\0\1\331\16\5\1\164"+
429 "\2\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0"+
430 "\2\5\3\0\2\5\1\320\17\5\17\0\1\311\12\0"+
431 "\1\311\2\0\1\311\6\0\2\206\42\0\7\5\4\0"+
432 "\10\5\1\0\2\5\1\0\2\5\3\0\1\315\21\5"+
433 "\15\0\3\5\1\351\3\5\4\0\10\5\1\0\2\5"+
434 "\1\0\2\5\3\0\22\5\15\0\7\5\4\0\10\5"+
435 "\1\0\2\5\1\0\2\5\3\0\11\5\1\352\10\5"+
436 "\15\0\7\5\4\0\10\5\1\0\2\5\1\0\2\5"+
437 "\3\0\10\5\1\353\6\5\1\214\2\5\15\0\7\5"+
438 "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\2\5"+
439 "\1\354\17\5\15\0\7\5\4\0\1\127\7\5\1\0"+
440 "\2\5\1\0\2\5\3\0\22\5\15\0\7\5\4\0"+
441 "\10\5\1\0\2\5\1\0\2\5\3\0\4\5\1\320"+
442 "\15\5\15\0\7\5\4\0\1\355\7\5\1\0\2\5"+
443 "\1\0\2\5\3\0\22\5\15\0\7\5\4\0\6\5"+
444 "\1\356\1\5\1\0\2\5\1\0\2\5\3\0\22\5"+
445 "\15\0\7\5\4\0\10\5\1\0\2\5\1\0\2\5"+
446 "\3\0\12\5\1\131\7\5\15\0\7\5\4\0\10\5"+
447 "\1\0\1\357\1\5\1\0\2\5\3\0\22\5\15\0"+
448 "\3\5\1\131\3\5\4\0\10\5\1\0\2\5\1\0"+
449 "\2\5\3\0\22\5\15\0\7\5\4\0\10\5\1\0"+
450 "\2\5\1\0\2\5\3\0\13\5\1\164\6\5\15\0"+
451 "\7\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0"+
452 "\4\5\1\360\15\5\15\0\7\5\4\0\1\361\7\5"+
453 "\1\0\2\5\1\0\2\5\3\0\22\5\15\0\7\5"+
454 "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\10\5"+
455 "\1\315\11\5\15\0\7\5\4\0\10\5\1\0\2\5"+
456 "\1\0\2\5\3\0\11\5\1\362\10\5\15\0\7\5"+
457 "\4\0\10\5\1\0\1\306\1\5\1\0\2\5\3\0"+
458 "\22\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0"+
459 "\2\5\3\0\6\5\1\162\13\5\15\0\7\5\4\0"+
460 "\10\5\1\0\2\5\1\0\2\5\3\0\3\5\1\363"+
461 "\16\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0"+
462 "\2\5\3\0\1\364\21\5\15\0\7\5\4\0\10\5"+
463 "\1\0\2\5\1\0\2\5\3\0\11\5\1\365\10\5"+
464 "\15\0\7\5\4\0\1\366\7\5\1\0\2\5\1\0"+
465 "\2\5\3\0\11\5\1\257\10\5\15\0\7\5\4\0"+
466 "\10\5\1\0\2\5\1\0\2\5\3\0\7\5\1\160"+
467 "\12\5\15\0\3\5\1\105\3\5\4\0\10\5\1\0"+
468 "\2\5\1\0\2\5\3\0\22\5\15\0\7\5\4\0"+
469 "\10\5\1\0\2\5\1\0\2\5\3\0\5\5\1\367"+
470 "\14\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0"+
471 "\2\5\3\0\3\5\1\370\16\5\15\0\7\5\4\0"+
472 "\10\5\1\0\1\371\1\5\1\0\2\5\3\0\22\5"+
473 "\15\0\7\5\4\0\10\5\1\0\2\5\1\0\2\5"+
474 "\3\0\1\372\21\5\15\0\7\5\4\0\10\5\1\0"+
475 "\2\5\1\0\2\5\3\0\1\5\1\162\20\5\15\0"+
476 "\7\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0"+
477 "\1\5\1\373\20\5\15\0\7\5\4\0\10\5\1\0"+
478 "\2\5\1\0\2\5\3\0\2\5\1\260\17\5\15\0"+
479 "\7\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0"+
480 "\1\162\21\5\15\0\7\5\4\0\1\143\7\5\1\0"+
481 "\2\5\1\0\2\5\3\0\22\5\15\0\7\5\4\0"+
482 "\10\5\1\0\2\5\1\0\2\5\3\0\11\5\1\257"+
483 "\10\5\15\0\3\5\1\374\3\5\4\0\10\5\1\0"+
484 "\2\5\1\0\2\5\3\0\22\5\15\0\7\5\4\0"+
485 "\10\5\1\0\2\5\1\0\2\5\3\0\4\5\1\214"+
486 "\15\5\15\0\7\5\4\0\10\5\1\0\1\320\1\5"+
487 "\1\0\2\5\3\0\22\5\15\0\7\5\4\0\10\5"+
488 "\1\0\2\5\1\0\2\5\3\0\7\5\1\375\12\5"+
489 "\15\0\7\5\4\0\10\5\1\0\2\5\1\0\2\5"+
490 "\3\0\14\5\1\376\5\5\15\0\7\5\4\0\10\5"+
491 "\1\0\2\5\1\0\2\5\3\0\5\5\1\257\14\5"+
492 "\15\0\7\5\4\0\10\5\1\0\2\5\1\0\2\5"+
493 "\3\0\1\5\1\377\20\5\15\0\7\5\4\0\10\5"+
494 "\1\0\1\177\1\5\1\0\2\5\3\0\22\5\15\0"+
495 "\7\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0"+
496 "\7\5\1\u0100\12\5\15\0\7\5\4\0\10\5\1\0"+
497 "\2\5\1\0\2\5\3\0\4\5\1\u0101\15\5\15\0"+
498 "\3\5\1\u0102\3\5\4\0\10\5\1\0\2\5\1\0"+
499 "\2\5\3\0\22\5\15\0\7\5\4\0\1\u0103\7\5"+
500 "\1\0\2\5\1\0\2\5\3\0\22\5\15\0\7\5"+
501 "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\12\5"+
502 "\1\273\7\5\15\0\7\5\4\0\10\5\1\0\2\5"+
503 "\1\0\2\5\3\0\1\u0104\21\5\15\0\7\5\4\0"+
504 "\10\5\1\0\1\u0105\1\5\1\0\2\5\3\0\22\5"+
505 "\15\0\4\5\1\237\2\5\4\0\10\5\1\0\2\5"+
506 "\1\0\2\5\3\0\22\5\15\0\7\5\4\0\1\u0106"+
507 "\7\5\1\0\2\5\1\0\2\5\3\0\22\5\15\0"+
508 "\7\5\4\0\10\5\1\0\2\5\1\0\2\5\3\0"+
509 "\1\u0107\21\5\15\0\7\5\4\0\10\5\1\0\2\5"+
510 "\1\0\2\5\3\0\4\5\1\330\15\5\15\0\7\5"+
511 "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\4\5"+
512 "\1\260\15\5\15\0\7\5\4\0\10\5\1\0\2\5"+
513 "\1\0\2\5\3\0\4\5\1\u0108\15\5\15\0\7\5"+
514 "\4\0\10\5\1\0\2\5\1\0\2\5\3\0\1\u0109"+
515 "\21\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0"+
516 "\2\5\3\0\1\5\1\252\20\5\15\0\7\5\4\0"+
517 "\10\5\1\0\2\5\1\0\2\5\3\0\17\5\1\333"+
518 "\2\5\15\0\7\5\4\0\10\5\1\0\2\5\1\0"+
519 "\2\5\3\0\3\5\1\127\16\5\14\0";
520
521 private static int [] zzUnpackTrans() {
522 int [] result = new int[14514];
523 int offset = 0;
524 offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
525 return result;
526 }
527
528 private static int zzUnpackTrans(String packed, int offset, int [] result) {
529 int i = 0; /* index in packed string */
530 int j = offset; /* index in unpacked array */
531 int l = packed.length();
532 while (i < l) {
533 int count = packed.charAt(i++);
534 int value = packed.charAt(i++);
535 value--;
536 do result[j++] = value; while (--count > 0);
537 }
538 return j;
539 }
540
541
542 /* error codes */
543 private static final int ZZ_UNKNOWN_ERROR = 0;
544 private static final int ZZ_NO_MATCH = 1;
545 private static final int ZZ_PUSHBACK_2BIG = 2;
546
547 /* error messages for the codes above */
548 private static final String ZZ_ERROR_MSG[] = {
549 "Unkown internal scanner error",
550 "Error: could not match input",
551 "Error: pushback value was too large"
552 };
553
554 /**
555 * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
556 */
557 private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
558
559 private static final String ZZ_ATTRIBUTE_PACKED_0 =
560 "\3\0\1\11\10\1\1\11\32\1\1\11\3\1\1\11"+
561 "\4\1\1\11\17\1\1\0\2\1\1\0\76\1\3\0"+
562 "\1\11\1\1\1\0\12\1\3\11\61\1\2\11\101\1";
563
564 private static int [] zzUnpackAttribute() {
565 int [] result = new int[265];
566 int offset = 0;
567 offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
568 return result;
569 }
570
571 private static int zzUnpackAttribute(String packed, int offset, int [] result) {
572 int i = 0; /* index in packed string */
573 int j = offset; /* index in unpacked array */
574 int l = packed.length();
575 while (i < l) {
576 int count = packed.charAt(i++);
577 int value = packed.charAt(i++);
578 do result[j++] = value; while (--count > 0);
579 }
580 return j;
581 }
582
583 /** the input device */
584 private java.io.Reader zzReader;
585
586 /** the current state of the DFA */
587 private int zzState;
588
589 /** the current lexical state */
590 private int zzLexicalState = YYINITIAL;
591
592 /** this buffer contains the current text to be matched and is
593 the source of the yytext() string */
594 private char zzBuffer[];
595
596 /** the textposition at the last accepting state */
597 private int zzMarkedPos;
598
599 /** the current text position in the buffer */
600 private int zzCurrentPos;
601
602 /** startRead marks the beginning of the yytext() string in the buffer */
603 private int zzStartRead;
604
605 /** endRead marks the last character in the buffer, that has been read
606 from input */
607 private int zzEndRead;
608
609 /** zzAtEOF == true <=> the scanner is at the EOF */
610 private boolean zzAtEOF;
611
612 /* user code: */
613
614
615 /**
616 * Constructor. This must be here because JFlex does not generate a
617 * no-parameter constructor.
618 */
619 public PythonTokenMaker() {
620 super();
621 }
622
623
624 /**
625 * Adds the token specified to the current linked list of tokens.
626 *
627 * @param tokenType The token's type.
628 */
629 private void addToken(int tokenType) {
630 addToken(zzStartRead, zzMarkedPos-1, tokenType);
631 }
632
633
634 /**
635 * Adds the token specified to the current linked list of tokens.
636 *
637 * @param tokenType The token's type.
638 */
639 private void addToken(int start, int end, int tokenType) {
640 int so = start + offsetShift;
641 addToken(zzBuffer, start,end, tokenType, so);
642 }
643
644
645 /**
646 * Adds the token specified to the current linked list of tokens.
647 *
648 * @param array The character array.
649 * @param start The starting offset in the array.
650 * @param end The ending offset in the array.
651 * @param tokenType The token's type.
652 * @param startOffset The offset in the document at which this token
653 * occurs.
654 */
655 public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
656 super.addToken(array, start,end, tokenType, startOffset);
657 zzStartRead = zzMarkedPos;
658 }
659
660
661 /**
662 * Returns the text to place at the beginning and end of a
663 * line to "comment" it in a this programming language.
664 *
665 * @return The start and end strings to add to a line to "comment"
666 * it out.
667 */
668 public String[] getLineCommentStartAndEnd() {
669 return new String[] { "#", null };
670 }
671
672
673 /**
674 * Returns the first token in the linked list of tokens generated
675 * from <code>text</code>. This method must be implemented by
676 * subclasses so they can correctly implement syntax highlighting.
677 *
678 * @param text The text from which to get tokens.
679 * @param initialTokenType The token type we should start with.
680 * @param startOffset The offset into the document at which
681 * <code>text</code> starts.
682 * @return The first <code>Token</code> in a linked list representing
683 * the syntax highlighted text.
684 */
685 public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
686
687 resetTokenList();
688 this.offsetShift = -text.offset + startOffset;
689
690 // Start off in the proper state.
691 int state = Token.NULL;
692 switch (initialTokenType) {
693 case Token.LITERAL_STRING_DOUBLE_QUOTE:
694 state = LONG_STRING_2;
695 break;
696 case Token.LITERAL_CHAR:
697 state = LONG_STRING_1;
698 break;
699 default:
700 state = Token.NULL;
701 }
702
703 s = text;
704 try {
705 yyreset(zzReader);
706 yybegin(state);
707 return yylex();
708 } catch (IOException ioe) {
709 ioe.printStackTrace();
710 return new DefaultToken();
711 }
712
713 }
714
715
716 /**
717 * Resets the scanner to read from a new input stream.
718 * Does not close the old reader.
719 *
720 * All internal variables are reset, the old input stream
721 * <b>cannot</b> be reused (internal buffer is discarded and lost).
722 * Lexical state is set to <tt>YY_INITIAL</tt>.
723 *
724 * @param reader the new input stream
725 */
726 public final void yyreset(java.io.Reader reader) throws java.io.IOException {
727 // 's' has been updated.
728 zzBuffer = s.array;
729 /*
730 * We replaced the line below with the two below it because zzRefill
731 * no longer "refills" the buffer (since the way we do it, it's always
732 * "full" the first time through, since it points to the segment's
733 * array). So, we assign zzEndRead here.
734 */
735 //zzStartRead = zzEndRead = s.offset;
736 zzStartRead = s.offset;
737 zzEndRead = zzStartRead + s.count - 1;
738 zzCurrentPos = zzMarkedPos = s.offset;
739 zzLexicalState = YYINITIAL;
740 zzReader = reader;
741 zzAtEOF = false;
742 }
743
744
745 /**
746 * Refills the input buffer.
747 *
748 * @return <code>true</code> if EOF was reached, otherwise
749 * <code>false</code>.
750 * @exception IOException if any I/O-Error occurs.
751 */
752 private boolean zzRefill() throws java.io.IOException {
753 return zzCurrentPos>=s.offset+s.count;
754 }
755
756
757
758
759 /**
760 * Creates a new scanner
761 * There is also a java.io.InputStream version of this constructor.
762 *
763 * @param in the java.io.Reader to read input from.
764 */
765 public PythonTokenMaker(java.io.Reader in) {
766 this.zzReader = in;
767 }
768
769 /**
770 * Creates a new scanner.
771 * There is also java.io.Reader version of this constructor.
772 *
773 * @param in the java.io.Inputstream to read input from.
774 */
775 public PythonTokenMaker(java.io.InputStream in) {
776 this(new java.io.InputStreamReader(in));
777 }
778
779 /**
780 * Unpacks the compressed character translation table.
781 *
782 * @param packed the packed character translation table
783 * @return the unpacked character translation table
784 */
785 private static char [] zzUnpackCMap(String packed) {
786 char [] map = new char[0x10000];
787 int i = 0; /* index in packed string */
788 int j = 0; /* index in unpacked array */
789 while (i < 168) {
790 int count = packed.charAt(i++);
791 char value = packed.charAt(i++);
792 do map[j++] = value; while (--count > 0);
793 }
794 return map;
795 }
796
797
798 /**
799 * Closes the input stream.
800 */
801 public final void yyclose() throws java.io.IOException {
802 zzAtEOF = true; /* indicate end of file */
803 zzEndRead = zzStartRead; /* invalidate buffer */
804
805 if (zzReader != null)
806 zzReader.close();
807 }
808
809
810 /**
811 * Returns the current lexical state.
812 */
813 public final int yystate() {
814 return zzLexicalState;
815 }
816
817
818 /**
819 * Enters a new lexical state
820 *
821 * @param newState the new lexical state
822 */
823 public final void yybegin(int newState) {
824 zzLexicalState = newState;
825 }
826
827
828 /**
829 * Returns the text matched by the current regular expression.
830 */
831 public final String yytext() {
832 return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
833 }
834
835
836 /**
837 * Returns the character at position <tt>pos</tt> from the
838 * matched text.
839 *
840 * It is equivalent to yytext().charAt(pos), but faster
841 *
842 * @param pos the position of the character to fetch.
843 * A value from 0 to yylength()-1.
844 *
845 * @return the character at position pos
846 */
847 public final char yycharat(int pos) {
848 return zzBuffer[zzStartRead+pos];
849 }
850
851
852 /**
853 * Returns the length of the matched text region.
854 */
855 public final int yylength() {
856 return zzMarkedPos-zzStartRead;
857 }
858
859
860 /**
861 * Reports an error that occured while scanning.
862 *
863 * In a wellformed scanner (no or only correct usage of
864 * yypushback(int) and a match-all fallback rule) this method
865 * will only be called with things that "Can't Possibly Happen".
866 * If this method is called, something is seriously wrong
867 * (e.g. a JFlex bug producing a faulty scanner etc.).
868 *
869 * Usual syntax/scanner level error handling should be done
870 * in error fallback rules.
871 *
872 * @param errorCode the code of the errormessage to display
873 */
874 private void zzScanError(int errorCode) {
875 String message;
876 try {
877 message = ZZ_ERROR_MSG[errorCode];
878 }
879 catch (ArrayIndexOutOfBoundsException e) {
880 message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
881 }
882
883 throw new Error(message);
884 }
885
886
887 /**
888 * Pushes the specified amount of characters back into the input stream.
889 *
890 * They will be read again by then next call of the scanning method
891 *
892 * @param number the number of characters to be read again.
893 * This number must not be greater than yylength()!
894 */
895 public void yypushback(int number) {
896 if ( number > yylength() )
897 zzScanError(ZZ_PUSHBACK_2BIG);
898
899 zzMarkedPos -= number;
900 }
901
902
903 /**
904 * Resumes scanning until the next regular expression is matched,
905 * the end of input is encountered or an I/O-Error occurs.
906 *
907 * @return the next token
908 * @exception java.io.IOException if any I/O-Error occurs
909 */
910 public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
911 int zzInput;
912 int zzAction;
913
914 // cached fields:
915 int zzCurrentPosL;
916 int zzMarkedPosL;
917 int zzEndReadL = zzEndRead;
918 char [] zzBufferL = zzBuffer;
919 char [] zzCMapL = ZZ_CMAP;
920
921 int [] zzTransL = ZZ_TRANS;
922 int [] zzRowMapL = ZZ_ROWMAP;
923 int [] zzAttrL = ZZ_ATTRIBUTE;
924
925 while (true) {
926 zzMarkedPosL = zzMarkedPos;
927
928 zzAction = -1;
929
930 zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
931
932 zzState = zzLexicalState;
933
934
935 zzForAction: {
936 while (true) {
937
938 if (zzCurrentPosL < zzEndReadL)
939 zzInput = zzBufferL[zzCurrentPosL++];
940 else if (zzAtEOF) {
941 zzInput = YYEOF;
942 break zzForAction;
943 }
944 else {
945 // store back cached positions
946 zzCurrentPos = zzCurrentPosL;
947 zzMarkedPos = zzMarkedPosL;
948 boolean eof = zzRefill();
949 // get translated positions and possibly new buffer
950 zzCurrentPosL = zzCurrentPos;
951 zzMarkedPosL = zzMarkedPos;
952 zzBufferL = zzBuffer;
953 zzEndReadL = zzEndRead;
954 if (eof) {
955 zzInput = YYEOF;
956 break zzForAction;
957 }
958 else {
959 zzInput = zzBufferL[zzCurrentPosL++];
960 }
961 }
962 int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
963 if (zzNext == -1) break zzForAction;
964 zzState = zzNext;
965
966 int zzAttributes = zzAttrL[zzState];
967 if ( (zzAttributes & 1) == 1 ) {
968 zzAction = zzState;
969 zzMarkedPosL = zzCurrentPosL;
970 if ( (zzAttributes & 8) == 8 ) break zzForAction;
971 }
972
973 }
974 }
975
976 // store back cached position
977 zzMarkedPos = zzMarkedPosL;
978
979 switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
980 case 5:
981 { addNullToken(); return firstToken;
982 }
983 case 20: break;
984 case 10:
985 { addToken(Token.LITERAL_CHAR);
986 }
987 case 21: break;
988 case 8:
989 { addToken(Token.WHITESPACE);
990 }
991 case 22: break;
992 case 12:
993 { addToken(Token.LITERAL_NUMBER_FLOAT);
994 }
995 case 23: break;
996 case 13:
997 { addToken(Token.RESERVED_WORD);
998 }
999 case 24: break;
1000 case 9:
1001 { addToken(Token.SEPARATOR);
1002 }
1003 case 25: break;
1004 case 15:
1005 { yybegin(LONG_STRING_1); addToken(Token.LITERAL_CHAR);
1006 }
1007 case 26: break;
1008 case 2:
1009 { addToken(Token.IDENTIFIER);
1010 }
1011 case 27: break;
1012 case 14:
1013 { addToken(Token.FUNCTION);
1014 }
1015 case 28: break;
1016 case 1:
1017 { addToken(Token.ERROR_IDENTIFIER);
1018 }
1019 case 29: break;
1020 case 17:
1021 { addToken(Token.DATA_TYPE);
1022 }
1023 case 30: break;
1024 case 4:
1025 { addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
1026 }
1027 case 31: break;
1028 case 7:
1029 { addToken(Token.COMMENT_EOL);
1030 }
1031 case 32: break;
1032 case 11:
1033 { addToken(Token.ERROR_NUMBER_FORMAT);
1034 }
1035 case 33: break;
1036 case 3:
1037 { addToken(Token.LITERAL_NUMBER_DECIMAL_INT);
1038 }
1039 case 34: break;
1040 case 6:
1041 { addToken(Token.OPERATOR);
1042 }
1043 case 35: break;
1044 case 19:
1045 { yybegin(YYINITIAL); addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
1046 }
1047 case 36: break;
1048 case 16:
1049 { yybegin(LONG_STRING_2); addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
1050 }
1051 case 37: break;
1052 case 18:
1053 { yybegin(YYINITIAL); addToken(Token.LITERAL_CHAR);
1054 }
1055 case 38: break;
1056 default:
1057 if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
1058 zzAtEOF = true;
1059 switch (zzLexicalState) {
1060 case YYINITIAL: {
1061 addNullToken(); return firstToken;
1062 }
1063 case 266: break;
1064 case LONG_STRING_2: {
1065 if (firstToken==null) {
1066 addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
1067 }
1068 return firstToken;
1069 }
1070 case 267: break;
1071 case LONG_STRING_1: {
1072 if (firstToken==null) {
1073 addToken(Token.LITERAL_CHAR);
1074 }
1075 return firstToken;
1076 }
1077 case 268: break;
1078 default:
1079 return null;
1080 }
1081 }
1082 else {
1083 zzScanError(ZZ_NO_MATCH);
1084 }
1085 }
1086 }
1087 }
1088
1089
1090}
Note: See TracBrowser for help on using the repository browser.