[lex.digraph]

# 5 Lexical conventions [[lex]](./#lex)

## 5.9 Alternative tokens [lex.digraph]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lex.tex#L815)

Alternative token representations are provided for some operators and
punctuators[.](#1.sentence-1)[10](#footnote-10 "These include âdigraphsâ and additional reserved words. The term âdigraphâ (token consisting of two characters) is not perfectly descriptive, since one of the alternative preprocessing-tokens is %:%: and of course several primary tokens contain two characters. Nonetheless, those alternative tokens that aren't lexical keywords are colloquially known as âdigraphsâ.")

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lex.tex#L829)

In all respects of the language, each alternative token behaves the
same, respectively, as its primary token, except for its spelling[.](#2.sentence-1)[11](#footnote-11 "Thus the âstringizedâ values ([cpp.stringize]) of [ and &lt;: will be different, maintaining the source spelling, but the tokens can otherwise be freely interchanged.")

The set of alternative tokens is defined in
Table [3](#tab:lex.digraph "Table 3: Alternative tokens")[.](#2.sentence-2)

Table [3](#tab:lex.digraph) — Alternative tokens [[tab:lex.digraph]](./tab:lex.digraph)  

| [ð](#tab:lex.digraph-row-1)<br>**Alternative** | **Primary** | **Alternative** | **Primary** | **Alternative** | **Primary** |
| --- | --- | --- | --- | --- | --- |
| [ð](#tab:lex.digraph-row-2)<br><% | { | and | && | and_eq | &= |
| [ð](#tab:lex.digraph-row-3)<br>%> | } | bitor | | | or_eq | |= |
| [ð](#tab:lex.digraph-row-4)<br><: | [ | or | || | xor_eq | ^= |
| [ð](#tab:lex.digraph-row-5)<br>:> | ] | xor | ^ | not | ! |
| [ð](#tab:lex.digraph-row-6)<br>%: | # | compl | ~ | not_eq | != |
| [ð](#tab:lex.digraph-row-7)<br>%:%: | ## | bitand | & |  |  |

[10)](#footnote-10)[10)](#footnoteref-10)

These include âdigraphsâ and additional reserved words[.](#footnote-10.sentence-1)

The term
âdigraphâ (token consisting of two characters) is not perfectly
descriptive, since one of the alternative [*preprocessing-token*](lex.pptoken#nt:preprocessing-token "5.5 Preprocessing tokens [lex.pptoken]")*s* is%:%: and of course several primary tokens contain two
characters[.](#footnote-10.sentence-2)

Nonetheless, those alternative tokens that aren't lexical
keywords are colloquially known as âdigraphsâ[.](#footnote-10.sentence-3)

[11)](#footnote-11)[11)](#footnoteref-11)

Thus the âstringizedâ values ([[cpp.stringize]](cpp.stringize "15.7.3 The # operator")) of[ and <: will be different, maintaining the source
spelling, but the tokens can otherwise be freely interchanged[.](#footnote-11.sentence-1)
