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