initial import
[vuplus_webkit] / Source / WebCore / inspector / front-end / SourceHTMLTokenizer.js
1 /* Generated by re2c 0.13.5 on Fri May  6 13:47:06 2011 */
2 /*
3  * Copyright (C) 2009 Google Inc. All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  *     * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *     * Redistributions in binary form must reproduce the above
12  * copyright notice, this list of conditions and the following disclaimer
13  * in the documentation and/or other materials provided with the
14  * distribution.
15  *     * Neither the name of Google Inc. nor the names of its
16  * contributors may be used to endorse or promote products derived from
17  * this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31
32 // Generate js file as follows:
33 //
34 // re2c -isc WebCore/inspector/front-end/SourceHTMLTokenizer.re2js \
35 // | sed 's|^yy\([^:]*\)*\:|case \1:|' \
36 // | sed 's|[*]cursor[+][+]|this._charAt(cursor++)|' \
37 // | sed 's|[[*][+][+]cursor|this._charAt(++cursor)|' \
38 // | sed 's|[*]cursor|this._charAt(cursor)|' \
39 // | sed 's|yych = \*\([^;]*\)|yych = this._charAt\1|' \
40 // | sed 's|{ gotoCase = \([^; continue; };]*\)|{ gotoCase = \1; continue; }|' \
41 // | sed 's|unsigned\ int|var|' \
42 // | sed 's|var\ yych|case 1: case 1: var yych|'
43
44 WebInspector.SourceHTMLTokenizer = function()
45 {
46     WebInspector.SourceTokenizer.call(this);
47
48     // The order is determined by the generated code.
49     this._lexConditions = {
50         INITIAL: 0,
51         COMMENT: 1,
52         DOCTYPE: 2,
53         TAG: 3,
54         DSTRING: 4,
55         SSTRING: 5
56     };
57     this.case_INITIAL = 1000;
58     this.case_COMMENT = 1001;
59     this.case_DOCTYPE = 1002;
60     this.case_TAG = 1003;
61     this.case_DSTRING = 1004;
62     this.case_SSTRING = 1005;
63
64     this._parseConditions = {
65         INITIAL: 0,
66         ATTRIBUTE: 1,
67         ATTRIBUTE_VALUE: 2,
68         LINKIFY: 4,
69         A_NODE: 8,
70         SCRIPT: 16,
71         STYLE: 32
72     };
73
74     this.condition = this.createInitialCondition();
75 }
76
77 WebInspector.SourceHTMLTokenizer.prototype = {
78     createInitialCondition: function()
79     {
80         return { lexCondition: this._lexConditions.INITIAL, parseCondition: this._parseConditions.INITIAL };
81     },
82
83     set line(line) {
84         if (this._condition.internalJavaScriptTokenizerCondition) {
85             var match = /<\/script/i.exec(line);
86             if (match) {
87                 this._internalJavaScriptTokenizer.line = line.substring(0, match.index);
88             } else
89                 this._internalJavaScriptTokenizer.line = line;
90         } else if (this._condition.internalCSSTokenizerCondition) {
91             var match = /<\/style/i.exec(line);
92             if (match) {
93                 this._internalCSSTokenizer.line = line.substring(0, match.index);
94             } else
95                 this._internalCSSTokenizer.line = line;
96         }
97         this._line = line;
98     },
99
100     _isExpectingAttribute: function()
101     {
102         return this._condition.parseCondition & this._parseConditions.ATTRIBUTE;
103     },
104
105     _isExpectingAttributeValue: function()
106     {
107         return this._condition.parseCondition & this._parseConditions.ATTRIBUTE_VALUE;
108     },
109
110     _setExpectingAttribute: function()
111     {
112         if (this._isExpectingAttributeValue())
113             this._condition.parseCondition ^= this._parseConditions.ATTRIBUTE_VALUE;
114         this._condition.parseCondition |= this._parseConditions.ATTRIBUTE;
115     },
116
117     _setExpectingAttributeValue: function()
118     {
119         if (this._isExpectingAttribute())
120             this._condition.parseCondition ^= this._parseConditions.ATTRIBUTE;
121         this._condition.parseCondition |= this._parseConditions.ATTRIBUTE_VALUE;
122     },
123
124     _stringToken: function(cursor, stringEnds)
125     {
126         if (!this._isExpectingAttributeValue()) {
127             this.tokenType = null;
128             return cursor;
129         }
130         this.tokenType = this._attrValueTokenType();
131         if (stringEnds)
132             this._setExpectingAttribute();
133         return cursor;
134     },
135
136     _attrValueTokenType: function()
137     {
138         if (this._condition.parseCondition & this._parseConditions.LINKIFY) {
139             if (this._condition.parseCondition & this._parseConditions.A_NODE)
140                 return "html-external-link";
141             return "html-resource-link";
142         }
143         return "html-attribute-value";
144     },
145
146     get _internalJavaScriptTokenizer()
147     {
148         return WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer("text/javascript");
149     },
150
151     get _internalCSSTokenizer()
152     {
153         return WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer("text/css");
154     },
155
156     scriptStarted: function(cursor)
157     {
158         this._condition.internalJavaScriptTokenizerCondition = this._internalJavaScriptTokenizer.createInitialCondition();
159     },
160
161     scriptEnded: function(cursor)
162     {
163     },
164
165     styleSheetStarted: function(cursor)
166     {
167         this._condition.internalCSSTokenizerCondition = this._internalCSSTokenizer.createInitialCondition();
168     },
169
170     styleSheetEnded: function(cursor)
171     {
172     },
173
174     nextToken: function(cursor)
175     {
176         if (this._condition.internalJavaScriptTokenizerCondition) {
177             // Re-set line to force </script> detection first.
178             this.line = this._line;
179             if (cursor !== this._internalJavaScriptTokenizer._line.length) {
180                 // Tokenizer is stateless, so restore its condition before tokenizing and save it after.
181                 this._internalJavaScriptTokenizer.condition = this._condition.internalJavaScriptTokenizerCondition;
182                 var result = this._internalJavaScriptTokenizer.nextToken(cursor);
183                 this.tokenType = this._internalJavaScriptTokenizer.tokenType;
184                 this._condition.internalJavaScriptTokenizerCondition = this._internalJavaScriptTokenizer.condition;
185                 return result;
186             } else if (cursor !== this._line.length)
187                 delete this._condition.internalJavaScriptTokenizerCondition;
188         } else if (this._condition.internalCSSTokenizerCondition) {
189             // Re-set line to force </style> detection first.
190             this.line = this._line;
191             if (cursor !== this._internalCSSTokenizer._line.length) {
192                 // Tokenizer is stateless, so restore its condition before tokenizing and save it after.
193                 this._internalCSSTokenizer.condition = this._condition.internalCSSTokenizerCondition;
194                 var result = this._internalCSSTokenizer.nextToken(cursor);
195                 this.tokenType = this._internalCSSTokenizer.tokenType;
196                 this._condition.internalCSSTokenizerCondition = this._internalCSSTokenizer.condition;
197                 return result;
198             } else if (cursor !== this._line.length)
199                 delete this._condition.internalCSSTokenizerCondition;
200         }
201
202         var cursorOnEnter = cursor;
203         var gotoCase = 1;
204         while (1) {
205             switch (gotoCase)
206             // Following comment is replaced with generated state machine.
207
208         {
209             case 1: var yych;
210             var yyaccept = 0;
211             if (this.getLexCondition() < 3) {
212                 if (this.getLexCondition() < 1) {
213                     { gotoCase = this.case_INITIAL; continue; };
214                 } else {
215                     if (this.getLexCondition() < 2) {
216                         { gotoCase = this.case_COMMENT; continue; };
217                     } else {
218                         { gotoCase = this.case_DOCTYPE; continue; };
219                     }
220                 }
221             } else {
222                 if (this.getLexCondition() < 4) {
223                     { gotoCase = this.case_TAG; continue; };
224                 } else {
225                     if (this.getLexCondition() < 5) {
226                         { gotoCase = this.case_DSTRING; continue; };
227                     } else {
228                         { gotoCase = this.case_SSTRING; continue; };
229                     }
230                 }
231             }
232 /* *********************************** */
233 case this.case_COMMENT:
234
235             yych = this._charAt(cursor);
236             if (yych <= '\f') {
237                 if (yych == '\n') { gotoCase = 4; continue; };
238                 { gotoCase = 3; continue; };
239             } else {
240                 if (yych <= '\r') { gotoCase = 4; continue; };
241                 if (yych == '-') { gotoCase = 6; continue; };
242                 { gotoCase = 3; continue; };
243             }
244 case 2:
245             { this.tokenType = "html-comment"; return cursor; }
246 case 3:
247             yyaccept = 0;
248             yych = this._charAt(YYMARKER = ++cursor);
249             { gotoCase = 9; continue; };
250 case 4:
251             ++cursor;
252 case 5:
253             { this.tokenType = null; return cursor; }
254 case 6:
255             yyaccept = 1;
256             yych = this._charAt(YYMARKER = ++cursor);
257             if (yych != '-') { gotoCase = 5; continue; };
258 case 7:
259             ++cursor;
260             yych = this._charAt(cursor);
261             if (yych == '>') { gotoCase = 10; continue; };
262 case 8:
263             yyaccept = 0;
264             YYMARKER = ++cursor;
265             yych = this._charAt(cursor);
266 case 9:
267             if (yych <= '\f') {
268                 if (yych == '\n') { gotoCase = 2; continue; };
269                 { gotoCase = 8; continue; };
270             } else {
271                 if (yych <= '\r') { gotoCase = 2; continue; };
272                 if (yych == '-') { gotoCase = 12; continue; };
273                 { gotoCase = 8; continue; };
274             }
275 case 10:
276             ++cursor;
277             this.setLexCondition(this._lexConditions.INITIAL);
278             { this.tokenType = "html-comment"; return cursor; }
279 case 12:
280             ++cursor;
281             yych = this._charAt(cursor);
282             if (yych == '-') { gotoCase = 7; continue; };
283             cursor = YYMARKER;
284             if (yyaccept <= 0) {
285                 { gotoCase = 2; continue; };
286             } else {
287                 { gotoCase = 5; continue; };
288             }
289 /* *********************************** */
290 case this.case_DOCTYPE:
291             yych = this._charAt(cursor);
292             if (yych <= '\f') {
293                 if (yych == '\n') { gotoCase = 18; continue; };
294                 { gotoCase = 17; continue; };
295             } else {
296                 if (yych <= '\r') { gotoCase = 18; continue; };
297                 if (yych == '>') { gotoCase = 20; continue; };
298                 { gotoCase = 17; continue; };
299             }
300 case 16:
301             { this.tokenType = "html-doctype"; return cursor; }
302 case 17:
303             yych = this._charAt(++cursor);
304             { gotoCase = 23; continue; };
305 case 18:
306             ++cursor;
307             { this.tokenType = null; return cursor; }
308 case 20:
309             ++cursor;
310             this.setLexCondition(this._lexConditions.INITIAL);
311             { this.tokenType = "html-doctype"; return cursor; }
312 case 22:
313             ++cursor;
314             yych = this._charAt(cursor);
315 case 23:
316             if (yych <= '\f') {
317                 if (yych == '\n') { gotoCase = 16; continue; };
318                 { gotoCase = 22; continue; };
319             } else {
320                 if (yych <= '\r') { gotoCase = 16; continue; };
321                 if (yych == '>') { gotoCase = 16; continue; };
322                 { gotoCase = 22; continue; };
323             }
324 /* *********************************** */
325 case this.case_DSTRING:
326             yych = this._charAt(cursor);
327             if (yych <= '\f') {
328                 if (yych == '\n') { gotoCase = 28; continue; };
329                 { gotoCase = 27; continue; };
330             } else {
331                 if (yych <= '\r') { gotoCase = 28; continue; };
332                 if (yych == '"') { gotoCase = 30; continue; };
333                 { gotoCase = 27; continue; };
334             }
335 case 26:
336             { return this._stringToken(cursor); }
337 case 27:
338             yych = this._charAt(++cursor);
339             { gotoCase = 34; continue; };
340 case 28:
341             ++cursor;
342             { this.tokenType = null; return cursor; }
343 case 30:
344             ++cursor;
345 case 31:
346             this.setLexCondition(this._lexConditions.TAG);
347             { return this._stringToken(cursor, true); }
348 case 32:
349             yych = this._charAt(++cursor);
350             { gotoCase = 31; continue; };
351 case 33:
352             ++cursor;
353             yych = this._charAt(cursor);
354 case 34:
355             if (yych <= '\f') {
356                 if (yych == '\n') { gotoCase = 26; continue; };
357                 { gotoCase = 33; continue; };
358             } else {
359                 if (yych <= '\r') { gotoCase = 26; continue; };
360                 if (yych == '"') { gotoCase = 32; continue; };
361                 { gotoCase = 33; continue; };
362             }
363 /* *********************************** */
364 case this.case_INITIAL:
365             yych = this._charAt(cursor);
366             if (yych == '<') { gotoCase = 39; continue; };
367             ++cursor;
368             { this.tokenType = null; return cursor; }
369 case 39:
370             yyaccept = 0;
371             yych = this._charAt(YYMARKER = ++cursor);
372             if (yych <= '/') {
373                 if (yych == '!') { gotoCase = 44; continue; };
374                 if (yych >= '/') { gotoCase = 41; continue; };
375             } else {
376                 if (yych <= 'S') {
377                     if (yych >= 'S') { gotoCase = 42; continue; };
378                 } else {
379                     if (yych == 's') { gotoCase = 42; continue; };
380                 }
381             }
382 case 40:
383             this.setLexCondition(this._lexConditions.TAG);
384             {
385                     if (this._condition.parseCondition & (this._parseConditions.SCRIPT | this._parseConditions.STYLE)) {
386                         // Do not tokenize script and style tag contents, keep lexer state, even though processing "<".
387                         this.setLexCondition(this._lexConditions.INITIAL);
388                         this.tokenType = null;
389                         return cursor;
390                     }
391
392                     this._condition.parseCondition = this._parseConditions.INITIAL;
393                     this.tokenType = "html-tag";
394                     return cursor;
395                 }
396 case 41:
397             yyaccept = 0;
398             yych = this._charAt(YYMARKER = ++cursor);
399             if (yych == 'S') { gotoCase = 73; continue; };
400             if (yych == 's') { gotoCase = 73; continue; };
401             { gotoCase = 40; continue; };
402 case 42:
403             yych = this._charAt(++cursor);
404             if (yych <= 'T') {
405                 if (yych == 'C') { gotoCase = 62; continue; };
406                 if (yych >= 'T') { gotoCase = 63; continue; };
407             } else {
408                 if (yych <= 'c') {
409                     if (yych >= 'c') { gotoCase = 62; continue; };
410                 } else {
411                     if (yych == 't') { gotoCase = 63; continue; };
412                 }
413             }
414 case 43:
415             cursor = YYMARKER;
416             { gotoCase = 40; continue; };
417 case 44:
418             yych = this._charAt(++cursor);
419             if (yych <= 'C') {
420                 if (yych != '-') { gotoCase = 43; continue; };
421             } else {
422                 if (yych <= 'D') { gotoCase = 46; continue; };
423                 if (yych == 'd') { gotoCase = 46; continue; };
424                 { gotoCase = 43; continue; };
425             }
426             yych = this._charAt(++cursor);
427             if (yych == '-') { gotoCase = 54; continue; };
428             { gotoCase = 43; continue; };
429 case 46:
430             yych = this._charAt(++cursor);
431             if (yych == 'O') { gotoCase = 47; continue; };
432             if (yych != 'o') { gotoCase = 43; continue; };
433 case 47:
434             yych = this._charAt(++cursor);
435             if (yych == 'C') { gotoCase = 48; continue; };
436             if (yych != 'c') { gotoCase = 43; continue; };
437 case 48:
438             yych = this._charAt(++cursor);
439             if (yych == 'T') { gotoCase = 49; continue; };
440             if (yych != 't') { gotoCase = 43; continue; };
441 case 49:
442             yych = this._charAt(++cursor);
443             if (yych == 'Y') { gotoCase = 50; continue; };
444             if (yych != 'y') { gotoCase = 43; continue; };
445 case 50:
446             yych = this._charAt(++cursor);
447             if (yych == 'P') { gotoCase = 51; continue; };
448             if (yych != 'p') { gotoCase = 43; continue; };
449 case 51:
450             yych = this._charAt(++cursor);
451             if (yych == 'E') { gotoCase = 52; continue; };
452             if (yych != 'e') { gotoCase = 43; continue; };
453 case 52:
454             ++cursor;
455             this.setLexCondition(this._lexConditions.DOCTYPE);
456             { this.tokenType = "html-doctype"; return cursor; }
457 case 54:
458             ++cursor;
459             yych = this._charAt(cursor);
460             if (yych <= '\f') {
461                 if (yych == '\n') { gotoCase = 57; continue; };
462                 { gotoCase = 54; continue; };
463             } else {
464                 if (yych <= '\r') { gotoCase = 57; continue; };
465                 if (yych != '-') { gotoCase = 54; continue; };
466             }
467             ++cursor;
468             yych = this._charAt(cursor);
469             if (yych == '-') { gotoCase = 59; continue; };
470             { gotoCase = 43; continue; };
471 case 57:
472             ++cursor;
473             this.setLexCondition(this._lexConditions.COMMENT);
474             { this.tokenType = "html-comment"; return cursor; }
475 case 59:
476             ++cursor;
477             yych = this._charAt(cursor);
478             if (yych != '>') { gotoCase = 54; continue; };
479             ++cursor;
480             { this.tokenType = "html-comment"; return cursor; }
481 case 62:
482             yych = this._charAt(++cursor);
483             if (yych == 'R') { gotoCase = 68; continue; };
484             if (yych == 'r') { gotoCase = 68; continue; };
485             { gotoCase = 43; continue; };
486 case 63:
487             yych = this._charAt(++cursor);
488             if (yych == 'Y') { gotoCase = 64; continue; };
489             if (yych != 'y') { gotoCase = 43; continue; };
490 case 64:
491             yych = this._charAt(++cursor);
492             if (yych == 'L') { gotoCase = 65; continue; };
493             if (yych != 'l') { gotoCase = 43; continue; };
494 case 65:
495             yych = this._charAt(++cursor);
496             if (yych == 'E') { gotoCase = 66; continue; };
497             if (yych != 'e') { gotoCase = 43; continue; };
498 case 66:
499             ++cursor;
500             this.setLexCondition(this._lexConditions.TAG);
501             {
502                     if (this._condition.parseCondition & this._parseConditions.STYLE) {
503                         // Do not tokenize style tag contents, keep lexer state, even though processing "<".
504                         this.setLexCondition(this._lexConditions.INITIAL);
505                         this.tokenType = null;
506                         return cursor;
507                     }
508                     this.tokenType = "html-tag";
509                     this._condition.parseCondition = this._parseConditions.STYLE;
510                     this._setExpectingAttribute();
511                     return cursor;
512                 }
513 case 68:
514             yych = this._charAt(++cursor);
515             if (yych == 'I') { gotoCase = 69; continue; };
516             if (yych != 'i') { gotoCase = 43; continue; };
517 case 69:
518             yych = this._charAt(++cursor);
519             if (yych == 'P') { gotoCase = 70; continue; };
520             if (yych != 'p') { gotoCase = 43; continue; };
521 case 70:
522             yych = this._charAt(++cursor);
523             if (yych == 'T') { gotoCase = 71; continue; };
524             if (yych != 't') { gotoCase = 43; continue; };
525 case 71:
526             ++cursor;
527             this.setLexCondition(this._lexConditions.TAG);
528             {
529                     if (this._condition.parseCondition & this._parseConditions.SCRIPT) {
530                         // Do not tokenize script tag contents, keep lexer state, even though processing "<".
531                         this.setLexCondition(this._lexConditions.INITIAL);
532                         this.tokenType = null;
533                         return cursor;
534                     }
535                     this.tokenType = "html-tag";
536                     this._condition.parseCondition = this._parseConditions.SCRIPT;
537                     this._setExpectingAttribute();
538                     return cursor;
539                 }
540 case 73:
541             yych = this._charAt(++cursor);
542             if (yych <= 'T') {
543                 if (yych == 'C') { gotoCase = 75; continue; };
544                 if (yych <= 'S') { gotoCase = 43; continue; };
545             } else {
546                 if (yych <= 'c') {
547                     if (yych <= 'b') { gotoCase = 43; continue; };
548                     { gotoCase = 75; continue; };
549                 } else {
550                     if (yych != 't') { gotoCase = 43; continue; };
551                 }
552             }
553             yych = this._charAt(++cursor);
554             if (yych == 'Y') { gotoCase = 81; continue; };
555             if (yych == 'y') { gotoCase = 81; continue; };
556             { gotoCase = 43; continue; };
557 case 75:
558             yych = this._charAt(++cursor);
559             if (yych == 'R') { gotoCase = 76; continue; };
560             if (yych != 'r') { gotoCase = 43; continue; };
561 case 76:
562             yych = this._charAt(++cursor);
563             if (yych == 'I') { gotoCase = 77; continue; };
564             if (yych != 'i') { gotoCase = 43; continue; };
565 case 77:
566             yych = this._charAt(++cursor);
567             if (yych == 'P') { gotoCase = 78; continue; };
568             if (yych != 'p') { gotoCase = 43; continue; };
569 case 78:
570             yych = this._charAt(++cursor);
571             if (yych == 'T') { gotoCase = 79; continue; };
572             if (yych != 't') { gotoCase = 43; continue; };
573 case 79:
574             ++cursor;
575             this.setLexCondition(this._lexConditions.TAG);
576             {
577                     this.tokenType = "html-tag";
578                     this._condition.parseCondition = this._parseConditions.INITIAL;
579                     this.scriptEnded(cursor - 8);
580                     return cursor;
581                 }
582 case 81:
583             yych = this._charAt(++cursor);
584             if (yych == 'L') { gotoCase = 82; continue; };
585             if (yych != 'l') { gotoCase = 43; continue; };
586 case 82:
587             yych = this._charAt(++cursor);
588             if (yych == 'E') { gotoCase = 83; continue; };
589             if (yych != 'e') { gotoCase = 43; continue; };
590 case 83:
591             ++cursor;
592             this.setLexCondition(this._lexConditions.TAG);
593             {
594                     this.tokenType = "html-tag";
595                     this._condition.parseCondition = this._parseConditions.INITIAL;
596                     this.styleSheetEnded(cursor - 7);
597                     return cursor;
598                 }
599 /* *********************************** */
600 case this.case_SSTRING:
601             yych = this._charAt(cursor);
602             if (yych <= '\f') {
603                 if (yych == '\n') { gotoCase = 89; continue; };
604                 { gotoCase = 88; continue; };
605             } else {
606                 if (yych <= '\r') { gotoCase = 89; continue; };
607                 if (yych == '\'') { gotoCase = 91; continue; };
608                 { gotoCase = 88; continue; };
609             }
610 case 87:
611             { return this._stringToken(cursor); }
612 case 88:
613             yych = this._charAt(++cursor);
614             { gotoCase = 95; continue; };
615 case 89:
616             ++cursor;
617             { this.tokenType = null; return cursor; }
618 case 91:
619             ++cursor;
620 case 92:
621             this.setLexCondition(this._lexConditions.TAG);
622             { return this._stringToken(cursor, true); }
623 case 93:
624             yych = this._charAt(++cursor);
625             { gotoCase = 92; continue; };
626 case 94:
627             ++cursor;
628             yych = this._charAt(cursor);
629 case 95:
630             if (yych <= '\f') {
631                 if (yych == '\n') { gotoCase = 87; continue; };
632                 { gotoCase = 94; continue; };
633             } else {
634                 if (yych <= '\r') { gotoCase = 87; continue; };
635                 if (yych == '\'') { gotoCase = 93; continue; };
636                 { gotoCase = 94; continue; };
637             }
638 /* *********************************** */
639 case this.case_TAG:
640             yych = this._charAt(cursor);
641             if (yych <= '&') {
642                 if (yych <= '\r') {
643                     if (yych == '\n') { gotoCase = 100; continue; };
644                     if (yych >= '\r') { gotoCase = 100; continue; };
645                 } else {
646                     if (yych <= ' ') {
647                         if (yych >= ' ') { gotoCase = 100; continue; };
648                     } else {
649                         if (yych == '"') { gotoCase = 102; continue; };
650                     }
651                 }
652             } else {
653                 if (yych <= '>') {
654                     if (yych <= ';') {
655                         if (yych <= '\'') { gotoCase = 103; continue; };
656                     } else {
657                         if (yych <= '<') { gotoCase = 100; continue; };
658                         if (yych <= '=') { gotoCase = 104; continue; };
659                         { gotoCase = 106; continue; };
660                     }
661                 } else {
662                     if (yych <= '[') {
663                         if (yych >= '[') { gotoCase = 100; continue; };
664                     } else {
665                         if (yych == ']') { gotoCase = 100; continue; };
666                     }
667                 }
668             }
669             ++cursor;
670             yych = this._charAt(cursor);
671             { gotoCase = 119; continue; };
672 case 99:
673             {
674                     if (this._condition.parseCondition === this._parseConditions.SCRIPT || this._condition.parseCondition === this._parseConditions.STYLE) {
675                         // Fall through if expecting attributes.
676                         this.tokenType = null;
677                         return cursor;
678                     }
679
680                     if (this._condition.parseCondition === this._parseConditions.INITIAL) {
681                         this.tokenType = "html-tag";
682                         this._setExpectingAttribute();
683                         var token = this._line.substring(cursorOnEnter, cursor);
684                         if (token === "a")
685                             this._condition.parseCondition |= this._parseConditions.A_NODE;
686                         else if (this._condition.parseCondition & this._parseConditions.A_NODE)
687                             this._condition.parseCondition ^= this._parseConditions.A_NODE;
688                     } else if (this._isExpectingAttribute()) {
689                         var token = this._line.substring(cursorOnEnter, cursor);
690                         if (token === "href" || token === "src")
691                             this._condition.parseCondition |= this._parseConditions.LINKIFY;
692                         else if (this._condition.parseCondition |= this._parseConditions.LINKIFY)
693                             this._condition.parseCondition ^= this._parseConditions.LINKIFY;
694                         this.tokenType = "html-attribute-name";
695                     } else if (this._isExpectingAttributeValue())
696                         this.tokenType = this._attrValueTokenType();
697                     else
698                         this.tokenType = null;
699                     return cursor;
700                 }
701 case 100:
702             ++cursor;
703             { this.tokenType = null; return cursor; }
704 case 102:
705             yyaccept = 0;
706             yych = this._charAt(YYMARKER = ++cursor);
707             { gotoCase = 115; continue; };
708 case 103:
709             yyaccept = 0;
710             yych = this._charAt(YYMARKER = ++cursor);
711             { gotoCase = 109; continue; };
712 case 104:
713             ++cursor;
714             {
715                     if (this._isExpectingAttribute())
716                         this._setExpectingAttributeValue();
717                     this.tokenType = null;
718                     return cursor;
719                 }
720 case 106:
721             ++cursor;
722             this.setLexCondition(this._lexConditions.INITIAL);
723             {
724                     this.tokenType = "html-tag";
725                     if (this._condition.parseCondition & this._parseConditions.SCRIPT) {
726                         this.scriptStarted(cursor);
727                         // Do not tokenize script tag contents.
728                         return cursor;
729                     }
730
731                     if (this._condition.parseCondition & this._parseConditions.STYLE) {
732                         this.styleSheetStarted(cursor);
733                         // Do not tokenize style tag contents.
734                         return cursor;
735                     }
736
737                     this._condition.parseCondition = this._parseConditions.INITIAL;
738                     return cursor;
739                 }
740 case 108:
741             ++cursor;
742             yych = this._charAt(cursor);
743 case 109:
744             if (yych <= '\f') {
745                 if (yych != '\n') { gotoCase = 108; continue; };
746             } else {
747                 if (yych <= '\r') { gotoCase = 110; continue; };
748                 if (yych == '\'') { gotoCase = 112; continue; };
749                 { gotoCase = 108; continue; };
750             }
751 case 110:
752             ++cursor;
753             this.setLexCondition(this._lexConditions.SSTRING);
754             { return this._stringToken(cursor); }
755 case 112:
756             ++cursor;
757             { return this._stringToken(cursor, true); }
758 case 114:
759             ++cursor;
760             yych = this._charAt(cursor);
761 case 115:
762             if (yych <= '\f') {
763                 if (yych != '\n') { gotoCase = 114; continue; };
764             } else {
765                 if (yych <= '\r') { gotoCase = 116; continue; };
766                 if (yych == '"') { gotoCase = 112; continue; };
767                 { gotoCase = 114; continue; };
768             }
769 case 116:
770             ++cursor;
771             this.setLexCondition(this._lexConditions.DSTRING);
772             { return this._stringToken(cursor); }
773 case 118:
774             ++cursor;
775             yych = this._charAt(cursor);
776 case 119:
777             if (yych <= '"') {
778                 if (yych <= '\r') {
779                     if (yych == '\n') { gotoCase = 99; continue; };
780                     if (yych <= '\f') { gotoCase = 118; continue; };
781                     { gotoCase = 99; continue; };
782                 } else {
783                     if (yych == ' ') { gotoCase = 99; continue; };
784                     if (yych <= '!') { gotoCase = 118; continue; };
785                     { gotoCase = 99; continue; };
786                 }
787             } else {
788                 if (yych <= '>') {
789                     if (yych == '\'') { gotoCase = 99; continue; };
790                     if (yych <= ';') { gotoCase = 118; continue; };
791                     { gotoCase = 99; continue; };
792                 } else {
793                     if (yych <= '[') {
794                         if (yych <= 'Z') { gotoCase = 118; continue; };
795                         { gotoCase = 99; continue; };
796                     } else {
797                         if (yych == ']') { gotoCase = 99; continue; };
798                         { gotoCase = 118; continue; };
799                     }
800                 }
801             }
802         }
803
804         }
805     }
806 }
807
808 WebInspector.SourceHTMLTokenizer.prototype.__proto__ = WebInspector.SourceTokenizer.prototype;