白色 space 是否被视为 C 类语言中的标记?
Is white space considered a token in C like languages?
白色 space 是否被视为类 C 语言中的一种标记(特别是对 C 特别感兴趣)? K&R 中的参考手册对此似乎有些含糊。
不,白色 space 不会被视为令牌。来自http://c0x.coding-guidelines.com/6.4.html(草案标准文本,遗憾的是实际标准要花钱而且没有公开link):
token:
keyword
identifier
constant
string-literal
punctuator
preprocessing-token:
header-name
identifier
pp-number
character-constant
string-literal
punctuator
each non-white-space character that cannot be one of the above
GCC does not consider white space tokens:
White space separates tokens; it is not itself a token of any kind.
Tokens do not have to be separated by white space, but it is often
necessary to avoid ambiguities.
也不 Visual Studio:
Tokens are delimited (bounded) by white-space characters and by other
tokens, such as operators and punctuation. When parsing code, the C
compiler ignores white-space characters unless you use them as
separators or as components of character constants or string literals.
K&R A2.1 Tokens 可能有歧义,但符合这些文本:
There are six classes of tokens: identifiers, keywords, constants,
string literals, operators, and other separators. Blanks, horizontal
and vertical tabs, newlines formfeeds, and comments as described below
(collectively, "white space") are ignored except as they separate
tokens.
白色 space 是否被视为类 C 语言中的一种标记(特别是对 C 特别感兴趣)? K&R 中的参考手册对此似乎有些含糊。
不,白色 space 不会被视为令牌。来自http://c0x.coding-guidelines.com/6.4.html(草案标准文本,遗憾的是实际标准要花钱而且没有公开link):
token: keyword identifier constant string-literal punctuator preprocessing-token: header-name identifier pp-number character-constant string-literal punctuator each non-white-space character that cannot be one of the above
GCC does not consider white space tokens:
White space separates tokens; it is not itself a token of any kind. Tokens do not have to be separated by white space, but it is often necessary to avoid ambiguities.
也不 Visual Studio:
Tokens are delimited (bounded) by white-space characters and by other tokens, such as operators and punctuation. When parsing code, the C compiler ignores white-space characters unless you use them as separators or as components of character constants or string literals.
K&R A2.1 Tokens 可能有歧义,但符合这些文本:
There are six classes of tokens: identifiers, keywords, constants, string literals, operators, and other separators. Blanks, horizontal and vertical tabs, newlines formfeeds, and comments as described below (collectively, "white space") are ignored except as they separate tokens.