153 lines
13 KiB
Markdown
153 lines
13 KiB
Markdown
[gram.cpp]
|
||
|
||
# Annex A (informative) Grammar summary [[gram]](./#gram)
|
||
|
||
## A.13 Preprocessing directives [gram.cpp]
|
||
|
||
[preprocessing-file:](cpp.pre#nt:preprocessing-file "15.1 Preamble [cpp.pre]")
|
||
[*group*](cpp.pre#nt:group "15.1 Preamble [cpp.pre]")opt
|
||
[*module-file*](cpp.pre#nt:module-file "15.1 Preamble [cpp.pre]")
|
||
|
||
[module-file:](cpp.pre#nt:module-file "15.1 Preamble [cpp.pre]")
|
||
[*pp-global-module-fragment*](cpp.pre#nt:pp-global-module-fragment "15.1 Preamble [cpp.pre]")opt [*pp-module*](cpp.module#nt:pp-module "15.5 Module directive [cpp.module]") [*group*](cpp.pre#nt:group "15.1 Preamble [cpp.pre]")opt [*pp-private-module-fragment*](cpp.pre#nt:pp-private-module-fragment "15.1 Preamble [cpp.pre]")opt
|
||
|
||
[pp-global-module-fragment:](cpp.pre#nt:pp-global-module-fragment "15.1 Preamble [cpp.pre]")
|
||
module ; [*new-line*](cpp.pre#nt:new-line "15.1 Preamble [cpp.pre]") [*group*](cpp.pre#nt:group "15.1 Preamble [cpp.pre]")opt
|
||
|
||
[pp-private-module-fragment:](cpp.pre#nt:pp-private-module-fragment "15.1 Preamble [cpp.pre]")
|
||
module : private ; [*new-line*](cpp.pre#nt:new-line "15.1 Preamble [cpp.pre]") [*group*](cpp.pre#nt:group "15.1 Preamble [cpp.pre]")opt
|
||
|
||
[group:](cpp.pre#nt:group "15.1 Preamble [cpp.pre]")
|
||
[*group-part*](cpp.pre#nt:group-part "15.1 Preamble [cpp.pre]")
|
||
[*group*](cpp.pre#nt:group "15.1 Preamble [cpp.pre]") [*group-part*](cpp.pre#nt:group-part "15.1 Preamble [cpp.pre]")
|
||
|
||
[group-part:](cpp.pre#nt:group-part "15.1 Preamble [cpp.pre]")
|
||
[*control-line*](cpp.pre#nt:control-line "15.1 Preamble [cpp.pre]")
|
||
[*if-section*](cpp.pre#nt:if-section "15.1 Preamble [cpp.pre]")
|
||
[*text-line*](cpp.pre#nt:text-line "15.1 Preamble [cpp.pre]")
|
||
# [*conditionally-supported-directive*](cpp.pre#nt:conditionally-supported-directive "15.1 Preamble [cpp.pre]")
|
||
|
||
[control-line:](cpp.pre#nt:control-line "15.1 Preamble [cpp.pre]")
|
||
# include [*pp-tokens*](cpp.pre#nt:pp-tokens "15.1 Preamble [cpp.pre]") [*new-line*](cpp.pre#nt:new-line "15.1 Preamble [cpp.pre]")
|
||
[*pp-import*](cpp.import#nt:pp-import "15.6 Header unit importation [cpp.import]")
|
||
# embed [*pp-tokens*](cpp.pre#nt:pp-tokens "15.1 Preamble [cpp.pre]") [*new-line*](cpp.pre#nt:new-line "15.1 Preamble [cpp.pre]")
|
||
# define [*identifier*](lex.name#nt:identifier "5.11 Identifiers [lex.name]") [*replacement-list*](cpp.pre#nt:replacement-list "15.1 Preamble [cpp.pre]") [*new-line*](cpp.pre#nt:new-line "15.1 Preamble [cpp.pre]")
|
||
# define [*identifier*](lex.name#nt:identifier "5.11 Identifiers [lex.name]") [*lparen*](cpp.pre#nt:lparen "15.1 Preamble [cpp.pre]") [*identifier-list*](cpp.pre#nt:identifier-list "15.1 Preamble [cpp.pre]")opt ) [*replacement-list*](cpp.pre#nt:replacement-list "15.1 Preamble [cpp.pre]") [*new-line*](cpp.pre#nt:new-line "15.1 Preamble [cpp.pre]")
|
||
# define [*identifier*](lex.name#nt:identifier "5.11 Identifiers [lex.name]") [*lparen*](cpp.pre#nt:lparen "15.1 Preamble [cpp.pre]") ... ) [*replacement-list*](cpp.pre#nt:replacement-list "15.1 Preamble [cpp.pre]") [*new-line*](cpp.pre#nt:new-line "15.1 Preamble [cpp.pre]")
|
||
# define [*identifier*](lex.name#nt:identifier "5.11 Identifiers [lex.name]") [*lparen*](cpp.pre#nt:lparen "15.1 Preamble [cpp.pre]") [*identifier-list*](cpp.pre#nt:identifier-list "15.1 Preamble [cpp.pre]") , ... ) [*replacement-list*](cpp.pre#nt:replacement-list "15.1 Preamble [cpp.pre]") [*new-line*](cpp.pre#nt:new-line "15.1 Preamble [cpp.pre]")
|
||
# undef [*identifier*](lex.name#nt:identifier "5.11 Identifiers [lex.name]") [*new-line*](cpp.pre#nt:new-line "15.1 Preamble [cpp.pre]")
|
||
# line [*pp-tokens*](cpp.pre#nt:pp-tokens "15.1 Preamble [cpp.pre]") [*new-line*](cpp.pre#nt:new-line "15.1 Preamble [cpp.pre]")
|
||
# error [*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]")
|
||
# warning [*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]")
|
||
# pragma [*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]")
|
||
# [*new-line*](cpp.pre#nt:new-line "15.1 Preamble [cpp.pre]")
|
||
|
||
[if-section:](cpp.pre#nt:if-section "15.1 Preamble [cpp.pre]")
|
||
[*if-group*](cpp.pre#nt:if-group "15.1 Preamble [cpp.pre]") [*elif-groups*](cpp.pre#nt:elif-groups "15.1 Preamble [cpp.pre]")opt [*else-group*](cpp.pre#nt:else-group "15.1 Preamble [cpp.pre]")opt [*endif-line*](cpp.pre#nt:endif-line "15.1 Preamble [cpp.pre]")
|
||
|
||
[if-group:](cpp.pre#nt:if-group "15.1 Preamble [cpp.pre]")
|
||
# if [*constant-expression*](expr.const#nt:constant-expression "7.7 Constant expressions [expr.const]") [*new-line*](cpp.pre#nt:new-line "15.1 Preamble [cpp.pre]") [*group*](cpp.pre#nt:group "15.1 Preamble [cpp.pre]")opt
|
||
# ifdef [*identifier*](lex.name#nt:identifier "5.11 Identifiers [lex.name]") [*new-line*](cpp.pre#nt:new-line "15.1 Preamble [cpp.pre]") [*group*](cpp.pre#nt:group "15.1 Preamble [cpp.pre]")opt
|
||
# ifndef [*identifier*](lex.name#nt:identifier "5.11 Identifiers [lex.name]") [*new-line*](cpp.pre#nt:new-line "15.1 Preamble [cpp.pre]") [*group*](cpp.pre#nt:group "15.1 Preamble [cpp.pre]")opt
|
||
|
||
[elif-groups:](cpp.pre#nt:elif-groups "15.1 Preamble [cpp.pre]")
|
||
[*elif-group*](cpp.pre#nt:elif-group "15.1 Preamble [cpp.pre]") [*elif-groups*](cpp.pre#nt:elif-groups "15.1 Preamble [cpp.pre]")opt
|
||
|
||
[elif-group:](cpp.pre#nt:elif-group "15.1 Preamble [cpp.pre]")
|
||
# elif [*constant-expression*](expr.const#nt:constant-expression "7.7 Constant expressions [expr.const]") [*new-line*](cpp.pre#nt:new-line "15.1 Preamble [cpp.pre]") [*group*](cpp.pre#nt:group "15.1 Preamble [cpp.pre]")opt
|
||
# elifdef [*identifier*](lex.name#nt:identifier "5.11 Identifiers [lex.name]") [*new-line*](cpp.pre#nt:new-line "15.1 Preamble [cpp.pre]") [*group*](cpp.pre#nt:group "15.1 Preamble [cpp.pre]")opt
|
||
# elifndef [*identifier*](lex.name#nt:identifier "5.11 Identifiers [lex.name]") [*new-line*](cpp.pre#nt:new-line "15.1 Preamble [cpp.pre]") [*group*](cpp.pre#nt:group "15.1 Preamble [cpp.pre]")opt
|
||
|
||
[else-group:](cpp.pre#nt:else-group "15.1 Preamble [cpp.pre]")
|
||
# else [*new-line*](cpp.pre#nt:new-line "15.1 Preamble [cpp.pre]") [*group*](cpp.pre#nt:group "15.1 Preamble [cpp.pre]")opt
|
||
|
||
[endif-line:](cpp.pre#nt:endif-line "15.1 Preamble [cpp.pre]")
|
||
# endif [*new-line*](cpp.pre#nt:new-line "15.1 Preamble [cpp.pre]")
|
||
|
||
[text-line:](cpp.pre#nt:text-line "15.1 Preamble [cpp.pre]")
|
||
[*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]")
|
||
|
||
[conditionally-supported-directive:](cpp.pre#nt:conditionally-supported-directive "15.1 Preamble [cpp.pre]")
|
||
[*pp-tokens*](cpp.pre#nt:pp-tokens "15.1 Preamble [cpp.pre]") [*new-line*](cpp.pre#nt:new-line "15.1 Preamble [cpp.pre]")
|
||
|
||
[lparen:](cpp.pre#nt:lparen "15.1 Preamble [cpp.pre]")
|
||
a ( character not immediately preceded by whitespace
|
||
|
||
[identifier-list:](cpp.pre#nt:identifier-list "15.1 Preamble [cpp.pre]")
|
||
[*identifier*](lex.name#nt:identifier "5.11 Identifiers [lex.name]")
|
||
[*identifier-list*](cpp.pre#nt:identifier-list "15.1 Preamble [cpp.pre]") , [*identifier*](lex.name#nt:identifier "5.11 Identifiers [lex.name]")
|
||
|
||
[replacement-list:](cpp.pre#nt:replacement-list "15.1 Preamble [cpp.pre]")
|
||
[*pp-tokens*](cpp.pre#nt:pp-tokens "15.1 Preamble [cpp.pre]")opt
|
||
|
||
[pp-tokens:](cpp.pre#nt:pp-tokens "15.1 Preamble [cpp.pre]")
|
||
[*preprocessing-token*](lex.pptoken#nt:preprocessing-token "5.5 Preprocessing tokens [lex.pptoken]") [*pp-tokens*](cpp.pre#nt:pp-tokens "15.1 Preamble [cpp.pre]")opt
|
||
|
||
[embed-parameter-seq:](cpp.pre#nt:embed-parameter-seq "15.1 Preamble [cpp.pre]")
|
||
[*embed-parameter*](cpp.pre#nt:embed-parameter "15.1 Preamble [cpp.pre]") [*embed-parameter-seq*](cpp.pre#nt:embed-parameter-seq "15.1 Preamble [cpp.pre]")opt
|
||
|
||
[embed-parameter:](cpp.pre#nt:embed-parameter "15.1 Preamble [cpp.pre]")
|
||
[*embed-standard-parameter*](cpp.pre#nt:embed-standard-parameter "15.1 Preamble [cpp.pre]")
|
||
[*embed-prefixed-parameter*](cpp.pre#nt:embed-prefixed-parameter "15.1 Preamble [cpp.pre]")
|
||
|
||
[embed-standard-parameter:](cpp.pre#nt:embed-standard-parameter "15.1 Preamble [cpp.pre]")
|
||
limit ( [*pp-balanced-token-seq*](cpp.pre#nt:pp-balanced-token-seq "15.1 Preamble [cpp.pre]") )
|
||
prefix ( [*pp-balanced-token-seq*](cpp.pre#nt:pp-balanced-token-seq "15.1 Preamble [cpp.pre]")opt )
|
||
suffix ( [*pp-balanced-token-seq*](cpp.pre#nt:pp-balanced-token-seq "15.1 Preamble [cpp.pre]")opt )
|
||
if_empty ( [*pp-balanced-token-seq*](cpp.pre#nt:pp-balanced-token-seq "15.1 Preamble [cpp.pre]")opt )
|
||
|
||
[embed-prefixed-parameter:](cpp.pre#nt:embed-prefixed-parameter "15.1 Preamble [cpp.pre]")
|
||
[*identifier*](lex.name#nt:identifier "5.11 Identifiers [lex.name]") :: [*identifier*](lex.name#nt:identifier "5.11 Identifiers [lex.name]")
|
||
[*identifier*](lex.name#nt:identifier "5.11 Identifiers [lex.name]") :: [*identifier*](lex.name#nt:identifier "5.11 Identifiers [lex.name]") ( [*pp-balanced-token-seq*](cpp.pre#nt:pp-balanced-token-seq "15.1 Preamble [cpp.pre]")opt )
|
||
|
||
[pp-balanced-token-seq:](cpp.pre#nt:pp-balanced-token-seq "15.1 Preamble [cpp.pre]")
|
||
[*pp-balanced-token*](cpp.pre#nt:pp-balanced-token "15.1 Preamble [cpp.pre]") [*pp-balanced-token-seq*](cpp.pre#nt:pp-balanced-token-seq "15.1 Preamble [cpp.pre]")opt
|
||
|
||
[pp-balanced-token:](cpp.pre#nt:pp-balanced-token "15.1 Preamble [cpp.pre]")
|
||
( [*pp-balanced-token-seq*](cpp.pre#nt:pp-balanced-token-seq "15.1 Preamble [cpp.pre]")opt )
|
||
[ [*pp-balanced-token-seq*](cpp.pre#nt:pp-balanced-token-seq "15.1 Preamble [cpp.pre]")opt ]
|
||
{ [*pp-balanced-token-seq*](cpp.pre#nt:pp-balanced-token-seq "15.1 Preamble [cpp.pre]")opt }
|
||
any pp-token except:
|
||
parenthesis (U+0028 left parenthesis and U+0029 right parenthesis),
|
||
bracket (U+005b left square bracket and U+005d right square bracket), or
|
||
brace (U+007b left curly bracket and U+007d right curly bracket).
|
||
|
||
[new-line:](cpp.pre#nt:new-line "15.1 Preamble [cpp.pre]")
|
||
the new-line character
|
||
|
||
[defined-macro-expression:](cpp.cond#nt:defined-macro-expression "15.2 Conditional inclusion [cpp.cond]")
|
||
defined [*identifier*](lex.name#nt:identifier "5.11 Identifiers [lex.name]")
|
||
defined ( [*identifier*](lex.name#nt:identifier "5.11 Identifiers [lex.name]") )
|
||
|
||
[h-preprocessing-token:](cpp.cond#nt:h-preprocessing-token "15.2 Conditional inclusion [cpp.cond]")
|
||
any [*preprocessing-token*](lex.pptoken#nt:preprocessing-token "5.5 Preprocessing tokens [lex.pptoken]") other than >
|
||
|
||
[h-pp-tokens:](cpp.cond#nt:h-pp-tokens "15.2 Conditional inclusion [cpp.cond]")
|
||
[*h-preprocessing-token*](cpp.cond#nt:h-preprocessing-token "15.2 Conditional inclusion [cpp.cond]") [*h-pp-tokens*](cpp.cond#nt:h-pp-tokens "15.2 Conditional inclusion [cpp.cond]")opt
|
||
|
||
[header-name-tokens:](cpp.cond#nt:header-name-tokens "15.2 Conditional inclusion [cpp.cond]")
|
||
[*string-literal*](lex.string#nt:string-literal "5.13.5 String literals [lex.string]")
|
||
< [*h-pp-tokens*](cpp.cond#nt:h-pp-tokens "15.2 Conditional inclusion [cpp.cond]") >
|
||
|
||
[has-include-expression:](cpp.cond#nt:has-include-expression "15.2 Conditional inclusion [cpp.cond]")
|
||
__has_include ( [*header-name*](lex.header#nt:header-name "5.6 Header names [lex.header]") )
|
||
__has_include ( [*header-name-tokens*](cpp.cond#nt:header-name-tokens "15.2 Conditional inclusion [cpp.cond]") )
|
||
|
||
[has-embed-expression:](cpp.cond#nt:has-embed-expression "15.2 Conditional inclusion [cpp.cond]")
|
||
__has_embed ( [*header-name*](lex.header#nt:header-name "5.6 Header names [lex.header]") [*pp-balanced-token-seq*](cpp.pre#nt:pp-balanced-token-seq "15.1 Preamble [cpp.pre]")opt )
|
||
__has_embed ( [*header-name-tokens*](cpp.cond#nt:header-name-tokens "15.2 Conditional inclusion [cpp.cond]") [*pp-balanced-token-seq*](cpp.pre#nt:pp-balanced-token-seq "15.1 Preamble [cpp.pre]")opt )
|
||
|
||
[has-attribute-expression:](cpp.cond#nt:has-attribute-expression "15.2 Conditional inclusion [cpp.cond]")
|
||
__has_cpp_attribute ( [*pp-tokens*](cpp.pre#nt:pp-tokens "15.1 Preamble [cpp.pre]") )
|
||
|
||
[pp-module:](cpp.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]")
|
||
|
||
[pp-import:](cpp.import#nt:pp-import "15.6 Header unit importation [cpp.import]")
|
||
exportopt import [*header-name*](lex.header#nt:header-name "5.6 Header names [lex.header]") [*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]")
|
||
exportopt import [*header-name-tokens*](cpp.cond#nt:header-name-tokens "15.2 Conditional inclusion [cpp.cond]") [*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]")
|
||
exportopt import [*pp-tokens*](cpp.pre#nt:pp-tokens "15.1 Preamble [cpp.pre]") ; [*new-line*](cpp.pre#nt:new-line "15.1 Preamble [cpp.pre]")
|
||
|
||
[va-opt-replacement:](cpp.subst#nt:va-opt-replacement "15.7.2 Argument substitution [cpp.subst]")
|
||
__VA_OPT__ ( [*pp-tokens*](cpp.pre#nt:pp-tokens "15.1 Preamble [cpp.pre]")opt )
|