update copyright
[fedora-idea.git] / xml / impl / src / com / intellij / lexer / _HtmlLexer.java
bloba614d25daf697e8c0b0cd077e6276f33c680d3f3
1 /*
2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 /* The following code was generated by JFlex 1.4.1 on 01.06.09 13:59 */
19 /* It's an automatically generated code. Do not modify it. */
20 package com.intellij.lexer;
22 import com.intellij.psi.tree.IElementType;
23 import com.intellij.psi.xml.XmlTokenType;
26 /**
27 * This class is a scanner generated by
28 * <a href="http://www.jflex.de/">JFlex</a> 1.4.1
29 * on 01.06.09 13:59 from the specification file
30 * <tt>C:/Trunk/tools/lexer/_HtmlLexer.flex</tt>
32 public class _HtmlLexer implements FlexLexer {
33 /** initial size of the lookahead buffer */
34 private static final int ZZ_BUFFERSIZE = 16384;
36 /** lexical states */
37 public static final int PROCESSING_INSTRUCTION = 9;
38 public static final int C_COMMENT_END = 14;
39 public static final int END_TAG_NAME = 4;
40 public static final int START_TAG_NAME = 3;
41 public static final int ATTRIBUTE_VALUE_SQ = 8;
42 public static final int DOC_TYPE = 1;
43 public static final int ATTRIBUTE_VALUE_DQ = 7;
44 public static final int YYINITIAL = 0;
45 public static final int TAG_CHARACTERS = 12;
46 public static final int START_TAG_NAME2 = 10;
47 public static final int TAG_ATTRIBUTES = 5;
48 public static final int COMMENT = 2;
49 public static final int ATTRIBUTE_VALUE_START = 6;
50 public static final int C_COMMENT_START = 13;
51 public static final int END_TAG_NAME2 = 11;
53 /**
54 * Translates characters to character classes
56 private static final String ZZ_CMAP_PACKED =
57 "\11\0\2\3\1\0\2\3\22\0\1\3\1\13\1\10\1\7\1\40"+
58 "\1\0\1\45\1\11\1\44\1\44\3\0\1\6\1\5\1\47\12\2"+
59 "\1\4\1\54\1\12\1\53\1\43\1\46\1\0\1\63\1\35\1\17"+
60 "\1\14\1\25\1\63\1\1\1\26\1\37\2\1\1\31\1\27\1\1"+
61 "\1\15\1\23\3\1\1\20\1\33\3\1\1\22\1\1\1\50\1\52"+
62 "\1\51\1\0\1\4\1\0\1\56\1\36\1\17\1\14\1\25\1\63"+
63 "\1\55\1\26\1\37\2\1\1\32\1\30\1\61\1\16\1\24\1\60"+
64 "\1\1\1\57\1\21\1\34\2\1\1\62\1\22\1\1\1\41\1\44"+
65 "\1\42\54\0\1\1\12\0\1\1\4\0\1\1\5\0\27\1\1\0"+
66 "\37\1\1\0\u013f\1\31\0\162\1\4\0\14\1\16\0\5\1\11\0"+
67 "\1\1\213\0\1\1\13\0\1\1\1\0\3\1\1\0\1\1\1\0"+
68 "\24\1\1\0\54\1\1\0\46\1\1\0\5\1\4\0\202\1\10\0"+
69 "\105\1\1\0\46\1\2\0\2\1\6\0\20\1\41\0\46\1\2\0"+
70 "\1\1\7\0\47\1\110\0\33\1\5\0\3\1\56\0\32\1\5\0"+
71 "\13\1\43\0\2\1\1\0\143\1\1\0\1\1\17\0\2\1\7\0"+
72 "\2\1\12\0\3\1\2\0\1\1\20\0\1\1\1\0\36\1\35\0"+
73 "\3\1\60\0\46\1\13\0\1\1\u0152\0\66\1\3\0\1\1\22\0"+
74 "\1\1\7\0\12\1\43\0\10\1\2\0\2\1\2\0\26\1\1\0"+
75 "\7\1\1\0\1\1\3\0\4\1\3\0\1\1\36\0\2\1\1\0"+
76 "\3\1\16\0\2\1\23\0\6\1\4\0\2\1\2\0\26\1\1\0"+
77 "\7\1\1\0\2\1\1\0\2\1\1\0\2\1\37\0\4\1\1\0"+
78 "\1\1\23\0\3\1\20\0\11\1\1\0\3\1\1\0\26\1\1\0"+
79 "\7\1\1\0\2\1\1\0\5\1\3\0\1\1\22\0\1\1\17\0"+
80 "\2\1\43\0\10\1\2\0\2\1\2\0\26\1\1\0\7\1\1\0"+
81 "\2\1\1\0\5\1\3\0\1\1\36\0\2\1\1\0\3\1\17\0"+
82 "\1\1\21\0\1\1\1\0\6\1\3\0\3\1\1\0\4\1\3\0"+
83 "\2\1\1\0\1\1\1\0\2\1\3\0\2\1\3\0\3\1\3\0"+
84 "\10\1\1\0\3\1\113\0\10\1\1\0\3\1\1\0\27\1\1\0"+
85 "\12\1\1\0\5\1\46\0\2\1\43\0\10\1\1\0\3\1\1\0"+
86 "\27\1\1\0\12\1\1\0\5\1\3\0\1\1\40\0\1\1\1\0"+
87 "\2\1\43\0\10\1\1\0\3\1\1\0\27\1\1\0\20\1\46\0"+
88 "\2\1\43\0\22\1\3\0\30\1\1\0\11\1\1\0\1\1\2\0"+
89 "\7\1\72\0\60\1\1\0\2\1\14\0\7\1\72\0\2\1\1\0"+
90 "\1\1\2\0\2\1\1\0\1\1\2\0\1\1\6\0\4\1\1\0"+
91 "\7\1\1\0\3\1\1\0\1\1\1\0\1\1\2\0\2\1\1\0"+
92 "\4\1\1\0\2\1\11\0\1\1\2\0\5\1\1\0\1\1\25\0"+
93 "\2\1\42\0\1\1\77\0\10\1\1\0\42\1\35\0\4\1\164\0"+
94 "\42\1\1\0\5\1\1\0\2\1\45\0\6\1\112\0\46\1\12\0"+
95 "\51\1\7\0\132\1\5\0\104\1\5\0\122\1\6\0\7\1\1\0"+
96 "\77\1\1\0\1\1\1\0\4\1\2\0\7\1\1\0\1\1\1\0"+
97 "\4\1\2\0\47\1\1\0\1\1\1\0\4\1\2\0\37\1\1\0"+
98 "\1\1\1\0\4\1\2\0\7\1\1\0\1\1\1\0\4\1\2\0"+
99 "\7\1\1\0\7\1\1\0\27\1\1\0\37\1\1\0\1\1\1\0"+
100 "\4\1\2\0\7\1\1\0\47\1\1\0\23\1\105\0\125\1\14\0"+
101 "\u026c\1\2\0\10\1\12\0\32\1\5\0\113\1\25\0\15\1\1\0"+
102 "\4\1\16\0\22\1\16\0\22\1\16\0\15\1\1\0\3\1\17\0"+
103 "\64\1\43\0\1\1\4\0\1\1\103\0\130\1\10\0\51\1\127\0"+
104 "\35\1\63\0\36\1\2\0\5\1\u038b\0\154\1\224\0\234\1\4\0"+
105 "\132\1\6\0\26\1\2\0\6\1\2\0\46\1\2\0\6\1\2\0"+
106 "\10\1\1\0\1\1\1\0\1\1\1\0\1\1\1\0\37\1\2\0"+
107 "\65\1\1\0\7\1\1\0\1\1\3\0\3\1\1\0\7\1\3\0"+
108 "\4\1\2\0\6\1\4\0\15\1\5\0\3\1\1\0\7\1\164\0"+
109 "\1\1\15\0\1\1\202\0\1\1\4\0\1\1\2\0\12\1\1\0"+
110 "\1\1\3\0\5\1\6\0\1\1\1\0\1\1\1\0\1\1\1\0"+
111 "\4\1\1\0\3\1\1\0\7\1\3\0\3\1\5\0\5\1\u0ebb\0"+
112 "\2\1\52\0\5\1\5\0\2\1\4\0\126\1\6\0\3\1\1\0"+
113 "\132\1\1\0\4\1\5\0\50\1\4\0\136\1\21\0\30\1\70\0"+
114 "\20\1\u0200\0\u19b6\1\112\0\u51a6\1\132\0\u048d\1\u0773\0\u2ba4\1\u215c\0"+
115 "\u012e\1\2\0\73\1\225\0\7\1\14\0\5\1\5\0\1\1\1\0"+
116 "\12\1\1\0\15\1\1\0\5\1\1\0\1\1\1\0\2\1\1\0"+
117 "\2\1\1\0\154\1\41\0\u016b\1\22\0\100\1\2\0\66\1\50\0"+
118 "\14\1\164\0\5\1\1\0\207\1\44\0\32\1\6\0\32\1\13\0"+
119 "\131\1\3\0\6\1\2\0\6\1\2\0\6\1\2\0\3\1\43\0";
121 /**
122 * Translates characters to character classes
124 private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
126 /**
127 * Translates DFA states to action switch labels.
129 private static final int [] ZZ_ACTION = zzUnpackAction();
131 private static final String ZZ_ACTION_PACKED_0 =
132 "\1\1\5\0\1\2\2\0\1\3\5\0\1\1\1\4"+
133 "\5\1\1\5\1\6\4\5\1\7\1\5\4\10\1\11"+
134 "\1\12\1\13\1\14\2\12\1\15\1\16\1\12\1\17"+
135 "\1\2\1\20\1\21\2\2\1\22\1\23\4\22\1\3"+
136 "\1\24\1\5\1\25\3\26\1\27\1\10\3\27\1\30"+
137 "\1\31\1\32\1\0\1\33\1\34\15\0\1\34\1\35"+
138 "\2\2\3\0\1\36\2\0\1\37\1\40\1\41\1\42"+
139 "\11\0\1\43\1\44\1\0\1\45\1\2\1\45\1\46"+
140 "\1\0\1\47\3\0\1\15\3\0\1\50\2\0\1\51";
142 private static int [] zzUnpackAction() {
143 int [] result = new int[129];
144 int offset = 0;
145 offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
146 return result;
149 private static int zzUnpackAction(String packed, int offset, int [] result) {
150 int i = 0; /* index in packed string */
151 int j = offset; /* index in unpacked array */
152 int l = packed.length();
153 while (i < l) {
154 int count = packed.charAt(i++);
155 int value = packed.charAt(i++);
156 do result[j++] = value; while (--count > 0);
158 return j;
162 /**
163 * Translates a state to a row index in the transition table
165 private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
167 private static final String ZZ_ROWMAP_PACKED_0 =
168 "\0\0\0\64\0\150\0\234\0\320\0\u0104\0\u0138\0\u016c"+
169 "\0\u01a0\0\u01d4\0\u0208\0\u023c\0\u0270\0\u02a4\0\u02d8\0\u030c"+
170 "\0\u0340\0\u0374\0\u03a8\0\u03dc\0\u0410\0\u0444\0\u0374\0\u0478"+
171 "\0\u04ac\0\u04e0\0\u0514\0\u0548\0\u0374\0\u0410\0\u0374\0\u057c"+
172 "\0\u05b0\0\u0410\0\u0374\0\u0374\0\u05e4\0\u0374\0\u0410\0\u0618"+
173 "\0\u064c\0\u0374\0\u0680\0\u0374\0\u06b4\0\u0374\0\u0374\0\u06e8"+
174 "\0\u071c\0\u0374\0\u0374\0\u0750\0\u0410\0\u0784\0\u07b8\0\u07ec"+
175 "\0\u0374\0\u0820\0\u0854\0\u0374\0\u0410\0\u0680\0\u0374\0\u0888"+
176 "\0\u057c\0\u0410\0\u08bc\0\u0374\0\u08f0\0\u0924\0\u0958\0\u0374"+
177 "\0\u098c\0\u09c0\0\u09f4\0\u0a28\0\u0a5c\0\u0a90\0\u0ac4\0\u0af8"+
178 "\0\u04ac\0\u04e0\0\u0b2c\0\u0b60\0\u0b94\0\u0bc8\0\u0374\0\u0374"+
179 "\0\u0bfc\0\u0c30\0\u0c64\0\u0c98\0\u0ccc\0\u0374\0\u0d00\0\u0d34"+
180 "\0\u0d68\0\u0d9c\0\u0374\0\u0374\0\u0dd0\0\u0e04\0\u0e38\0\u0e6c"+
181 "\0\u0ea0\0\u0ed4\0\u0f08\0\u0f3c\0\u0f70\0\u0374\0\u0374\0\u0fa4"+
182 "\0\u06b4\0\u0fd8\0\u0374\0\u0374\0\u100c\0\u0374\0\u1040\0\u1074"+
183 "\0\u10a8\0\u0374\0\u10dc\0\u1110\0\u1144\0\u0374\0\u1178\0\u11ac"+
184 "\0\u0374";
186 private static int [] zzUnpackRowMap() {
187 int [] result = new int[129];
188 int offset = 0;
189 offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
190 return result;
193 private static int zzUnpackRowMap(String packed, int offset, int [] result) {
194 int i = 0; /* index in packed string */
195 int j = offset; /* index in unpacked array */
196 int l = packed.length();
197 while (i < l) {
198 int high = packed.charAt(i++) << 16;
199 result[j++] = high | packed.charAt(i++);
201 return j;
204 /**
205 * The transition table of the DFA
207 private static final int [] ZZ_TRANS = zzUnpackTrans();
209 private static final String ZZ_TRANS_PACKED_0 =
210 "\3\20\1\21\3\20\1\22\2\20\1\23\25\20\1\24"+
211 "\4\20\1\25\4\20\1\26\11\20\3\27\1\30\4\27"+
212 "\1\31\1\32\11\27\2\33\1\27\1\34\14\27\1\35"+
213 "\1\27\1\36\16\27\6\37\1\40\3\37\1\41\32\37"+
214 "\1\42\2\37\1\43\13\37\1\44\1\45\1\44\1\30"+
215 "\1\45\5\44\1\46\1\44\24\45\5\44\1\47\7\44"+
216 "\7\45\1\44\1\45\1\44\1\30\1\45\5\44\1\50"+
217 "\1\44\24\45\5\44\1\47\7\44\7\45\1\44\1\51"+
218 "\1\44\1\30\1\51\7\44\24\51\3\44\1\52\1\44"+
219 "\1\47\1\44\1\53\3\44\1\54\1\44\7\51\3\55"+
220 "\1\30\4\55\1\56\1\57\26\55\1\60\2\55\1\52"+
221 "\3\55\1\61\14\55\10\62\1\63\27\62\1\64\4\62"+
222 "\1\65\4\62\1\66\22\62\1\63\26\62\1\67\4\62"+
223 "\1\65\4\62\1\66\11\62\43\70\1\71\2\70\1\72"+
224 "\15\70\7\27\1\73\2\27\1\46\32\27\1\36\16\27"+
225 "\3\44\1\30\3\44\1\51\2\44\1\50\30\44\1\52"+
226 "\1\44\1\47\16\44\3\74\1\30\6\74\1\46\30\74"+
227 "\1\52\1\74\1\75\1\74\1\76\14\74\1\77\1\100"+
228 "\4\77\1\101\5\77\24\100\5\77\1\102\3\77\1\103"+
229 "\3\77\7\100\1\77\1\100\4\77\1\101\5\77\24\100"+
230 "\5\77\1\102\3\77\1\104\3\77\7\100\3\20\1\0"+
231 "\3\20\1\0\2\20\1\0\25\20\1\0\4\20\1\0"+
232 "\4\20\1\26\11\20\3\0\1\21\145\0\1\105\2\0"+
233 "\1\105\2\0\1\106\3\0\1\107\24\105\6\0\1\110"+
234 "\1\111\5\0\7\105\41\0\1\112\23\0\1\113\2\0"+
235 "\1\113\2\0\1\114\4\0\16\113\1\115\5\113\15\0"+
236 "\1\115\1\116\1\113\1\117\1\120\2\113\3\20\1\0"+
237 "\6\20\1\0\32\20\1\0\4\20\1\26\11\20\3\0"+
238 "\1\30\60\0\10\121\1\62\53\121\11\122\1\62\52\122"+
239 "\33\0\2\123\47\0\2\124\50\0\1\125\70\0\1\126"+
240 "\51\0\2\45\1\0\3\45\5\0\24\45\15\0\7\45"+
241 "\47\0\1\127\15\0\2\51\1\0\3\51\5\0\24\51"+
242 "\15\0\7\51\43\0\1\130\20\0\3\55\1\0\4\55"+
243 "\2\0\31\55\1\0\3\55\1\131\17\55\1\0\4\55"+
244 "\2\0\27\55\1\132\1\55\1\0\3\55\1\131\57\55"+
245 "\1\130\3\55\1\131\14\55\41\0\1\133\62\0\1\62"+
246 "\64\0\1\134\22\0\43\70\1\0\2\70\1\135\60\70"+
247 "\1\71\20\70\1\0\2\73\1\0\3\73\5\0\24\73"+
248 "\15\0\7\73\1\0\3\100\1\0\1\100\5\0\25\100"+
249 "\4\0\2\100\7\0\7\100\43\0\1\136\21\0\2\105"+
250 "\1\0\3\105\5\0\24\105\15\0\7\105\1\0\2\106"+
251 "\1\0\3\106\5\0\24\106\15\0\7\106\6\0\1\137"+
252 "\5\0\1\140\50\0\1\141\2\0\1\141\2\0\1\142"+
253 "\4\0\24\141\15\0\7\141\42\112\1\143\21\112\1\0"+
254 "\2\113\1\0\3\113\5\0\24\113\14\0\1\144\7\113"+
255 "\2\0\1\145\57\0\1\146\2\0\2\113\1\0\3\113"+
256 "\5\0\5\113\1\147\16\113\14\0\1\144\7\113\1\0"+
257 "\2\113\1\0\3\113\5\0\10\113\1\150\3\113\1\151"+
258 "\7\113\14\0\1\144\7\113\1\0\2\113\1\0\3\113"+
259 "\5\0\20\113\1\152\3\113\14\0\1\144\7\113\1\0"+
260 "\2\113\1\0\3\113\5\0\22\113\1\153\1\113\14\0"+
261 "\1\144\7\113\35\0\2\154\54\0\2\155\36\0\1\125"+
262 "\37\0\1\156\70\0\1\157\13\0\43\55\1\0\3\55"+
263 "\1\131\14\55\3\132\1\160\4\132\2\160\30\132\1\161"+
264 "\1\160\3\132\1\162\14\132\10\133\1\0\31\133\1\163"+
265 "\21\133\11\134\1\0\30\134\1\163\21\134\43\70\1\0"+
266 "\20\70\6\0\1\164\72\0\2\165\46\0\2\141\1\0"+
267 "\3\141\5\0\24\141\15\0\7\141\1\0\2\142\1\0"+
268 "\3\142\5\0\24\142\15\0\7\142\2\0\1\145\51\0"+
269 "\1\166\11\0\1\167\11\0\1\167\2\0\1\167\5\0"+
270 "\1\167\7\0\2\167\17\0\1\167\4\0\1\167\1\0"+
271 "\2\113\1\0\3\113\5\0\24\113\14\0\1\166\7\113"+
272 "\1\0\2\113\1\0\3\113\5\0\2\113\1\170\21\113"+
273 "\14\0\1\144\7\113\1\0\2\113\1\0\3\113\5\0"+
274 "\10\113\1\147\13\113\14\0\1\144\7\113\1\0\2\113"+
275 "\1\0\3\113\5\0\2\113\1\115\21\113\14\0\1\144"+
276 "\7\113\1\0\2\113\1\0\3\113\5\0\24\113\14\0"+
277 "\1\144\2\113\1\151\4\113\31\0\2\171\62\0\2\172"+
278 "\31\0\42\160\1\163\21\160\42\132\1\161\1\160\3\132"+
279 "\1\162\14\132\17\0\1\173\46\0\1\167\11\0\1\167"+
280 "\2\0\1\167\5\0\1\167\7\0\2\167\15\0\1\166"+
281 "\1\0\1\167\4\0\1\167\1\0\2\113\1\0\3\113"+
282 "\5\0\24\113\14\0\1\144\2\113\1\147\4\113\37\0"+
283 "\1\174\44\0\2\175\61\0\1\176\66\0\1\177\64\0"+
284 "\2\200\64\0\1\201\36\0";
286 private static int [] zzUnpackTrans() {
287 int [] result = new int[4576];
288 int offset = 0;
289 offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
290 return result;
293 private static int zzUnpackTrans(String packed, int offset, int [] result) {
294 int i = 0; /* index in packed string */
295 int j = offset; /* index in unpacked array */
296 int l = packed.length();
297 while (i < l) {
298 int count = packed.charAt(i++);
299 int value = packed.charAt(i++);
300 value--;
301 do result[j++] = value; while (--count > 0);
303 return j;
307 /* error codes */
308 private static final int ZZ_UNKNOWN_ERROR = 0;
309 private static final int ZZ_NO_MATCH = 1;
310 private static final int ZZ_PUSHBACK_2BIG = 2;
311 private static final char[] EMPTY_BUFFER = new char[0];
312 private static final int YYEOF = -1;
313 private static java.io.Reader zzReader = null; // Fake
315 /* error messages for the codes above */
316 private static final String ZZ_ERROR_MSG[] = {
317 "Unkown internal scanner error",
318 "Error: could not match input",
319 "Error: pushback value was too large"
323 * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
325 private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
327 private static final String ZZ_ATTRIBUTE_PACKED_0 =
328 "\1\1\5\0\1\1\2\0\1\1\5\0\2\1\1\11"+
329 "\4\1\1\11\5\1\1\11\1\1\1\11\3\1\2\11"+
330 "\1\1\1\11\3\1\1\11\1\1\1\11\1\1\2\11"+
331 "\2\1\2\11\5\1\1\11\2\1\1\11\2\1\1\11"+
332 "\4\1\1\11\2\1\1\0\1\11\1\1\15\0\2\11"+
333 "\2\1\3\0\1\11\2\0\2\1\2\11\11\0\2\11"+
334 "\1\0\2\1\2\11\1\0\1\11\3\0\1\11\3\0"+
335 "\1\11\2\0\1\11";
337 private static int [] zzUnpackAttribute() {
338 int [] result = new int[129];
339 int offset = 0;
340 offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
341 return result;
344 private static int zzUnpackAttribute(String packed, int offset, int [] result) {
345 int i = 0; /* index in packed string */
346 int j = offset; /* index in unpacked array */
347 int l = packed.length();
348 while (i < l) {
349 int count = packed.charAt(i++);
350 int value = packed.charAt(i++);
351 do result[j++] = value; while (--count > 0);
353 return j;
356 /** the current state of the DFA */
357 private int zzState;
359 /** the current lexical state */
360 private int zzLexicalState = YYINITIAL;
362 /** this buffer contains the current text to be matched and is
363 the source of the yytext() string */
364 private CharSequence zzBuffer = "";
366 /** this buffer may contains the current text array to be matched when it is cheap to acquire it */
367 private char[] zzBufferArray;
369 /** the textposition at the last accepting state */
370 private int zzMarkedPos;
372 /** the textposition at the last state to be included in yytext */
373 private int zzPushbackPos;
375 /** the current text position in the buffer */
376 private int zzCurrentPos;
378 /** startRead marks the beginning of the yytext() string in the buffer */
379 private int zzStartRead;
381 /** endRead marks the last character in the buffer, that has been read
382 from input */
383 private int zzEndRead;
386 * zzAtBOL == true <=> the scanner is currently at the beginning of a line
388 private boolean zzAtBOL = true;
390 /** zzAtEOF == true <=> the scanner is at the EOF */
391 private boolean zzAtEOF;
393 /** denotes if the user-EOF-code has already been executed */
394 private boolean zzEOFDone;
396 /* user code: */
397 private IElementType elTokenType = XmlTokenType.XML_DATA_CHARACTERS;
398 private IElementType elTokenType2 = XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN;
400 public void setElTypes(IElementType _elTokenType,IElementType _elTokenType2) {
401 elTokenType = _elTokenType;
402 elTokenType2 = _elTokenType2;
405 public _HtmlLexer() {
406 this((java.io.Reader)null);
410 public _HtmlLexer(java.io.Reader in) {
411 this.zzReader = in;
415 * Creates a new scanner.
416 * There is also java.io.Reader version of this constructor.
418 * @param in the java.io.Inputstream to read input from.
420 public _HtmlLexer(java.io.InputStream in) {
421 this(new java.io.InputStreamReader(in));
424 /**
425 * Unpacks the compressed character translation table.
427 * @param packed the packed character translation table
428 * @return the unpacked character translation table
430 private static char [] zzUnpackCMap(String packed) {
431 char [] map = new char[0x10000];
432 int i = 0; /* index in packed string */
433 int j = 0; /* index in unpacked array */
434 while (i < 1260) {
435 int count = packed.charAt(i++);
436 char value = packed.charAt(i++);
437 do map[j++] = value; while (--count > 0);
439 return map;
442 public final int getTokenStart(){
443 return zzStartRead;
446 public final int getTokenEnd(){
447 return getTokenStart() + yylength();
450 public void reset(CharSequence buffer, int start, int end,int initialState){
451 zzBuffer = buffer;
452 zzBufferArray = com.intellij.util.text.CharArrayUtil.fromSequenceWithoutCopying(buffer);
453 zzCurrentPos = zzMarkedPos = zzStartRead = start;
454 zzPushbackPos = 0;
455 zzAtEOF = false;
456 zzAtBOL = true;
457 zzEndRead = end;
458 yybegin(initialState);
461 // For Demetra compatibility
462 public void reset(CharSequence buffer, int initialState){
463 zzBuffer = buffer;
464 zzBufferArray = null;
465 zzCurrentPos = zzMarkedPos = zzStartRead = 0;
466 zzPushbackPos = 0;
467 zzAtEOF = false;
468 zzAtBOL = true;
469 zzEndRead = buffer.length();
470 yybegin(initialState);
474 * Refills the input buffer.
476 * @return <code>false</code>, iff there was new input.
478 * @exception java.io.IOException if any I/O-Error occurs
480 private boolean zzRefill() throws java.io.IOException {
481 return true;
486 * Returns the current lexical state.
488 public final int yystate() {
489 return zzLexicalState;
494 * Enters a new lexical state
496 * @param newState the new lexical state
498 public final void yybegin(int newState) {
499 zzLexicalState = newState;
504 * Returns the text matched by the current regular expression.
506 public final CharSequence yytext() {
507 return zzBuffer.subSequence(zzStartRead, zzMarkedPos);
512 * Returns the character at position <tt>pos</tt> from the
513 * matched text.
515 * It is equivalent to yytext().charAt(pos), but faster
517 * @param pos the position of the character to fetch.
518 * A value from 0 to yylength()-1.
520 * @return the character at position pos
522 public final char yycharat(int pos) {
523 return zzBufferArray != null ? zzBufferArray[zzStartRead+pos]:zzBuffer.charAt(zzStartRead+pos);
528 * Returns the length of the matched text region.
530 public final int yylength() {
531 return zzMarkedPos-zzStartRead;
536 * Reports an error that occured while scanning.
538 * In a wellformed scanner (no or only correct usage of
539 * yypushback(int) and a match-all fallback rule) this method
540 * will only be called with things that "Can't Possibly Happen".
541 * If this method is called, something is seriously wrong
542 * (e.g. a JFlex bug producing a faulty scanner etc.).
544 * Usual syntax/scanner level error handling should be done
545 * in error fallback rules.
547 * @param errorCode the code of the errormessage to display
549 private void zzScanError(int errorCode) {
550 String message;
551 try {
552 message = ZZ_ERROR_MSG[errorCode];
554 catch (ArrayIndexOutOfBoundsException e) {
555 message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
558 throw new Error(message);
563 * Pushes the specified amount of characters back into the input stream.
565 * They will be read again by then next call of the scanning method
567 * @param number the number of characters to be read again.
568 * This number must not be greater than yylength()!
570 public void yypushback(int number) {
571 if ( number > yylength() )
572 zzScanError(ZZ_PUSHBACK_2BIG);
574 zzMarkedPos -= number;
579 * Contains user EOF-code, which will be executed exactly once,
580 * when the end of file is reached
582 private void zzDoEOF() {
583 if (!zzEOFDone) {
584 zzEOFDone = true;
591 * Resumes scanning until the next regular expression is matched,
592 * the end of input is encountered or an I/O-Error occurs.
594 * @return the next token
595 * @exception java.io.IOException if any I/O-Error occurs
597 public IElementType advance() throws java.io.IOException {
598 int zzInput;
599 int zzAction;
601 // cached fields:
602 int zzCurrentPosL;
603 int zzMarkedPosL;
604 int zzEndReadL = zzEndRead;
605 CharSequence zzBufferL = zzBuffer;
606 char[] zzBufferArrayL = zzBufferArray;
607 char [] zzCMapL = ZZ_CMAP;
609 int [] zzTransL = ZZ_TRANS;
610 int [] zzRowMapL = ZZ_ROWMAP;
611 int [] zzAttrL = ZZ_ATTRIBUTE;
613 while (true) {
614 zzMarkedPosL = zzMarkedPos;
616 zzAction = -1;
618 zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
620 zzState = zzLexicalState;
623 zzForAction: {
624 while (true) {
626 if (zzCurrentPosL < zzEndReadL)
627 zzInput = zzBufferArrayL != null ? zzBufferArrayL[zzCurrentPosL++]:zzBufferL.charAt(zzCurrentPosL++);
628 else if (zzAtEOF) {
629 zzInput = YYEOF;
630 break zzForAction;
632 else {
633 // store back cached positions
634 zzCurrentPos = zzCurrentPosL;
635 zzMarkedPos = zzMarkedPosL;
636 boolean eof = zzRefill();
637 // get translated positions and possibly new buffer
638 zzCurrentPosL = zzCurrentPos;
639 zzMarkedPosL = zzMarkedPos;
640 zzBufferL = zzBuffer;
641 zzEndReadL = zzEndRead;
642 if (eof) {
643 zzInput = YYEOF;
644 break zzForAction;
646 else {
647 zzInput = zzBufferArrayL != null ? zzBufferArrayL[zzCurrentPosL++]:zzBufferL.charAt(zzCurrentPosL++);
650 int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
651 if (zzNext == -1) break zzForAction;
652 zzState = zzNext;
654 int zzAttributes = zzAttrL[zzState];
655 if ( (zzAttributes & 1) == 1 ) {
656 zzAction = zzState;
657 zzMarkedPosL = zzCurrentPosL;
658 if ( (zzAttributes & 8) == 8 ) break zzForAction;
664 // store back cached position
665 zzMarkedPos = zzMarkedPosL;
667 switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
668 case 18:
669 { return XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN;
671 case 42: break;
672 case 25:
673 { yybegin(START_TAG_NAME); yypushback(yylength());
675 case 43: break;
676 case 22:
677 { return XmlTokenType.XML_TAG_CHARACTERS;
679 case 44: break;
680 case 15:
681 { yybegin(ATTRIBUTE_VALUE_START); return XmlTokenType.XML_EQ;
683 case 45: break;
684 case 33:
685 { return elTokenType;
687 case 46: break;
688 case 13:
689 { return XmlTokenType.XML_NAME;
691 case 47: break;
692 case 19:
693 { yybegin(TAG_ATTRIBUTES); return XmlTokenType.XML_ATTRIBUTE_VALUE_END_DELIMITER;
695 case 48: break;
696 case 10:
697 { yybegin(YYINITIAL); yypushback(1); break;
699 case 49: break;
700 case 40:
701 { return XmlTokenType.XML_DOCTYPE_PUBLIC;
703 case 50: break;
704 case 38:
705 { yybegin(COMMENT); return XmlTokenType.XML_COMMENT_START;
707 case 51: break;
708 case 4:
709 { return XmlTokenType.XML_REAL_WHITE_SPACE;
711 case 52: break;
712 case 31:
713 { yybegin(END_TAG_NAME); yypushback(yylength());
715 case 53: break;
716 case 1:
717 { return XmlTokenType.XML_DATA_CHARACTERS;
719 case 54: break;
720 case 24:
721 { yybegin(COMMENT); return XmlTokenType.XML_CONDITIONAL_COMMENT_END;
723 case 55: break;
724 case 32:
725 { yybegin(END_TAG_NAME2); yypushback(yylength());
727 case 56: break;
728 case 5:
729 { return XmlTokenType.XML_BAD_CHARACTER;
731 case 57: break;
732 case 14:
733 { yybegin(YYINITIAL); return XmlTokenType.XML_TAG_END;
735 case 58: break;
736 case 30:
737 { yybegin(COMMENT); return XmlTokenType.XML_CONDITIONAL_COMMENT_START_END;
739 case 59: break;
740 case 28:
741 { return XmlTokenType.XML_END_TAG_START;
743 case 60: break;
744 case 35:
745 { yybegin(YYINITIAL); return XmlTokenType.XML_COMMENT_END;
747 case 61: break;
748 case 41:
749 { yybegin(DOC_TYPE); return XmlTokenType.XML_DOCTYPE_START;
751 case 62: break;
752 case 3:
753 { return XmlTokenType.XML_PI_TARGET;
755 case 63: break;
756 case 29:
757 { yybegin(YYINITIAL); return XmlTokenType.XML_EMPTY_ELEMENT_END;
759 case 64: break;
760 case 36:
761 { yybegin(C_COMMENT_END); return XmlTokenType.XML_CONDITIONAL_COMMENT_END_START;
763 case 65: break;
764 case 27:
765 { yybegin(PROCESSING_INSTRUCTION); return XmlTokenType.XML_PI_START;
767 case 66: break;
768 case 9:
769 { yybegin(C_COMMENT_START); return XmlTokenType.XML_CONDITIONAL_COMMENT_START;
771 case 67: break;
772 case 21:
773 { yybegin(TAG_CHARACTERS); return XmlTokenType.XML_NAME;
775 case 68: break;
776 case 7:
777 { yybegin(YYINITIAL); return XmlTokenType.XML_DOCTYPE_END;
779 case 69: break;
780 case 39:
781 { return XmlTokenType.XML_CHAR_ENTITY_REF;
783 case 70: break;
784 case 12:
785 { return XmlTokenType.XML_START_TAG_START;
787 case 71: break;
788 case 6:
789 { return XmlTokenType.XML_WHITE_SPACE;
791 case 72: break;
792 case 34:
793 { return XmlTokenType.XML_ENTITY_REF_TOKEN;
795 case 73: break;
796 case 23:
797 { yybegin(COMMENT); return XmlTokenType.XML_COMMENT_CHARACTERS;
799 case 74: break;
800 case 37:
801 { return elTokenType2;
803 case 75: break;
804 case 20:
805 { yybegin(YYINITIAL); return XmlTokenType.XML_PI_END;
807 case 76: break;
808 case 16:
809 { yybegin(ATTRIBUTE_VALUE_DQ); return XmlTokenType.XML_ATTRIBUTE_VALUE_START_DELIMITER;
811 case 77: break;
812 case 17:
813 { yybegin(ATTRIBUTE_VALUE_SQ); return XmlTokenType.XML_ATTRIBUTE_VALUE_START_DELIMITER;
815 case 78: break;
816 case 11:
817 { yybegin(TAG_ATTRIBUTES); return XmlTokenType.XML_NAME;
819 case 79: break;
820 case 26:
821 { yybegin(START_TAG_NAME2); yypushback(yylength());
823 case 80: break;
824 case 2:
825 { yybegin(TAG_ATTRIBUTES); return XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN;
827 case 81: break;
828 case 8:
829 { return XmlTokenType.XML_COMMENT_CHARACTERS;
831 case 82: break;
832 default:
833 if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
834 zzAtEOF = true;
835 zzDoEOF();
836 return null;
838 else {
839 zzScanError(ZZ_NO_MATCH);