| OLD | NEW |
| 1 Parsing | 1 Parsing |
| 2 ======= | 2 ======= |
| 3 | 3 |
| 4 Parsing in Sky is a strict pipeline consisting of five stages: | 4 Parsing in Sky is a strict pipeline consisting of five stages: |
| 5 | 5 |
| 6 - decoding, which converts incoming bytes into Unicode characters | 6 - decoding, which converts incoming bytes into Unicode characters |
| 7 using UTF-8. | 7 using UTF-8. |
| 8 | 8 |
| 9 - normalising, which manipulates the sequence of characters. | 9 - normalising, which manipulates the sequence of characters. |
| 10 | 10 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 token. Consume the character. Stay in this state. | 167 token. Consume the character. Stay in this state. |
| 168 | 168 |
| 169 | 169 |
| 170 #### **Script raw data: close 1** state #### | 170 #### **Script raw data: close 1** state #### |
| 171 | 171 |
| 172 If the current character is... | 172 If the current character is... |
| 173 | 173 |
| 174 * '``/``': Consume the character and switch to the **script raw | 174 * '``/``': Consume the character and switch to the **script raw |
| 175 data: close 2** state. | 175 data: close 2** state. |
| 176 | 176 |
| 177 * Anything else: Emit '``<``' character tokens. Consume the | 177 * Anything else: Emit '``<``' character tokens. Switch to the |
| 178 character. Switch to the **script raw data** state. | 178 **script raw data** state without consuming the character. |
| 179 | 179 |
| 180 | 180 |
| 181 #### **Script raw data: close 2** state #### | 181 #### **Script raw data: close 2** state #### |
| 182 | 182 |
| 183 If the current character is... | 183 If the current character is... |
| 184 | 184 |
| 185 * '``s``': Consume the character and switch to the **script raw | 185 * '``s``': Consume the character and switch to the **script raw |
| 186 data: close 3** state. | 186 data: close 3** state. |
| 187 | 187 |
| 188 * Anything else: Emit '``</``' character tokens. Consume the | 188 * Anything else: Emit '``</``' character tokens. Switch to the |
| 189 character. Switch to the **script raw data** state. | 189 **script raw data** state without consuming the character. |
| 190 | 190 |
| 191 | 191 |
| 192 #### **Script raw data: close 3** state #### | 192 #### **Script raw data: close 3** state #### |
| 193 | 193 |
| 194 If the current character is... | 194 If the current character is... |
| 195 | 195 |
| 196 * '``c``': Consume the character and switch to the **script raw | 196 * '``c``': Consume the character and switch to the **script raw |
| 197 data: close 4** state. | 197 data: close 4** state. |
| 198 | 198 |
| 199 * Anything else: Emit '``</s``' character tokens. Consume the | 199 * Anything else: Emit '``</s``' character tokens. Switch to the |
| 200 character. Switch to the **script raw data** state. | 200 **script raw data** state without consuming the character. |
| 201 | 201 |
| 202 | 202 |
| 203 #### **Script raw data: close 4** state #### | 203 #### **Script raw data: close 4** state #### |
| 204 | 204 |
| 205 If the current character is... | 205 If the current character is... |
| 206 | 206 |
| 207 * '``r``': Consume the character and switch to the **script raw | 207 * '``r``': Consume the character and switch to the **script raw |
| 208 data: close 5** state. | 208 data: close 5** state. |
| 209 | 209 |
| 210 * Anything else: Emit '``</sc``' character tokens. Consume the | 210 * Anything else: Emit '``</sc``' character tokens. Switch to the |
| 211 character. Switch to the **script raw data** state. | 211 **script raw data** state without consuming the character. |
| 212 | 212 |
| 213 | 213 |
| 214 #### **Script raw data: close 5** state #### | 214 #### **Script raw data: close 5** state #### |
| 215 | 215 |
| 216 If the current character is... | 216 If the current character is... |
| 217 | 217 |
| 218 * '``i``': Consume the character and switch to the **script raw | 218 * '``i``': Consume the character and switch to the **script raw |
| 219 data: close 6** state. | 219 data: close 6** state. |
| 220 | 220 |
| 221 * Anything else: Emit '``</scr``' character tokens. Consume the | 221 * Anything else: Emit '``</scr``' character tokens. Switch to the |
| 222 character. Switch to the **script raw data** state. | 222 **script raw data** state without consuming the character. |
| 223 | 223 |
| 224 | 224 |
| 225 #### **Script raw data: close 6** state #### | 225 #### **Script raw data: close 6** state #### |
| 226 | 226 |
| 227 If the current character is... | 227 If the current character is... |
| 228 | 228 |
| 229 * '``p``': Consume the character and switch to the **script raw | 229 * '``p``': Consume the character and switch to the **script raw |
| 230 data: close 7** state. | 230 data: close 7** state. |
| 231 | 231 |
| 232 * Anything else: Emit '``</scri``' character tokens. Consume the | 232 * Anything else: Emit '``</scri``' character tokens. Switch to the |
| 233 character. Switch to the **script raw data** state. | 233 **script raw data** state without consuming the character. |
| 234 | 234 |
| 235 | 235 |
| 236 #### **Script raw data: close 7** state #### | 236 #### **Script raw data: close 7** state #### |
| 237 | 237 |
| 238 If the current character is... | 238 If the current character is... |
| 239 | 239 |
| 240 * '``t``': Consume the character and switch to the **script raw | 240 * '``t``': Consume the character and switch to the **script raw |
| 241 data: close 8** state. | 241 data: close 8** state. |
| 242 | 242 |
| 243 * Anything else: Emit '``</scrip``' character tokens. Consume the | 243 * Anything else: Emit '``</scrip``' character tokens. Switch to the |
| 244 character. Switch to the **script raw data** state. | 244 **script raw data** state without consuming the character. |
| 245 | 245 |
| 246 | 246 |
| 247 #### **Script raw data: close 8** state #### | 247 #### **Script raw data: close 8** state #### |
| 248 | 248 |
| 249 If the current character is... | 249 If the current character is... |
| 250 | 250 |
| 251 * U+0020, U+000A, '``/``', '``>``': Create an end tag token, and | 251 * U+0020, U+000A, '``/``', '``>``': Create an end tag token, and |
| 252 let its tag name be the string '``script``'. Switch to the | 252 let its tag name be the string '``script``'. Switch to the |
| 253 **before attribute name** state without consuming the character. | 253 **before attribute name** state without consuming the character. |
| 254 | 254 |
| 255 * Anything else: Emit '``</script``' character tokens. Consume the | 255 * Anything else: Emit '``</script``' character tokens. Switch to the |
| 256 character. Switch to the **script raw data** state. | 256 **script raw data** state without consuming the character. |
| 257 | 257 |
| 258 | 258 |
| 259 #### **Style raw data** state #### | 259 #### **Style raw data** state #### |
| 260 | 260 |
| 261 If the current character is... | 261 If the current character is... |
| 262 | 262 |
| 263 * '``<``': Consume the character and switch to the **style raw | 263 * '``<``': Consume the character and switch to the **style raw |
| 264 data: close 1** state. | 264 data: close 1** state. |
| 265 | 265 |
| 266 * Anything else: Emit the current input character as a character | 266 * Anything else: Emit the current input character as a character |
| 267 token. Consume the character. Stay in this state. | 267 token. Consume the character. Stay in this state. |
| 268 | 268 |
| 269 | 269 |
| 270 #### **Style raw data: close 1** state #### | 270 #### **Style raw data: close 1** state #### |
| 271 | 271 |
| 272 If the current character is... | 272 If the current character is... |
| 273 | 273 |
| 274 * '``/``': Consume the character and switch to the **style raw | 274 * '``/``': Consume the character and switch to the **style raw |
| 275 data: close 2** state. | 275 data: close 2** state. |
| 276 | 276 |
| 277 * Anything else: Emit '``<``' character tokens. Consume the | 277 * Anything else: Emit '``<``' character tokens. Switch to the |
| 278 character. Switch to the **style raw data** state. | 278 **style raw data** state without consuming the character. |
| 279 | 279 |
| 280 | 280 |
| 281 #### **Style raw data: close 2** state #### | 281 #### **Style raw data: close 2** state #### |
| 282 | 282 |
| 283 If the current character is... | 283 If the current character is... |
| 284 | 284 |
| 285 * '``s``': Consume the character and switch to the **style raw | 285 * '``s``': Consume the character and switch to the **style raw |
| 286 data: close 3** state. | 286 data: close 3** state. |
| 287 | 287 |
| 288 * Anything else: Emit '``</``' character tokens. Consume the | 288 * Anything else: Emit '``</``' character tokens. Switch to the |
| 289 character. Switch to the **style raw data** state. | 289 **style raw data** state without consuming the character. |
| 290 | 290 |
| 291 | 291 |
| 292 #### **Style raw data: close 3** state #### | 292 #### **Style raw data: close 3** state #### |
| 293 | 293 |
| 294 If the current character is... | 294 If the current character is... |
| 295 | 295 |
| 296 * '``t``': Consume the character and switch to the **style raw | 296 * '``t``': Consume the character and switch to the **style raw |
| 297 data: close 4** state. | 297 data: close 4** state. |
| 298 | 298 |
| 299 * Anything else: Emit '``</s``' character tokens. Consume the | 299 * Anything else: Emit '``</s``' character tokens. Switch to the |
| 300 character. Switch to the **style raw data** state. | 300 **style raw data** state without consuming the character. |
| 301 | 301 |
| 302 | 302 |
| 303 #### **Style raw data: close 4** state #### | 303 #### **Style raw data: close 4** state #### |
| 304 | 304 |
| 305 If the current character is... | 305 If the current character is... |
| 306 | 306 |
| 307 * '``y``': Consume the character and switch to the **style raw | 307 * '``y``': Consume the character and switch to the **style raw |
| 308 data: close 5** state. | 308 data: close 5** state. |
| 309 | 309 |
| 310 * Anything else: Emit '``</st``' character tokens. Consume the | 310 * Anything else: Emit '``</st``' character tokens. Switch to the |
| 311 character. Switch to the **style raw data** state. | 311 **style raw data** state without consuming the character. |
| 312 | 312 |
| 313 | 313 |
| 314 #### **Style raw data: close 5** state #### | 314 #### **Style raw data: close 5** state #### |
| 315 | 315 |
| 316 If the current character is... | 316 If the current character is... |
| 317 | 317 |
| 318 * '``l``': Consume the character and switch to the **style raw | 318 * '``l``': Consume the character and switch to the **style raw |
| 319 data: close 6** state. | 319 data: close 6** state. |
| 320 | 320 |
| 321 * Anything else: Emit '``</sty``' character tokens. Consume the | 321 * Anything else: Emit '``</sty``' character tokens. Switch to the |
| 322 character. Switch to the **style raw data** state. | 322 **style raw data** state without consuming the character. |
| 323 | 323 |
| 324 | 324 |
| 325 #### **Style raw data: close 6** state #### | 325 #### **Style raw data: close 6** state #### |
| 326 | 326 |
| 327 If the current character is... | 327 If the current character is... |
| 328 | 328 |
| 329 * '``e``': Consume the character and switch to the **style raw | 329 * '``e``': Consume the character and switch to the **style raw |
| 330 data: close 7** state. | 330 data: close 7** state. |
| 331 | 331 |
| 332 * Anything else: Emit '``</styl``' character tokens. Consume the | 332 * Anything else: Emit '``</styl``' character tokens. Switch to the |
| 333 character. Switch to the **style raw data** state. | 333 **style raw data** state without consuming the character. |
| 334 | 334 |
| 335 | 335 |
| 336 #### **Style raw data: close 7** state #### | 336 #### **Style raw data: close 7** state #### |
| 337 | 337 |
| 338 If the current character is... | 338 If the current character is... |
| 339 | 339 |
| 340 * U+0020, U+000A, '``/``', '``>``': Create an end tag token, and | 340 * U+0020, U+000A, '``/``', '``>``': Create an end tag token, and |
| 341 let its tag name be the string '``style``'. Switch to the | 341 let its tag name be the string '``style``'. Switch to the |
| 342 **before attribute name** state without consuming the character. | 342 **before attribute name** state without consuming the character. |
| 343 | 343 |
| 344 * Anything else: Emit '``</style``' character tokens. Consume the | 344 * Anything else: Emit '``</style``' character tokens. Switch to the |
| 345 character. Switch to the **style raw data** state. | 345 **style raw data** state without consuming the character. |
| 346 | 346 |
| 347 | 347 |
| 348 #### **Tag open** state #### | 348 #### **Tag open** state #### |
| 349 | 349 |
| 350 If the current character is... | 350 If the current character is... |
| 351 | 351 |
| 352 * '``!``': Consume the character and switch to the **comment start | 352 * '``!``': Consume the character and switch to the **comment start |
| 353 1** state. | 353 1** state. |
| 354 | 354 |
| 355 * '``/``': Consume the character and switch to the **close tag | 355 * '``/``': Consume the character and switch to the **close tag |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 | 417 |
| 418 * U+0020, U+000A: Consume the current character. Stay in this state. | 418 * U+0020, U+000A: Consume the current character. Stay in this state. |
| 419 | 419 |
| 420 * '``/``': Consume the current character. Switch to the **void tag** | 420 * '``/``': Consume the current character. Switch to the **void tag** |
| 421 state. | 421 state. |
| 422 | 422 |
| 423 * '``>``': Consume the current character. Switch to the **after | 423 * '``>``': Consume the current character. Switch to the **after |
| 424 tag** state. | 424 tag** state. |
| 425 | 425 |
| 426 * Anything else: Create a new attribute in the tag token, and set its | 426 * Anything else: Create a new attribute in the tag token, and set its |
| 427 name to the current character. Consume the current character. Switch | 427 name to the current character and its value to the empty string. |
| 428 to the **attribute name** state. | 428 Consume the current character. Switch to the **attribute name** |
| 429 state. |
| 429 | 430 |
| 430 | 431 |
| 431 #### **Attribute name** state #### | 432 #### **Attribute name** state #### |
| 432 | 433 |
| 433 If the current character is... | 434 If the current character is... |
| 434 | 435 |
| 435 * U+0020, U+000A: Consume the current character. Switch to the **after | 436 * U+0020, U+000A: Consume the current character. Switch to the **after |
| 436 attribute name** state. | 437 attribute name** state. |
| 437 | 438 |
| 438 * '``/``': Consume the current character. Switch to the **void tag** | 439 * '``/``': Consume the current character. Switch to the **void tag** |
| (...skipping 19 matching lines...) Expand all Loading... |
| 458 * '``/``': Consume the current character. Switch to the **void tag** | 459 * '``/``': Consume the current character. Switch to the **void tag** |
| 459 state. | 460 state. |
| 460 | 461 |
| 461 * '``=``': Consume the current character. Switch to the **before | 462 * '``=``': Consume the current character. Switch to the **before |
| 462 attribute value** state. | 463 attribute value** state. |
| 463 | 464 |
| 464 * '``>``': Consume the current character. Switch to the **after | 465 * '``>``': Consume the current character. Switch to the **after |
| 465 tag** state. | 466 tag** state. |
| 466 | 467 |
| 467 * Anything else: Create a new attribute in the tag token, and set its | 468 * Anything else: Create a new attribute in the tag token, and set its |
| 468 name to the current character. Consume the current character. Switch | 469 name to the current character and its value to the empty string. |
| 469 to the **attribute name** state. | 470 Consume the current character. Switch to the **attribute name** |
| 471 state. |
| 470 | 472 |
| 471 | 473 |
| 472 #### **Before attribute value** state #### | 474 #### **Before attribute value** state #### |
| 473 | 475 |
| 474 If the current character is... | 476 If the current character is... |
| 475 | 477 |
| 476 * U+0020, U+000A: Consume the current character. Stay in this state. | 478 * U+0020, U+000A: Consume the current character. Stay in this state. |
| 477 | 479 |
| 478 * '``>``': Consume the current character. Switch to the **after | 480 * '``>``': Consume the current character. Switch to the **after |
| 479 tag** state. | 481 tag** state. |
| 480 | 482 |
| 481 * '``'``': Consume the current character. Switch to the | 483 * '``'``': Consume the current character. Switch to the |
| 482 **single-quoted attribute value** state. | 484 **single-quoted attribute value** state. |
| 483 | 485 |
| 484 * '``"``': Consume the current character. Switch to the | 486 * '``"``': Consume the current character. Switch to the |
| 485 **double-quoted attribute value** state. | 487 **double-quoted attribute value** state. |
| 486 | 488 |
| 487 * Anything else: Set the value of the most recently added attribute to | 489 * Anything else: Switch to the **unquoted attribute value** state |
| 488 the current character. Consume the current character. Switch to the | 490 without consuming the current character. |
| 489 **unquoted attribute value** state. | |
| 490 | 491 |
| 491 | 492 |
| 492 #### **Single-quoted attribute value** state #### | 493 #### **Single-quoted attribute value** state #### |
| 493 | 494 |
| 494 If the current character is... | 495 If the current character is... |
| 495 | 496 |
| 496 * '``'``': Consume the current character. Switch to the | 497 * '``'``': Consume the current character. Switch to the |
| 497 **before attribute name** state. | 498 **before attribute name** state. |
| 498 | 499 |
| 499 * '``&``': Consume the character and switch to the **character | 500 * '``&``': Consume the character and switch to the **character |
| (...skipping 25 matching lines...) Expand all Loading... |
| 525 this state. | 526 this state. |
| 526 | 527 |
| 527 | 528 |
| 528 #### **Unquoted attribute value** state #### | 529 #### **Unquoted attribute value** state #### |
| 529 | 530 |
| 530 If the current character is... | 531 If the current character is... |
| 531 | 532 |
| 532 * U+0020, U+000A: Consume the current character. Switch to the | 533 * U+0020, U+000A: Consume the current character. Switch to the |
| 533 **before attribute name** state. | 534 **before attribute name** state. |
| 534 | 535 |
| 535 * '``>``': Consume the current character. Switch to the **data** | 536 * '``>``': Consume the current character. Switch to the **after tag** |
| 536 state. Switch to the **after tag** state. | 537 state. |
| 537 | 538 |
| 538 * '``&``': Consume the character and switch to the **character | 539 * '``&``': Consume the character and switch to the **character |
| 539 reference** state, with the _return state_ set to the **unquoted | 540 reference** state, with the _return state_ set to the **unquoted |
| 540 attribute value** state which has the same effect), and the | 541 attribute value** state, and the _emitting operation_ being to |
| 541 _emitting operation_ being to append the given character to the | 542 append the given character to the value of the most recently added |
| 542 value of the most recently added attribute. | 543 attribute. |
| 543 | 544 |
| 544 * Anything else: Append the current character to the value of the most | 545 * Anything else: Append the current character to the value of the most |
| 545 recently added attribute. Consume the current character. Stay in | 546 recently added attribute. Consume the current character. Stay in |
| 546 this state. | 547 this state. |
| 547 | 548 |
| 548 | 549 |
| 549 #### **After tag** state #### | 550 #### **After tag** state #### |
| 550 | 551 |
| 551 Emit the tag token. | 552 Emit the tag token. |
| 552 | 553 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 569 Switch to the **data** state. | 570 Switch to the **data** state. |
| 570 | 571 |
| 571 | 572 |
| 572 #### **Comment start 1** state #### | 573 #### **Comment start 1** state #### |
| 573 | 574 |
| 574 If the current character is... | 575 If the current character is... |
| 575 | 576 |
| 576 * '``-``': Consume the character and switch to the **comment start | 577 * '``-``': Consume the character and switch to the **comment start |
| 577 2** state. | 578 2** state. |
| 578 | 579 |
| 579 * '``>``': Emit character tokens for '``<!>``'. Consume the | 580 * Anything else: Emit character tokens for '``<!``'. Switch to the |
| 580 current character. Switch to the **data** state. | 581 **data** state without consuming the current character. |
| 581 | 582 |
| 582 | 583 |
| 583 #### **Comment start 2** state #### | 584 #### **Comment start 2** state #### |
| 584 | 585 |
| 585 If the current character is... | 586 If the current character is... |
| 586 | 587 |
| 587 * '``-``': Consume the character and switch to the **comment** | 588 * '``-``': Consume the character and switch to the **comment** |
| 588 state. | 589 state. |
| 589 | 590 |
| 590 * '``>``': Emit character tokens for '``<!->``'. Consume the | 591 * Anything else: Emit character tokens for '``<!-``'. Switch to the |
| 591 current character. Switch to the **data** state. | 592 **data** state without consuming the current character. |
| 592 | 593 |
| 593 | 594 |
| 594 #### **Comment** state #### | 595 #### **Comment** state #### |
| 595 | 596 |
| 596 If the current character is... | 597 If the current character is... |
| 597 | 598 |
| 598 * '``-``': Consume the character and switch to the **comment end 1** | 599 * '``-``': Consume the character and switch to the **comment end 1** |
| 599 state. | 600 state. |
| 600 | 601 |
| 601 * Anything else: Consume the character and switch to the **comment** | 602 * Anything else: Consume the character and stay in this state. |
| 602 state. | |
| 603 | 603 |
| 604 | 604 |
| 605 #### **Comment end 1** state #### | 605 #### **Comment end 1** state #### |
| 606 | 606 |
| 607 If the current character is... | 607 If the current character is... |
| 608 | 608 |
| 609 * '``-``': Consume the character, switch to the **comment end 2** | 609 * '``-``': Consume the character, switch to the **comment end 2** |
| 610 state. | 610 state. |
| 611 | 611 |
| 612 * Anything else: Consume the character, and switch to the **comment** | 612 * Anything else: Consume the character, and switch to the **comment** |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 there isn't one, skip this token. | 809 there isn't one, skip this token. |
| 810 2. If there's a ``template`` element in the _stack of open | 810 2. If there's a ``template`` element in the _stack of open |
| 811 nodes_ above _node_, then skip this token. | 811 nodes_ above _node_, then skip this token. |
| 812 3. Pop nodes from the _stack of open nodes_ until _node_ has been | 812 3. Pop nodes from the _stack of open nodes_ until _node_ has been |
| 813 popped. | 813 popped. |
| 814 4. If _node_'s tag name is ``script``, then yield until there | 814 4. If _node_'s tag name is ``script``, then yield until there |
| 815 are no pending import loads, then execute the script given by | 815 are no pending import loads, then execute the script given by |
| 816 the element's contents. | 816 the element's contents. |
| 817 3. Yield until there are no pending import loads. | 817 3. Yield until there are no pending import loads. |
| 818 3. Fire a ``load`` event at the _parsing context_ object. | 818 3. Fire a ``load`` event at the _parsing context_ object. |
| OLD | NEW |