2 // Generated by JFlex 1.8.2 http://jflex.de/
\r
3 // source: jflex/matchingblock.jflex
\r
7 package org.scilab.modules.scinotes;
9 import java.io.IOException;
10 import javax.swing.text.Element;
12 @javax.annotation.Generated("JFlex")
14 // See https://github.com/jflex-de/jflex/issues/222
\r
15 @SuppressWarnings("FallThrough")
\r
16 public final class MatchingBlockScanner {
\r
18 /** This character denotes the end of file. */
\r
19 public static final int YYEOF = -1;
\r
21 /** Initial size of the lookahead buffer. */
\r
22 private static final int ZZ_BUFFERSIZE = 256;
\r
25 public static final int YYINITIAL = 0;
\r
26 public static final int LR = 2;
\r
27 public static final int RL = 4;
\r
28 public static final int OPENCLOSE = 6;
\r
29 public static final int CLOSEOPEN = 8;
\r
30 public static final int PSNART = 10;
\r
31 public static final int SPEC = 12;
\r
34 * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l
\r
35 * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l
\r
36 * at the beginning of a line
\r
37 * l is of the form l = 2*k, k a non negative integer
\r
39 private static final int ZZ_LEXSTATE[] = {
\r
40 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6
\r
44 * Top-level table for translating characters to character classes
\r
46 private static final int [] ZZ_CMAP_TOP = zzUnpackcmap_top();
\r
48 private static final String ZZ_CMAP_TOP_PACKED_0 =
\r
49 "\1\0\37\u0100\1\u0200\267\u0100\10\u0300\u1020\u0100";
\r
51 private static int [] zzUnpackcmap_top() {
\r
52 int [] result = new int[4352];
\r
54 offset = zzUnpackcmap_top(ZZ_CMAP_TOP_PACKED_0, offset, result);
\r
58 private static int zzUnpackcmap_top(String packed, int offset, int [] result) {
\r
59 int i = 0; /* index in packed string */
\r
60 int j = offset; /* index in unpacked array */
\r
61 int l = packed.length();
\r
63 int count = packed.charAt(i++);
\r
64 int value = packed.charAt(i++);
\r
65 do result[j++] = value; while (--count > 0);
\r
72 * Second-level tables for translating characters to character classes
\r
74 private static final int [] ZZ_CMAP_BLOCKS = zzUnpackcmap_blocks();
\r
76 private static final String ZZ_CMAP_BLOCKS_PACKED_0 =
\r
77 "\12\0\1\1\2\2\1\3\23\0\1\4\1\5\1\4"+
\r
78 "\1\6\1\7\1\0\1\10\1\11\1\12\5\0\1\13"+
\r
79 "\12\6\5\0\1\4\1\0\32\4\1\11\1\0\1\12"+
\r
80 "\1\0\1\4\1\0\2\4\1\14\1\15\1\16\1\17"+
\r
81 "\1\4\1\20\1\21\2\4\1\22\1\4\1\23\1\24"+
\r
82 "\2\4\1\25\1\26\1\27\1\30\1\4\1\31\1\4"+
\r
83 "\1\32\1\4\1\11\1\0\1\12\7\0\1\2\u01a2\0"+
\r
84 "\2\2\326\0\u0100\2";
\r
86 private static int [] zzUnpackcmap_blocks() {
\r
87 int [] result = new int[1024];
\r
89 offset = zzUnpackcmap_blocks(ZZ_CMAP_BLOCKS_PACKED_0, offset, result);
\r
93 private static int zzUnpackcmap_blocks(String packed, int offset, int [] result) {
\r
94 int i = 0; /* index in packed string */
\r
95 int j = offset; /* index in unpacked array */
\r
96 int l = packed.length();
\r
98 int count = packed.charAt(i++);
\r
99 int value = packed.charAt(i++);
\r
100 do result[j++] = value; while (--count > 0);
\r
106 * Translates DFA states to action switch labels.
\r
108 private static final int [] ZZ_ACTION = zzUnpackAction();
\r
110 private static final String ZZ_ACTION_PACKED_0 =
\r
111 "\7\0\5\1\1\2\1\3\11\1\1\4\1\3\10\1"+
\r
112 "\11\3\1\5\1\6\1\7\1\0\1\1\2\0\3\1"+
\r
113 "\1\2\4\1\14\0\1\3\10\0\1\2\11\0\1\3"+
\r
114 "\5\1\10\0\1\1\2\0\1\3\3\0\1\3\6\0"+
\r
115 "\6\1\11\0\1\2\7\0\4\1\15\0\2\1\7\0"+
\r
116 "\2\1\6\0\1\1\1\0\1\3\3\0\3\1\3\0"+
\r
119 private static int [] zzUnpackAction() {
\r
120 int [] result = new int[189];
\r
122 offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
\r
126 private static int zzUnpackAction(String packed, int offset, int [] result) {
\r
127 int i = 0; /* index in packed string */
\r
128 int j = offset; /* index in unpacked array */
\r
129 int l = packed.length();
\r
131 int count = packed.charAt(i++);
\r
132 int value = packed.charAt(i++);
\r
133 do result[j++] = value; while (--count > 0);
\r
140 * Translates a state to a row index in the transition table
\r
142 private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
\r
144 private static final String ZZ_ROWMAP_PACKED_0 =
\r
145 "\0\0\0\33\0\66\0\121\0\154\0\207\0\242\0\0"+
\r
146 "\0\275\0\330\0\363\0\u010e\0\0\0\u0129\0\u0144\0\u015f"+
\r
147 "\0\u017a\0\u0195\0\u01b0\0\u01cb\0\u01e6\0\u0201\0\u021c\0\0"+
\r
148 "\0\0\0\u0237\0\u0252\0\u026d\0\u0288\0\u02a3\0\u02be\0\u02d9"+
\r
149 "\0\u02f4\0\u030f\0\u032a\0\u0345\0\u0360\0\u037b\0\u0396\0\u03b1"+
\r
150 "\0\u03cc\0\u03e7\0\0\0\0\0\0\0\330\0\u0402\0\u041d"+
\r
151 "\0\u0438\0\u0453\0\u046e\0\u0489\0\u010e\0\u04a4\0\u04bf\0\u04da"+
\r
152 "\0\u04f5\0\u0201\0\u0510\0\u052b\0\u0546\0\u0561\0\u057c\0\u0597"+
\r
153 "\0\u05b2\0\u05cd\0\u05e8\0\u0603\0\u061e\0\u0639\0\u0654\0\u066f"+
\r
154 "\0\u068a\0\u06a5\0\u06c0\0\u06db\0\u06f6\0\u0711\0\u072c\0\u0747"+
\r
155 "\0\u0762\0\u077d\0\u0798\0\u07b3\0\u07ce\0\u07e9\0\u0804\0\u081f"+
\r
156 "\0\u083a\0\u0855\0\u0870\0\u088b\0\u08a6\0\u0510\0\u08c1\0\u08dc"+
\r
157 "\0\u08f7\0\u0912\0\u092d\0\u0948\0\u0963\0\u097e\0\u0999\0\u09b4"+
\r
158 "\0\u09cf\0\u09ea\0\u0a05\0\u0a20\0\u0a3b\0\u072c\0\u0a56\0\u0a71"+
\r
159 "\0\u0a8c\0\u0aa7\0\u0ac2\0\u0add\0\u0af8\0\u0b13\0\u0b2e\0\u0b49"+
\r
160 "\0\u0b64\0\u0b7f\0\u0b9a\0\u0bb5\0\u0bd0\0\u0beb\0\u0c06\0\u0c21"+
\r
161 "\0\u0c3c\0\u0c57\0\u0c72\0\u0c8d\0\u0ca8\0\u0cc3\0\u0cde\0\u0cf9"+
\r
162 "\0\u0d14\0\u0d2f\0\u0d4a\0\u0d65\0\u0d80\0\u0d9b\0\u0db6\0\u0dd1"+
\r
163 "\0\u0dec\0\u0e07\0\u0e22\0\u0e3d\0\u0e58\0\u0e73\0\u0e8e\0\u0ea9"+
\r
164 "\0\u0ec4\0\u0edf\0\u0efa\0\u0f15\0\u0f30\0\u0f4b\0\u0f66\0\u0f81"+
\r
165 "\0\u0f9c\0\u0fb7\0\u0fd2\0\u0fed\0\u1008\0\u1023\0\u103e\0\u1059"+
\r
166 "\0\u1074\0\u108f\0\u10aa\0\u10c5\0\u10e0\0\u10fb\0\u1116\0\u1131"+
\r
167 "\0\u114c\0\u1167\0\u1182\0\u119d\0\u11b8\0\u11d3\0\u11ee\0\u11d3"+
\r
168 "\0\u1209\0\u1224\0\u123f\0\u125a\0\u010e";
\r
170 private static int [] zzUnpackRowMap() {
\r
171 int [] result = new int[189];
\r
173 offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
\r
177 private static int zzUnpackRowMap(String packed, int offset, int [] result) {
\r
178 int i = 0; /* index in packed string */
\r
179 int j = offset; /* index in unpacked array */
\r
180 int l = packed.length();
\r
182 int high = packed.charAt(i++) << 16;
\r
183 result[j++] = high | packed.charAt(i++);
\r
189 * The transition table of the DFA
\r
191 private static final int [] ZZ_TRANS = zzUnpackTrans();
\r
193 private static final String ZZ_TRANS_PACKED_0 =
\r
194 "\33\0\2\10\2\0\1\11\1\12\1\13\1\14\1\12"+
\r
195 "\1\15\1\16\1\17\2\11\1\20\1\21\1\11\1\22"+
\r
196 "\4\11\1\23\1\24\1\11\1\25\1\11\1\10\1\26"+
\r
197 "\2\0\1\27\1\12\1\27\1\10\1\30\1\31\1\15"+
\r
198 "\1\10\1\27\1\32\1\33\1\34\1\35\2\27\1\36"+
\r
199 "\1\27\1\37\1\27\1\40\2\27\1\41\2\31\2\0"+
\r
200 "\5\31\1\15\4\31\1\42\1\43\1\31\1\44\4\31"+
\r
201 "\1\45\1\46\1\31\1\47\3\31\2\0\1\50\1\31"+
\r
202 "\1\50\3\31\1\15\1\31\1\50\1\51\5\50\1\52"+
\r
203 "\7\50\10\0\1\53\22\0\2\54\2\0\27\54\4\0"+
\r
204 "\1\14\1\0\1\14\1\0\1\55\3\0\17\14\1\56"+
\r
205 "\1\0\1\56\1\0\1\56\1\57\2\56\1\57\22\56"+
\r
206 "\10\0\1\55\5\0\1\60\20\0\1\14\1\0\1\14"+
\r
207 "\5\0\17\14\10\0\1\55\35\0\1\61\23\0\1\14"+
\r
208 "\1\0\1\14\1\0\1\55\3\0\7\14\1\62\7\14"+
\r
209 "\4\0\1\14\1\0\1\14\1\0\1\55\3\0\10\14"+
\r
210 "\1\63\3\14\1\64\2\14\4\0\1\14\1\0\1\14"+
\r
211 "\1\0\1\55\3\0\3\14\1\65\13\14\4\0\1\14"+
\r
212 "\1\0\1\14\1\0\1\55\3\0\2\14\1\66\12\14"+
\r
213 "\1\67\1\14\4\0\1\14\1\0\1\14\1\0\1\55"+
\r
214 "\3\0\11\14\1\70\5\14\4\0\1\14\1\0\1\14"+
\r
215 "\1\0\1\55\3\0\4\14\1\71\12\14\1\72\1\0"+
\r
216 "\1\72\1\0\7\72\1\73\17\72\15\0\1\74\1\75"+
\r
217 "\1\76\1\77\2\0\1\100\1\0\1\101\1\0\1\102"+
\r
218 "\2\0\1\103\15\0\1\74\1\75\1\76\1\77\2\0"+
\r
219 "\1\104\1\0\1\101\1\0\1\102\2\0\1\103\15\0"+
\r
220 "\1\74\1\75\1\76\1\77\1\0\1\105\1\100\1\0"+
\r
221 "\1\101\1\0\1\102\2\0\1\103\15\0\1\74\1\75"+
\r
222 "\1\76\1\77\1\106\1\0\1\100\1\0\1\101\1\0"+
\r
223 "\1\102\2\0\1\103\14\0\1\107\1\74\1\75\1\76"+
\r
224 "\1\77\2\0\1\100\1\0\1\101\1\0\1\102\2\0"+
\r
225 "\1\103\15\0\1\74\1\75\1\76\1\77\2\0\1\100"+
\r
226 "\1\110\1\101\1\0\1\102\2\0\1\103\15\0\1\74"+
\r
227 "\1\75\1\76\1\77\2\0\1\100\1\111\1\101\1\0"+
\r
228 "\1\102\2\0\1\103\14\0\1\112\1\74\1\75\1\76"+
\r
229 "\1\77\2\0\1\100\1\0\1\101\1\0\1\102\2\0"+
\r
230 "\1\103\15\0\1\74\1\75\1\76\1\77\2\0\1\100"+
\r
231 "\1\0\1\113\1\0\1\102\2\0\1\103\22\0\1\114"+
\r
232 "\34\0\1\115\3\0\1\116\21\0\1\117\31\0\1\120"+
\r
233 "\12\0\1\121\26\0\1\122\25\0\1\123\27\0\1\124"+
\r
234 "\5\0\1\125\24\0\1\124\5\0\1\126\24\0\1\124"+
\r
235 "\5\0\1\125\1\127\13\0\1\56\2\0\1\56\45\0"+
\r
236 "\1\130\7\0\1\61\1\10\2\0\27\61\4\0\1\14"+
\r
237 "\1\0\1\14\5\0\1\14\1\131\15\14\4\0\1\14"+
\r
238 "\1\0\1\14\5\0\11\14\1\65\5\14\4\0\1\14"+
\r
239 "\1\0\1\14\5\0\7\14\1\132\7\14\4\0\1\14"+
\r
240 "\1\0\1\14\5\0\6\14\1\133\10\14\4\0\1\14"+
\r
241 "\1\0\1\14\5\0\5\14\1\134\11\14\4\0\1\14"+
\r
242 "\1\0\1\14\5\0\16\14\1\65\4\0\1\14\1\0"+
\r
243 "\1\14\5\0\5\14\1\135\11\14\1\72\1\0\1\72"+
\r
244 "\1\0\7\72\1\136\17\72\23\0\1\137\31\0\1\140"+
\r
245 "\31\0\1\10\25\0\1\141\42\0\1\142\32\0\1\143"+
\r
246 "\22\0\1\144\43\0\1\145\23\0\1\15\5\0\1\142"+
\r
247 "\27\0\1\146\15\0\1\10\1\0\1\10\5\0\2\10"+
\r
248 "\1\147\14\10\27\0\1\150\24\0\1\151\30\0\1\152"+
\r
249 "\31\0\1\153\40\0\1\143\2\0\1\152\31\0\1\154"+
\r
250 "\31\0\1\117\30\0\1\155\13\0\1\156\1\0\1\156"+
\r
251 "\5\0\17\156\22\0\1\157\31\0\1\160\43\0\1\117"+
\r
252 "\21\0\1\161\34\0\1\162\33\0\1\163\24\0\1\15"+
\r
253 "\5\0\1\163\27\0\1\164\26\0\1\165\21\0\1\14"+
\r
254 "\1\0\1\14\5\0\3\14\1\166\13\14\4\0\1\14"+
\r
255 "\1\0\1\14\5\0\1\167\16\14\4\0\1\14\1\0"+
\r
256 "\1\14\5\0\2\14\1\170\14\14\4\0\1\14\1\0"+
\r
257 "\1\14\5\0\13\14\1\171\3\14\4\0\1\14\1\0"+
\r
258 "\1\14\5\0\6\14\1\172\10\14\16\0\1\10\35\0"+
\r
259 "\1\173\40\0\1\174\24\0\1\175\30\0\1\10\31\0"+
\r
260 "\1\176\43\0\1\10\23\0\1\177\40\0\1\200\25\0"+
\r
261 "\1\201\40\0\1\202\7\0\1\10\1\0\1\10\5\0"+
\r
262 "\17\10\22\0\1\203\26\0\1\204\30\0\1\205\34\0"+
\r
263 "\1\206\43\0\1\207\25\0\1\210\26\0\1\31\35\0"+
\r
264 "\1\211\40\0\1\212\22\0\1\213\17\0\1\14\1\0"+
\r
265 "\1\14\5\0\14\14\1\214\2\14\4\0\1\14\1\0"+
\r
266 "\1\14\5\0\13\14\1\215\3\14\4\0\1\14\1\0"+
\r
267 "\1\14\5\0\1\216\16\14\4\0\1\14\1\0\1\14"+
\r
268 "\5\0\1\217\16\14\4\0\1\14\1\0\1\14\5\0"+
\r
269 "\2\14\1\65\14\14\20\0\1\220\33\0\1\221\40\0"+
\r
270 "\1\222\25\0\1\223\41\0\1\152\23\0\1\137\41\0"+
\r
271 "\1\224\15\0\1\225\34\0\1\224\35\0\1\226\40\0"+
\r
272 "\1\227\17\0\1\230\32\0\1\231\34\0\1\117\43\0"+
\r
273 "\1\232\17\0\1\233\46\0\1\234\6\0\1\14\1\0"+
\r
274 "\1\14\5\0\7\14\1\235\7\14\4\0\1\14\1\0"+
\r
275 "\1\14\5\0\5\14\1\236\11\14\4\0\1\14\1\0"+
\r
276 "\1\14\5\0\13\14\1\65\3\14\4\0\1\14\1\0"+
\r
277 "\1\14\5\0\4\14\1\65\12\14\31\0\1\10\32\0"+
\r
278 "\1\237\15\0\1\240\34\0\1\237\42\0\1\152\27\0"+
\r
279 "\1\241\26\0\1\15\34\0\1\242\40\0\1\117\23\0"+
\r
280 "\1\117\26\0\1\243\41\0\1\244\32\0\1\245\13\0"+
\r
281 "\1\14\1\0\1\14\5\0\1\246\16\14\4\0\1\14"+
\r
282 "\1\0\1\14\5\0\10\14\1\247\6\14\26\0\1\10"+
\r
283 "\27\0\1\250\37\0\1\251\26\0\1\252\31\0\1\253"+
\r
284 "\37\0\1\254\16\0\1\255\22\0\1\14\1\0\1\14"+
\r
285 "\5\0\13\14\1\256\3\14\4\0\1\14\1\0\1\14"+
\r
286 "\5\0\7\14\1\65\7\14\30\0\1\257\21\0\1\260"+
\r
287 "\36\0\1\117\37\0\1\261\21\0\1\262\42\0\1\263"+
\r
288 "\7\0\1\14\1\0\1\14\5\0\5\14\1\264\11\14"+
\r
289 "\17\0\1\265\17\0\1\10\1\0\1\10\5\0\1\10"+
\r
290 "\1\266\15\10\17\0\1\267\30\0\1\270\36\0\1\271"+
\r
291 "\15\0\1\14\1\0\1\14\5\0\10\14\1\272\6\14"+
\r
292 "\15\0\1\74\40\0\1\273\24\0\1\124\41\0\1\274"+
\r
293 "\12\0\1\14\1\0\1\14\5\0\7\14\1\275\7\14"+
\r
294 "\16\0\1\15\37\0\1\10\7\0";
\r
296 private static int [] zzUnpackTrans() {
\r
297 int [] result = new int[4725];
\r
299 offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
\r
303 private static int zzUnpackTrans(String packed, int offset, int [] result) {
\r
304 int i = 0; /* index in packed string */
\r
305 int j = offset; /* index in unpacked array */
\r
306 int l = packed.length();
\r
308 int count = packed.charAt(i++);
\r
309 int value = packed.charAt(i++);
\r
311 do result[j++] = value; while (--count > 0);
\r
317 /** Error code for "Unknown internal scanner error". */
\r
318 private static final int ZZ_UNKNOWN_ERROR = 0;
\r
319 /** Error code for "could not match input". */
\r
320 private static final int ZZ_NO_MATCH = 1;
\r
321 /** Error code for "pushback value was too large". */
\r
322 private static final int ZZ_PUSHBACK_2BIG = 2;
\r
325 * Error messages for {@link #ZZ_UNKNOWN_ERROR}, {@link #ZZ_NO_MATCH}, and
\r
326 * {@link #ZZ_PUSHBACK_2BIG} respectively.
\r
328 private static final String ZZ_ERROR_MSG[] = {
\r
329 "Unknown internal scanner error",
\r
330 "Error: could not match input",
\r
331 "Error: pushback value was too large"
\r
335 * ZZ_ATTRIBUTE[aState] contains the attributes of state {@code aState}
\r
337 private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
\r
339 private static final String ZZ_ATTRIBUTE_PACKED_0 =
\r
340 "\1\10\6\0\1\11\4\1\1\11\12\1\2\11\21\1"+
\r
341 "\3\11\1\0\1\1\2\0\10\1\14\0\1\1\10\0"+
\r
342 "\1\1\11\0\6\1\10\0\1\1\2\0\1\1\3\0"+
\r
343 "\1\1\6\0\6\1\11\0\1\1\7\0\4\1\15\0"+
\r
344 "\2\1\7\0\2\1\6\0\1\1\1\0\1\1\3\0"+
\r
345 "\3\1\3\0\1\1\2\0\1\1";
\r
347 private static int [] zzUnpackAttribute() {
\r
348 int [] result = new int[189];
\r
350 offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
\r
354 private static int zzUnpackAttribute(String packed, int offset, int [] result) {
\r
355 int i = 0; /* index in packed string */
\r
356 int j = offset; /* index in unpacked array */
\r
357 int l = packed.length();
\r
359 int count = packed.charAt(i++);
\r
360 int value = packed.charAt(i++);
\r
361 do result[j++] = value; while (--count > 0);
\r
366 /** Input device. */
\r
367 private java.io.Reader zzReader;
\r
369 /** Current state of the DFA. */
\r
370 private int zzState;
\r
372 /** Current lexical state. */
\r
373 private int zzLexicalState = YYINITIAL;
\r
376 * This buffer contains the current text to be matched and is the source of the {@link #yytext()}
\r
379 private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
\r
381 /** Text position at the last accepting state. */
\r
382 private int zzMarkedPos;
\r
384 /** Current text position in the buffer. */
\r
385 private int zzCurrentPos;
\r
387 /** Marks the beginning of the {@link #yytext()} string in the buffer. */
\r
388 private int zzStartRead;
\r
390 /** Marks the last character in the buffer, that has been read from input. */
\r
391 private int zzEndRead;
\r
394 * Whether the scanner is at the end of file.
\r
397 private boolean zzAtEOF;
\r
400 * The number of occupied positions in {@link #zzBuffer} beyond {@link #zzEndRead}.
\r
402 * <p>When a lead/high surrogate has been read from the input stream into the final
\r
403 * {@link #zzBuffer} position, this will have a value of 1; otherwise, it will have a value of 0.
\r
405 private int zzFinalHighSurrogate = 0;
\r
407 /** Number of newlines encountered up to the start of the matched text. */
\r
408 @SuppressWarnings("unused")
\r
409 private int yyline;
\r
411 /** Number of characters from the last newline up to the start of the matched text. */
\r
412 @SuppressWarnings("unused")
\r
413 private int yycolumn;
\r
415 /** Number of characters up to the start of the matched text. */
\r
416 private long yychar;
\r
418 /** Whether the scanner is currently at the beginning of a line. */
\r
419 @SuppressWarnings("unused")
\r
420 private boolean zzAtBOL = true;
\r
422 /** Whether the user-EOF-code has already been executed. */
\r
423 @SuppressWarnings("unused")
\r
424 private boolean zzEOFDone;
\r
427 private ScilabDocument doc;
428 private Element elem;
429 private boolean transp = false;
430 private ScilabLexer scilabLexer;
435 public MatchingBlockScanner(ScilabDocument doc) {
437 this.elem = doc.getDefaultRootElement();
438 this.scilabLexer = new ScilabLexer(doc, null, false);
441 public int yychar() {
445 public MatchingPositions getNextBlock(int pos, boolean lr) {
451 end = doc.getEndPosition().getOffset();
452 yyreset(new ScilabDocumentReader(doc, start, end));
457 yyreset(new ScilabDocumentReader(doc, true, start, end));
466 } while (zzMarkedPos != 0 && s != 0);
467 } catch (IOException e) {
472 return new MatchingPositions(pos, pos, pos + yychar(), pos + yychar() + (transp?(yylength()-1):yylength()));
474 return new MatchingPositions(pos, pos, pos - yychar() - yylength(), pos - yychar());
481 public MatchingPositions getMatchingBlock(int pos, boolean lr) {
487 end = doc.getEndPosition().getOffset();
488 yyreset(new ScilabDocumentReader(doc, start, end));
494 p1 = pos + yylength();
499 yyreset(new ScilabDocumentReader(doc, true, start, end));
504 p1 = pos - yylength();
514 } while (zzMarkedPos != 0 && s != 0);
515 } catch (IOException e) {
520 return new MatchingPositions(pos, p1, pos + yychar(), pos + yychar() + (transp?(yylength()-1):yylength()));
522 return new MatchingPositions(p1, pos, pos - yychar() - yylength(), pos - yychar());
529 public final class MatchingPositions {
535 private MatchingPositions(int x1, int x2, int y1, int y2) {
545 * Creates a new scanner
\r
547 * @param in the java.io.Reader to read input from.
\r
549 public MatchingBlockScanner(java.io.Reader in) {
\r
550 this.zzReader = in;
\r
554 * Translates raw input code points to DFA table row
\r
556 private static int zzCMap(int input) {
\r
557 int offset = input & 255;
\r
558 return offset == input ? ZZ_CMAP_BLOCKS[offset] : ZZ_CMAP_BLOCKS[ZZ_CMAP_TOP[input >> 8] | offset];
\r
562 * Refills the input buffer.
\r
564 * @return {@code false} iff there was new input.
\r
565 * @exception java.io.IOException if any I/O-Error occurs
\r
567 private boolean zzRefill() throws java.io.IOException {
\r
569 /* first: make room (if you can) */
\r
570 if (zzStartRead > 0) {
\r
571 zzEndRead += zzFinalHighSurrogate;
\r
572 zzFinalHighSurrogate = 0;
\r
573 System.arraycopy(zzBuffer, zzStartRead,
\r
575 zzEndRead - zzStartRead);
\r
577 /* translate stored positions */
\r
578 zzEndRead -= zzStartRead;
\r
579 zzCurrentPos -= zzStartRead;
\r
580 zzMarkedPos -= zzStartRead;
\r
584 /* is the buffer big enough? */
\r
585 if (zzCurrentPos >= zzBuffer.length - zzFinalHighSurrogate) {
\r
586 /* if not: blow it up */
\r
587 char newBuffer[] = new char[zzBuffer.length * 2];
\r
588 System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
\r
589 zzBuffer = newBuffer;
\r
590 zzEndRead += zzFinalHighSurrogate;
\r
591 zzFinalHighSurrogate = 0;
\r
594 /* fill the buffer with new input */
\r
595 int requested = zzBuffer.length - zzEndRead;
\r
596 int numRead = zzReader.read(zzBuffer, zzEndRead, requested);
\r
598 /* not supposed to occur according to specification of java.io.Reader */
\r
599 if (numRead == 0) {
\r
600 throw new java.io.IOException(
\r
601 "Reader returned 0 characters. See JFlex examples/zero-reader for a workaround.");
\r
604 zzEndRead += numRead;
\r
605 if (Character.isHighSurrogate(zzBuffer[zzEndRead - 1])) {
\r
606 if (numRead == requested) { // We requested too few chars to encode a full Unicode character
\r
608 zzFinalHighSurrogate = 1;
\r
609 } else { // There is room in the buffer for at least one more char
\r
610 int c = zzReader.read(); // Expecting to read a paired low surrogate char
\r
614 zzBuffer[zzEndRead++] = (char)c;
\r
618 /* potentially more input available */
\r
622 /* numRead < 0 ==> end of stream */
\r
628 * Closes the input reader.
\r
630 * @throws java.io.IOException if the reader could not be closed.
\r
632 public final void yyclose() throws java.io.IOException {
\r
633 zzAtEOF = true; // indicate end of file
\r
634 zzEndRead = zzStartRead; // invalidate buffer
\r
636 if (zzReader != null) {
\r
643 * Resets the scanner to read from a new input stream.
\r
645 * <p>Does not close the old reader.
\r
647 * <p>All internal variables are reset, the old input stream <b>cannot</b> be reused (internal
\r
648 * buffer is discarded and lost). Lexical state is set to {@code ZZ_INITIAL}.
\r
650 * <p>Internal scan buffer is resized down to its initial length, if it has grown.
\r
652 * @param reader The new input stream.
\r
654 public final void yyreset(java.io.Reader reader) {
\r
658 zzLexicalState = YYINITIAL;
\r
659 if (zzBuffer.length > ZZ_BUFFERSIZE) {
\r
660 zzBuffer = new char[ZZ_BUFFERSIZE];
\r
665 * Resets the input position.
\r
667 private final void yyResetPosition() {
\r
674 zzFinalHighSurrogate = 0;
\r
682 * Returns whether the scanner has reached the end of the reader it reads from.
\r
684 * @return whether the scanner has reached EOF.
\r
686 public final boolean yyatEOF() {
\r
692 * Returns the current lexical state.
\r
694 * @return the current lexical state.
\r
696 public final int yystate() {
\r
697 return zzLexicalState;
\r
702 * Enters a new lexical state.
\r
704 * @param newState the new lexical state
\r
706 public final void yybegin(int newState) {
\r
707 zzLexicalState = newState;
\r
712 * Returns the text matched by the current regular expression.
\r
714 * @return the matched text.
\r
716 public final String yytext() {
\r
717 return new String(zzBuffer, zzStartRead, zzMarkedPos-zzStartRead);
\r
722 * Returns the character at the given position from the matched text.
\r
724 * <p>It is equivalent to {@code yytext().charAt(pos)}, but faster.
\r
726 * @param position the position of the character to fetch. A value from 0 to {@code yylength()-1}.
\r
728 * @return the character at {@code position}.
\r
730 public final char yycharat(int position) {
\r
731 return zzBuffer[zzStartRead + position];
\r
736 * How many characters were matched.
\r
738 * @return the length of the matched text region.
\r
740 public final int yylength() {
\r
741 return zzMarkedPos-zzStartRead;
\r
746 * Reports an error that occurred while scanning.
\r
748 * <p>In a well-formed scanner (no or only correct usage of {@code yypushback(int)} and a
\r
749 * match-all fallback rule) this method will only be called with things that
\r
750 * "Can't Possibly Happen".
\r
752 * <p>If this method is called, something is seriously wrong (e.g. a JFlex bug producing a faulty
\r
755 * <p>Usual syntax/scanner level error handling should be done in error fallback rules.
\r
757 * @param errorCode the code of the error message to display.
\r
759 private static void zzScanError(int errorCode) {
\r
762 message = ZZ_ERROR_MSG[errorCode];
\r
763 } catch (ArrayIndexOutOfBoundsException e) {
\r
764 message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
\r
767 throw new Error(message);
\r
772 * Pushes the specified amount of characters back into the input stream.
\r
774 * <p>They will be read again by then next call of the scanning method.
\r
776 * @param number the number of characters to be read again. This number must not be greater than
\r
777 * {@link #yylength()}.
\r
779 public void yypushback(int number) {
\r
780 if ( number > yylength() )
\r
781 zzScanError(ZZ_PUSHBACK_2BIG);
\r
783 zzMarkedPos -= number;
\r
790 * Resumes scanning until the next regular expression is matched, the end of input is encountered
\r
791 * or an I/O-Error occurs.
\r
793 * @return the next token.
\r
794 * @exception java.io.IOException if any I/O-Error occurs.
\r
796 public int yylex() throws java.io.IOException {
\r
803 int zzEndReadL = zzEndRead;
\r
804 char[] zzBufferL = zzBuffer;
\r
806 int [] zzTransL = ZZ_TRANS;
\r
807 int [] zzRowMapL = ZZ_ROWMAP;
\r
808 int [] zzAttrL = ZZ_ATTRIBUTE;
\r
811 zzMarkedPosL = zzMarkedPos;
\r
813 yychar+= zzMarkedPosL-zzStartRead;
\r
817 zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
\r
819 zzState = ZZ_LEXSTATE[zzLexicalState];
\r
821 // set up zzAction for empty match case:
\r
822 int zzAttributes = zzAttrL[zzState];
\r
823 if ( (zzAttributes & 1) == 1 ) {
\r
824 zzAction = zzState;
\r
831 if (zzCurrentPosL < zzEndReadL) {
\r
832 zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL, zzEndReadL);
\r
833 zzCurrentPosL += Character.charCount(zzInput);
\r
835 else if (zzAtEOF) {
\r
840 // store back cached positions
\r
841 zzCurrentPos = zzCurrentPosL;
\r
842 zzMarkedPos = zzMarkedPosL;
\r
843 boolean eof = zzRefill();
\r
844 // get translated positions and possibly new buffer
\r
845 zzCurrentPosL = zzCurrentPos;
\r
846 zzMarkedPosL = zzMarkedPos;
\r
847 zzBufferL = zzBuffer;
\r
848 zzEndReadL = zzEndRead;
\r
854 zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL, zzEndReadL);
\r
855 zzCurrentPosL += Character.charCount(zzInput);
\r
858 int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMap(zzInput) ];
\r
859 if (zzNext == -1) break zzForAction;
\r
862 zzAttributes = zzAttrL[zzState];
\r
863 if ( (zzAttributes & 1) == 1 ) {
\r
864 zzAction = zzState;
\r
865 zzMarkedPosL = zzCurrentPosL;
\r
866 if ( (zzAttributes & 8) == 8 ) break zzForAction;
\r
872 // store back cached position
\r
873 zzMarkedPos = zzMarkedPosL;
\r
875 if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
\r
881 switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
\r
904 { if (scilabLexer.getKeyword(start - yychar(), false) == ScilabLexerConstants.STRING) {
905 savePos = start - yychar() - scilabLexer.beginString - scilabLexer.start;
914 { if (--savePos == 0) {
921 { char c = yycharat(yylength() - 2);
922 if (c == ')' || c == ']' || c == '}') {
930 zzScanError(ZZ_NO_MATCH);
\r