次の方法で共有


C 字句文法

トークン

token=
keyword
identifier
constant
string-literal
punctuator

preprocessing-token=
header-name
identifier
pp-number
character-constant
string-literal
punctuator
 上記のいずれでもない空白以外の各文字

キーワード

keyword: 次のいずれか
auto break case char const continue
default do double else enum extern
float for goto if inline int long
register restrict return short signed
sizeof static struct switch typedef union
unsigned void volatile while _Alignas
_Alignof _Atomic _Bool _Complex _Generic
_Imaginary _Noreturn _Static_assert
_Thread_local

その他の Microsoft 固有のキーワードの一覧については、「C キーワード」を参照してください。

識別子

identifier=
identifier-nondigit
identifier identifier-nondigit
identifier digit

identifier-nondigit=
nondigit
universal-character-name
 実装で定義されている他の文字

nondigit: 次のいずれか
_ a b c d e f g h i j k l m
n o p q r s t u v w x y z
A B C D E F G H I J K L M
N O P Q R S T U V W X Y Z

digit: 次のいずれか
0 1 2 3 4 5 6 7 8 9

universal-character-name=
\u hex-quad
\U hex-quad hex-quad

hex-quad=
hexadecimal-digit hexadecimal-digit hexadecimal-digit hexadecimal-digit

定数

constant=
integer-constant
floating-constant
enumeration-constant
character-constant

integer-constant=
decimal-constant integer-suffixopt
binary-constant1 integer-suffixopt
octal-constant integer-suffixopt
hexadecimal-constant integer-suffixopt

decimal-constant=
nonzero-digit
decimal-constant digit

binary-constant:1
binary-prefix binary-digit
binary-constant binary-digit

binary-prefix1: 次のいずれか
0b 0B

binary-digit1: 次のいずれか
0 1

octal-constant=
0
octal-constant octal-digit

hexadecimal-constant=
hexadecimal-prefix hexadecimal-digit
hexadecimal-constant hexadecimal-digit

hexadecimal-prefix: 次のいずれか
0x 0X

nonzero-digit: 次のいずれか
1 2 3 4 5 6 7 8 9

octal-digit: 次のいずれか
0 1 2 3 4 5 6 7

hexadecimal-digit: 次のいずれか
0 1 2 3 4 5 6 7 8 9
a b c d e f
A B C D E F

integer-suffix=
unsigned-suffix long-suffixopt
unsigned-suffix long-long-suffixopt
long-suffix unsigned-suffixopt
long-long-suffix unsigned-suffixopt

unsigned-suffix: 次のいずれか
u U

long-suffix: 次のいずれか
l L

long-long-suffix: 次のいずれか
ll LL

floating-constant=
decimal-floating-constant
hexadecimal-floating-constant

decimal-floating-constant=
fractional-constant exponent-partopt floating-suffixopt
digit-sequence exponent-part floating-suffixopt

hexadecimal-floating-constant=
hexadecimal-prefix hexadecimal-fractional-constant binary-exponent-partopt floating-suffixopt
hexadecimal-prefix hexadecimal-digit-sequence binary-exponent-part floating-suffixopt

fractional-constant=
digit-sequenceopt . digit-sequence
digit-sequence .

exponent-part=
eoptsign digit-sequence
Eoptsign digit-sequence

sign: 次のいずれか
+ -

digit-sequence=
digit
digit-sequence digit

hexadecimal-fractional-constant=
hexadecimal-digit-sequenceopt . hexadecimal-digit-sequence
hexadecimal-digit-sequence .

binary-exponent-part=
poptsign digit-sequence
Poptsign digit-sequence

hexadecimal-digit-sequence=
hexadecimal-digit
hexadecimal-digit-sequence hexadecimal-digit

floating-suffix: 次のいずれか
f l F L

enumeration-constant=
identifier

character-constant=
' c-char-sequence '
L' c-char-sequence '

c-char-sequence=
c-char
c-char-sequence c-char

c-char=
 単一引用符 (')、円記号 (\)、改行文字を除くソース文字セットの任意のメンバー
escape-sequence

escape-sequence=
simple-escape-sequence
octal-escape-sequence
hexadecimal-escape-sequence
universal-character-name

simple-escape-sequence: 次のいずれか
\a \b \f \n \r \t \v
\' \" \\ \?

octal-escape-sequence=
\ octal-digit
\ octal-digit octal-digit
\ octal-digit octal-digit octal-digit

hexadecimal-escape-sequence=
\x hexadecimal-digit
hexadecimal-escape-sequence hexadecimal-digit

文字列リテラル

string-literal=
encoding-prefix " s-char-sequenceopt "

encoding-prefix=
u8
u
U
L

s-char-sequence=
s-char
s-char-sequence s-char

s-char=
 二重引用符 (")、円記号 (\)、改行文字を除くソース文字セットの任意のメンバー
escape-sequence

区切り記号

punctuator: 次のいずれか
[ ] ( ) { } . ->
++ -- & * + - ~ !
/ % << >> < > <= >= ==
!= ^ | && || ? : ; ...
= *= /= %= += -= <<= >>=
&= ^= |= , # ##
<: :> <% %> %: %:%:

ヘッダー名

header-name=
< h-char-sequence >
" q-char-sequence "

h-char-sequence=
h-char
h-char-sequence h-char

h-char=
 改行文字と > を除くソース文字セットの任意のメンバー

q-char-sequence=
q-char
q-char-sequence q-char

q-char=
 改行文字と " を除くソース文字セットの任意のメンバー

プリプロセ番号

pp-number=
digit
. digit
pp-number digit
pp-number identifier-nondigit
pp-number e sign
pp-number E sign
pp-number p sign
pp-number P sign
pp-number .

1 binary-constantbinary-prefixbinary-digit は、Microsoft 固有の拡張機能です。

関連項目

C 言語の構文概要