Files
cppdraft_translate/cppdraft/uaxid/def/general.md
2025-10-25 03:02:53 +03:00

44 lines
1.6 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[uaxid.def.general]
# Annex E (informative) Conformance with UAX #31 [[uaxid]](./#uaxid)
## E.2 R1 Default identifiers [[uaxid.def]](uaxid.def#general)
### E.2.1 General [uaxid.def.general]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/uax31.tex#L24)
UAX #31 specifies a default syntax for identifiers
based on properties from the Unicode Character Database, UAX #44[.](#1.sentence-1)
The general syntax is
```
<Identifier> := <Start> <Continue>* (<Medial> <Continue>+)*
```
where <Start> has the XID_Start property,<Continue> has the XID_Continue property, and<Medial> is a list of characters permitted between continue characters[.](#1.sentence-2)
For C++ we add the character U+005f low line, or _,
to the set of permitted <Start> characters,
the <Medial> set is empty, and
the <Continue> characters are unmodified[.](#1.sentence-3)
In the grammar used in UAX #31, this is
```
<Identifier> := <Start> <Continue>*
<Start> := XID_Start + U+005f
<Continue> := <Start> + XID_Continue
```
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/uax31.tex#L45)
This is described in the C++ grammar in [[lex.name]](lex.name "5.11Identifiers"),
where [*identifier*](lex.name#nt:identifier "5.11Identifiers[lex.name]") is formed from[*identifier-start*](lex.name#nt:identifier-start "5.11Identifiers[lex.name]") or[*identifier*](lex.name#nt:identifier "5.11Identifiers[lex.name]") followed by [*identifier-continue*](lex.name#nt:identifier-continue "5.11Identifiers[lex.name]")[.](#2.sentence-1)