Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3665)

Delta Between Two Patch Sets: Doc/reference/lexical_analysis.rst

Issue 15096: Drop support for the "ur" string prefix
Left Patch Set: Created 11 months, 1 week ago
Right Patch Set: Created 11 months, 1 week ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | Lib/test/test_strlit.py » ('j') | Lib/test/test_tokenize.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 1
2 .. _lexical: 2 .. _lexical:
3 3
4 **************** 4 ****************
5 Lexical analysis 5 Lexical analysis
6 **************** 6 ****************
7 7
8 .. index:: lexical analysis, parser, token 8 .. index:: lexical analysis, parser, token
9 9
10 A Python program is read by a *parser*. Input to the parser is a stream of 10 A Python program is read by a *parser*. Input to the parser is a stream of
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 394
395 String and Bytes literals 395 String and Bytes literals
396 ------------------------- 396 -------------------------
397 397
398 .. index:: string literal, bytes literal, ASCII 398 .. index:: string literal, bytes literal, ASCII
399 399
400 String literals are described by the following lexical definitions: 400 String literals are described by the following lexical definitions:
401 401
402 .. productionlist:: 402 .. productionlist::
403 stringliteral: [`stringprefix`](`shortstring` | `longstring`) 403 stringliteral: [`stringprefix`](`shortstring` | `longstring`)
404 stringprefix: "r" | "u" | "R" | "U" 404 stringprefix: "r" | "u" | "R" | "U"
405 shortstring: "'" `shortstringitem`* "'" | '"' `shortstringitem`* '"' 405 shortstring: "'" `shortstringitem`* "'" | '"' `shortstringitem`* '"'
406 longstring: "'''" `longstringitem`* "'''" | '"""' `longstringitem`* '"""' 406 longstring: "'''" `longstringitem`* "'''" | '"""' `longstringitem`* '"""'
407 shortstringitem: `shortstringchar` | `stringescapeseq` 407 shortstringitem: `shortstringchar` | `stringescapeseq`
408 longstringitem: `longstringchar` | `stringescapeseq` 408 longstringitem: `longstringchar` | `stringescapeseq`
409 shortstringchar: <any source character except "\" or newline or the quote> 409 shortstringchar: <any source character except "\" or newline or the quote>
410 longstringchar: <any source character except "\"> 410 longstringchar: <any source character except "\">
411 stringescapeseq: "\" <any source character> 411 stringescapeseq: "\" <any source character>
412 412
413 .. productionlist:: 413 .. productionlist::
414 bytesliteral: `bytesprefix`(`shortbytes` | `longbytes`) 414 bytesliteral: `bytesprefix`(`shortbytes` | `longbytes`)
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 literal characters. As a result, in string literals, ``'\U'`` and ``'\u'`` 449 literal characters. As a result, in string literals, ``'\U'`` and ``'\u'``
450 escapes in raw strings are not treated specially. Given that Python 2.x's raw 450 escapes in raw strings are not treated specially. Given that Python 2.x's raw
451 unicode literals behave differently than Python 3.x's the ``'ur'`` syntax 451 unicode literals behave differently than Python 3.x's the ``'ur'`` syntax
452 is not supported. 452 is not supported.
453 453
454 .. versionadded:: 3.3 454 .. versionadded:: 3.3
455 The ``'rb'`` prefix of raw bytes literals has been added as a synonym 455 The ``'rb'`` prefix of raw bytes literals has been added as a synonym
456 of ``'br'``. 456 of ``'br'``.
457 457
458 .. versionadded:: 3.3 458 .. versionadded:: 3.3
459 Support for the unicode legacy literal (``u'value'``) and other 459 Support for the unicode legacy literal (``u'value'``) and other
storchaka 2012/06/20 09:05:59 "other versions" is not true now.
460 versions were reintroduced to simplify the maintenance of dual 460 versions were reintroduced to simplify the maintenance of dual
461 Python 2.x and 3.x codebases. See :pep:`414` for more information. 461 Python 2.x and 3.x codebases. See :pep:`414` for more information.
462 462
463 In triple-quoted strings, unescaped newlines and quotes are allowed (and are 463 In triple-quoted strings, unescaped newlines and quotes are allowed (and are
464 retained), except that three unescaped quotes in a row terminate the string. (A 464 retained), except that three unescaped quotes in a row terminate the string. (A
465 "quote" is the character used to open the string, i.e. either ``'`` or ``"``.) 465 "quote" is the character used to open the string, i.e. either ``'`` or ``"``.)
466 466
467 .. index:: physical line, escape sequence, Standard C, C 467 .. index:: physical line, escape sequence, Standard C, C
468 468
469 Unless an ``'r'`` or ``'R'`` prefix is present, escape sequences in strings are 469 Unless an ``'r'`` or ``'R'`` prefix is present, escape sequences in strings are
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 722
723 The following printing ASCII characters are not used in Python. Their 723 The following printing ASCII characters are not used in Python. Their
724 occurrence outside string literals and comments is an unconditional error:: 724 occurrence outside string literals and comments is an unconditional error::
725 725
726 $ ? ` 726 $ ? `
727 727
728 728
729 .. rubric:: Footnotes 729 .. rubric:: Footnotes
730 730
731 .. [#] http://www.unicode.org/Public/6.1.0/ucd/NameAliases.txt 731 .. [#] http://www.unicode.org/Public/6.1.0/ucd/NameAliases.txt
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7