source: other-projects/rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/modes/LuaTokenMaker.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: 32.2 KB
Line 
1/* The following code was generated by JFlex 1.4.1 on 10/16/06 10:31 AM */
2
3/*
4 * 07/14/2006
5 *
6 * LuaTokenMaker.java - Scanner for the Lua 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.*;
17
18
19/**
20 * Scanner for the Lua programming language.<p>
21 *
22 * This implementation was created using
23 * <a href="http://www.jflex.de/">JFlex</a> 1.4.1; however, the generated file
24 * was modified for performance. Memory allocation needs to be almost
25 * completely removed to be competitive with the handwritten lexers (subclasses
26 * of <code>AbstractTokenMaker</code>, so this class has been modified so that
27 * Strings are never allocated (via yytext()), and the scanner never has to
28 * worry about refilling its buffer (needlessly copying chars around).
29 * We can achieve this because RText always scans exactly 1 line of tokens at a
30 * time, and hands the scanner this line as an array of characters (a Segment
31 * really). Since tokens contain pointers to char arrays instead of Strings
32 * holding their contents, there is no need for allocating new memory for
33 * Strings.<p>
34 *
35 * The actual algorithm generated for scanning has, of course, not been
36 * modified.<p>
37 *
38 * If you wish to regenerate this file yourself, keep in mind the following:
39 * <ul>
40 * <li>The generated <code>LuaTokenMaker.java</code> file will contain two
41 * definitions of both <code>zzRefill</code> and <code>yyreset</code>.
42 * You should hand-delete the second of each definition (the ones
43 * generated by the lexer), as these generated methods modify the input
44 * buffer, which we'll never have to do.</li>
45 * <li>You should also change the declaration/definition of zzBuffer to NOT
46 * be initialized. This is a needless memory allocation for us since we
47 * will be pointing the array somewhere else anyway.</li>
48 * <li>You should NOT call <code>yylex()</code> on the generated scanner
49 * directly; rather, you should use <code>getTokenList</code> as you would
50 * with any other <code>TokenMaker</code> instance.</li>
51 * </ul>
52 *
53 * @author Robert Futrell
54 * @version 0.4
55 *
56 */
57
58public class LuaTokenMaker extends AbstractJFlexTokenMaker implements TokenMaker {
59
60 /** This character denotes the end of file */
61 public static final int YYEOF = -1;
62
63 /** lexical states */
64 public static final int YYINITIAL = 0;
65 public static final int LONGSTRING = 2;
66 public static final int LINECOMMENT = 3;
67 public static final int MLC = 1;
68
69 /**
70 * Translates characters to character classes
71 */
72 private static final String ZZ_CMAP_PACKED =
73 "\11\0\1\4\1\3\1\0\1\4\23\0\1\4\1\0\1\7\1\27"+
74 "\1\0\1\27\1\0\1\5\2\26\1\27\1\15\1\0\1\12\1\13"+
75 "\1\27\12\2\2\0\1\30\1\32\1\31\2\0\4\1\1\14\1\1"+
76 "\1\54\1\1\1\60\2\1\1\52\1\1\1\50\1\61\2\1\1\56"+
77 "\1\57\1\1\1\51\1\55\4\1\1\10\1\6\1\11\1\27\1\53"+
78 "\1\0\1\23\1\37\1\42\1\35\1\21\1\22\1\47\1\44\1\41"+
79 "\1\1\1\40\1\24\1\46\1\34\1\36\1\43\1\64\1\17\1\25"+
80 "\1\16\1\20\1\62\1\45\1\63\1\65\1\1\1\26\1\0\1\26"+
81 "\1\33\uff81\0";
82
83 /**
84 * Translates characters to character classes
85 */
86 private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
87
88 /**
89 * Translates DFA states to action switch labels.
90 */
91 private static final int [] ZZ_ACTION = zzUnpackAction();
92
93 private static final String ZZ_ACTION_PACKED_0 =
94 "\4\0\2\1\1\2\1\3\1\4\1\5\1\6\2\7"+
95 "\1\10\1\1\1\10\10\1\2\10\16\1\1\11\1\12"+
96 "\1\11\1\13\2\11\1\14\2\2\1\15\1\5\1\6"+
97 "\1\16\1\17\1\20\1\10\21\1\3\0\3\1\1\21"+
98 "\1\10\1\1\1\21\11\1\1\22\2\1\1\23\1\24"+
99 "\1\15\1\16\1\0\24\1\4\0\13\1\1\25\1\26"+
100 "\11\1\1\21\2\1\1\22\3\1\4\0\6\1\1\27"+
101 "\13\1\1\27\2\0\10\1\2\0\15\1";
102
103 private static int [] zzUnpackAction() {
104 int [] result = new int[201];
105 int offset = 0;
106 offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
107 return result;
108 }
109
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();
114 while (i < l) {
115 int count = packed.charAt(i++);
116 int value = packed.charAt(i++);
117 do result[j++] = value; while (--count > 0);
118 }
119 return j;
120 }
121
122
123 /**
124 * Translates a state to a row index in the transition table
125 */
126 private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
127
128 private static final String ZZ_ROWMAP_PACKED_0 =
129 "\0\0\0\66\0\154\0\242\0\330\0\u010e\0\u0144\0\330"+
130 "\0\u017a\0\u01b0\0\u01e6\0\u021c\0\330\0\u0252\0\u0288\0\330"+
131 "\0\u02be\0\u02f4\0\u032a\0\u0360\0\u0396\0\u03cc\0\u0402\0\u0438"+
132 "\0\u046e\0\u04a4\0\u04a4\0\u04da\0\u0510\0\u0546\0\u057c\0\u05b2"+
133 "\0\u05e8\0\u061e\0\u0654\0\u068a\0\u06c0\0\u06f6\0\u072c\0\u0762"+
134 "\0\u0798\0\330\0\u07ce\0\330\0\u0804\0\u083a\0\330\0\u0870"+
135 "\0\u08a6\0\330\0\u08dc\0\u0912\0\330\0\330\0\u0948\0\u097e"+
136 "\0\u09b4\0\u09ea\0\u0a20\0\u0a56\0\u0a8c\0\u0ac2\0\u0af8\0\u0b2e"+
137 "\0\u0b64\0\u0b9a\0\u0bd0\0\u0c06\0\u0c3c\0\u0c72\0\u0ca8\0\u0cde"+
138 "\0\u0d14\0\u0d4a\0\u0d80\0\u0db6\0\u0dec\0\u0e22\0\u0e58\0\u0e8e"+
139 "\0\u010e\0\u0ec4\0\u010e\0\u0efa\0\u0f30\0\u0f66\0\u0f9c\0\u0fd2"+
140 "\0\u1008\0\u103e\0\u1074\0\u10aa\0\u010e\0\u10e0\0\u1116\0\330"+
141 "\0\330\0\u01b0\0\u01e6\0\u114c\0\u1182\0\u11b8\0\u11ee\0\u1224"+
142 "\0\u125a\0\u1290\0\u12c6\0\u12fc\0\u1332\0\u1368\0\u139e\0\u13d4"+
143 "\0\u140a\0\u1440\0\u1476\0\u14ac\0\u14e2\0\u1518\0\u154e\0\u1584"+
144 "\0\u15ba\0\u15f0\0\u1626\0\u165c\0\u1692\0\u16c8\0\u16fe\0\u1734"+
145 "\0\u176a\0\u17a0\0\u17d6\0\u180c\0\u1842\0\u1878\0\u18ae\0\330"+
146 "\0\u010e\0\u18e4\0\u191a\0\u1950\0\u1986\0\u19bc\0\u19f2\0\u1a28"+
147 "\0\u1a5e\0\u1a94\0\u1aca\0\u1b00\0\u1b36\0\u1b6c\0\u1ba2\0\u1bd8"+
148 "\0\u1c0e\0\u1c44\0\u1c7a\0\u1cb0\0\u1ce6\0\u1d1c\0\u1d52\0\u1d88"+
149 "\0\u1dbe\0\u1df4\0\u1e2a\0\u010e\0\u1e60\0\u1e96\0\u1ecc\0\u1f02"+
150 "\0\u1f38\0\u1f6e\0\u1fa4\0\u1fda\0\u2010\0\u2046\0\u207c\0\330"+
151 "\0\u20b2\0\u20e8\0\u211e\0\u2154\0\u218a\0\u21c0\0\u21f6\0\u222c"+
152 "\0\u2262\0\u2298\0\u22ce\0\u2304\0\u233a\0\u2370\0\u23a6\0\u23dc"+
153 "\0\u2412\0\u2448\0\u247e\0\u24b4\0\u24ea\0\u2520\0\u2556\0\u258c"+
154 "\0\u25c2";
155
156 private static int [] zzUnpackRowMap() {
157 int [] result = new int[201];
158 int offset = 0;
159 offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
160 return result;
161 }
162
163 private static int zzUnpackRowMap(String packed, int offset, int [] result) {
164 int i = 0; /* index in packed string */
165 int j = offset; /* index in unpacked array */
166 int l = packed.length();
167 while (i < l) {
168 int high = packed.charAt(i++) << 16;
169 result[j++] = high | packed.charAt(i++);
170 }
171 return j;
172 }
173
174 /**
175 * The transition table of the DFA
176 */
177 private static final int [] ZZ_TRANS = zzUnpackTrans();
178
179 private static final String ZZ_TRANS_PACKED_0 =
180 "\1\5\1\6\1\7\1\10\1\11\1\12\1\5\1\13"+
181 "\1\14\1\15\1\16\1\17\1\6\1\20\1\21\1\22"+
182 "\1\23\1\24\1\25\1\26\1\27\1\30\1\15\1\20"+
183 "\1\31\1\32\2\33\1\34\1\35\1\36\1\37\1\6"+
184 "\1\40\1\41\1\42\1\6\1\43\1\44\1\45\1\46"+
185 "\2\6\1\47\7\6\1\50\2\6\3\51\1\52\5\51"+
186 "\1\53\57\51\1\54\5\51\1\55\54\51\3\56\1\57"+
187 "\62\56\67\0\2\6\11\0\1\6\1\0\10\6\6\0"+
188 "\32\6\1\0\1\60\1\7\10\0\1\7\1\61\1\0"+
189 "\3\60\1\61\4\60\6\0\32\60\4\0\1\11\61\0"+
190 "\3\12\1\0\1\12\1\62\1\63\57\12\3\13\1\0"+
191 "\2\13\1\64\1\65\56\13\10\0\1\66\67\0\1\67"+
192 "\55\0\1\7\10\0\1\70\53\0\2\6\11\0\1\6"+
193 "\1\0\1\6\1\71\6\6\6\0\2\6\1\72\5\6"+
194 "\1\73\20\6\1\74\1\0\2\6\11\0\1\6\1\0"+
195 "\3\6\1\75\1\6\1\76\2\6\6\0\32\6\1\0"+
196 "\2\6\11\0\1\6\1\0\10\6\6\0\1\77\31\6"+
197 "\1\0\2\6\11\0\1\6\1\0\1\6\1\100\4\6"+
198 "\1\101\1\6\6\0\1\102\31\6\1\0\2\6\11\0"+
199 "\1\6\1\0\2\6\1\103\2\6\1\104\2\6\6\0"+
200 "\2\6\1\105\27\6\1\0\2\6\11\0\1\6\1\0"+
201 "\7\6\1\106\6\0\1\107\31\6\1\0\2\6\11\0"+
202 "\1\6\1\0\10\6\6\0\2\6\1\110\27\6\1\0"+
203 "\2\6\11\0\1\6\1\0\3\6\1\111\4\6\6\0"+
204 "\32\6\21\0\1\112\3\0\1\113\4\0\1\20\1\0"+
205 "\1\114\63\0\1\20\34\0\2\6\11\0\1\6\1\0"+
206 "\3\6\1\115\4\6\6\0\2\6\1\116\2\6\1\117"+
207 "\24\6\1\0\2\6\11\0\1\6\1\0\10\6\6\0"+
208 "\2\6\1\120\27\6\1\0\2\6\11\0\1\6\1\0"+
209 "\1\6\1\121\6\6\6\0\32\6\1\0\2\6\11\0"+
210 "\1\6\1\0\1\6\1\122\6\6\6\0\32\6\1\0"+
211 "\2\6\11\0\1\6\1\0\4\6\1\123\3\6\6\0"+
212 "\7\6\1\124\22\6\1\0\2\6\11\0\1\6\1\0"+
213 "\10\6\6\0\2\6\1\125\27\6\1\0\2\6\11\0"+
214 "\1\6\1\0\1\6\1\126\3\6\1\127\2\6\6\0"+
215 "\6\6\1\130\23\6\1\0\2\6\11\0\1\6\1\0"+
216 "\10\6\6\0\10\6\1\131\21\6\1\0\2\6\11\0"+
217 "\1\6\1\0\10\6\6\0\2\6\1\132\27\6\1\0"+
218 "\2\6\11\0\1\6\1\0\3\6\1\133\4\6\6\0"+
219 "\32\6\1\0\2\6\11\0\1\6\1\0\10\6\6\0"+
220 "\15\6\1\134\14\6\1\0\2\6\11\0\1\6\1\0"+
221 "\10\6\6\0\20\6\1\135\1\136\10\6\1\0\2\6"+
222 "\11\0\1\6\1\0\10\6\6\0\7\6\1\137\22\6"+
223 "\3\51\1\0\5\51\1\0\54\51\11\0\1\140\65\0"+
224 "\1\141\54\0\3\56\1\0\62\56\1\0\2\60\11\0"+
225 "\1\60\1\0\10\60\6\0\32\60\1\0\2\60\7\0"+
226 "\1\60\1\0\12\60\6\0\32\60\3\12\1\0\1\12"+
227 "\1\142\1\63\57\12\3\13\1\0\2\13\1\64\1\143"+
228 "\56\13\10\0\1\144\70\0\1\20\53\0\2\6\11\0"+
229 "\1\6\1\0\2\6\1\145\5\6\6\0\32\6\1\0"+
230 "\2\6\11\0\1\6\1\0\7\6\1\146\6\0\1\147"+
231 "\31\6\1\0\2\6\11\0\1\6\1\0\3\6\1\150"+
232 "\4\6\6\0\32\6\1\0\2\6\11\0\1\6\1\0"+
233 "\10\6\6\0\7\6\1\151\22\6\1\0\2\6\11\0"+
234 "\1\6\1\0\1\152\7\6\6\0\7\6\1\153\20\6"+
235 "\1\154\1\6\1\0\2\6\11\0\1\6\1\0\10\6"+
236 "\6\0\11\6\1\155\20\6\1\0\2\6\11\0\1\6"+
237 "\1\0\1\156\7\6\6\0\7\6\1\157\22\6\1\0"+
238 "\2\6\11\0\1\6\1\0\1\6\1\160\6\6\6\0"+
239 "\32\6\1\0\2\6\11\0\1\6\1\0\7\6\1\161"+
240 "\6\0\32\6\1\0\2\6\11\0\1\6\1\0\10\6"+
241 "\6\0\1\6\1\123\30\6\1\0\2\6\11\0\1\6"+
242 "\1\0\10\6\6\0\1\162\31\6\1\0\2\6\11\0"+
243 "\1\6\1\0\6\6\1\163\1\6\6\0\32\6\1\0"+
244 "\2\6\11\0\1\6\1\0\1\6\1\123\6\6\6\0"+
245 "\32\6\1\0\2\6\11\0\1\6\1\0\7\6\1\164"+
246 "\6\0\32\6\1\0\2\6\11\0\1\6\1\0\10\6"+
247 "\6\0\1\6\1\121\30\6\1\0\2\6\11\0\1\6"+
248 "\1\0\5\6\1\165\2\6\6\0\6\6\1\166\23\6"+
249 "\1\0\2\6\11\0\1\6\1\0\1\167\5\6\1\170"+
250 "\1\6\6\0\32\6\36\0\1\171\45\0\1\172\67\0"+
251 "\1\173\2\0\1\174\43\0\2\6\11\0\1\6\1\0"+
252 "\10\6\6\0\27\6\1\175\2\6\1\0\2\6\11\0"+
253 "\1\6\1\0\1\121\7\6\6\0\32\6\1\0\2\6"+
254 "\11\0\1\6\1\0\6\6\1\123\1\6\6\0\32\6"+
255 "\1\0\2\6\11\0\1\6\1\0\4\6\1\176\3\6"+
256 "\6\0\32\6\1\0\2\6\11\0\1\6\1\0\3\6"+
257 "\1\177\4\6\6\0\32\6\1\0\2\6\11\0\1\6"+
258 "\1\0\5\6\1\127\2\6\6\0\32\6\1\0\2\6"+
259 "\11\0\1\6\1\0\6\6\1\200\1\6\6\0\32\6"+
260 "\1\0\2\6\11\0\1\6\1\0\10\6\6\0\5\6"+
261 "\1\201\24\6\1\0\2\6\11\0\1\6\1\0\10\6"+
262 "\6\0\5\6\1\202\24\6\1\0\2\6\11\0\1\6"+
263 "\1\0\5\6\1\203\2\6\6\0\32\6\1\0\2\6"+
264 "\11\0\1\6\1\0\10\6\6\0\5\6\1\204\24\6"+
265 "\1\0\2\6\11\0\1\6\1\0\10\6\6\0\1\6"+
266 "\1\205\30\6\1\0\2\6\11\0\1\6\1\0\1\167"+
267 "\7\6\6\0\32\6\1\0\2\6\11\0\1\6\1\0"+
268 "\10\6\6\0\16\6\1\206\13\6\1\0\2\6\11\0"+
269 "\1\207\1\0\10\6\6\0\32\6\1\0\2\6\11\0"+
270 "\1\6\1\0\10\6\6\0\6\6\1\130\23\6\10\0"+
271 "\1\210\56\0\2\6\11\0\1\6\1\0\3\6\1\211"+
272 "\4\6\6\0\32\6\1\0\2\6\11\0\1\6\1\0"+
273 "\1\212\7\6\6\0\32\6\1\0\2\6\11\0\1\6"+
274 "\1\0\2\6\1\213\5\6\6\0\32\6\1\0\2\6"+
275 "\11\0\1\6\1\0\10\6\6\0\1\123\31\6\1\0"+
276 "\2\6\11\0\1\6\1\0\3\6\1\135\4\6\6\0"+
277 "\32\6\1\0\2\6\11\0\1\6\1\0\2\6\1\214"+
278 "\5\6\6\0\32\6\1\0\2\6\11\0\1\6\1\0"+
279 "\3\6\1\215\4\6\6\0\32\6\1\0\2\6\11\0"+
280 "\1\6\1\0\2\6\1\216\5\6\6\0\32\6\1\0"+
281 "\2\6\11\0\1\6\1\0\3\6\1\217\3\6\1\220"+
282 "\6\0\13\6\1\220\16\6\1\0\2\6\11\0\1\6"+
283 "\1\0\10\6\6\0\5\6\1\117\24\6\1\0\2\6"+
284 "\11\0\1\6\1\0\5\6\1\221\2\6\6\0\32\6"+
285 "\1\0\2\6\11\0\1\6\1\0\10\6\6\0\2\6"+
286 "\1\222\27\6\1\0\2\6\11\0\1\6\1\0\3\6"+
287 "\1\223\4\6\6\0\32\6\1\0\2\6\11\0\1\6"+
288 "\1\0\10\6\6\0\6\6\1\224\23\6\1\0\2\6"+
289 "\11\0\1\6\1\0\7\6\1\145\6\0\32\6\1\0"+
290 "\2\6\11\0\1\6\1\0\3\6\1\225\4\6\6\0"+
291 "\32\6\1\0\2\6\11\0\1\6\1\0\10\6\6\0"+
292 "\1\6\1\226\30\6\1\0\2\6\11\0\1\6\1\0"+
293 "\5\6\1\117\2\6\6\0\32\6\1\0\2\6\11\0"+
294 "\1\6\1\0\4\6\1\227\3\6\6\0\12\6\1\230"+
295 "\17\6\1\0\2\6\11\0\1\6\1\0\3\6\1\231"+
296 "\4\6\6\0\32\6\22\0\1\232\62\0\1\233\114\0"+
297 "\1\234\65\0\1\235\20\0\2\6\11\0\1\6\1\0"+
298 "\1\135\7\6\6\0\32\6\1\0\2\6\11\0\1\6"+
299 "\1\0\10\6\6\0\5\6\1\236\24\6\1\0\2\6"+
300 "\11\0\1\6\1\0\5\6\1\237\2\6\6\0\32\6"+
301 "\1\0\2\6\11\0\1\6\1\0\6\6\1\240\1\6"+
302 "\6\0\32\6\1\0\2\6\11\0\1\6\1\0\10\6"+
303 "\6\0\1\175\31\6\1\0\2\6\11\0\1\6\1\0"+
304 "\1\6\1\241\6\6\6\0\32\6\1\0\2\6\11\0"+
305 "\1\6\1\0\6\6\1\242\1\6\6\0\32\6\1\0"+
306 "\2\6\11\0\1\6\1\0\6\6\1\243\1\6\6\0"+
307 "\32\6\1\0\2\6\11\0\1\6\1\0\2\6\1\236"+
308 "\5\6\6\0\32\6\1\0\2\6\11\0\1\6\1\0"+
309 "\10\6\6\0\16\6\1\244\13\6\1\0\2\6\11\0"+
310 "\1\6\1\0\10\6\6\0\22\6\1\245\7\6\1\0"+
311 "\2\6\11\0\1\6\1\0\1\6\1\246\6\6\6\0"+
312 "\32\6\1\0\2\6\11\0\1\6\1\0\10\6\6\0"+
313 "\12\6\1\247\17\6\1\0\2\6\11\0\1\6\1\0"+
314 "\1\6\1\150\6\6\6\0\32\6\1\0\2\6\11\0"+
315 "\1\6\1\0\5\6\1\250\2\6\6\0\32\6\1\0"+
316 "\2\6\11\0\1\6\1\0\10\6\6\0\5\6\1\251"+
317 "\24\6\1\0\2\6\11\0\1\6\1\0\10\6\6\0"+
318 "\30\6\1\252\1\6\1\0\2\6\11\0\1\6\1\0"+
319 "\3\6\1\175\4\6\6\0\32\6\1\0\2\6\11\0"+
320 "\1\6\1\0\10\6\6\0\6\6\1\253\23\6\1\0"+
321 "\2\6\11\0\1\6\1\0\1\6\1\135\6\6\6\0"+
322 "\32\6\1\0\2\6\11\0\1\6\1\0\10\6\6\0"+
323 "\5\6\1\254\24\6\1\0\2\6\11\0\1\6\1\0"+
324 "\1\255\7\6\6\0\32\6\1\0\2\6\11\0\1\6"+
325 "\1\0\1\6\1\175\6\6\6\0\32\6\1\0\2\6"+
326 "\11\0\1\6\1\0\4\6\1\176\2\6\1\146\6\0"+
327 "\32\6\1\0\2\6\11\0\1\6\1\0\3\6\1\256"+
328 "\4\6\6\0\32\6\1\0\2\6\11\0\1\6\1\0"+
329 "\3\6\1\257\4\6\6\0\32\6\1\0\2\6\11\0"+
330 "\1\6\1\0\10\6\6\0\6\6\1\175\23\6\31\0"+
331 "\1\260\75\0\1\261\63\0\1\262\47\0\1\232\45\0"+
332 "\2\6\11\0\1\6\1\0\6\6\1\151\1\6\6\0"+
333 "\32\6\1\0\2\6\11\0\1\6\1\0\10\6\6\0"+
334 "\4\6\1\123\25\6\1\0\2\6\11\0\1\6\1\0"+
335 "\3\6\1\263\4\6\6\0\32\6\1\0\2\6\11\0"+
336 "\1\6\1\0\7\6\1\135\6\0\32\6\1\0\2\6"+
337 "\11\0\1\6\1\0\6\6\1\135\1\6\6\0\32\6"+
338 "\1\0\2\6\11\0\1\6\1\0\3\6\1\123\4\6"+
339 "\6\0\32\6\1\0\2\6\11\0\1\6\1\0\10\6"+
340 "\6\0\23\6\1\264\6\6\1\0\2\6\11\0\1\6"+
341 "\1\0\10\6\6\0\5\6\1\265\24\6\1\0\2\6"+
342 "\11\0\1\6\1\0\10\6\6\0\3\6\1\266\26\6"+
343 "\1\0\2\6\11\0\1\6\1\0\1\123\7\6\6\0"+
344 "\32\6\1\0\2\6\11\0\1\6\1\0\1\6\1\151"+
345 "\6\6\6\0\32\6\1\0\2\6\11\0\1\6\1\0"+
346 "\2\6\1\267\5\6\6\0\32\6\1\0\2\6\11\0"+
347 "\1\6\1\0\10\6\6\0\4\6\1\135\25\6\1\0"+
348 "\2\6\11\0\1\6\1\0\4\6\1\123\3\6\6\0"+
349 "\32\6\1\0\2\6\11\0\1\6\1\0\10\6\6\0"+
350 "\5\6\1\270\24\6\1\0\2\6\11\0\1\6\1\0"+
351 "\10\6\6\0\1\271\31\6\1\0\2\6\11\0\1\6"+
352 "\1\0\1\272\7\6\6\0\32\6\34\0\1\273\52\0"+
353 "\1\274\45\0\2\6\11\0\1\6\1\0\10\6\6\0"+
354 "\6\6\1\275\23\6\1\0\2\6\11\0\1\6\1\0"+
355 "\10\6\6\0\24\6\1\276\5\6\1\0\2\6\11\0"+
356 "\1\6\1\0\10\6\6\0\1\277\31\6\1\0\2\6"+
357 "\11\0\1\6\1\0\3\6\1\222\4\6\6\0\32\6"+
358 "\1\0\2\6\11\0\1\6\1\0\5\6\1\242\2\6"+
359 "\6\0\32\6\1\0\2\6\11\0\1\6\1\0\10\6"+
360 "\6\0\2\6\1\150\27\6\1\0\2\6\11\0\1\6"+
361 "\1\0\10\6\6\0\26\6\1\135\3\6\1\0\2\6"+
362 "\11\0\1\6\1\0\5\6\1\300\2\6\6\0\32\6"+
363 "\47\0\1\232\35\0\1\232\47\0\2\6\11\0\1\6"+
364 "\1\0\1\301\7\6\6\0\32\6\1\0\2\6\11\0"+
365 "\1\6\1\0\10\6\6\0\25\6\1\302\4\6\1\0"+
366 "\2\6\11\0\1\6\1\0\10\6\6\0\13\6\1\135"+
367 "\16\6\1\0\2\6\11\0\1\6\1\0\1\303\7\6"+
368 "\6\0\32\6\1\0\2\6\11\0\1\6\1\0\10\6"+
369 "\6\0\13\6\1\304\16\6\1\0\2\6\11\0\1\6"+
370 "\1\0\10\6\6\0\14\6\1\135\15\6\1\0\2\6"+
371 "\11\0\1\6\1\0\5\6\1\305\2\6\6\0\32\6"+
372 "\1\0\2\6\11\0\1\6\1\0\5\6\1\306\2\6"+
373 "\6\0\32\6\1\0\2\6\11\0\1\6\1\0\10\6"+
374 "\6\0\3\6\1\236\26\6\1\0\2\6\11\0\1\6"+
375 "\1\0\1\6\1\307\6\6\6\0\32\6\1\0\2\6"+
376 "\11\0\1\6\1\0\10\6\6\0\3\6\1\310\26\6"+
377 "\1\0\2\6\11\0\1\6\1\0\5\6\1\311\2\6"+
378 "\6\0\32\6\1\0\2\6\11\0\1\6\1\0\10\6"+
379 "\6\0\13\6\1\151\16\6";
380
381 private static int [] zzUnpackTrans() {
382 int [] result = new int[9720];
383 int offset = 0;
384 offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
385 return result;
386 }
387
388 private static int zzUnpackTrans(String packed, int offset, int [] result) {
389 int i = 0; /* index in packed string */
390 int j = offset; /* index in unpacked array */
391 int l = packed.length();
392 while (i < l) {
393 int count = packed.charAt(i++);
394 int value = packed.charAt(i++);
395 value--;
396 do result[j++] = value; while (--count > 0);
397 }
398 return j;
399 }
400
401
402 /* error codes */
403 private static final int ZZ_UNKNOWN_ERROR = 0;
404 private static final int ZZ_NO_MATCH = 1;
405 private static final int ZZ_PUSHBACK_2BIG = 2;
406
407 /* error messages for the codes above */
408 private static final String ZZ_ERROR_MSG[] = {
409 "Unkown internal scanner error",
410 "Error: could not match input",
411 "Error: pushback value was too large"
412 };
413
414 /**
415 * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
416 */
417 private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
418
419 private static final String ZZ_ATTRIBUTE_PACKED_0 =
420 "\4\0\1\11\2\1\1\11\4\1\1\11\2\1\1\11"+
421 "\31\1\1\11\1\1\1\11\2\1\1\11\2\1\1\11"+
422 "\2\1\2\11\23\1\3\0\23\1\2\11\2\1\1\0"+
423 "\24\1\4\0\13\1\1\11\21\1\4\0\22\1\1\11"+
424 "\2\0\10\1\2\0\15\1";
425
426 private static int [] zzUnpackAttribute() {
427 int [] result = new int[201];
428 int offset = 0;
429 offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
430 return result;
431 }
432
433 private static int zzUnpackAttribute(String packed, int offset, int [] result) {
434 int i = 0; /* index in packed string */
435 int j = offset; /* index in unpacked array */
436 int l = packed.length();
437 while (i < l) {
438 int count = packed.charAt(i++);
439 int value = packed.charAt(i++);
440 do result[j++] = value; while (--count > 0);
441 }
442 return j;
443 }
444
445 /** the input device */
446 private java.io.Reader zzReader;
447
448 /** the current state of the DFA */
449 private int zzState;
450
451 /** the current lexical state */
452 private int zzLexicalState = YYINITIAL;
453
454 /** this buffer contains the current text to be matched and is
455 the source of the yytext() string */
456 private char zzBuffer[];
457
458 /** the textposition at the last accepting state */
459 private int zzMarkedPos;
460
461 /** the current text position in the buffer */
462 private int zzCurrentPos;
463
464 /** startRead marks the beginning of the yytext() string in the buffer */
465 private int zzStartRead;
466
467 /** endRead marks the last character in the buffer, that has been read
468 from input */
469 private int zzEndRead;
470
471 /** zzAtEOF == true <=> the scanner is at the EOF */
472 private boolean zzAtEOF;
473
474 /* user code: */
475
476
477 /**
478 * Constructor. This must be here because JFlex does not generate a
479 * no-parameter constructor.
480 */
481 public LuaTokenMaker() {
482 }
483
484
485 /**
486 * Adds the token specified to the current linked list of tokens.
487 *
488 * @param tokenType The token's type.
489 */
490 private void addToken(int tokenType) {
491 addToken(zzStartRead, zzMarkedPos-1, tokenType);
492 }
493
494
495 /**
496 * Adds the token specified to the current linked list of tokens.
497 *
498 * @param tokenType The token's type.
499 */
500 private void addToken(int start, int end, int tokenType) {
501 int so = start + offsetShift;
502 addToken(zzBuffer, start,end, tokenType, so);
503 }
504
505
506 /**
507 * Adds the token specified to the current linked list of tokens.
508 *
509 * @param array The character array.
510 * @param start The starting offset in the array.
511 * @param end The ending offset in the array.
512 * @param tokenType The token's type.
513 * @param startOffset The offset in the document at which this token
514 * occurs.
515 */
516 public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
517 super.addToken(array, start,end, tokenType, startOffset);
518 zzStartRead = zzMarkedPos;
519 }
520
521
522 /**
523 * Returns the text to place at the beginning and end of a
524 * line to "comment" it in a this programming language.
525 *
526 * @return The start and end strings to add to a line to "comment"
527 * it out.
528 */
529 public String[] getLineCommentStartAndEnd() {
530 return new String[] { "--", null };
531 }
532
533
534 /**
535 * Returns the first token in the linked list of tokens generated
536 * from <code>text</code>. This method must be implemented by
537 * subclasses so they can correctly implement syntax highlighting.
538 *
539 * @param text The text from which to get tokens.
540 * @param initialTokenType The token type we should start with.
541 * @param startOffset The offset into the document at which
542 * <code>text</code> starts.
543 * @return The first <code>Token</code> in a linked list representing
544 * the syntax highlighted text.
545 */
546 public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
547
548 resetTokenList();
549 this.offsetShift = -text.offset + startOffset;
550
551 // Start off in the proper state.
552 int state = Token.NULL;
553 switch (initialTokenType) {
554 case Token.COMMENT_MULTILINE:
555 state = MLC;
556 start = text.offset;
557 break;
558 case Token.LITERAL_STRING_DOUBLE_QUOTE:
559 state = LONGSTRING;
560 start = text.offset;
561 break;
562 default:
563 state = Token.NULL;
564 }
565
566 s = text;
567 try {
568 yyreset(zzReader);
569 yybegin(state);
570 return yylex();
571 } catch (IOException ioe) {
572 ioe.printStackTrace();
573 return new DefaultToken();
574 }
575
576 }
577
578
579 /**
580 * Refills the input buffer.
581 *
582 * @return <code>true</code> if EOF was reached, otherwise
583 * <code>false</code>.
584 * @exception IOException if any I/O-Error occurs.
585 */
586 private boolean zzRefill() throws java.io.IOException {
587 return zzCurrentPos>=s.offset+s.count;
588 }
589
590
591 /**
592 * Resets the scanner to read from a new input stream.
593 * Does not close the old reader.
594 *
595 * All internal variables are reset, the old input stream
596 * <b>cannot</b> be reused (internal buffer is discarded and lost).
597 * Lexical state is set to <tt>YY_INITIAL</tt>.
598 *
599 * @param reader the new input stream
600 */
601 public final void yyreset(java.io.Reader reader) throws java.io.IOException {
602 // 's' has been updated.
603 zzBuffer = s.array;
604 /*
605 * We replaced the line below with the two below it because zzRefill
606 * no longer "refills" the buffer (since the way we do it, it's always
607 * "full" the first time through, since it points to the segment's
608 * array). So, we assign zzEndRead here.
609 */
610 //zzStartRead = zzEndRead = s.offset;
611 zzStartRead = s.offset;
612 zzEndRead = zzStartRead + s.count - 1;
613 zzCurrentPos = zzMarkedPos = s.offset;
614 zzLexicalState = YYINITIAL;
615 zzReader = reader;
616 zzAtEOF = false;
617 }
618
619
620
621
622 /**
623 * Creates a new scanner
624 * There is also a java.io.InputStream version of this constructor.
625 *
626 * @param in the java.io.Reader to read input from.
627 */
628 public LuaTokenMaker(java.io.Reader in) {
629 this.zzReader = in;
630 }
631
632 /**
633 * Creates a new scanner.
634 * There is also java.io.Reader version of this constructor.
635 *
636 * @param in the java.io.Inputstream to read input from.
637 */
638 public LuaTokenMaker(java.io.InputStream in) {
639 this(new java.io.InputStreamReader(in));
640 }
641
642 /**
643 * Unpacks the compressed character translation table.
644 *
645 * @param packed the packed character translation table
646 * @return the unpacked character translation table
647 */
648 private static char [] zzUnpackCMap(String packed) {
649 char [] map = new char[0x10000];
650 int i = 0; /* index in packed string */
651 int j = 0; /* index in unpacked array */
652 while (i < 164) {
653 int count = packed.charAt(i++);
654 char value = packed.charAt(i++);
655 do map[j++] = value; while (--count > 0);
656 }
657 return map;
658 }
659
660
661 /**
662 * Closes the input stream.
663 */
664 public final void yyclose() throws java.io.IOException {
665 zzAtEOF = true; /* indicate end of file */
666 zzEndRead = zzStartRead; /* invalidate buffer */
667
668 if (zzReader != null)
669 zzReader.close();
670 }
671
672
673 /**
674 * Returns the current lexical state.
675 */
676 public final int yystate() {
677 return zzLexicalState;
678 }
679
680
681 /**
682 * Enters a new lexical state
683 *
684 * @param newState the new lexical state
685 */
686 public final void yybegin(int newState) {
687 zzLexicalState = newState;
688 }
689
690
691 /**
692 * Returns the text matched by the current regular expression.
693 */
694 public final String yytext() {
695 return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
696 }
697
698
699 /**
700 * Returns the character at position <tt>pos</tt> from the
701 * matched text.
702 *
703 * It is equivalent to yytext().charAt(pos), but faster
704 *
705 * @param pos the position of the character to fetch.
706 * A value from 0 to yylength()-1.
707 *
708 * @return the character at position pos
709 */
710 public final char yycharat(int pos) {
711 return zzBuffer[zzStartRead+pos];
712 }
713
714
715 /**
716 * Returns the length of the matched text region.
717 */
718 public final int yylength() {
719 return zzMarkedPos-zzStartRead;
720 }
721
722
723 /**
724 * Reports an error that occured while scanning.
725 *
726 * In a wellformed scanner (no or only correct usage of
727 * yypushback(int) and a match-all fallback rule) this method
728 * will only be called with things that "Can't Possibly Happen".
729 * If this method is called, something is seriously wrong
730 * (e.g. a JFlex bug producing a faulty scanner etc.).
731 *
732 * Usual syntax/scanner level error handling should be done
733 * in error fallback rules.
734 *
735 * @param errorCode the code of the errormessage to display
736 */
737 private void zzScanError(int errorCode) {
738 String message;
739 try {
740 message = ZZ_ERROR_MSG[errorCode];
741 }
742 catch (ArrayIndexOutOfBoundsException e) {
743 message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
744 }
745
746 throw new Error(message);
747 }
748
749
750 /**
751 * Pushes the specified amount of characters back into the input stream.
752 *
753 * They will be read again by then next call of the scanning method
754 *
755 * @param number the number of characters to be read again.
756 * This number must not be greater than yylength()!
757 */
758 public void yypushback(int number) {
759 if ( number > yylength() )
760 zzScanError(ZZ_PUSHBACK_2BIG);
761
762 zzMarkedPos -= number;
763 }
764
765
766 /**
767 * Resumes scanning until the next regular expression is matched,
768 * the end of input is encountered or an I/O-Error occurs.
769 *
770 * @return the next token
771 * @exception java.io.IOException if any I/O-Error occurs
772 */
773 public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
774 int zzInput;
775 int zzAction;
776
777 // cached fields:
778 int zzCurrentPosL;
779 int zzMarkedPosL;
780 int zzEndReadL = zzEndRead;
781 char [] zzBufferL = zzBuffer;
782 char [] zzCMapL = ZZ_CMAP;
783
784 int [] zzTransL = ZZ_TRANS;
785 int [] zzRowMapL = ZZ_ROWMAP;
786 int [] zzAttrL = ZZ_ATTRIBUTE;
787
788 while (true) {
789 zzMarkedPosL = zzMarkedPos;
790
791 zzAction = -1;
792
793 zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
794
795 zzState = zzLexicalState;
796
797
798 zzForAction: {
799 while (true) {
800
801 if (zzCurrentPosL < zzEndReadL)
802 zzInput = zzBufferL[zzCurrentPosL++];
803 else if (zzAtEOF) {
804 zzInput = YYEOF;
805 break zzForAction;
806 }
807 else {
808 // store back cached positions
809 zzCurrentPos = zzCurrentPosL;
810 zzMarkedPos = zzMarkedPosL;
811 boolean eof = zzRefill();
812 // get translated positions and possibly new buffer
813 zzCurrentPosL = zzCurrentPos;
814 zzMarkedPosL = zzMarkedPos;
815 zzBufferL = zzBuffer;
816 zzEndReadL = zzEndRead;
817 if (eof) {
818 zzInput = YYEOF;
819 break zzForAction;
820 }
821 else {
822 zzInput = zzBufferL[zzCurrentPosL++];
823 }
824 }
825 int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
826 if (zzNext == -1) break zzForAction;
827 zzState = zzNext;
828
829 int zzAttributes = zzAttrL[zzState];
830 if ( (zzAttributes & 1) == 1 ) {
831 zzAction = zzState;
832 zzMarkedPosL = zzCurrentPosL;
833 if ( (zzAttributes & 8) == 8 ) break zzForAction;
834 }
835
836 }
837 }
838
839 // store back cached position
840 zzMarkedPos = zzMarkedPosL;
841
842 switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
843 case 3:
844 { addNullToken(); return firstToken;
845 }
846 case 24: break;
847 case 13:
848 { addToken(Token.LITERAL_CHAR);
849 }
850 case 25: break;
851 case 15:
852 { start = zzMarkedPos-2; yybegin(LONGSTRING);
853 }
854 case 26: break;
855 case 19:
856 { yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE);
857 }
858 case 27: break;
859 case 4:
860 { addToken(Token.WHITESPACE);
861 }
862 case 28: break;
863 case 2:
864 { addToken(Token.LITERAL_NUMBER_FLOAT);
865 }
866 case 29: break;
867 case 17:
868 { addToken(Token.RESERVED_WORD);
869 }
870 case 30: break;
871 case 21:
872 { start = zzMarkedPos-4; yybegin(MLC);
873 }
874 case 31: break;
875 case 7:
876 { addToken(Token.SEPARATOR);
877 }
878 case 32: break;
879 case 1:
880 { addToken(Token.IDENTIFIER);
881 }
882 case 33: break;
883 case 18:
884 { addToken(Token.FUNCTION);
885 }
886 case 34: break;
887 case 5:
888 { addToken(Token.ERROR_CHAR); addNullToken(); return firstToken;
889 }
890 case 35: break;
891 case 6:
892 { addToken(Token.ERROR_STRING_DOUBLE); addNullToken(); return firstToken;
893 }
894 case 36: break;
895 case 23:
896 { addToken(Token.DATA_TYPE);
897 }
898 case 37: break;
899 case 22:
900 { addToken(Token.LITERAL_BOOLEAN);
901 }
902 case 38: break;
903 case 20:
904 { yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.LITERAL_STRING_DOUBLE_QUOTE);
905 }
906 case 39: break;
907 case 14:
908 { addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
909 }
910 case 40: break;
911 case 11:
912 { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken;
913 }
914 case 41: break;
915 case 12:
916 { addToken(start,zzStartRead-1, Token.COMMENT_EOL); return firstToken;
917 }
918 case 42: break;
919 case 8:
920 { addToken(Token.OPERATOR);
921 }
922 case 43: break;
923 case 16:
924 { start = zzMarkedPos-2; yybegin(LINECOMMENT);
925 }
926 case 44: break;
927 case 9:
928 {
929 }
930 case 45: break;
931 case 10:
932 { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken;
933 }
934 case 46: break;
935 default:
936 if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
937 zzAtEOF = true;
938 switch (zzLexicalState) {
939 case YYINITIAL: {
940 addNullToken(); return firstToken;
941 }
942 case 202: break;
943 case LONGSTRING: {
944 addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken;
945 }
946 case 203: break;
947 case LINECOMMENT: {
948 addToken(start,zzStartRead-1, Token.COMMENT_EOL); return firstToken;
949 }
950 case 204: break;
951 case MLC: {
952 addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken;
953 }
954 case 205: break;
955 default:
956 return null;
957 }
958 }
959 else {
960 zzScanError(ZZ_NO_MATCH);
961 }
962 }
963 }
964 }
965
966
967}
Note: See TracBrowser for help on using the repository browser.