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