Mercurial > hgrepos > Python > libs > pygments-lexer-pseudocode2
comparison docs/lexer-algpseudocode.rst @ 209:f20177032d21
A chapter about escaping rules
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Wed, 13 May 2026 15:57:26 +0200 |
| parents | de7118d299e9 |
| children | 18553f595b34 |
comparison
equal
deleted
inserted
replaced
| 208:de7118d299e9 | 209:f20177032d21 |
|---|---|
| 250 * Escaping within the braces is possible using the backslash ``\`` as | 250 * Escaping within the braces is possible using the backslash ``\`` as |
| 251 escape character | 251 escape character |
| 252 * Parameters are separated from the keyword/command by a (possibly empty) run | 252 * Parameters are separated from the keyword/command by a (possibly empty) run |
| 253 of space or TAB characters. | 253 of space or TAB characters. |
| 254 This is true for required and optional parameters. | 254 This is true for required and optional parameters. |
| 255 | 255 - Unrecognized commands typically result in a |
| 256 .. todo:: Escaping | 256 :py:class:`pygments.token.Token.Error` token. |
| 257 | 257 |
| 258 A single backslash yields a Generic.Error token when in | 258 More on escaping rules you can find in :ref:`this chapter <escaping-rules>`. |
| 259 `default` and `expression` states. | |
| 260 | 259 |
| 261 | 260 |
| 262 Commands With Required Parameters | 261 Commands With Required Parameters |
| 263 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 262 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 264 | 263 |
| 489 \text{• \\ttx-NON-EXISTING[∈_∌](p1, p2)} \ttx-NON_EXISTING[∈_∌](p1, p2) | 488 \text{• \\ttx-NON-EXISTING[∈_∌](p1, p2)} \ttx-NON_EXISTING[∈_∌](p1, p2) |
| 490 | 489 |
| 491 .. note:: Explicit token types are **case-sensitive**. | 490 .. note:: Explicit token types are **case-sensitive**. |
| 492 | 491 |
| 493 | 492 |
| 493 .. _escaping-rules: | |
| 494 | |
| 495 Escaping Rules | |
| 496 ============== | |
| 497 | |
| 498 The escape character is a backslash ``\``. | |
| 499 | |
| 500 A backslash can be escaped with ``\\`` and yields a single backslash token. | |
| 501 | |
| 502 Within parameters a closing curly brace ``}`` ends the current | |
| 503 parameters environment. | |
| 504 It must be escaped using ``\}`` if a closing curly brace is part of the | |
| 505 argument content. | |
| 506 | |
| 507 A single backslash yields a :py:class:`pygments.token.Token.Generic.Error` | |
| 508 token when in `default` and `expression` states. | |
| 509 Contrary---in `text` contexts a single backslash character that does not | |
| 510 introduce a command yields a normal text token. | |
| 511 | |
| 512 In all contexts a backslash that would normally introduce a known command | |
| 513 must be escaped if the content should not recognized as a command. | |
| 514 | |
| 515 Single- and double-quotes must be escaped also (``\"`` or ``\'``) in | |
| 516 `default` and `expression` contexts when they should not introduce a | |
| 517 string token. | |
| 518 | |
| 519 | |
| 494 .. _customized-sphinx-lexers: | 520 .. _customized-sphinx-lexers: |
| 495 | 521 |
| 496 Customized Lexers in Sphinx | 522 Customized Lexers in Sphinx |
| 497 =========================== | 523 =========================== |
| 498 | 524 |
