Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
lexical_analysis also uses python-grammar
  • Loading branch information
vstinner committed Sep 17, 2020
commit 4fbcb97c4b64088737b84267a4bcea017865dfc4
14 changes: 7 additions & 7 deletions Doc/reference/lexical_analysis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ Unicode Character Database as included in the :mod:`unicodedata` module.

Identifiers are unlimited in length. Case is significant.

.. productionlist:: lexical-analysis
.. productionlist:: python-grammar
identifier: `xid_start` `xid_continue`*
id_start: <all characters in general categories Lu, Ll, Lt, Lm, Lo, Nl, the underscore, and characters with the Other_ID_Start property>
id_continue: <all characters in `id_start`, plus characters in the categories Mn, Mc, Nd, Pc and others with the Other_ID_Continue property>
Expand Down Expand Up @@ -412,7 +412,7 @@ String and Bytes literals

String literals are described by the following lexical definitions:

.. productionlist:: lexical-analysis
.. productionlist:: python-grammar
stringliteral: [`stringprefix`](`shortstring` | `longstring`)
stringprefix: "r" | "u" | "R" | "U" | "f" | "F"
: | "fr" | "Fr" | "fR" | "FR" | "rf" | "rF" | "Rf" | "RF"
Expand All @@ -424,7 +424,7 @@ String literals are described by the following lexical definitions:
longstringchar: <any source character except "\">
stringescapeseq: "\" <any source character>

.. productionlist:: lexical-analysis
.. productionlist:: python-grammar
bytesliteral: `bytesprefix`(`shortbytes` | `longbytes`)
bytesprefix: "b" | "B" | "br" | "Br" | "bR" | "BR" | "rb" | "rB" | "Rb" | "RB"
shortbytes: "'" `shortbytesitem`* "'" | '"' `shortbytesitem`* '"'
Expand Down Expand Up @@ -659,7 +659,7 @@ Escape sequences are decoded like in ordinary string literals (except when
a literal is also marked as a raw string). After decoding, the grammar
for the contents of the string is:

.. productionlist:: lexical-analysis
.. productionlist:: python-grammar
f_string: (`literal_char` | "{{" | "}}" | `replacement_field`)*
replacement_field: "{" `f_expression` ["="] ["!" `conversion`] [":" `format_spec`] "}"
f_expression: (`conditional_expression` | "*" `or_expr`)
Expand Down Expand Up @@ -820,7 +820,7 @@ Integer literals

Integer literals are described by the following lexical definitions:

.. productionlist:: lexical-analysis
.. productionlist:: python-grammar
integer: `decinteger` | `bininteger` | `octinteger` | `hexinteger`
decinteger: `nonzerodigit` (["_"] `digit`)* | "0"+ (["_"] "0")*
bininteger: "0" ("b" | "B") (["_"] `bindigit`)+
Expand Down Expand Up @@ -864,7 +864,7 @@ Floating point literals

Floating point literals are described by the following lexical definitions:

.. productionlist:: lexical-analysis
.. productionlist:: python-grammar
floatnumber: `pointfloat` | `exponentfloat`
pointfloat: [`digitpart`] `fraction` | `digitpart` "."
exponentfloat: (`digitpart` | `pointfloat`) `exponent`
Expand Down Expand Up @@ -894,7 +894,7 @@ Imaginary literals

Imaginary literals are described by the following lexical definitions:

.. productionlist:: lexical-analysis
.. productionlist:: python-grammar
imagnumber: (`floatnumber` | `digitpart`) ("j" | "J")

An imaginary literal yields a complex number with a real part of 0.0. Complex
Expand Down