aboutsummaryrefslogtreecommitdiff
path: root/doc/sphinx/language/core
diff options
context:
space:
mode:
authorHugo Herbelin2020-05-15 16:51:29 +0200
committerHugo Herbelin2020-05-15 16:51:29 +0200
commita5c9ad83071c99110fed464a0b9a0f5e73f1be9b (patch)
tree4e436ada97fc8e74311e8c77312e164772957ac9 /doc/sphinx/language/core
parentb5b6e2d4c8347cb25da6f827a6b6f06cb0f566e5 (diff)
parent31f5e89eaefcff04a04850d77b0c83cb24602f98 (diff)
Merge PR #11948: Hexadecimal numerals
Reviewed-by: JasonGross Ack-by: Zimmi48 Ack-by: herbelin
Diffstat (limited to 'doc/sphinx/language/core')
-rw-r--r--doc/sphinx/language/core/basic.rst19
1 files changed, 14 insertions, 5 deletions
diff --git a/doc/sphinx/language/core/basic.rst b/doc/sphinx/language/core/basic.rst
index aa93b4d21f..250a0f0326 100644
--- a/doc/sphinx/language/core/basic.rst
+++ b/doc/sphinx/language/core/basic.rst
@@ -111,18 +111,27 @@ Identifiers
Numerals
Numerals are sequences of digits with an optional fractional part
- and exponent, optionally preceded by a minus sign. :n:`@int` is an integer;
- a numeral without fractional or exponent parts. :n:`@num` is a non-negative
+ and exponent, optionally preceded by a minus sign. Hexadecimal numerals
+ start with ``0x`` or ``0X``. :n:`@int` is an integer;
+ a numeral without fractional nor exponent parts. :n:`@num` is a non-negative
integer. Underscores embedded in the digits are ignored, for example
``1_000_000`` is the same as ``1000000``.
.. insertprodn numeral digit
.. prodn::
- numeral ::= {+ @digit } {? . {+ @digit } } {? {| e | E } {? {| + | - } } {+ @digit } }
- int ::= {? - } {+ @digit }
- num ::= {+ @digit }
digit ::= 0 .. 9
+ digitu ::= {| @digit | _ }
+ hexdigit ::= {| 0 .. 9 | a..f | A..F }
+ hexdigitu ::= {| @hexdigit | _ }
+ decnum ::= @digit {* @digitu }
+ hexnum ::= {| 0x | 0X } @hexdigit {* @hexdigitu }
+ num ::= {| @decnum | @hexnum }
+ sign ::= {| + | - }
+ int ::= {? - } @num
+ decimal ::= @decnum {? . {+ @digitu } } {? {| e | E } {? @sign } @decnum }
+ hexadecimal ::= @hexnum {? . {+ @hexdigitu } } {? {| p | P } {? @sign } @decnum }
+ numeral ::= {? - } {| @decimal | @hexadecimal }
Strings
Strings begin and end with ``"`` (double quote). Use ``""`` to represent