Files
carbon-lang/docs/design/lexical_conventions
Richard Smith a1655b6858 Tuples and tuple indexing (#3646)
Add support for extracting elements of a tuple by their numerical index.

Also formally add the well-established basic syntactic and semantic
rules for
tuples, for which we have had leads issues but no proposal, into the
design.
2024-01-31 23:42:11 +00:00
..
2024-01-31 23:42:11 +00:00
2023-07-13 18:28:28 +00:00

Lexical conventions

Table of contents

Lexical elements

The first stage of processing a source file is the division of the source file into lexical elements.

A lexical element is one of the following:

The sequence of lexical elements is formed by repeatedly removing the longest initial sequence of characters that forms a valid lexical element, with the following exception:

  • When a numeric literal immediately follows a . or -> token, with no intervening whitespace, a real literal is never formed. Instead, the token will end no later than the next . character. For example, tuple.1.2 is five tokens, tuple . 1 . 2, not three tokens, tuple . 1.2. However, tuple . 1.2 is lexed as three tokens.