May 27, 2007

ECMA-262试译:7.4 Comments

7.4 注释

描述

注释可以是单行或多行的。多行注释不能自包含。

由于单行注释可以包含除行结束符之外的任何字符①。根据常规,托肯总是进行最长匹配,所以单行 注释总是由从 // 开始到行末结束的所有字符组成。不过,行尾的行结束符不被识别为单行注释的一部分;它被词法文法识别为分隔符,并 成为给语法文法提供的输入元素流的一部分。这一点非常重要,因为这意味着单行注释的存在与否对自动分号插入的过程没有影响。

除非多行注释中包含有一个行结束字符,导致整个注释被语法文法解析为一个行 结束符,否则抛弃注释,行为类似空白字符。

语法

注释::
多行注释
单行注释

多行注释::
/*
多行注释字符集opt */

多行注释字符集::
多行注释非星号字符 多行注释字符集opt

*
后置星号注释字符opt

后置星号注释字符::
多行非斜杠或星号字符 多行注释字符集opt
*
后星号注释字符opt

多行非星号字符::
源代码字符 but not 星号 *

多行非正斜杠或星号字符::
源代码字符 but not 正斜杠 /or 星号*

单行注释::
//
单行注释字符集opt

单行注释字符集::
单行注释字符 单行注释字符集opt

单行注释字符::
源代码字符
but not 行结束符


①此句有歧义,正确意思是"单行注释直到行末"。

5 comments:

Anonymous said...

wow gold site: wow goldwow goldwow gold

Anonymous said...

soma drug buy soma everwear tires - generic soma imprints

Anonymous said...

Thanks for sharing such a pleasant idea, paragraph is nice, thats why i
have read it entirely

Feel free to surf to my website ... league of legends hack

Anonymous said...

It's an awesome paragraph designed for all the internet people; they will get benefit from it I am sure.

My web site - World Of Tanks Hack

Anonymous said...

Hmm it seems like your blog ate my first comment
(it was extremely long) so I guess I'll just sum it up what I wrote and say, I'm thoroughly enjoying your blog.
I too am an aspiring blog writer but I'm still new to the whole thing. Do you have any tips for rookie blog writers? I'd certainly appreciate
it.

Here is my blog post ... Minecraft Crack