W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
注釋可以是單行或多行。多行注釋不能嵌套。
因為單行注釋可以包含除了 LineTerminator 字符之外的任何字符,又因為有一般規(guī)則:一個 token 總是盡可能匹配更長,所以一個單行注釋總是包含從 // 到行終結符之間的所有字符。然而,在該行末尾的 LineTerminator 不被看成是單行注釋的一部分,它被詞法文法識別成語法文法輸入元素流的一部分。這一點非常重要,因為這意味著是否存在單行注釋都不影響自動分號插入進程(見 7.9)。
像空白一樣,注釋會被語法文法簡單丟棄,除了 MultiLineComment 包含行終結符字符的情況,這種情況下整個注釋會當作一個 LineTerminator 提供給語法文法解析。
語法:
Comment ::
MultiLineComment
SingleLineComment
MultiLineComment ::
/* MultiLineCommentCharsopt*/
MultiLineCommentChars ::
MultiLineNotAsteriskChar MultiLineCommentCharsopt
* PostAsteriskCommentCharsopt
PostAsteriskCommentChars ::
MultiLineNotForwardSlashOrAsteriskChar MultiLineCommentCharsopt
* PostAsteriskCommentCharsopt
MultiLineNotAsteriskChar ::
SourceCharacter but not asterisk *
MultiLineNotForwardSlashOrAsteriskChar ::
SourceCharacter but not forward-slash / or asterisk *
SingleLineComment ::
// SingleLineCommentCharsopt
SingleLineCommentChars ::
SingleLineCommentChar SingleLineCommentCharsopt
SingleLineCommentChar ::
SourceCharacter but not LineTerminator
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: