source: other-projects/rsyntax-textarea/src/java/org/fife/ui/rsyntaxtextarea/modes/ScalaTokenMaker.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 8/21/09 3:31 PM */
2
3/*
4 * 8/19/2009
5 *
6 * ScalaTokenMaker.java - Scanner for the Scala 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 Scala 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 ScalaTokenMaker.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.5
55 *
56 */
57
58public class ScalaTokenMaker extends AbstractJFlexCTokenMaker {
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 EOL_COMMENT = 2;
65 public static final int YYINITIAL = 0;
66 public static final int MLC = 1;
67
68 /**
69 * Translates characters to character classes
70 */
71 private static final String ZZ_CMAP_PACKED =
72 "\11\0\1\31\1\24\1\0\1\31\23\0\1\31\1\33\1\25\1\33"+
73 "\1\1\1\33\1\33\1\22\2\4\1\30\1\16\1\33\1\16\1\21"+
74 "\1\27\1\12\11\3\1\42\1\33\1\0\1\33\1\0\2\33\3\10"+
75 "\1\17\1\14\1\17\5\1\1\6\6\1\1\52\7\1\1\4\1\23"+
76 "\1\4\1\0\1\5\1\26\1\44\1\45\1\11\1\20\1\15\1\40"+
77 "\1\61\1\34\1\41\1\56\1\60\1\7\1\53\1\50\1\47\1\36"+
78 "\1\2\1\46\1\37\1\35\1\55\1\57\1\43\1\13\1\51\1\54"+
79 "\1\32\1\0\1\32\1\33\uff81\0";
80
81 /**
82 * Translates characters to character classes
83 */
84 private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
85
86 /**
87 * Translates DFA states to action switch labels.
88 */
89 private static final int [] ZZ_ACTION = zzUnpackAction();
90
91 private static final String ZZ_ACTION_PACKED_0 =
92 "\3\0\2\1\1\2\1\3\2\1\1\2\3\1\1\4"+
93 "\1\5\1\6\2\1\1\7\15\1\1\10\1\11\5\10"+
94 "\1\12\3\10\1\1\1\2\1\0\2\13\3\1\1\0"+
95 "\3\1\1\14\1\15\1\4\1\6\1\16\1\6\1\17"+
96 "\1\20\26\1\1\21\10\0\1\1\1\13\1\0\4\1"+
97 "\1\22\1\1\1\23\11\1\1\14\12\1\10\0\21\1"+
98 "\2\0\1\24\2\0\1\25\4\1\1\14\6\1\4\0"+
99 "\3\1";
100
101 private static int [] zzUnpackAction() {
102 int [] result = new int[173];
103 int offset = 0;
104 offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
105 return result;
106 }
107
108 private static int zzUnpackAction(String packed, int offset, int [] result) {
109 int i = 0; /* index in packed string */
110 int j = offset; /* index in unpacked array */
111 int l = packed.length();
112 while (i < l) {
113 int count = packed.charAt(i++);
114 int value = packed.charAt(i++);
115 do result[j++] = value; while (--count > 0);
116 }
117 return j;
118 }
119
120
121 /**
122 * Translates a state to a row index in the transition table
123 */
124 private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
125
126 private static final String ZZ_ROWMAP_PACKED_0 =
127 "\0\0\0\62\0\144\0\226\0\310\0\372\0\226\0\u012c"+
128 "\0\u015e\0\u0190\0\u01c2\0\u01f4\0\u0226\0\u0258\0\226\0\u028a"+
129 "\0\u02bc\0\u02ee\0\u0320\0\u0352\0\u0384\0\u03b6\0\u03e8\0\u041a"+
130 "\0\u044c\0\u047e\0\u04b0\0\u04e2\0\u0514\0\u0546\0\u0578\0\u05aa"+
131 "\0\u05dc\0\226\0\u060e\0\u0640\0\u0672\0\u06a4\0\u06d6\0\226"+
132 "\0\u0708\0\u073a\0\u076c\0\u079e\0\226\0\u07d0\0\226\0\u0802"+
133 "\0\u0834\0\u0866\0\u0898\0\u08ca\0\u08fc\0\u092e\0\u0960\0\310"+
134 "\0\226\0\u0992\0\u09c4\0\226\0\u09f6\0\226\0\226\0\u0a28"+
135 "\0\u0a5a\0\u0a8c\0\u0abe\0\u0af0\0\u0b22\0\u0b54\0\u0b86\0\u0bb8"+
136 "\0\u0bea\0\u0c1c\0\u0c4e\0\u0c80\0\u0cb2\0\u0ce4\0\u0d16\0\u0d48"+
137 "\0\u0d7a\0\u0dac\0\u0dde\0\u0e10\0\u0e42\0\226\0\u0e74\0\u0ea6"+
138 "\0\u0ed8\0\u0f0a\0\u0f3c\0\u0f6e\0\u0fa0\0\u0fd2\0\u1004\0\u1036"+
139 "\0\u1068\0\u109a\0\u10cc\0\u10fe\0\u1130\0\u08ca\0\u1162\0\226"+
140 "\0\u1194\0\u11c6\0\u11f8\0\u122a\0\u125c\0\u128e\0\u12c0\0\u12f2"+
141 "\0\u1324\0\u1356\0\u1388\0\u13ba\0\u13ec\0\u141e\0\u1450\0\u1482"+
142 "\0\u14b4\0\u14e6\0\u1518\0\u154a\0\u157c\0\u15ae\0\u15e0\0\u1612"+
143 "\0\u1644\0\u1676\0\u16a8\0\u16da\0\u170c\0\u173e\0\u1770\0\u17a2"+
144 "\0\u17d4\0\u1806\0\u1838\0\u186a\0\u189c\0\u18ce\0\u1900\0\u1932"+
145 "\0\u1964\0\u1996\0\u19c8\0\u19fa\0\u1a2c\0\u1a5e\0\u1a90\0\u1ac2"+
146 "\0\u1af4\0\u1b26\0\u1b58\0\u1b8a\0\u1bbc\0\u1bee\0\u1c20\0\u1c52"+
147 "\0\u1c84\0\u1cb6\0\u1ce8\0\u1d1a\0\u1d4c\0\u1d7e\0\u1db0\0\u1ac2"+
148 "\0\u1de2\0\u1b58\0\u1e14\0\u1e46\0\u1e78";
149
150 private static int [] zzUnpackRowMap() {
151 int [] result = new int[173];
152 int offset = 0;
153 offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
154 return result;
155 }
156
157 private static int zzUnpackRowMap(String packed, int offset, int [] result) {
158 int i = 0; /* index in packed string */
159 int j = offset; /* index in unpacked array */
160 int l = packed.length();
161 while (i < l) {
162 int high = packed.charAt(i++) << 16;
163 result[j++] = high | packed.charAt(i++);
164 }
165 return j;
166 }
167
168 /**
169 * The transition table of the DFA
170 */
171 private static final int [] ZZ_TRANS = zzUnpackTrans();
172
173 private static final String ZZ_TRANS_PACKED_0 =
174 "\1\4\2\5\1\6\1\7\2\5\1\10\1\5\1\11"+
175 "\1\12\2\5\1\13\1\4\1\5\1\14\1\15\1\16"+
176 "\1\4\1\17\1\20\1\21\1\22\1\4\1\23\1\7"+
177 "\1\4\1\5\1\24\1\25\1\26\1\27\1\30\1\4"+
178 "\1\31\1\32\1\5\1\33\1\34\1\35\1\36\1\5"+
179 "\1\37\3\5\1\40\2\5\24\41\1\42\3\41\1\43"+
180 "\3\41\1\44\3\41\1\45\2\41\1\46\16\41\24\47"+
181 "\1\50\7\47\1\51\3\47\1\52\2\47\1\53\16\47"+
182 "\63\0\3\5\1\0\1\54\10\5\1\0\2\5\13\0"+
183 "\6\5\1\0\17\5\3\0\1\6\2\0\2\55\2\0"+
184 "\1\6\1\0\2\56\1\0\2\57\1\60\16\0\1\57"+
185 "\22\0\3\5\1\0\1\54\10\5\1\0\2\5\13\0"+
186 "\6\5\1\0\1\5\1\61\15\5\1\0\3\5\1\0"+
187 "\1\54\1\5\1\62\6\5\1\0\2\5\13\0\6\5"+
188 "\1\0\1\5\1\63\15\5\3\0\1\6\2\0\2\55"+
189 "\2\0\1\6\1\64\2\56\1\0\2\57\1\60\16\0"+
190 "\1\57\22\0\3\5\1\0\1\54\1\5\1\65\3\5"+
191 "\1\66\2\5\1\0\2\5\13\0\6\5\1\0\17\5"+
192 "\1\0\3\5\1\0\1\54\7\5\1\67\1\0\2\5"+
193 "\13\0\6\5\1\0\4\5\1\70\12\5\3\0\1\60"+
194 "\6\0\1\60\47\0\22\16\1\71\1\72\36\16\23\20"+
195 "\1\73\1\20\1\74\34\20\26\75\1\0\33\75\27\0"+
196 "\1\76\1\77\62\0\1\23\31\0\3\5\1\0\1\54"+
197 "\10\5\1\0\2\5\13\0\1\100\5\5\1\0\3\5"+
198 "\1\101\2\5\1\102\10\5\1\0\3\5\1\0\1\54"+
199 "\10\5\1\0\2\5\13\0\6\5\1\0\1\5\1\103"+
200 "\1\5\1\104\13\5\1\0\3\5\1\0\1\54\7\5"+
201 "\1\105\1\0\2\5\13\0\6\5\1\0\12\5\1\106"+
202 "\4\5\1\0\3\5\1\0\1\54\10\5\1\0\2\5"+
203 "\13\0\5\5\1\107\1\0\1\5\1\110\2\5\1\111"+
204 "\12\5\1\0\3\5\1\0\1\54\10\5\1\0\2\5"+
205 "\13\0\4\5\1\70\1\5\1\0\10\5\1\112\6\5"+
206 "\1\0\3\5\1\0\1\54\10\5\1\0\2\5\13\0"+
207 "\1\113\4\5\1\114\1\0\17\5\1\0\3\5\1\0"+
208 "\1\54\10\5\1\0\2\5\13\0\6\5\1\0\2\5"+
209 "\1\115\14\5\1\0\3\5\1\0\1\54\7\5\1\116"+
210 "\1\0\2\5\13\0\6\5\1\0\17\5\1\0\3\5"+
211 "\1\0\1\54\10\5\1\0\2\5\13\0\6\5\1\0"+
212 "\2\5\1\117\11\5\1\120\2\5\1\0\3\5\1\0"+
213 "\1\54\7\5\1\121\1\0\2\5\13\0\6\5\1\0"+
214 "\12\5\1\122\4\5\1\0\3\5\1\0\1\54\10\5"+
215 "\1\0\2\5\13\0\5\5\1\123\1\0\17\5\1\0"+
216 "\3\5\1\0\1\54\10\5\1\0\2\5\13\0\6\5"+
217 "\1\0\1\5\1\124\15\5\1\0\3\5\1\0\1\54"+
218 "\10\5\1\0\2\5\13\0\6\5\1\0\1\5\1\125"+
219 "\15\5\24\41\1\0\3\41\1\0\3\41\1\0\3\41"+
220 "\1\0\2\41\1\0\16\41\27\0\1\126\67\0\1\127"+
221 "\61\0\1\130\3\0\1\131\63\0\1\132\16\0\24\47"+
222 "\1\0\7\47\1\0\3\47\1\0\2\47\1\0\16\47"+
223 "\35\0\1\133\61\0\1\134\3\0\1\135\63\0\1\136"+
224 "\16\0\1\137\3\5\1\0\1\54\10\5\1\137\2\5"+
225 "\1\0\7\137\1\0\2\137\6\5\1\137\17\5\3\0"+
226 "\1\140\6\0\1\140\3\0\1\141\46\0\1\60\6\0"+
227 "\1\60\1\0\2\56\1\0\2\57\17\0\1\57\22\0"+
228 "\3\5\1\0\1\54\10\5\1\0\2\5\13\0\6\5"+
229 "\1\0\11\5\1\142\5\5\1\0\3\5\1\0\1\54"+
230 "\10\5\1\0\2\5\13\0\6\5\1\0\1\5\1\143"+
231 "\15\5\1\0\3\5\1\0\1\54\10\5\1\0\2\5"+
232 "\13\0\1\5\1\144\1\5\1\145\2\5\1\0\17\5"+
233 "\3\0\1\146\4\0\3\146\1\0\2\146\1\0\2\146"+
234 "\17\0\1\146\3\0\2\146\15\0\3\5\1\0\1\54"+
235 "\10\5\1\0\2\5\13\0\3\5\1\145\2\5\1\0"+
236 "\17\5\1\0\3\5\1\0\1\54\10\5\1\0\2\5"+
237 "\13\0\1\5\1\147\4\5\1\0\17\5\1\0\3\5"+
238 "\1\0\1\54\10\5\1\0\2\5\13\0\4\5\1\70"+
239 "\1\5\1\0\17\5\24\16\1\0\35\16\24\20\1\0"+
240 "\35\20\26\75\1\150\33\75\1\0\3\5\1\0\1\54"+
241 "\10\5\1\0\2\5\13\0\5\5\1\151\1\0\3\5"+
242 "\1\152\13\5\1\0\3\5\1\0\1\54\10\5\1\0"+
243 "\2\5\13\0\6\5\1\0\1\5\1\153\4\5\1\70"+
244 "\3\5\1\145\4\5\1\0\3\5\1\0\1\54\10\5"+
245 "\1\0\2\5\13\0\2\5\1\145\3\5\1\0\17\5"+
246 "\1\0\3\5\1\0\1\54\3\5\1\154\4\5\1\0"+
247 "\2\5\13\0\6\5\1\0\17\5\1\0\3\5\1\0"+
248 "\1\54\10\5\1\0\2\5\13\0\5\5\1\155\1\0"+
249 "\4\5\1\156\12\5\1\0\3\5\1\0\1\54\10\5"+
250 "\1\0\2\5\13\0\6\5\1\0\1\5\1\157\15\5"+
251 "\1\0\3\5\1\0\1\54\10\5\1\0\2\5\13\0"+
252 "\2\5\1\160\3\5\1\0\17\5\1\0\3\5\1\0"+
253 "\1\54\10\5\1\0\2\5\13\0\6\5\1\0\5\5"+
254 "\1\161\11\5\1\0\3\5\1\0\1\54\1\5\1\65"+
255 "\6\5\1\0\2\5\13\0\6\5\1\0\17\5\1\0"+
256 "\3\5\1\0\1\54\10\5\1\0\2\5\13\0\6\5"+
257 "\1\0\3\5\1\162\13\5\1\0\3\5\1\0\1\54"+
258 "\10\5\1\0\2\5\13\0\2\5\1\163\3\5\1\0"+
259 "\17\5\1\0\3\5\1\0\1\54\10\5\1\0\2\5"+
260 "\13\0\5\5\1\164\1\0\17\5\1\0\3\5\1\0"+
261 "\1\54\10\5\1\0\2\5\13\0\1\5\1\165\4\5"+
262 "\1\0\17\5\1\0\3\5\1\0\1\54\10\5\1\0"+
263 "\2\5\13\0\3\5\1\166\2\5\1\0\17\5\1\0"+
264 "\1\5\1\167\1\5\1\0\1\54\10\5\1\0\2\5"+
265 "\13\0\1\5\1\170\4\5\1\0\17\5\1\0\3\5"+
266 "\1\0\1\54\10\5\1\0\2\5\13\0\6\5\1\0"+
267 "\13\5\1\171\3\5\1\0\3\5\1\0\1\54\7\5"+
268 "\1\172\1\0\2\5\13\0\6\5\1\0\17\5\1\0"+
269 "\3\5\1\0\1\54\10\5\1\0\2\5\13\0\6\5"+
270 "\1\0\1\70\16\5\1\0\3\5\1\0\1\54\1\5"+
271 "\1\173\6\5\1\0\2\5\13\0\6\5\1\0\17\5"+
272 "\1\0\3\5\1\0\1\54\7\5\1\174\1\0\2\5"+
273 "\13\0\6\5\1\0\17\5\1\0\3\5\1\0\1\54"+
274 "\10\5\1\0\2\5\13\0\1\5\1\144\4\5\1\0"+
275 "\17\5\1\0\3\5\1\0\1\54\1\5\1\70\6\5"+
276 "\1\0\2\5\13\0\6\5\1\0\3\5\1\70\13\5"+
277 "\35\0\1\175\62\0\1\176\32\0\1\177\115\0\1\200"+
278 "\53\0\1\201\62\0\1\202\32\0\1\203\115\0\1\204"+
279 "\16\0\1\137\15\0\1\137\3\0\7\137\1\0\2\137"+
280 "\6\0\1\137\22\0\1\140\6\0\1\140\4\0\2\57"+
281 "\17\0\1\57\24\0\1\140\6\0\1\140\50\0\3\5"+
282 "\1\0\1\54\10\5\1\0\2\5\13\0\6\5\1\0"+
283 "\6\5\1\70\10\5\1\0\3\5\1\0\1\54\10\5"+
284 "\1\0\2\5\13\0\3\5\1\151\2\5\1\0\17\5"+
285 "\1\0\3\5\1\0\1\54\3\5\1\165\4\5\1\0"+
286 "\2\5\13\0\6\5\1\0\17\5\1\0\3\5\1\0"+
287 "\1\54\7\5\1\70\1\0\2\5\13\0\6\5\1\0"+
288 "\17\5\1\0\3\5\1\0\1\54\7\5\1\205\1\0"+
289 "\2\5\13\0\6\5\1\0\17\5\1\0\3\5\1\0"+
290 "\1\54\10\5\1\0\2\5\13\0\3\5\1\70\2\5"+
291 "\1\0\17\5\1\0\3\5\1\0\1\54\10\5\1\0"+
292 "\2\5\13\0\6\5\1\0\4\5\1\121\12\5\1\0"+
293 "\3\5\1\0\1\54\10\5\1\0\2\5\13\0\5\5"+
294 "\1\206\1\0\17\5\1\0\3\5\1\0\1\54\10\5"+
295 "\1\0\2\5\13\0\6\5\1\0\15\5\1\207\1\5"+
296 "\1\0\3\5\1\0\1\54\10\5\1\0\2\5\13\0"+
297 "\6\5\1\0\14\5\1\210\2\5\1\0\3\5\1\0"+
298 "\1\54\10\5\1\0\2\5\13\0\1\5\1\211\4\5"+
299 "\1\0\17\5\1\0\3\5\1\0\1\54\1\5\1\212"+
300 "\6\5\1\0\2\5\13\0\6\5\1\0\17\5\1\0"+
301 "\3\5\1\0\1\54\7\5\1\213\1\0\2\5\13\0"+
302 "\6\5\1\0\17\5\1\0\3\5\1\0\1\54\10\5"+
303 "\1\0\2\5\13\0\6\5\1\0\1\5\1\214\15\5"+
304 "\1\0\3\5\1\0\1\54\10\5\1\0\2\5\13\0"+
305 "\6\5\1\0\7\5\1\215\7\5\1\0\3\5\1\0"+
306 "\1\54\1\5\1\216\6\5\1\0\2\5\13\0\6\5"+
307 "\1\0\4\5\1\217\12\5\1\0\3\5\1\0\1\54"+
308 "\1\5\1\145\6\5\1\0\2\5\13\0\6\5\1\0"+
309 "\17\5\1\0\3\5\1\0\1\54\10\5\1\0\2\5"+
310 "\13\0\1\70\5\5\1\0\17\5\1\0\3\5\1\0"+
311 "\1\54\10\5\1\0\2\5\13\0\1\5\1\220\4\5"+
312 "\1\0\17\5\1\0\3\5\1\0\1\54\10\5\1\0"+
313 "\2\5\13\0\6\5\1\0\12\5\1\221\4\5\1\0"+
314 "\3\5\1\0\1\54\10\5\1\0\2\5\13\0\6\5"+
315 "\1\0\12\5\1\222\4\5\1\0\3\5\1\0\1\54"+
316 "\7\5\1\223\1\0\2\5\13\0\6\5\1\0\17\5"+
317 "\1\0\3\5\1\0\1\54\10\5\1\0\2\5\13\0"+
318 "\6\5\1\0\3\5\1\224\13\5\1\0\3\5\1\0"+
319 "\1\54\1\5\1\70\6\5\1\0\2\5\13\0\6\5"+
320 "\1\0\17\5\1\0\3\5\1\0\1\54\1\5\1\225"+
321 "\6\5\1\0\2\5\13\0\6\5\1\0\17\5\36\0"+
322 "\1\226\65\0\1\227\34\0\1\176\65\0\1\230\76\0"+
323 "\1\231\65\0\1\232\34\0\1\202\65\0\1\233\41\0"+
324 "\3\5\1\0\1\54\10\5\1\0\2\5\13\0\6\5"+
325 "\1\0\5\5\1\234\11\5\1\0\3\5\1\0\1\54"+
326 "\10\5\1\0\2\5\13\0\1\5\1\70\4\5\1\0"+
327 "\17\5\1\0\3\5\1\0\1\54\10\5\1\0\2\5"+
328 "\13\0\6\5\1\0\1\5\1\235\15\5\1\0\3\5"+
329 "\1\0\1\54\10\5\1\0\2\5\13\0\6\5\1\0"+
330 "\1\5\1\236\15\5\1\0\3\5\1\0\1\54\7\5"+
331 "\1\237\1\0\2\5\13\0\6\5\1\0\17\5\1\0"+
332 "\3\5\1\0\1\54\7\5\1\225\1\0\2\5\13\0"+
333 "\6\5\1\0\17\5\1\0\3\5\1\0\1\54\10\5"+
334 "\1\0\2\5\13\0\6\5\1\0\3\5\1\70\13\5"+
335 "\1\0\3\5\1\0\1\54\1\5\1\240\6\5\1\0"+
336 "\2\5\13\0\6\5\1\0\17\5\1\0\3\5\1\0"+
337 "\1\54\10\5\1\0\2\5\13\0\6\5\1\0\4\5"+
338 "\1\241\12\5\1\0\3\5\1\0\1\54\10\5\1\0"+
339 "\2\5\13\0\5\5\1\242\1\0\17\5\1\0\3\5"+
340 "\1\0\1\54\10\5\1\0\2\5\13\0\6\5\1\0"+
341 "\3\5\1\206\13\5\1\0\3\5\1\0\1\54\10\5"+
342 "\1\0\2\5\13\0\6\5\1\0\3\5\1\243\13\5"+
343 "\1\0\3\5\1\0\1\54\10\5\1\0\2\5\13\0"+
344 "\5\5\1\244\1\0\17\5\1\0\3\5\1\0\1\54"+
345 "\10\5\1\0\2\5\13\0\6\5\1\0\3\5\1\245"+
346 "\13\5\1\0\3\5\1\0\1\54\3\5\1\206\4\5"+
347 "\1\0\2\5\13\0\6\5\1\0\17\5\1\0\3\5"+
348 "\1\0\1\54\10\5\1\0\2\5\13\0\6\5\1\0"+
349 "\3\5\1\246\13\5\1\0\3\5\1\0\1\54\10\5"+
350 "\1\0\1\5\1\70\13\0\6\5\1\0\17\5\37\0"+
351 "\1\176\2\0\1\227\46\0\1\247\33\0\3\230\1\250"+
352 "\11\230\1\250\2\230\2\250\4\0\1\230\1\250\2\0"+
353 "\1\250\6\230\1\250\17\230\37\0\1\202\2\0\1\232"+
354 "\46\0\1\251\33\0\3\233\1\252\11\233\1\252\2\233"+
355 "\2\252\4\0\1\233\1\252\2\0\1\252\6\233\1\252"+
356 "\17\233\1\0\3\5\1\0\1\54\10\5\1\0\1\5"+
357 "\1\151\13\0\6\5\1\0\17\5\1\0\3\5\1\0"+
358 "\1\54\10\5\1\0\2\5\13\0\6\5\1\0\16\5"+
359 "\1\145\1\0\3\5\1\0\1\54\10\5\1\0\2\5"+
360 "\13\0\1\5\1\145\4\5\1\0\17\5\1\0\3\5"+
361 "\1\0\1\54\3\5\1\253\4\5\1\0\2\5\13\0"+
362 "\6\5\1\0\17\5\1\0\3\5\1\0\1\54\1\5"+
363 "\1\142\6\5\1\0\2\5\13\0\6\5\1\0\17\5"+
364 "\1\0\3\5\1\0\1\54\10\5\1\0\2\5\13\0"+
365 "\6\5\1\0\10\5\1\145\6\5\1\0\3\5\1\0"+
366 "\1\54\3\5\1\153\4\5\1\0\2\5\13\0\6\5"+
367 "\1\0\17\5\1\0\3\5\1\0\1\54\10\5\1\0"+
368 "\2\5\13\0\6\5\1\0\1\5\1\223\15\5\1\0"+
369 "\3\5\1\0\1\54\10\5\1\0\2\5\13\0\6\5"+
370 "\1\0\3\5\1\254\13\5\1\0\3\5\1\0\1\54"+
371 "\10\5\1\0\2\5\13\0\6\5\1\0\5\5\1\70"+
372 "\11\5\1\0\3\5\1\0\1\54\10\5\1\0\2\5"+
373 "\13\0\5\5\1\255\1\0\17\5\27\0\1\230\61\0"+
374 "\1\233\33\0\3\5\1\0\1\54\10\5\1\0\2\5"+
375 "\13\0\1\5\1\212\4\5\1\0\17\5\1\0\3\5"+
376 "\1\0\1\54\7\5\1\151\1\0\2\5\13\0\6\5"+
377 "\1\0\17\5\1\0\3\5\1\0\1\54\10\5\1\0"+
378 "\1\5\1\145\13\0\6\5\1\0\17\5";
379
380 private static int [] zzUnpackTrans() {
381 int [] result = new int[7850];
382 int offset = 0;
383 offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
384 return result;
385 }
386
387 private static int zzUnpackTrans(String packed, int offset, int [] result) {
388 int i = 0; /* index in packed string */
389 int j = offset; /* index in unpacked array */
390 int l = packed.length();
391 while (i < l) {
392 int count = packed.charAt(i++);
393 int value = packed.charAt(i++);
394 value--;
395 do result[j++] = value; while (--count > 0);
396 }
397 return j;
398 }
399
400
401 /* error codes */
402 private static final int ZZ_UNKNOWN_ERROR = 0;
403 private static final int ZZ_NO_MATCH = 1;
404 private static final int ZZ_PUSHBACK_2BIG = 2;
405
406 /* error messages for the codes above */
407 private static final String ZZ_ERROR_MSG[] = {
408 "Unkown internal scanner error",
409 "Error: could not match input",
410 "Error: pushback value was too large"
411 };
412
413 /**
414 * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
415 */
416 private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
417
418 private static final String ZZ_ATTRIBUTE_PACKED_0 =
419 "\3\0\1\11\2\1\1\11\7\1\1\11\22\1\1\11"+
420 "\5\1\1\11\4\1\1\11\1\0\1\11\4\1\1\0"+
421 "\4\1\1\11\2\1\1\11\1\1\2\11\26\1\1\11"+
422 "\10\0\2\1\1\0\6\1\1\11\24\1\10\0\21\1"+
423 "\2\0\1\1\2\0\14\1\4\0\3\1";
424
425 private static int [] zzUnpackAttribute() {
426 int [] result = new int[173];
427 int offset = 0;
428 offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
429 return result;
430 }
431
432 private static int zzUnpackAttribute(String packed, int offset, int [] result) {
433 int i = 0; /* index in packed string */
434 int j = offset; /* index in unpacked array */
435 int l = packed.length();
436 while (i < l) {
437 int count = packed.charAt(i++);
438 int value = packed.charAt(i++);
439 do result[j++] = value; while (--count > 0);
440 }
441 return j;
442 }
443
444 /** the input device */
445 private java.io.Reader zzReader;
446
447 /** the current state of the DFA */
448 private int zzState;
449
450 /** the current lexical state */
451 private int zzLexicalState = YYINITIAL;
452
453 /** this buffer contains the current text to be matched and is
454 the source of the yytext() string */
455 private char zzBuffer[];
456
457 /** the textposition at the last accepting state */
458 private int zzMarkedPos;
459
460 /** the current text position in the buffer */
461 private int zzCurrentPos;
462
463 /** startRead marks the beginning of the yytext() string in the buffer */
464 private int zzStartRead;
465
466 /** endRead marks the last character in the buffer, that has been read
467 from input */
468 private int zzEndRead;
469
470 /** zzAtEOF == true <=> the scanner is at the EOF */
471 private boolean zzAtEOF;
472
473 /* user code: */
474
475
476 /**
477 * Constructor. This must be here because JFlex does not generate a
478 * no-parameter constructor.
479 */
480 public ScalaTokenMaker() {
481 }
482
483
484 /**
485 * Adds the token specified to the current linked list of tokens.
486 *
487 * @param tokenType The token's type.
488 * @see #addToken(int, int, int)
489 */
490 private void addHyperlinkToken(int start, int end, int tokenType) {
491 int so = start + offsetShift;
492 addToken(zzBuffer, start,end, tokenType, so, true);
493 }
494
495
496 /**
497 * Adds the token specified to the current linked list of tokens.
498 *
499 * @param tokenType The token's type.
500 */
501 private void addToken(int tokenType) {
502 addToken(zzStartRead, zzMarkedPos-1, tokenType);
503 }
504
505
506 /**
507 * Adds the token specified to the current linked list of tokens.
508 *
509 * @param tokenType The token's type.
510 * @see #addHyperlinkToken(int, int, int)
511 */
512 private void addToken(int start, int end, int tokenType) {
513 int so = start + offsetShift;
514 addToken(zzBuffer, start,end, tokenType, so, false);
515 }
516
517
518 /**
519 * Adds the token specified to the current linked list of tokens.
520 *
521 * @param array The character array.
522 * @param start The starting offset in the array.
523 * @param end The ending offset in the array.
524 * @param tokenType The token's type.
525 * @param startOffset The offset in the document at which this token
526 * occurs.
527 * @param hyperlink Whether this token is a hyperlink.
528 */
529 public void addToken(char[] array, int start, int end, int tokenType,
530 int startOffset, boolean hyperlink) {
531 super.addToken(array, start,end, tokenType, startOffset, hyperlink);
532 zzStartRead = zzMarkedPos;
533 }
534
535
536 /**
537 * Returns the text to place at the beginning and end of a
538 * line to "comment" it in a this programming language.
539 *
540 * @return The start and end strings to add to a line to "comment"
541 * it out.
542 */
543 public String[] getLineCommentStartAndEnd() {
544 return new String[] { "//", null };
545 }
546
547
548 /**
549 * Returns the first token in the linked list of tokens generated
550 * from <code>text</code>. This method must be implemented by
551 * subclasses so they can correctly implement syntax highlighting.
552 *
553 * @param text The text from which to get tokens.
554 * @param initialTokenType The token type we should start with.
555 * @param startOffset The offset into the document at which
556 * <code>text</code> starts.
557 * @return The first <code>Token</code> in a linked list representing
558 * the syntax highlighted text.
559 */
560 public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
561
562 resetTokenList();
563 this.offsetShift = -text.offset + startOffset;
564
565 // Start off in the proper state.
566 int state = Token.NULL;
567 switch (initialTokenType) {
568 case Token.COMMENT_MULTILINE:
569 state = MLC;
570 start = text.offset;
571 break;
572 default:
573 state = Token.NULL;
574 }
575
576 s = text;
577 try {
578 yyreset(zzReader);
579 yybegin(state);
580 return yylex();
581 } catch (IOException ioe) {
582 ioe.printStackTrace();
583 return new DefaultToken();
584 }
585
586 }
587
588
589 /**
590 * Refills the input buffer.
591 *
592 * @return <code>true</code> if EOF was reached, otherwise
593 * <code>false</code>.
594 * @exception IOException if any I/O-Error occurs.
595 */
596 private boolean zzRefill() throws java.io.IOException {
597 return zzCurrentPos>=s.offset+s.count;
598 }
599
600
601 /**
602 * Resets the scanner to read from a new input stream.
603 * Does not close the old reader.
604 *
605 * All internal variables are reset, the old input stream
606 * <b>cannot</b> be reused (internal buffer is discarded and lost).
607 * Lexical state is set to <tt>YY_INITIAL</tt>.
608 *
609 * @param reader the new input stream
610 */
611 public final void yyreset(java.io.Reader reader) throws IOException {
612 // 's' has been updated.
613 zzBuffer = s.array;
614 /*
615 * We replaced the line below with the two below it because zzRefill
616 * no longer "refills" the buffer (since the way we do it, it's always
617 * "full" the first time through, since it points to the segment's
618 * array). So, we assign zzEndRead here.
619 */
620 //zzStartRead = zzEndRead = s.offset;
621 zzStartRead = s.offset;
622 zzEndRead = zzStartRead + s.count - 1;
623 zzCurrentPos = zzMarkedPos = s.offset;
624 zzLexicalState = YYINITIAL;
625 zzReader = reader;
626 zzAtEOF = false;
627 }
628
629
630
631
632 /**
633 * Creates a new scanner
634 * There is also a java.io.InputStream version of this constructor.
635 *
636 * @param in the java.io.Reader to read input from.
637 */
638 public ScalaTokenMaker(java.io.Reader in) {
639 this.zzReader = in;
640 }
641
642 /**
643 * Creates a new scanner.
644 * There is also java.io.Reader version of this constructor.
645 *
646 * @param in the java.io.Inputstream to read input from.
647 */
648 public ScalaTokenMaker(java.io.InputStream in) {
649 this(new java.io.InputStreamReader(in));
650 }
651
652 /**
653 * Unpacks the compressed character translation table.
654 *
655 * @param packed the packed character translation table
656 * @return the unpacked character translation table
657 */
658 private static char [] zzUnpackCMap(String packed) {
659 char [] map = new char[0x10000];
660 int i = 0; /* index in packed string */
661 int j = 0; /* index in unpacked array */
662 while (i < 150) {
663 int count = packed.charAt(i++);
664 char value = packed.charAt(i++);
665 do map[j++] = value; while (--count > 0);
666 }
667 return map;
668 }
669
670
671 /**
672 * Closes the input stream.
673 */
674 public final void yyclose() throws java.io.IOException {
675 zzAtEOF = true; /* indicate end of file */
676 zzEndRead = zzStartRead; /* invalidate buffer */
677
678 if (zzReader != null)
679 zzReader.close();
680 }
681
682
683 /**
684 * Returns the current lexical state.
685 */
686 public final int yystate() {
687 return zzLexicalState;
688 }
689
690
691 /**
692 * Enters a new lexical state
693 *
694 * @param newState the new lexical state
695 */
696 public final void yybegin(int newState) {
697 zzLexicalState = newState;
698 }
699
700
701 /**
702 * Returns the text matched by the current regular expression.
703 */
704 public final String yytext() {
705 return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
706 }
707
708
709 /**
710 * Returns the character at position <tt>pos</tt> from the
711 * matched text.
712 *
713 * It is equivalent to yytext().charAt(pos), but faster
714 *
715 * @param pos the position of the character to fetch.
716 * A value from 0 to yylength()-1.
717 *
718 * @return the character at position pos
719 */
720 public final char yycharat(int pos) {
721 return zzBuffer[zzStartRead+pos];
722 }
723
724
725 /**
726 * Returns the length of the matched text region.
727 */
728 public final int yylength() {
729 return zzMarkedPos-zzStartRead;
730 }
731
732
733 /**
734 * Reports an error that occured while scanning.
735 *
736 * In a wellformed scanner (no or only correct usage of
737 * yypushback(int) and a match-all fallback rule) this method
738 * will only be called with things that "Can't Possibly Happen".
739 * If this method is called, something is seriously wrong
740 * (e.g. a JFlex bug producing a faulty scanner etc.).
741 *
742 * Usual syntax/scanner level error handling should be done
743 * in error fallback rules.
744 *
745 * @param errorCode the code of the errormessage to display
746 */
747 private void zzScanError(int errorCode) {
748 String message;
749 try {
750 message = ZZ_ERROR_MSG[errorCode];
751 }
752 catch (ArrayIndexOutOfBoundsException e) {
753 message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
754 }
755
756 throw new Error(message);
757 }
758
759
760 /**
761 * Pushes the specified amount of characters back into the input stream.
762 *
763 * They will be read again by then next call of the scanning method
764 *
765 * @param number the number of characters to be read again.
766 * This number must not be greater than yylength()!
767 */
768 public void yypushback(int number) {
769 if ( number > yylength() )
770 zzScanError(ZZ_PUSHBACK_2BIG);
771
772 zzMarkedPos -= number;
773 }
774
775
776 /**
777 * Resumes scanning until the next regular expression is matched,
778 * the end of input is encountered or an I/O-Error occurs.
779 *
780 * @return the next token
781 * @exception java.io.IOException if any I/O-Error occurs
782 */
783 public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
784 int zzInput;
785 int zzAction;
786
787 // cached fields:
788 int zzCurrentPosL;
789 int zzMarkedPosL;
790 int zzEndReadL = zzEndRead;
791 char [] zzBufferL = zzBuffer;
792 char [] zzCMapL = ZZ_CMAP;
793
794 int [] zzTransL = ZZ_TRANS;
795 int [] zzRowMapL = ZZ_ROWMAP;
796 int [] zzAttrL = ZZ_ATTRIBUTE;
797
798 while (true) {
799 zzMarkedPosL = zzMarkedPos;
800
801 zzAction = -1;
802
803 zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
804
805 zzState = zzLexicalState;
806
807
808 zzForAction: {
809 while (true) {
810
811 if (zzCurrentPosL < zzEndReadL)
812 zzInput = zzBufferL[zzCurrentPosL++];
813 else if (zzAtEOF) {
814 zzInput = YYEOF;
815 break zzForAction;
816 }
817 else {
818 // store back cached positions
819 zzCurrentPos = zzCurrentPosL;
820 zzMarkedPos = zzMarkedPosL;
821 boolean eof = zzRefill();
822 // get translated positions and possibly new buffer
823 zzCurrentPosL = zzCurrentPos;
824 zzMarkedPosL = zzMarkedPos;
825 zzBufferL = zzBuffer;
826 zzEndReadL = zzEndRead;
827 if (eof) {
828 zzInput = YYEOF;
829 break zzForAction;
830 }
831 else {
832 zzInput = zzBufferL[zzCurrentPosL++];
833 }
834 }
835 int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
836 if (zzNext == -1) break zzForAction;
837 zzState = zzNext;
838
839 int zzAttributes = zzAttrL[zzState];
840 if ( (zzAttributes & 1) == 1 ) {
841 zzAction = zzState;
842 zzMarkedPosL = zzCurrentPosL;
843 if ( (zzAttributes & 8) == 8 ) break zzForAction;
844 }
845
846 }
847 }
848
849 // store back cached position
850 zzMarkedPos = zzMarkedPosL;
851
852 switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
853 case 5:
854 { addNullToken(); return firstToken;
855 }
856 case 22: break;
857 case 13:
858 { addToken(Token.LITERAL_CHAR);
859 }
860 case 23: break;
861 case 17:
862 { yybegin(YYINITIAL); addToken(start,zzStartRead+1, Token.COMMENT_MULTILINE);
863 }
864 case 24: break;
865 case 16:
866 { start = zzMarkedPos-2; yybegin(MLC);
867 }
868 case 25: break;
869 case 7:
870 { addToken(Token.WHITESPACE);
871 }
872 case 26: break;
873 case 18:
874 { addToken(Token.LITERAL_NUMBER_HEXADECIMAL);
875 }
876 case 27: break;
877 case 11:
878 { addToken(Token.LITERAL_NUMBER_FLOAT);
879 }
880 case 28: break;
881 case 12:
882 { addToken(Token.RESERVED_WORD);
883 }
884 case 29: break;
885 case 3:
886 { addToken(Token.SEPARATOR);
887 }
888 case 30: break;
889 case 19:
890 { addToken(Token.LITERAL_BACKQUOTE);
891 }
892 case 31: break;
893 case 1:
894 { addToken(Token.IDENTIFIER);
895 }
896 case 32: break;
897 case 10:
898 { addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken;
899 }
900 case 33: break;
901 case 15:
902 { start = zzMarkedPos-2; yybegin(EOL_COMMENT);
903 }
904 case 34: break;
905 case 4:
906 { addToken(Token.ERROR_CHAR); addNullToken(); return firstToken;
907 }
908 case 35: break;
909 case 6:
910 { addToken(Token.ERROR_STRING_DOUBLE); addNullToken(); return firstToken;
911 }
912 case 36: break;
913 case 14:
914 { addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
915 }
916 case 37: break;
917 case 21:
918 { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_EOL); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_EOL); start = zzMarkedPos;
919 }
920 case 38: break;
921 case 20:
922 { int temp=zzStartRead; addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); addHyperlinkToken(temp,zzMarkedPos-1, Token.COMMENT_MULTILINE); start = zzMarkedPos;
923 }
924 case 39: break;
925 case 2:
926 { addToken(Token.LITERAL_NUMBER_DECIMAL_INT);
927 }
928 case 40: break;
929 case 8:
930 {
931 }
932 case 41: break;
933 case 9:
934 { addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken;
935 }
936 case 42: break;
937 default:
938 if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
939 zzAtEOF = true;
940 switch (zzLexicalState) {
941 case EOL_COMMENT: {
942 addToken(start,zzStartRead-1, Token.COMMENT_EOL); addNullToken(); return firstToken;
943 }
944 case 174: break;
945 case YYINITIAL: {
946 addNullToken(); return firstToken;
947 }
948 case 175: break;
949 case MLC: {
950 addToken(start,zzStartRead-1, Token.COMMENT_MULTILINE); return firstToken;
951 }
952 case 176: break;
953 default:
954 return null;
955 }
956 }
957 else {
958 zzScanError(ZZ_NO_MATCH);
959 }
960 }
961 }
962 }
963
964
965}
Note: See TracBrowser for help on using the repository browser.