| 1 |
<!DOCTYPE html> |
| 2 |
<html lang="en"> |
| 3 |
<head> |
| 4 |
|
| 5 |
<meta charset="utf-8"> |
| 6 |
<title>Token - Documentation</title> |
| 7 |
|
| 8 |
|
| 9 |
<meta property="og:title" content="Prism generated API documentation"/> |
| 10 |
<meta property="og:type" content="website"/> |
| 11 |
<meta property="og:image" content="/logo.svg"/> |
| 12 |
<meta property="og:site_name" content="Prism"/> |
| 13 |
<meta property="og:url" content="https://prismjs.com"/> |
| 14 |
|
| 15 |
<script src="scripts/prettify/prettify.js"></script> |
| 16 |
<script src="scripts/prettify/lang-css.js"></script> |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
<link type="text/css" rel="stylesheet" href="styles/prettify.css"> |
| 21 |
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> |
| 22 |
<script src="scripts/nav.js" defer></script> |
| 23 |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 24 |
<link rel="icon" type="image/png" href="/favicon.png"/> |
| 25 |
</head> |
| 26 |
<body> |
| 27 |
|
| 28 |
<input type="checkbox" id="nav-trigger" class="nav-trigger" /> |
| 29 |
<label for="nav-trigger" class="navicon-button x"> |
| 30 |
<div class="navicon"></div> |
| 31 |
</label> |
| 32 |
|
| 33 |
<label for="nav-trigger" class="overlay"></label> |
| 34 |
|
| 35 |
<nav > |
| 36 |
|
| 37 |
<input type="text" id="nav-search" placeholder="Search" /> |
| 38 |
|
| 39 |
<h2><a href="index.html">Home</a></h2><h2><a href="https://prismjs.com" class="menu-item" id="website_link" >PrismJS</a></h2><h2><a href="https://github.com/PrismJS/prism" target="_blank" class="menu-item" id="github_link" >GitHub</a></h2><h3>Classes</h3><ul><li><a href="Token.html">Token</a></li></ul><h3>Namespaces</h3><ul><li><a href="Prism.html">Prism</a><ul class='members'><li data-type='member'><a href="Prism.html#.disableWorkerMessageHandler">disableWorkerMessageHandler</a></li><li data-type='member'><a href="Prism.html#.manual">manual</a></li></ul><ul class='methods'><li data-type='method'><a href="Prism.html#.highlight">highlight</a></li><li data-type='method'><a href="Prism.html#.highlightAll">highlightAll</a></li><li data-type='method'><a href="Prism.html#.highlightAllUnder">highlightAllUnder</a></li><li data-type='method'><a href="Prism.html#.highlightElement">highlightElement</a></li><li data-type='method'><a href="Prism.html#.tokenize">tokenize</a></li></ul></li><li><a href="Prism.hooks.html">hooks</a><ul class='methods'><li data-type='method'><a href="Prism.hooks.html#.add">add</a></li><li data-type='method'><a href="Prism.hooks.html#.run">run</a></li></ul></li><li><a href="Prism.languages.html">languages</a><ul class='methods'><li data-type='method'><a href="Prism.languages.html#.extend">extend</a></li><li data-type='method'><a href="Prism.languages.html#.insertBefore">insertBefore</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#Grammar">Grammar</a></li><li><a href="global.html#GrammarToken">GrammarToken</a></li><li><a href="global.html#HighlightCallback">HighlightCallback</a></li><li><a href="global.html#HookCallback">HookCallback</a></li><li><a href="global.html#TokenStream">TokenStream</a></li></ul> |
| 40 |
</nav> |
| 41 |
|
| 42 |
<div id="main"> |
| 43 |
|
| 44 |
<h1 class="page-title">Token</h1> |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
<section> |
| 53 |
|
| 54 |
<header> |
| 55 |
|
| 56 |
<h2> |
| 57 |
Token |
| 58 |
</h2> |
| 59 |
|
| 60 |
|
| 61 |
</header> |
| 62 |
|
| 63 |
<article> |
| 64 |
|
| 65 |
<div class="container-overview"> |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
<h4 class="name" id="Token"><span class="type-signature"></span>new Token<span class="signature">(type, content, alias<span class="signature-attributes">opt</span>, matchedStr<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
<dl class="details"> |
| 79 |
|
| 80 |
|
| 81 |
<dt class="tag-source">Source:</dt> |
| 82 |
<dd class="tag-source"><ul class="dummy"><li> |
| 83 |
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line783">line 783</a> |
| 84 |
</li></ul></dd> |
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
</dl> |
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
<div class="description usertext"> |
| 123 |
<p>Creates a new token.</p> |
| 124 |
</div> |
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
<h5>Parameters:</h5> |
| 137 |
|
| 138 |
|
| 139 |
<table class="params"> |
| 140 |
<thead> |
| 141 |
<tr> |
| 142 |
|
| 143 |
<th>Name</th> |
| 144 |
|
| 145 |
|
| 146 |
<th>Type</th> |
| 147 |
|
| 148 |
|
| 149 |
<th>Attributes</th> |
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
<th>Default</th> |
| 154 |
|
| 155 |
|
| 156 |
<th class="last">Description</th> |
| 157 |
</tr> |
| 158 |
</thead> |
| 159 |
|
| 160 |
<tbody> |
| 161 |
|
| 162 |
|
| 163 |
<tr> |
| 164 |
|
| 165 |
<td class="name"><code>type</code></td> |
| 166 |
|
| 167 |
|
| 168 |
<td class="type"> |
| 169 |
|
| 170 |
|
| 171 |
<span class="param-type">string</span> |
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
</td> |
| 176 |
|
| 177 |
|
| 178 |
<td class="attributes"> |
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
</td> |
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
<td class="default"> |
| 189 |
|
| 190 |
</td> |
| 191 |
|
| 192 |
|
| 193 |
<td class="description last"><p>See <a href="Token.html#type"><code>type</code></a></p></td> |
| 194 |
</tr> |
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
<tr> |
| 199 |
|
| 200 |
<td class="name"><code>content</code></td> |
| 201 |
|
| 202 |
|
| 203 |
<td class="type"> |
| 204 |
|
| 205 |
|
| 206 |
<span class="param-type">string</span> |
| 207 |
| |
| 208 |
|
| 209 |
<span class="param-type"><a href="global.html#TokenStream">TokenStream</a></span> |
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
</td> |
| 214 |
|
| 215 |
|
| 216 |
<td class="attributes"> |
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
</td> |
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
<td class="default"> |
| 227 |
|
| 228 |
</td> |
| 229 |
|
| 230 |
|
| 231 |
<td class="description last"><p>See <a href="Token.html#content"><code>content</code></a></p></td> |
| 232 |
</tr> |
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
<tr> |
| 237 |
|
| 238 |
<td class="name"><code>alias</code></td> |
| 239 |
|
| 240 |
|
| 241 |
<td class="type"> |
| 242 |
|
| 243 |
|
| 244 |
<span class="param-type">string</span> |
| 245 |
| |
| 246 |
|
| 247 |
<span class="param-type">Array.<string></span> |
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
</td> |
| 252 |
|
| 253 |
|
| 254 |
<td class="attributes"> |
| 255 |
|
| 256 |
<optional><br> |
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
</td> |
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
<td class="default"> |
| 267 |
|
| 268 |
</td> |
| 269 |
|
| 270 |
|
| 271 |
<td class="description last"><p>The alias(es) of the token.</p></td> |
| 272 |
</tr> |
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
<tr> |
| 277 |
|
| 278 |
<td class="name"><code>matchedStr</code></td> |
| 279 |
|
| 280 |
|
| 281 |
<td class="type"> |
| 282 |
|
| 283 |
|
| 284 |
<span class="param-type">string</span> |
| 285 |
|
| 286 |
|
| 287 |
|
| 288 |
</td> |
| 289 |
|
| 290 |
|
| 291 |
<td class="attributes"> |
| 292 |
|
| 293 |
<optional><br> |
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
|
| 298 |
|
| 299 |
</td> |
| 300 |
|
| 301 |
|
| 302 |
|
| 303 |
<td class="default"> |
| 304 |
|
| 305 |
<code>""</code> |
| 306 |
|
| 307 |
</td> |
| 308 |
|
| 309 |
|
| 310 |
<td class="description last"><p>A copy of the full string this token was created from.</p></td> |
| 311 |
</tr> |
| 312 |
|
| 313 |
|
| 314 |
</tbody> |
| 315 |
</table> |
| 316 |
|
| 317 |
|
| 318 |
|
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
|
| 325 |
|
| 326 |
|
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
|
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
</div> |
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
|
| 349 |
|
| 350 |
|
| 351 |
|
| 352 |
<h3 class="subsection-title">Members</h3> |
| 353 |
|
| 354 |
|
| 355 |
|
| 356 |
<h4 class="name" id="alias"><span class="type-signature"></span>alias<span class="type-signature"> :string|Array.<string></span></h4> |
| 357 |
|
| 358 |
|
| 359 |
|
| 360 |
|
| 361 |
|
| 362 |
<dl class="details"> |
| 363 |
|
| 364 |
|
| 365 |
<dt class="tag-source">Source:</dt> |
| 366 |
<dd class="tag-source"><ul class="dummy"><li> |
| 367 |
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line810">line 810</a> |
| 368 |
</li></ul></dd> |
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
|
| 378 |
|
| 379 |
|
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
|
| 389 |
|
| 390 |
|
| 391 |
|
| 392 |
|
| 393 |
|
| 394 |
|
| 395 |
|
| 396 |
|
| 397 |
|
| 398 |
<dt class="tag-see">See:</dt> |
| 399 |
<dd class="tag-see"> |
| 400 |
<ul> |
| 401 |
<li><a href="global.html#GrammarToken">GrammarToken</a></li> |
| 402 |
</ul> |
| 403 |
</dd> |
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
</dl> |
| 408 |
|
| 409 |
|
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
<div class="description usertext"> |
| 414 |
<p>The alias(es) of the token.</p> |
| 415 |
</div> |
| 416 |
|
| 417 |
|
| 418 |
|
| 419 |
<h5>Type:</h5> |
| 420 |
<ul> |
| 421 |
<li> |
| 422 |
|
| 423 |
<span class="param-type">string</span> |
| 424 |
| |
| 425 |
|
| 426 |
<span class="param-type">Array.<string></span> |
| 427 |
|
| 428 |
|
| 429 |
</li> |
| 430 |
</ul> |
| 431 |
|
| 432 |
|
| 433 |
|
| 434 |
|
| 435 |
|
| 436 |
|
| 437 |
|
| 438 |
|
| 439 |
<h4 class="name" id="content"><span class="type-signature"></span>content<span class="type-signature"> :string|<a href="global.html#TokenStream">TokenStream</a></span></h4> |
| 440 |
|
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
|
| 445 |
<dl class="details"> |
| 446 |
|
| 447 |
|
| 448 |
<dt class="tag-source">Source:</dt> |
| 449 |
<dd class="tag-source"><ul class="dummy"><li> |
| 450 |
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line802">line 802</a> |
| 451 |
</li></ul></dd> |
| 452 |
|
| 453 |
|
| 454 |
|
| 455 |
|
| 456 |
|
| 457 |
|
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
|
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
|
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
|
| 470 |
|
| 471 |
|
| 472 |
|
| 473 |
|
| 474 |
|
| 475 |
|
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
|
| 480 |
|
| 481 |
|
| 482 |
|
| 483 |
</dl> |
| 484 |
|
| 485 |
|
| 486 |
|
| 487 |
|
| 488 |
|
| 489 |
<div class="description usertext"> |
| 490 |
<p>The strings or tokens contained by this token.</p> |
| 491 |
<p>This will be a token stream if the pattern matched also defined an <code>inside</code> grammar.</p> |
| 492 |
</div> |
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
<h5>Type:</h5> |
| 497 |
<ul> |
| 498 |
<li> |
| 499 |
|
| 500 |
<span class="param-type">string</span> |
| 501 |
| |
| 502 |
|
| 503 |
<span class="param-type"><a href="global.html#TokenStream">TokenStream</a></span> |
| 504 |
|
| 505 |
|
| 506 |
</li> |
| 507 |
</ul> |
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
|
| 513 |
|
| 514 |
|
| 515 |
|
| 516 |
<h4 class="name" id="type"><span class="type-signature"></span>type<span class="type-signature"> :string</span></h4> |
| 517 |
|
| 518 |
|
| 519 |
|
| 520 |
|
| 521 |
|
| 522 |
<dl class="details"> |
| 523 |
|
| 524 |
|
| 525 |
<dt class="tag-source">Source:</dt> |
| 526 |
<dd class="tag-source"><ul class="dummy"><li> |
| 527 |
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line793">line 793</a> |
| 528 |
</li></ul></dd> |
| 529 |
|
| 530 |
|
| 531 |
|
| 532 |
|
| 533 |
|
| 534 |
|
| 535 |
|
| 536 |
|
| 537 |
|
| 538 |
|
| 539 |
|
| 540 |
|
| 541 |
|
| 542 |
|
| 543 |
|
| 544 |
|
| 545 |
|
| 546 |
|
| 547 |
|
| 548 |
|
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
|
| 555 |
|
| 556 |
|
| 557 |
|
| 558 |
<dt class="tag-see">See:</dt> |
| 559 |
<dd class="tag-see"> |
| 560 |
<ul> |
| 561 |
<li><a href="global.html#GrammarToken">GrammarToken</a></li> |
| 562 |
</ul> |
| 563 |
</dd> |
| 564 |
|
| 565 |
|
| 566 |
|
| 567 |
</dl> |
| 568 |
|
| 569 |
|
| 570 |
|
| 571 |
|
| 572 |
|
| 573 |
<div class="description usertext"> |
| 574 |
<p>The type of the token.</p> |
| 575 |
<p>This is usually the key of a pattern in a <a href="global.html#Grammar"><code>Grammar</code></a>.</p> |
| 576 |
</div> |
| 577 |
|
| 578 |
|
| 579 |
|
| 580 |
<h5>Type:</h5> |
| 581 |
<ul> |
| 582 |
<li> |
| 583 |
|
| 584 |
<span class="param-type">string</span> |
| 585 |
|
| 586 |
|
| 587 |
</li> |
| 588 |
</ul> |
| 589 |
|
| 590 |
|
| 591 |
|
| 592 |
|
| 593 |
|
| 594 |
|
| 595 |
|
| 596 |
|
| 597 |
|
| 598 |
|
| 599 |
|
| 600 |
|
| 601 |
|
| 602 |
|
| 603 |
</article> |
| 604 |
|
| 605 |
</section> |
| 606 |
|
| 607 |
|
| 608 |
|
| 609 |
|
| 610 |
|
| 611 |
|
| 612 |
</div> |
| 613 |
|
| 614 |
<br class="clear"> |
| 615 |
|
| 616 |
<footer> |
| 617 |
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.10</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. |
| 618 |
</footer> |
| 619 |
|
| 620 |
<script>prettyPrint();</script> |
| 621 |
<script src="scripts/polyfill.js"></script> |
| 622 |
<script src="scripts/linenumber.js"></script> |
| 623 |
|
| 624 |
<script src="scripts/search.js" defer></script> |
| 625 |
|
| 626 |
|
| 627 |
|
| 628 |
<link type="text/css" rel="stylesheet" href="styles/overwrites.css"> |
| 629 |
|
| 630 |
</body> |
| 631 |
</html> |