1 | /* The following code was generated by JFlex 1.4.1 on 10/16/06 10:31 AM */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * 03/23/2005
|
---|
5 | *
|
---|
6 | * FortranTokenMaker.java - Scanner for the Fortran programming language.
|
---|
7 | *
|
---|
8 | * This library is distributed under a modified BSD license. See the included
|
---|
9 | * RSyntaxTextArea.License.txt file for details.
|
---|
10 | */
|
---|
11 | package org.fife.ui.rsyntaxtextarea.modes;
|
---|
12 |
|
---|
13 | import java.io.*;
|
---|
14 | import javax.swing.text.Segment;
|
---|
15 |
|
---|
16 | import org.fife.ui.rsyntaxtextarea.*;
|
---|
17 |
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * Scanner for the Fortran programming language.
|
---|
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 FortranTokenMaker.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 |
|
---|
58 | public class FortranTokenMaker 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 STRING = 1;
|
---|
65 | public static final int YYINITIAL = 0;
|
---|
66 | public static final int CHAR = 2;
|
---|
67 |
|
---|
68 | /**
|
---|
69 | * Translates characters to character classes
|
---|
70 | */
|
---|
71 | private static final String ZZ_CMAP_PACKED =
|
---|
72 | "\11\0\1\2\1\1\1\0\1\2\23\0\1\2\1\5\1\10\1\0"+
|
---|
73 | "\1\6\1\0\1\14\1\11\2\0\1\3\3\0\1\16\1\15\1\45"+
|
---|
74 | "\1\50\1\51\7\6\2\0\1\12\1\13\1\12\2\0\1\25\1\37"+
|
---|
75 | "\1\7\1\4\1\22\1\31\1\21\1\41\1\33\1\46\1\42\1\17"+
|
---|
76 | "\1\36\1\24\1\26\1\35\1\23\1\27\1\32\1\20\1\30\1\6"+
|
---|
77 | "\1\44\1\40\1\43\1\47\4\0\1\6\1\0\1\25\1\37\1\34"+
|
---|
78 | "\1\4\1\22\1\31\1\21\1\41\1\33\1\46\1\42\1\17\1\36"+
|
---|
79 | "\1\24\1\26\1\35\1\23\1\27\1\32\1\20\1\30\1\6\1\44"+
|
---|
80 | "\1\40\1\43\1\47\uff85\0";
|
---|
81 |
|
---|
82 | /**
|
---|
83 | * Translates characters to character classes
|
---|
84 | */
|
---|
85 | private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
|
---|
86 |
|
---|
87 | /**
|
---|
88 | * Translates DFA states to action switch labels.
|
---|
89 | */
|
---|
90 | private static final int [] ZZ_ACTION = zzUnpackAction();
|
---|
91 |
|
---|
92 | private static final String ZZ_ACTION_PACKED_0 =
|
---|
93 | "\1\0\2\1\1\2\1\3\1\4\1\5\1\6\1\7"+
|
---|
94 | "\1\2\1\5\1\10\1\11\1\12\1\2\1\12\24\2"+
|
---|
95 | "\1\1\1\13\1\14\1\1\1\15\1\16\7\2\1\17"+
|
---|
96 | "\20\2\7\0\41\2\1\17\27\2\1\17\10\2\1\17"+
|
---|
97 | "\3\2\4\0\2\17\3\2\2\17\20\2\1\17\10\2"+
|
---|
98 | "\2\17\3\2\1\17\2\2\1\17\6\2\1\17\2\0"+
|
---|
99 | "\3\2\1\17\4\2\1\17\26\2\1\0\20\2\1\20"+
|
---|
100 | "\12\2\1\17";
|
---|
101 |
|
---|
102 | private static int [] zzUnpackAction() {
|
---|
103 | int [] result = new int[257];
|
---|
104 | int offset = 0;
|
---|
105 | offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
|
---|
106 | return result;
|
---|
107 | }
|
---|
108 |
|
---|
109 | private static int zzUnpackAction(String packed, int offset, int [] result) {
|
---|
110 | int i = 0; /* index in packed string */
|
---|
111 | int j = offset; /* index in unpacked array */
|
---|
112 | int l = packed.length();
|
---|
113 | while (i < l) {
|
---|
114 | int count = packed.charAt(i++);
|
---|
115 | int value = packed.charAt(i++);
|
---|
116 | do result[j++] = value; while (--count > 0);
|
---|
117 | }
|
---|
118 | return j;
|
---|
119 | }
|
---|
120 |
|
---|
121 |
|
---|
122 | /**
|
---|
123 | * Translates a state to a row index in the transition table
|
---|
124 | */
|
---|
125 | private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
|
---|
126 |
|
---|
127 | private static final String ZZ_ROWMAP_PACKED_0 =
|
---|
128 | "\0\0\0\52\0\124\0\176\0\176\0\250\0\176\0\322"+
|
---|
129 | "\0\176\0\374\0\u0126\0\176\0\176\0\u0150\0\u0150\0\176"+
|
---|
130 | "\0\u017a\0\u01a4\0\u01ce\0\u01f8\0\u0222\0\u024c\0\u0276\0\u02a0"+
|
---|
131 | "\0\u02ca\0\u02f4\0\u031e\0\u0348\0\u0372\0\u0126\0\u039c\0\u03c6"+
|
---|
132 | "\0\u03f0\0\u041a\0\u0444\0\u046e\0\u0498\0\176\0\176\0\u04c2"+
|
---|
133 | "\0\176\0\176\0\u04ec\0\u0516\0\u0540\0\u056a\0\u0594\0\u05be"+
|
---|
134 | "\0\u05e8\0\u0612\0\u063c\0\u0666\0\u0690\0\u06ba\0\u06e4\0\u070e"+
|
---|
135 | "\0\u0738\0\u0762\0\u078c\0\u07b6\0\u07e0\0\u080a\0\u0834\0\u085e"+
|
---|
136 | "\0\u0888\0\u08b2\0\u08dc\0\u0906\0\u0930\0\u095a\0\u0984\0\u09ae"+
|
---|
137 | "\0\u09d8\0\u0a02\0\u0a2c\0\u0a56\0\u0a80\0\u0aaa\0\u0ad4\0\u0afe"+
|
---|
138 | "\0\u0b28\0\u0b52\0\u0b7c\0\u0ba6\0\u0bd0\0\u0bfa\0\u0c24\0\u0c4e"+
|
---|
139 | "\0\u0c78\0\u0ca2\0\u0ccc\0\u0cf6\0\u0d20\0\u0d4a\0\u0d74\0\u0d9e"+
|
---|
140 | "\0\u0dc8\0\u0df2\0\u0e1c\0\u0e46\0\u0e70\0\u0e9a\0\u0ec4\0\u0eee"+
|
---|
141 | "\0\u0f18\0\u0f42\0\u0f6c\0\u0f96\0\u0fc0\0\u0fea\0\u1014\0\u103e"+
|
---|
142 | "\0\u1068\0\u1092\0\u10bc\0\u10e6\0\u1110\0\u113a\0\u1164\0\u118e"+
|
---|
143 | "\0\u11b8\0\u11e2\0\u120c\0\u1236\0\u1260\0\u128a\0\u12b4\0\u12de"+
|
---|
144 | "\0\u1308\0\u1332\0\u135c\0\u1386\0\u13b0\0\u13da\0\u1404\0\u142e"+
|
---|
145 | "\0\u1458\0\u1482\0\u14ac\0\u14d6\0\u1500\0\u152a\0\u1554\0\u157e"+
|
---|
146 | "\0\u15a8\0\u15d2\0\u15fc\0\374\0\u1626\0\u1650\0\u167a\0\u16a4"+
|
---|
147 | "\0\u16ce\0\u16f8\0\u1722\0\u174c\0\u1776\0\u17a0\0\u17ca\0\u17f4"+
|
---|
148 | "\0\u181e\0\u1848\0\u1872\0\u189c\0\u18c6\0\u18f0\0\u191a\0\u1944"+
|
---|
149 | "\0\u196e\0\u1998\0\u19c2\0\u19ec\0\u1a16\0\u1a40\0\u1a6a\0\u16f8"+
|
---|
150 | "\0\u1a94\0\u1abe\0\u1ae8\0\u1b12\0\u1b3c\0\u1b66\0\u1b90\0\u1bba"+
|
---|
151 | "\0\u1be4\0\u1c0e\0\u1c38\0\u174c\0\u1c62\0\u1c8c\0\u1cb6\0\u1ce0"+
|
---|
152 | "\0\u1d0a\0\u1d34\0\u1d5e\0\u1d88\0\u1db2\0\u1ddc\0\u1e06\0\u1e30"+
|
---|
153 | "\0\u1e5a\0\u1e84\0\u1eae\0\u1ed8\0\u1f02\0\u1f2c\0\u1b12\0\u1f56"+
|
---|
154 | "\0\u1f80\0\u1faa\0\u1fd4\0\u1ffe\0\u2028\0\u2052\0\u207c\0\u20a6"+
|
---|
155 | "\0\u20d0\0\u20fa\0\u2124\0\u214e\0\u2178\0\u21a2\0\u21cc\0\u21f6"+
|
---|
156 | "\0\u2220\0\u224a\0\u2274\0\u229e\0\u22c8\0\u22f2\0\u231c\0\u2346"+
|
---|
157 | "\0\u2370\0\u239a\0\u23c4\0\u23ee\0\u2418\0\u2442\0\u246c\0\u2496"+
|
---|
158 | "\0\u24c0\0\u24ea\0\u2514\0\u253e\0\u2568\0\176\0\u2592\0\u25bc"+
|
---|
159 | "\0\u25e6\0\u2610\0\u263a\0\u2664\0\u268e\0\u26b8\0\u26e2\0\u270c"+
|
---|
160 | "\0\u13da";
|
---|
161 |
|
---|
162 | private static int [] zzUnpackRowMap() {
|
---|
163 | int [] result = new int[257];
|
---|
164 | int offset = 0;
|
---|
165 | offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
|
---|
166 | return result;
|
---|
167 | }
|
---|
168 |
|
---|
169 | private static int zzUnpackRowMap(String packed, int offset, int [] result) {
|
---|
170 | int i = 0; /* index in packed string */
|
---|
171 | int j = offset; /* index in unpacked array */
|
---|
172 | int l = packed.length();
|
---|
173 | while (i < l) {
|
---|
174 | int high = packed.charAt(i++) << 16;
|
---|
175 | result[j++] = high | packed.charAt(i++);
|
---|
176 | }
|
---|
177 | return j;
|
---|
178 | }
|
---|
179 |
|
---|
180 | /**
|
---|
181 | * The transition table of the DFA
|
---|
182 | */
|
---|
183 | private static final int [] ZZ_TRANS = zzUnpackTrans();
|
---|
184 |
|
---|
185 | private static final String ZZ_TRANS_PACKED_0 =
|
---|
186 | "\1\4\1\5\1\6\1\7\1\10\1\11\1\12\1\13"+
|
---|
187 | "\1\14\1\15\1\16\1\17\1\20\1\17\1\21\1\22"+
|
---|
188 | "\1\23\1\24\1\25\1\12\1\26\1\27\1\30\1\31"+
|
---|
189 | "\1\32\1\33\1\34\1\35\1\36\1\37\1\40\1\41"+
|
---|
190 | "\2\12\1\42\1\12\1\43\2\12\1\44\2\12\1\45"+
|
---|
191 | "\1\46\6\45\1\47\41\45\1\50\1\51\7\50\1\52"+
|
---|
192 | "\40\50\54\0\1\6\53\0\1\53\1\0\1\12\1\54"+
|
---|
193 | "\7\0\1\55\1\56\1\12\1\57\1\12\1\60\1\61"+
|
---|
194 | "\1\62\1\63\1\12\1\64\1\65\1\66\1\54\1\67"+
|
---|
195 | "\1\70\1\71\12\12\4\0\1\12\1\0\2\12\7\0"+
|
---|
196 | "\33\12\4\0\1\12\1\0\1\12\1\72\7\0\1\73"+
|
---|
197 | "\2\12\1\74\2\12\1\75\1\76\3\12\1\77\1\12"+
|
---|
198 | "\1\72\1\12\1\100\2\12\1\101\1\12\1\102\6\12"+
|
---|
199 | "\13\0\1\20\55\0\1\103\1\104\1\103\1\105\1\0"+
|
---|
200 | "\1\106\1\107\1\110\2\0\1\111\24\0\1\12\1\0"+
|
---|
201 | "\2\12\7\0\1\112\1\12\1\112\1\113\3\12\1\114"+
|
---|
202 | "\23\12\4\0\1\12\1\0\2\12\7\0\6\12\1\115"+
|
---|
203 | "\1\12\1\116\11\12\1\117\10\12\4\0\1\12\1\0"+
|
---|
204 | "\2\12\7\0\7\12\1\120\23\12\4\0\1\12\1\0"+
|
---|
205 | "\2\12\7\0\1\121\4\12\1\122\13\12\1\123\11\12"+
|
---|
206 | "\4\0\1\12\1\0\2\12\7\0\7\12\1\124\4\12"+
|
---|
207 | "\1\125\16\12\4\0\1\12\1\0\1\12\1\72\7\0"+
|
---|
208 | "\1\126\1\127\3\12\1\60\5\12\1\130\1\131\1\72"+
|
---|
209 | "\1\12\1\132\1\133\12\12\4\0\1\12\1\0\2\12"+
|
---|
210 | "\7\0\16\12\1\117\14\12\4\0\1\12\1\0\2\12"+
|
---|
211 | "\7\0\3\12\1\134\27\12\4\0\1\12\1\0\2\12"+
|
---|
212 | "\7\0\13\12\1\135\17\12\4\0\1\12\1\0\2\12"+
|
---|
213 | "\7\0\1\136\6\12\1\137\1\12\1\140\21\12\4\0"+
|
---|
214 | "\1\12\1\0\2\12\7\0\1\12\1\141\1\12\1\142"+
|
---|
215 | "\1\143\1\144\3\12\1\145\2\12\1\146\16\12\4\0"+
|
---|
216 | "\1\147\1\0\1\12\1\150\7\0\5\12\1\151\1\152"+
|
---|
217 | "\3\12\1\153\1\154\1\12\1\150\1\12\1\155\13\12"+
|
---|
218 | "\4\0\1\12\1\0\2\12\7\0\6\12\1\156\1\12"+
|
---|
219 | "\1\157\22\12\4\0\1\12\1\0\2\12\7\0\6\12"+
|
---|
220 | "\1\160\1\161\4\12\1\162\16\12\4\0\1\12\1\0"+
|
---|
221 | "\2\12\7\0\6\12\1\163\24\12\4\0\1\12\1\0"+
|
---|
222 | "\2\12\7\0\14\12\1\164\16\12\4\0\1\12\1\0"+
|
---|
223 | "\2\12\7\0\10\12\1\165\11\12\1\166\10\12\4\0"+
|
---|
224 | "\1\12\1\0\2\12\7\0\3\12\1\167\27\12\1\45"+
|
---|
225 | "\1\0\6\45\1\0\41\45\1\50\1\0\7\50\1\0"+
|
---|
226 | "\40\50\4\0\1\12\1\0\2\12\7\0\14\12\1\170"+
|
---|
227 | "\16\12\4\0\1\12\1\0\2\12\7\0\7\12\1\171"+
|
---|
228 | "\7\12\1\100\13\12\4\0\1\12\1\0\2\12\7\0"+
|
---|
229 | "\7\12\1\172\23\12\4\0\1\12\1\0\2\12\7\0"+
|
---|
230 | "\6\12\1\115\24\12\4\0\1\12\1\0\2\12\7\0"+
|
---|
231 | "\6\12\1\173\3\12\1\174\6\12\1\175\11\12\4\0"+
|
---|
232 | "\1\12\1\0\2\12\7\0\14\12\1\125\16\12\4\0"+
|
---|
233 | "\1\12\1\0\1\12\1\72\7\0\1\12\1\176\11\12"+
|
---|
234 | "\1\130\1\12\1\72\2\12\1\133\12\12\4\0\1\12"+
|
---|
235 | "\1\0\2\12\7\0\11\12\1\177\21\12\4\0\1\12"+
|
---|
236 | "\1\0\2\12\7\0\3\12\1\200\27\12\4\0\1\12"+
|
---|
237 | "\1\0\2\12\7\0\1\201\32\12\4\0\1\12\1\0"+
|
---|
238 | "\2\12\7\0\4\12\1\143\7\12\1\146\16\12\4\0"+
|
---|
239 | "\1\12\1\0\2\12\7\0\5\12\1\202\11\12\1\203"+
|
---|
240 | "\13\12\4\0\1\12\1\0\2\12\7\0\10\12\1\204"+
|
---|
241 | "\22\12\4\0\1\12\1\0\2\12\7\0\6\12\1\205"+
|
---|
242 | "\1\206\4\12\1\207\16\12\4\0\1\12\1\0\2\12"+
|
---|
243 | "\7\0\1\135\32\12\4\0\1\12\1\0\2\12\7\0"+
|
---|
244 | "\7\12\1\133\23\12\4\0\1\12\1\0\2\12\7\0"+
|
---|
245 | "\7\12\1\210\23\12\4\0\1\12\1\0\2\12\7\0"+
|
---|
246 | "\14\12\1\211\16\12\4\0\1\12\1\0\2\12\7\0"+
|
---|
247 | "\1\212\12\12\1\135\4\12\1\133\12\12\4\0\1\12"+
|
---|
248 | "\1\0\2\12\7\0\5\12\1\213\5\12\1\214\3\12"+
|
---|
249 | "\1\215\13\12\4\0\1\12\1\0\2\12\7\0\4\12"+
|
---|
250 | "\1\143\7\12\1\113\16\12\4\0\1\12\1\0\2\12"+
|
---|
251 | "\7\0\16\12\1\216\14\12\4\0\1\12\1\0\2\12"+
|
---|
252 | "\7\0\6\12\1\217\24\12\4\0\1\12\1\0\1\12"+
|
---|
253 | "\1\71\7\0\15\12\1\71\15\12\20\0\1\220\1\0"+
|
---|
254 | "\1\220\56\0\1\221\45\0\1\220\50\0\1\220\53\0"+
|
---|
255 | "\1\222\54\0\1\220\47\0\1\223\30\0\1\12\1\0"+
|
---|
256 | "\2\12\7\0\1\12\1\224\1\12\1\224\27\12\4\0"+
|
---|
257 | "\1\12\1\0\2\12\7\0\5\12\1\224\25\12\4\0"+
|
---|
258 | "\1\12\1\0\2\12\7\0\2\12\1\225\30\12\4\0"+
|
---|
259 | "\1\12\1\0\2\12\7\0\5\12\1\214\25\12\4\0"+
|
---|
260 | "\1\12\1\0\2\12\7\0\6\12\1\226\24\12\4\0"+
|
---|
261 | "\1\12\1\0\2\12\7\0\3\12\1\113\27\12\4\0"+
|
---|
262 | "\1\12\1\0\2\12\7\0\1\12\1\227\31\12\4\0"+
|
---|
263 | "\1\12\1\0\2\12\7\0\13\12\1\230\17\12\4\0"+
|
---|
264 | "\1\231\1\0\2\12\7\0\33\12\4\0\1\12\1\0"+
|
---|
265 | "\2\12\7\0\14\12\1\202\1\12\1\232\14\12\4\0"+
|
---|
266 | "\1\12\1\0\2\12\7\0\5\12\1\135\25\12\4\0"+
|
---|
267 | "\1\12\1\0\2\12\7\0\5\12\1\202\25\12\4\0"+
|
---|
268 | "\1\12\1\0\2\12\7\0\1\233\6\12\1\172\23\12"+
|
---|
269 | "\4\0\1\12\1\0\2\12\7\0\6\12\1\234\24\12"+
|
---|
270 | "\4\0\1\12\1\0\2\12\7\0\14\12\1\113\16\12"+
|
---|
271 | "\4\0\1\12\1\0\2\12\7\0\5\12\1\202\11\12"+
|
---|
272 | "\1\235\13\12\4\0\1\12\1\0\2\12\7\0\6\12"+
|
---|
273 | "\1\236\1\206\4\12\1\237\16\12\4\0\1\12\1\0"+
|
---|
274 | "\2\12\7\0\13\12\1\224\17\12\4\0\1\12\1\0"+
|
---|
275 | "\2\12\7\0\1\12\1\240\4\12\1\241\16\12\1\42"+
|
---|
276 | "\5\12\4\0\1\12\1\0\2\12\7\0\3\12\1\224"+
|
---|
277 | "\27\12\4\0\1\12\1\0\2\12\7\0\7\12\1\242"+
|
---|
278 | "\23\12\4\0\1\12\1\0\2\12\7\0\10\12\1\243"+
|
---|
279 | "\22\12\4\0\1\12\1\0\2\12\7\0\5\12\1\244"+
|
---|
280 | "\25\12\4\0\1\12\1\0\2\12\7\0\7\12\1\175"+
|
---|
281 | "\23\12\4\0\1\12\1\0\2\12\7\0\1\245\32\12"+
|
---|
282 | "\4\0\1\12\1\0\2\12\7\0\10\12\1\202\22\12"+
|
---|
283 | "\4\0\1\12\1\0\2\12\7\0\2\12\1\212\30\12"+
|
---|
284 | "\4\0\1\12\1\0\2\12\7\0\20\12\1\246\12\12"+
|
---|
285 | "\4\0\1\12\1\0\2\12\7\0\2\12\1\113\2\12"+
|
---|
286 | "\1\214\25\12\4\0\1\12\1\0\2\12\7\0\5\12"+
|
---|
287 | "\1\60\6\12\1\247\16\12\4\0\1\12\1\0\2\12"+
|
---|
288 | "\7\0\22\12\1\250\10\12\4\0\1\251\1\0\1\12"+
|
---|
289 | "\1\252\7\0\1\12\1\253\2\12\1\254\10\12\1\252"+
|
---|
290 | "\15\12\4\0\1\12\1\0\2\12\7\0\20\12\1\133"+
|
---|
291 | "\12\12\4\0\1\12\1\0\2\12\7\0\14\12\1\255"+
|
---|
292 | "\16\12\4\0\1\12\1\0\2\12\7\0\14\12\1\256"+
|
---|
293 | "\16\12\4\0\1\12\1\0\2\12\7\0\6\12\1\257"+
|
---|
294 | "\7\12\1\260\14\12\4\0\1\12\1\0\2\12\7\0"+
|
---|
295 | "\10\12\1\261\1\32\21\12\4\0\1\12\1\0\2\12"+
|
---|
296 | "\7\0\3\12\1\262\3\12\1\263\4\12\1\125\16\12"+
|
---|
297 | "\4\0\1\12\1\0\2\12\7\0\21\12\1\264\11\12"+
|
---|
298 | "\4\0\1\265\1\0\2\12\7\0\33\12\4\0\1\12"+
|
---|
299 | "\1\0\2\12\7\0\5\12\1\264\25\12\4\0\1\12"+
|
---|
300 | "\1\0\1\12\1\266\7\0\15\12\1\266\15\12\4\0"+
|
---|
301 | "\1\12\1\0\2\12\7\0\5\12\1\206\25\12\4\0"+
|
---|
302 | "\1\12\1\0\2\12\7\0\14\12\1\267\16\12\4\0"+
|
---|
303 | "\1\12\1\0\2\12\7\0\3\12\1\270\10\12\1\71"+
|
---|
304 | "\16\12\4\0\1\12\1\0\2\12\7\0\21\12\1\202"+
|
---|
305 | "\11\12\4\0\1\12\1\0\2\12\7\0\17\12\1\224"+
|
---|
306 | "\13\12\4\0\1\12\1\0\2\12\7\0\13\12\1\214"+
|
---|
307 | "\17\12\4\0\1\12\1\0\2\12\7\0\2\12\1\271"+
|
---|
308 | "\30\12\4\0\1\12\1\0\2\12\7\0\1\272\32\12"+
|
---|
309 | "\4\0\1\12\1\0\2\12\7\0\6\12\1\273\24\12"+
|
---|
310 | "\4\0\1\12\1\0\2\12\7\0\16\12\1\224\14\12"+
|
---|
311 | "\4\0\1\12\1\0\2\12\7\0\6\12\1\274\24\12"+
|
---|
312 | "\4\0\1\12\1\0\2\12\7\0\20\12\1\71\12\12"+
|
---|
313 | "\4\0\1\12\1\0\2\12\7\0\6\12\1\212\24\12"+
|
---|
314 | "\4\0\1\12\1\0\2\12\7\0\7\12\1\275\23\12"+
|
---|
315 | "\4\0\1\12\1\0\2\12\7\0\1\12\1\224\31\12"+
|
---|
316 | "\4\0\1\12\1\0\2\12\7\0\3\12\1\276\27\12"+
|
---|
317 | "\4\0\1\12\1\0\2\12\7\0\7\12\1\206\23\12"+
|
---|
318 | "\4\0\1\12\1\0\2\12\7\0\21\12\1\277\11\12"+
|
---|
319 | "\4\0\1\224\1\0\2\12\7\0\33\12\4\0\1\12"+
|
---|
320 | "\1\0\2\12\7\0\5\12\1\277\25\12\4\0\1\12"+
|
---|
321 | "\1\0\2\12\7\0\2\12\1\224\10\12\1\135\17\12"+
|
---|
322 | "\4\0\1\12\1\0\2\12\7\0\1\300\32\12\4\0"+
|
---|
323 | "\1\12\1\0\2\12\7\0\1\224\32\12\4\0\1\12"+
|
---|
324 | "\1\0\2\12\7\0\1\12\1\301\25\12\1\257\3\12"+
|
---|
325 | "\4\0\1\12\1\0\2\12\7\0\22\12\1\224\10\12"+
|
---|
326 | "\4\0\1\12\1\0\2\12\7\0\16\12\1\302\14\12"+
|
---|
327 | "\4\0\1\12\1\0\2\12\7\0\1\255\32\12\4\0"+
|
---|
328 | "\1\12\1\0\2\12\7\0\10\12\1\303\22\12\16\0"+
|
---|
329 | "\1\20\63\0\1\304\25\0\1\220\64\0\1\305\36\0"+
|
---|
330 | "\1\12\1\0\2\12\7\0\14\12\1\306\14\12\1\307"+
|
---|
331 | "\1\12\4\0\1\12\1\0\2\12\7\0\5\12\1\310"+
|
---|
332 | "\25\12\4\0\1\12\1\0\2\12\7\0\7\12\1\224"+
|
---|
333 | "\23\12\4\0\1\12\1\0\2\12\7\0\3\12\1\311"+
|
---|
334 | "\27\12\4\0\1\227\1\0\2\12\7\0\12\12\1\312"+
|
---|
335 | "\1\12\1\313\16\12\4\0\1\12\1\0\2\12\7\0"+
|
---|
336 | "\1\314\32\12\4\0\1\12\1\0\2\12\7\0\7\12"+
|
---|
337 | "\1\315\23\12\4\0\1\12\1\0\2\12\7\0\5\12"+
|
---|
338 | "\1\316\25\12\4\0\1\12\1\0\2\12\7\0\6\12"+
|
---|
339 | "\1\257\24\12\4\0\1\12\1\0\2\12\7\0\21\12"+
|
---|
340 | "\1\317\11\12\4\0\1\12\1\0\2\12\7\0\5\12"+
|
---|
341 | "\1\317\25\12\4\0\1\12\1\0\2\12\7\0\11\12"+
|
---|
342 | "\1\320\21\12\4\0\1\224\1\0\2\12\7\0\1\224"+
|
---|
343 | "\32\12\4\0\1\12\1\0\2\12\7\0\6\12\1\202"+
|
---|
344 | "\1\321\23\12\4\0\1\12\1\0\2\12\7\0\6\12"+
|
---|
345 | "\1\322\10\12\1\275\13\12\4\0\1\12\1\0\1\12"+
|
---|
346 | "\1\323\7\0\15\12\1\323\15\12\4\0\1\12\1\0"+
|
---|
347 | "\2\12\7\0\3\12\1\324\27\12\4\0\1\12\1\0"+
|
---|
348 | "\2\12\7\0\10\12\1\325\22\12\4\0\1\12\1\0"+
|
---|
349 | "\2\12\7\0\5\12\1\202\11\12\1\224\13\12\4\0"+
|
---|
350 | "\1\12\1\0\2\12\7\0\6\12\1\321\24\12\4\0"+
|
---|
351 | "\1\12\1\0\2\12\7\0\3\12\1\255\27\12\4\0"+
|
---|
352 | "\1\12\1\0\2\12\7\0\1\326\32\12\4\0\1\12"+
|
---|
353 | "\1\0\2\12\7\0\3\12\1\327\27\12\4\0\1\12"+
|
---|
354 | "\1\0\2\12\7\0\11\12\1\330\21\12\4\0\1\12"+
|
---|
355 | "\1\0\2\12\7\0\21\12\1\224\11\12\4\0\1\12"+
|
---|
356 | "\1\0\2\12\7\0\2\12\1\113\30\12\4\0\1\12"+
|
---|
357 | "\1\0\2\12\7\0\2\12\1\224\30\12\4\0\1\12"+
|
---|
358 | "\1\0\2\12\7\0\6\12\1\331\24\12\4\0\1\12"+
|
---|
359 | "\1\0\1\12\1\332\7\0\15\12\1\332\15\12\4\0"+
|
---|
360 | "\1\12\1\0\2\12\7\0\2\12\1\333\30\12\4\0"+
|
---|
361 | "\1\12\1\0\2\12\7\0\26\12\1\224\2\12\1\224"+
|
---|
362 | "\1\12\4\0\1\12\1\0\2\12\7\0\11\12\1\334"+
|
---|
363 | "\21\12\4\0\1\12\1\0\2\12\7\0\23\12\1\335"+
|
---|
364 | "\7\12\4\0\1\12\1\0\2\12\7\0\1\12\1\135"+
|
---|
365 | "\31\12\4\0\1\12\1\0\2\12\7\0\10\12\1\135"+
|
---|
366 | "\22\12\4\0\1\12\1\0\2\12\7\0\31\12\1\307"+
|
---|
367 | "\1\12\4\0\1\12\1\0\2\12\7\0\1\336\32\12"+
|
---|
368 | "\4\0\1\12\1\0\2\12\7\0\11\12\1\337\21\12"+
|
---|
369 | "\4\0\1\12\1\0\2\12\7\0\6\12\1\202\24\12"+
|
---|
370 | "\4\0\1\12\1\0\2\12\7\0\5\12\1\340\25\12"+
|
---|
371 | "\4\0\1\12\1\0\2\12\7\0\31\12\1\224\1\12"+
|
---|
372 | "\4\0\1\12\1\0\2\12\7\0\14\12\1\341\16\12"+
|
---|
373 | "\4\0\1\12\1\0\2\12\7\0\6\12\1\342\5\12"+
|
---|
374 | "\1\343\16\12\4\0\1\12\1\0\2\12\7\0\1\251"+
|
---|
375 | "\32\12\4\0\1\12\1\0\2\12\7\0\6\12\1\344"+
|
---|
376 | "\24\12\22\0\1\345\61\0\1\304\23\0\1\12\1\0"+
|
---|
377 | "\1\12\1\200\7\0\15\12\1\200\15\12\4\0\1\12"+
|
---|
378 | "\1\0\2\12\7\0\26\12\1\224\4\12\4\0\1\12"+
|
---|
379 | "\1\0\2\12\7\0\13\12\1\346\17\12\4\0\1\12"+
|
---|
380 | "\1\0\2\12\7\0\14\12\1\313\10\12\1\347\5\12"+
|
---|
381 | "\4\0\1\12\1\0\2\12\7\0\14\12\1\71\16\12"+
|
---|
382 | "\4\0\1\12\1\0\2\12\7\0\12\12\1\224\20\12"+
|
---|
383 | "\4\0\1\12\1\0\2\12\7\0\14\12\1\350\16\12"+
|
---|
384 | "\4\0\1\12\1\0\1\12\1\351\7\0\15\12\1\351"+
|
---|
385 | "\15\12\4\0\1\12\1\0\2\12\7\0\32\12\1\224"+
|
---|
386 | "\4\0\1\12\1\0\2\12\7\0\10\12\1\113\22\12"+
|
---|
387 | "\4\0\1\12\1\0\2\12\7\0\10\12\1\224\22\12"+
|
---|
388 | "\4\0\1\12\1\0\2\12\7\0\1\212\32\12\4\0"+
|
---|
389 | "\1\12\1\0\2\12\7\0\1\12\1\352\31\12\4\0"+
|
---|
390 | "\1\12\1\0\1\12\1\202\7\0\15\12\1\202\15\12"+
|
---|
391 | "\4\0\1\12\1\0\2\12\7\0\7\12\1\353\23\12"+
|
---|
392 | "\4\0\1\12\1\0\2\12\7\0\11\12\1\354\21\12"+
|
---|
393 | "\4\0\1\12\1\0\2\12\7\0\2\12\1\355\30\12"+
|
---|
394 | "\4\0\1\12\1\0\2\12\7\0\14\12\1\270\16\12"+
|
---|
395 | "\4\0\1\12\1\0\2\12\7\0\17\12\1\356\13\12"+
|
---|
396 | "\4\0\1\12\1\0\2\12\7\0\14\12\1\340\16\12"+
|
---|
397 | "\4\0\1\12\1\0\2\12\7\0\10\12\1\357\22\12"+
|
---|
398 | "\4\0\1\12\1\0\2\12\7\0\1\360\32\12\4\0"+
|
---|
399 | "\1\12\1\0\2\12\7\0\13\12\1\361\17\12\4\0"+
|
---|
400 | "\1\12\1\0\2\12\7\0\7\12\1\362\23\12\4\0"+
|
---|
401 | "\1\12\1\0\2\12\7\0\1\202\32\12\4\0\1\12"+
|
---|
402 | "\1\0\2\12\7\0\13\12\1\352\17\12\4\0\1\12"+
|
---|
403 | "\1\0\2\12\7\0\5\12\1\257\25\12\4\0\1\12"+
|
---|
404 | "\1\0\2\12\7\0\14\12\1\363\16\12\4\0\1\12"+
|
---|
405 | "\1\0\2\12\7\0\5\12\1\364\25\12\4\0\1\12"+
|
---|
406 | "\1\0\1\12\1\365\7\0\15\12\1\365\15\12\16\0"+
|
---|
407 | "\1\366\37\0\1\12\1\0\2\12\7\0\12\12\1\355"+
|
---|
408 | "\20\12\4\0\1\12\1\0\2\12\7\0\22\12\1\367"+
|
---|
409 | "\10\12\4\0\1\12\1\0\1\12\1\370\7\0\15\12"+
|
---|
410 | "\1\370\15\12\4\0\1\12\1\0\2\12\7\0\6\12"+
|
---|
411 | "\1\371\24\12\4\0\1\12\1\0\2\12\7\0\14\12"+
|
---|
412 | "\1\372\16\12\4\0\1\12\1\0\2\12\7\0\11\12"+
|
---|
413 | "\1\373\21\12\4\0\1\135\1\0\2\12\7\0\33\12"+
|
---|
414 | "\4\0\1\12\1\0\2\12\7\0\3\12\1\321\27\12"+
|
---|
415 | "\4\0\1\12\1\0\2\12\7\0\3\12\1\365\27\12"+
|
---|
416 | "\4\0\1\12\1\0\2\12\7\0\6\12\1\170\24\12"+
|
---|
417 | "\4\0\1\12\1\0\2\12\7\0\3\12\1\224\3\12"+
|
---|
418 | "\1\224\23\12\4\0\1\12\1\0\2\12\7\0\16\12"+
|
---|
419 | "\1\374\14\12\4\0\1\12\1\0\1\12\1\375\7\0"+
|
---|
420 | "\15\12\1\375\15\12\4\0\1\12\1\0\2\12\7\0"+
|
---|
421 | "\5\12\1\133\25\12\4\0\1\12\1\0\2\12\7\0"+
|
---|
422 | "\11\12\1\135\21\12\4\0\1\12\1\0\2\12\7\0"+
|
---|
423 | "\1\12\1\355\31\12\4\0\1\12\1\0\2\12\7\0"+
|
---|
424 | "\3\12\1\270\27\12\4\0\1\12\1\0\2\12\7\0"+
|
---|
425 | "\14\12\1\202\16\12\4\0\1\12\1\0\2\12\7\0"+
|
---|
426 | "\1\12\1\376\31\12\4\0\1\12\1\0\2\12\7\0"+
|
---|
427 | "\7\12\1\113\23\12\4\0\1\12\1\0\2\12\7\0"+
|
---|
428 | "\1\12\1\377\31\12\4\0\1\12\1\0\2\12\7\0"+
|
---|
429 | "\6\12\1\u0100\24\12\4\0\1\12\1\0\2\12\7\0"+
|
---|
430 | "\6\12\1\267\24\12\4\0\1\12\1\0\2\12\7\0"+
|
---|
431 | "\3\12\1\u0101\2\12\1\177\24\12\4\0\1\12\1\0"+
|
---|
432 | "\2\12\7\0\14\12\1\124\16\12\4\0\1\12\1\0"+
|
---|
433 | "\1\12\1\135\7\0\15\12\1\135\15\12";
|
---|
434 |
|
---|
435 | private static int [] zzUnpackTrans() {
|
---|
436 | int [] result = new int[10038];
|
---|
437 | int offset = 0;
|
---|
438 | offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
|
---|
439 | return result;
|
---|
440 | }
|
---|
441 |
|
---|
442 | private static int zzUnpackTrans(String packed, int offset, int [] result) {
|
---|
443 | int i = 0; /* index in packed string */
|
---|
444 | int j = offset; /* index in unpacked array */
|
---|
445 | int l = packed.length();
|
---|
446 | while (i < l) {
|
---|
447 | int count = packed.charAt(i++);
|
---|
448 | int value = packed.charAt(i++);
|
---|
449 | value--;
|
---|
450 | do result[j++] = value; while (--count > 0);
|
---|
451 | }
|
---|
452 | return j;
|
---|
453 | }
|
---|
454 |
|
---|
455 |
|
---|
456 | /* error codes */
|
---|
457 | private static final int ZZ_UNKNOWN_ERROR = 0;
|
---|
458 | private static final int ZZ_NO_MATCH = 1;
|
---|
459 | private static final int ZZ_PUSHBACK_2BIG = 2;
|
---|
460 |
|
---|
461 | /* error messages for the codes above */
|
---|
462 | private static final String ZZ_ERROR_MSG[] = {
|
---|
463 | "Unkown internal scanner error",
|
---|
464 | "Error: could not match input",
|
---|
465 | "Error: pushback value was too large"
|
---|
466 | };
|
---|
467 |
|
---|
468 | /**
|
---|
469 | * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
|
---|
470 | */
|
---|
471 | private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
|
---|
472 |
|
---|
473 | private static final String ZZ_ATTRIBUTE_PACKED_0 =
|
---|
474 | "\1\0\2\1\2\11\1\1\1\11\1\1\1\11\2\1"+
|
---|
475 | "\2\11\2\1\1\11\25\1\2\11\1\1\2\11\30\1"+
|
---|
476 | "\7\0\106\1\4\0\60\1\2\0\37\1\1\0\20\1"+
|
---|
477 | "\1\11\13\1";
|
---|
478 |
|
---|
479 | private static int [] zzUnpackAttribute() {
|
---|
480 | int [] result = new int[257];
|
---|
481 | int offset = 0;
|
---|
482 | offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
|
---|
483 | return result;
|
---|
484 | }
|
---|
485 |
|
---|
486 | private static int zzUnpackAttribute(String packed, int offset, int [] result) {
|
---|
487 | int i = 0; /* index in packed string */
|
---|
488 | int j = offset; /* index in unpacked array */
|
---|
489 | int l = packed.length();
|
---|
490 | while (i < l) {
|
---|
491 | int count = packed.charAt(i++);
|
---|
492 | int value = packed.charAt(i++);
|
---|
493 | do result[j++] = value; while (--count > 0);
|
---|
494 | }
|
---|
495 | return j;
|
---|
496 | }
|
---|
497 |
|
---|
498 | /** the input device */
|
---|
499 | private java.io.Reader zzReader;
|
---|
500 |
|
---|
501 | /** the current state of the DFA */
|
---|
502 | private int zzState;
|
---|
503 |
|
---|
504 | /** the current lexical state */
|
---|
505 | private int zzLexicalState = YYINITIAL;
|
---|
506 |
|
---|
507 | /** this buffer contains the current text to be matched and is
|
---|
508 | the source of the yytext() string */
|
---|
509 | private char zzBuffer[];
|
---|
510 |
|
---|
511 | /** the textposition at the last accepting state */
|
---|
512 | private int zzMarkedPos;
|
---|
513 |
|
---|
514 | /** the current text position in the buffer */
|
---|
515 | private int zzCurrentPos;
|
---|
516 |
|
---|
517 | /** startRead marks the beginning of the yytext() string in the buffer */
|
---|
518 | private int zzStartRead;
|
---|
519 |
|
---|
520 | /** endRead marks the last character in the buffer, that has been read
|
---|
521 | from input */
|
---|
522 | private int zzEndRead;
|
---|
523 |
|
---|
524 | /** zzAtEOF == true <=> the scanner is at the EOF */
|
---|
525 | private boolean zzAtEOF;
|
---|
526 |
|
---|
527 | /* user code: */
|
---|
528 |
|
---|
529 |
|
---|
530 | /**
|
---|
531 | * Constructor. We must have this here as there is no default,
|
---|
532 | * no-parameter constructor generated by JFlex.
|
---|
533 | */
|
---|
534 | public FortranTokenMaker() {
|
---|
535 | super();
|
---|
536 | }
|
---|
537 |
|
---|
538 |
|
---|
539 | /**
|
---|
540 | * Adds the token specified to the current linked list of tokens.
|
---|
541 | *
|
---|
542 | * @param tokenType The token's type.
|
---|
543 | */
|
---|
544 | private void addToken(int tokenType) {
|
---|
545 | addToken(zzStartRead, zzMarkedPos-1, tokenType);
|
---|
546 | }
|
---|
547 |
|
---|
548 |
|
---|
549 | /**
|
---|
550 | * Adds the token specified to the current linked list of tokens.
|
---|
551 | *
|
---|
552 | * @param tokenType The token's type.
|
---|
553 | */
|
---|
554 | private void addToken(int start, int end, int tokenType) {
|
---|
555 | int so = start + offsetShift;
|
---|
556 | addToken(zzBuffer, start,end, tokenType, so);
|
---|
557 | }
|
---|
558 |
|
---|
559 |
|
---|
560 | /**
|
---|
561 | * Adds the token specified to the current linked list of tokens.
|
---|
562 | *
|
---|
563 | * @param array The character array.
|
---|
564 | * @param start The starting offset in the array.
|
---|
565 | * @param end The ending offset in the array.
|
---|
566 | * @param tokenType The token's type.
|
---|
567 | * @param startOffset The offset in the document at which this token
|
---|
568 | * occurs.
|
---|
569 | */
|
---|
570 | public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
|
---|
571 | super.addToken(array, start,end, tokenType, startOffset);
|
---|
572 | zzStartRead = zzMarkedPos;
|
---|
573 | }
|
---|
574 |
|
---|
575 |
|
---|
576 | /**
|
---|
577 | * Returns the text to place at the beginning and end of a
|
---|
578 | * line to "comment" it in a this programming language.
|
---|
579 | *
|
---|
580 | * @return The start and end strings to add to a line to "comment"
|
---|
581 | * it out.
|
---|
582 | */
|
---|
583 | public String[] getLineCommentStartAndEnd() {
|
---|
584 | return new String[] { "!", null };
|
---|
585 | }
|
---|
586 |
|
---|
587 |
|
---|
588 | /**
|
---|
589 | * Returns the first token in the linked list of tokens generated
|
---|
590 | * from <code>text</code>. This method must be implemented by
|
---|
591 | * subclasses so they can correctly implement syntax highlighting.
|
---|
592 | *
|
---|
593 | * @param text The text from which to get tokens.
|
---|
594 | * @param initialTokenType The token type we should start with.
|
---|
595 | * @param startOffset The offset into the document at which
|
---|
596 | * <code>text</code> starts.
|
---|
597 | * @return The first <code>Token</code> in a linked list representing
|
---|
598 | * the syntax highlighted text.
|
---|
599 | */
|
---|
600 | public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
|
---|
601 |
|
---|
602 | resetTokenList();
|
---|
603 | this.offsetShift = -text.offset + startOffset;
|
---|
604 |
|
---|
605 | // Start off in the proper state.
|
---|
606 | int state = Token.NULL;
|
---|
607 | switch (initialTokenType) {
|
---|
608 | case Token.LITERAL_STRING_DOUBLE_QUOTE:
|
---|
609 | state = STRING;
|
---|
610 | start = text.offset;
|
---|
611 | break;
|
---|
612 | case Token.LITERAL_CHAR:
|
---|
613 | state = CHAR;
|
---|
614 | start = text.offset;
|
---|
615 | break;
|
---|
616 | default:
|
---|
617 | state = Token.NULL;
|
---|
618 | }
|
---|
619 |
|
---|
620 | s = text;
|
---|
621 | try {
|
---|
622 | yyreset(zzReader);
|
---|
623 | yybegin(state);
|
---|
624 | return yylex();
|
---|
625 | } catch (IOException ioe) {
|
---|
626 | ioe.printStackTrace();
|
---|
627 | return new DefaultToken();
|
---|
628 | }
|
---|
629 |
|
---|
630 | }
|
---|
631 |
|
---|
632 |
|
---|
633 | /**
|
---|
634 | * Refills the input buffer.
|
---|
635 | *
|
---|
636 | * @return <code>true</code> if EOF was reached, otherwise
|
---|
637 | * <code>false</code>.
|
---|
638 | * @exception IOException if any I/O-Error occurs.
|
---|
639 | */
|
---|
640 | private boolean zzRefill() throws java.io.IOException {
|
---|
641 | return zzCurrentPos>=s.offset+s.count;
|
---|
642 | }
|
---|
643 |
|
---|
644 |
|
---|
645 | /**
|
---|
646 | * Resets the scanner to read from a new input stream.
|
---|
647 | * Does not close the old reader.
|
---|
648 | *
|
---|
649 | * All internal variables are reset, the old input stream
|
---|
650 | * <b>cannot</b> be reused (internal buffer is discarded and lost).
|
---|
651 | * Lexical state is set to <tt>YY_INITIAL</tt>.
|
---|
652 | *
|
---|
653 | * @param reader the new input stream
|
---|
654 | */
|
---|
655 | public final void yyreset(java.io.Reader reader) throws java.io.IOException {
|
---|
656 | // 's' has been updated.
|
---|
657 | zzBuffer = s.array;
|
---|
658 | /*
|
---|
659 | * We replaced the line below with the two below it because zzRefill
|
---|
660 | * no longer "refills" the buffer (since the way we do it, it's always
|
---|
661 | * "full" the first time through, since it points to the segment's
|
---|
662 | * array). So, we assign zzEndRead here.
|
---|
663 | */
|
---|
664 | //zzStartRead = zzEndRead = s.offset;
|
---|
665 | zzStartRead = s.offset;
|
---|
666 | zzEndRead = zzStartRead + s.count - 1;
|
---|
667 | zzCurrentPos = zzMarkedPos = s.offset;
|
---|
668 | zzLexicalState = YYINITIAL;
|
---|
669 | zzReader = reader;
|
---|
670 | zzAtEOF = false;
|
---|
671 | }
|
---|
672 |
|
---|
673 |
|
---|
674 |
|
---|
675 |
|
---|
676 | /**
|
---|
677 | * Creates a new scanner
|
---|
678 | * There is also a java.io.InputStream version of this constructor.
|
---|
679 | *
|
---|
680 | * @param in the java.io.Reader to read input from.
|
---|
681 | */
|
---|
682 | public FortranTokenMaker(java.io.Reader in) {
|
---|
683 | this.zzReader = in;
|
---|
684 | }
|
---|
685 |
|
---|
686 | /**
|
---|
687 | * Creates a new scanner.
|
---|
688 | * There is also java.io.Reader version of this constructor.
|
---|
689 | *
|
---|
690 | * @param in the java.io.Inputstream to read input from.
|
---|
691 | */
|
---|
692 | public FortranTokenMaker(java.io.InputStream in) {
|
---|
693 | this(new java.io.InputStreamReader(in));
|
---|
694 | }
|
---|
695 |
|
---|
696 | /**
|
---|
697 | * Unpacks the compressed character translation table.
|
---|
698 | *
|
---|
699 | * @param packed the packed character translation table
|
---|
700 | * @return the unpacked character translation table
|
---|
701 | */
|
---|
702 | private static char [] zzUnpackCMap(String packed) {
|
---|
703 | char [] map = new char[0x10000];
|
---|
704 | int i = 0; /* index in packed string */
|
---|
705 | int j = 0; /* index in unpacked array */
|
---|
706 | while (i < 168) {
|
---|
707 | int count = packed.charAt(i++);
|
---|
708 | char value = packed.charAt(i++);
|
---|
709 | do map[j++] = value; while (--count > 0);
|
---|
710 | }
|
---|
711 | return map;
|
---|
712 | }
|
---|
713 |
|
---|
714 |
|
---|
715 | /**
|
---|
716 | * Closes the input stream.
|
---|
717 | */
|
---|
718 | public final void yyclose() throws java.io.IOException {
|
---|
719 | zzAtEOF = true; /* indicate end of file */
|
---|
720 | zzEndRead = zzStartRead; /* invalidate buffer */
|
---|
721 |
|
---|
722 | if (zzReader != null)
|
---|
723 | zzReader.close();
|
---|
724 | }
|
---|
725 |
|
---|
726 |
|
---|
727 | /**
|
---|
728 | * Returns the current lexical state.
|
---|
729 | */
|
---|
730 | public final int yystate() {
|
---|
731 | return zzLexicalState;
|
---|
732 | }
|
---|
733 |
|
---|
734 |
|
---|
735 | /**
|
---|
736 | * Enters a new lexical state
|
---|
737 | *
|
---|
738 | * @param newState the new lexical state
|
---|
739 | */
|
---|
740 | public final void yybegin(int newState) {
|
---|
741 | zzLexicalState = newState;
|
---|
742 | }
|
---|
743 |
|
---|
744 |
|
---|
745 | /**
|
---|
746 | * Returns the text matched by the current regular expression.
|
---|
747 | */
|
---|
748 | public final String yytext() {
|
---|
749 | return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
|
---|
750 | }
|
---|
751 |
|
---|
752 |
|
---|
753 | /**
|
---|
754 | * Returns the character at position <tt>pos</tt> from the
|
---|
755 | * matched text.
|
---|
756 | *
|
---|
757 | * It is equivalent to yytext().charAt(pos), but faster
|
---|
758 | *
|
---|
759 | * @param pos the position of the character to fetch.
|
---|
760 | * A value from 0 to yylength()-1.
|
---|
761 | *
|
---|
762 | * @return the character at position pos
|
---|
763 | */
|
---|
764 | public final char yycharat(int pos) {
|
---|
765 | return zzBuffer[zzStartRead+pos];
|
---|
766 | }
|
---|
767 |
|
---|
768 |
|
---|
769 | /**
|
---|
770 | * Returns the length of the matched text region.
|
---|
771 | */
|
---|
772 | public final int yylength() {
|
---|
773 | return zzMarkedPos-zzStartRead;
|
---|
774 | }
|
---|
775 |
|
---|
776 |
|
---|
777 | /**
|
---|
778 | * Reports an error that occured while scanning.
|
---|
779 | *
|
---|
780 | * In a wellformed scanner (no or only correct usage of
|
---|
781 | * yypushback(int) and a match-all fallback rule) this method
|
---|
782 | * will only be called with things that "Can't Possibly Happen".
|
---|
783 | * If this method is called, something is seriously wrong
|
---|
784 | * (e.g. a JFlex bug producing a faulty scanner etc.).
|
---|
785 | *
|
---|
786 | * Usual syntax/scanner level error handling should be done
|
---|
787 | * in error fallback rules.
|
---|
788 | *
|
---|
789 | * @param errorCode the code of the errormessage to display
|
---|
790 | */
|
---|
791 | private void zzScanError(int errorCode) {
|
---|
792 | String message;
|
---|
793 | try {
|
---|
794 | message = ZZ_ERROR_MSG[errorCode];
|
---|
795 | }
|
---|
796 | catch (ArrayIndexOutOfBoundsException e) {
|
---|
797 | message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
|
---|
798 | }
|
---|
799 |
|
---|
800 | throw new Error(message);
|
---|
801 | }
|
---|
802 |
|
---|
803 |
|
---|
804 | /**
|
---|
805 | * Pushes the specified amount of characters back into the input stream.
|
---|
806 | *
|
---|
807 | * They will be read again by then next call of the scanning method
|
---|
808 | *
|
---|
809 | * @param number the number of characters to be read again.
|
---|
810 | * This number must not be greater than yylength()!
|
---|
811 | */
|
---|
812 | public void yypushback(int number) {
|
---|
813 | if ( number > yylength() )
|
---|
814 | zzScanError(ZZ_PUSHBACK_2BIG);
|
---|
815 |
|
---|
816 | zzMarkedPos -= number;
|
---|
817 | }
|
---|
818 |
|
---|
819 |
|
---|
820 | /**
|
---|
821 | * Resumes scanning until the next regular expression is matched,
|
---|
822 | * the end of input is encountered or an I/O-Error occurs.
|
---|
823 | *
|
---|
824 | * @return the next token
|
---|
825 | * @exception java.io.IOException if any I/O-Error occurs
|
---|
826 | */
|
---|
827 | public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
|
---|
828 | int zzInput;
|
---|
829 | int zzAction;
|
---|
830 |
|
---|
831 | // cached fields:
|
---|
832 | int zzCurrentPosL;
|
---|
833 | int zzMarkedPosL;
|
---|
834 | int zzEndReadL = zzEndRead;
|
---|
835 | char [] zzBufferL = zzBuffer;
|
---|
836 | char [] zzCMapL = ZZ_CMAP;
|
---|
837 |
|
---|
838 | int [] zzTransL = ZZ_TRANS;
|
---|
839 | int [] zzRowMapL = ZZ_ROWMAP;
|
---|
840 | int [] zzAttrL = ZZ_ATTRIBUTE;
|
---|
841 |
|
---|
842 | while (true) {
|
---|
843 | zzMarkedPosL = zzMarkedPos;
|
---|
844 |
|
---|
845 | zzAction = -1;
|
---|
846 |
|
---|
847 | zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
|
---|
848 |
|
---|
849 | zzState = zzLexicalState;
|
---|
850 |
|
---|
851 |
|
---|
852 | zzForAction: {
|
---|
853 | while (true) {
|
---|
854 |
|
---|
855 | if (zzCurrentPosL < zzEndReadL)
|
---|
856 | zzInput = zzBufferL[zzCurrentPosL++];
|
---|
857 | else if (zzAtEOF) {
|
---|
858 | zzInput = YYEOF;
|
---|
859 | break zzForAction;
|
---|
860 | }
|
---|
861 | else {
|
---|
862 | // store back cached positions
|
---|
863 | zzCurrentPos = zzCurrentPosL;
|
---|
864 | zzMarkedPos = zzMarkedPosL;
|
---|
865 | boolean eof = zzRefill();
|
---|
866 | // get translated positions and possibly new buffer
|
---|
867 | zzCurrentPosL = zzCurrentPos;
|
---|
868 | zzMarkedPosL = zzMarkedPos;
|
---|
869 | zzBufferL = zzBuffer;
|
---|
870 | zzEndReadL = zzEndRead;
|
---|
871 | if (eof) {
|
---|
872 | zzInput = YYEOF;
|
---|
873 | break zzForAction;
|
---|
874 | }
|
---|
875 | else {
|
---|
876 | zzInput = zzBufferL[zzCurrentPosL++];
|
---|
877 | }
|
---|
878 | }
|
---|
879 | int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
|
---|
880 | if (zzNext == -1) break zzForAction;
|
---|
881 | zzState = zzNext;
|
---|
882 |
|
---|
883 | int zzAttributes = zzAttrL[zzState];
|
---|
884 | if ( (zzAttributes & 1) == 1 ) {
|
---|
885 | zzAction = zzState;
|
---|
886 | zzMarkedPosL = zzCurrentPosL;
|
---|
887 | if ( (zzAttributes & 8) == 8 ) break zzForAction;
|
---|
888 | }
|
---|
889 |
|
---|
890 | }
|
---|
891 | }
|
---|
892 |
|
---|
893 | // store back cached position
|
---|
894 | zzMarkedPos = zzMarkedPosL;
|
---|
895 |
|
---|
896 | switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
|
---|
897 | case 15:
|
---|
898 | { addToken(Token.RESERVED_WORD);
|
---|
899 | }
|
---|
900 | case 17: break;
|
---|
901 | case 2:
|
---|
902 | { addToken(Token.IDENTIFIER);
|
---|
903 | }
|
---|
904 | case 18: break;
|
---|
905 | case 4:
|
---|
906 | { addToken(Token.WHITESPACE);
|
---|
907 | }
|
---|
908 | case 19: break;
|
---|
909 | case 11:
|
---|
910 | { addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken;
|
---|
911 | }
|
---|
912 | case 20: break;
|
---|
913 | case 13:
|
---|
914 | { addToken(start,zzStartRead-1, Token.LITERAL_CHAR); return firstToken;
|
---|
915 | }
|
---|
916 | case 21: break;
|
---|
917 | case 10:
|
---|
918 | { addToken(Token.OPERATOR);
|
---|
919 | }
|
---|
920 | case 22: break;
|
---|
921 | case 5:
|
---|
922 | { // Since we change zzStartRead, we have the unfortunate
|
---|
923 | // side-effect of not being able to use the '^' operator.
|
---|
924 | // So we must check whether we're really at the beginning
|
---|
925 | // of the line ourselves...
|
---|
926 | if (zzStartRead==s.offset) {
|
---|
927 | addToken(zzStartRead,zzEndRead, Token.COMMENT_EOL);
|
---|
928 | addNullToken();
|
---|
929 | return firstToken;
|
---|
930 | }
|
---|
931 | else {
|
---|
932 | addToken(Token.IDENTIFIER);
|
---|
933 | }
|
---|
934 | }
|
---|
935 | case 23: break;
|
---|
936 | case 16:
|
---|
937 | { addToken(Token.LITERAL_BOOLEAN);
|
---|
938 | }
|
---|
939 | case 24: break;
|
---|
940 | case 8:
|
---|
941 | { start = zzMarkedPos-1; yybegin(STRING);
|
---|
942 | }
|
---|
943 | case 25: break;
|
---|
944 | case 7:
|
---|
945 | { addToken(zzStartRead,zzEndRead, Token.COMMENT_EOL); addNullToken(); return firstToken;
|
---|
946 | }
|
---|
947 | case 26: break;
|
---|
948 | case 6:
|
---|
949 | { // Since we change zzStartRead, we have the unfortunate
|
---|
950 | // side-effect of not being able to use the '^' operator.
|
---|
951 | // So we must check whether we're really at the beginning
|
---|
952 | // of the line ourselves...
|
---|
953 | if (zzStartRead==s.offset) {
|
---|
954 | addToken(zzStartRead,zzEndRead, Token.COMMENT_DOCUMENTATION);
|
---|
955 | addNullToken();
|
---|
956 | return firstToken;
|
---|
957 | }
|
---|
958 | else {
|
---|
959 | addToken(Token.IDENTIFIER);
|
---|
960 | }
|
---|
961 | }
|
---|
962 | case 27: break;
|
---|
963 | case 9:
|
---|
964 | { start = zzMarkedPos-1; yybegin(CHAR);
|
---|
965 | }
|
---|
966 | case 28: break;
|
---|
967 | case 14:
|
---|
968 | { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_CHAR);
|
---|
969 | }
|
---|
970 | case 29: break;
|
---|
971 | case 12:
|
---|
972 | { yybegin(YYINITIAL); addToken(start,zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE);
|
---|
973 | }
|
---|
974 | case 30: break;
|
---|
975 | case 3:
|
---|
976 | { addNullToken(); return firstToken;
|
---|
977 | }
|
---|
978 | case 31: break;
|
---|
979 | case 1:
|
---|
980 | {
|
---|
981 | }
|
---|
982 | case 32: break;
|
---|
983 | default:
|
---|
984 | if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
|
---|
985 | zzAtEOF = true;
|
---|
986 | switch (zzLexicalState) {
|
---|
987 | case STRING: {
|
---|
988 | addToken(start,zzStartRead-1, Token.LITERAL_STRING_DOUBLE_QUOTE); return firstToken;
|
---|
989 | }
|
---|
990 | case 258: break;
|
---|
991 | case YYINITIAL: {
|
---|
992 | addNullToken(); return firstToken;
|
---|
993 | }
|
---|
994 | case 259: break;
|
---|
995 | case CHAR: {
|
---|
996 | addToken(start,zzStartRead-1, Token.LITERAL_CHAR); return firstToken;
|
---|
997 | }
|
---|
998 | case 260: break;
|
---|
999 | default:
|
---|
1000 | return null;
|
---|
1001 | }
|
---|
1002 | }
|
---|
1003 | else {
|
---|
1004 | zzScanError(ZZ_NO_MATCH);
|
---|
1005 | }
|
---|
1006 | }
|
---|
1007 | }
|
---|
1008 | }
|
---|
1009 |
|
---|
1010 |
|
---|
1011 | }
|
---|