[cpp.module]

# 15 Preprocessing directives [[cpp]](./#cpp)

## 15.5 Module directive [cpp.module]

[pp-module:](#nt:pp-module "15.5 Module directive [cpp.module]")  
exportopt module [*pp-tokens*](cpp.pre#nt:pp-tokens "15.1 Preamble [cpp.pre]")opt ; [*new-line*](cpp.pre#nt:new-line "15.1 Preamble [cpp.pre]")

[1](#1)

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

A [*pp-module*](#nt:pp-module "15.5 Module directive [cpp.module]") shall not
appear in a context where module or (if it is the first preprocessing token of the [*pp-module*](#nt:pp-module "15.5 Module directive [cpp.module]")) export is an identifier defined as an object-like macro[.](#1.sentence-1)

[2](#2)

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

The [*pp-tokens*](cpp.pre#nt:pp-tokens "15.1 Preamble [cpp.pre]"), if any, of a [*pp-module*](#nt:pp-module "15.5 Module directive [cpp.module]") shall be of the form:

[*pp-module-name*](#nt:pp-module-name "15.5 Module directive [cpp.module]") [*pp-module-partition*](#nt:pp-module-partition "15.5 Module directive [cpp.module]")opt [*pp-tokens*](cpp.pre#nt:pp-tokens "15.1 Preamble [cpp.pre]")opt

where the [*pp-tokens*](cpp.pre#nt:pp-tokens "15.1 Preamble [cpp.pre]") (if any) shall not begin with
a ( preprocessing token and
the grammar non-terminals are defined as:

[pp-module-name:](#nt:pp-module-name "15.5 Module directive [cpp.module]")  
[*pp-module-name-qualifier*](#nt:pp-module-name-qualifier "15.5 Module directive [cpp.module]")opt [*identifier*](lex.name#nt:identifier "5.11 Identifiers [lex.name]")

[pp-module-partition:](#nt:pp-module-partition "15.5 Module directive [cpp.module]")  
: [*pp-module-name-qualifier*](#nt:pp-module-name-qualifier "15.5 Module directive [cpp.module]")opt [*identifier*](lex.name#nt:identifier "5.11 Identifiers [lex.name]")

[pp-module-name-qualifier:](#nt:pp-module-name-qualifier "15.5 Module directive [cpp.module]")  
[*identifier*](lex.name#nt:identifier "5.11 Identifiers [lex.name]") .  
[*pp-module-name-qualifier*](#nt:pp-module-name-qualifier "15.5 Module directive [cpp.module]") [*identifier*](lex.name#nt:identifier "5.11 Identifiers [lex.name]") .

No [*identifier*](lex.name#nt:identifier "5.11 Identifiers [lex.name]") in
the [*pp-module-name*](#nt:pp-module-name "15.5 Module directive [cpp.module]") or [*pp-module-partition*](#nt:pp-module-partition "15.5 Module directive [cpp.module]") shall currently be defined as an object-like macro[.](#2.sentence-1)

[3](#3)

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

Any preprocessing tokens after the module preprocessing token
in the module directive are processed just as in normal text[.](#3.sentence-1)

[*Note [1](#note-1)*:

Each identifier currently defined as a macro name
is replaced by its replacement list of preprocessing tokens[.](#3.sentence-2)

â *end note*]

[4](#4)

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

The module and export (if it exists) preprocessing tokens
are replaced by the *module-keyword* and*export-keyword* preprocessing tokens respectively[.](#4.sentence-1)

[*Note [2](#note-2)*:

This makes the line no longer a directive
so it is not removed at the end of phase 4[.](#4.sentence-2)

â *end note*]
