mozilla/rust — Issue #1588: Block comment grammar
Author: mikesamuel
Created: 2012-01-21 02:47:11+00:00
State: open

http://doc.rust-lang.org/doc/rust.html#comments describes the grammar of block comments as

block_comment : "/*" block_comment_body * "*/" ;
block_comment_body : block_comment | non_star * | '*' non_slash ;

Since non_slash matches '*', this would mean that

/***/

is not a full block comment, because the **/ at the end matches '*' non_slash, and then '/' is left to match non_star.

/***/*/

is a single block comment token.

Perhaps

'*' non_slash

should be

'*'+ non_star_slash

Also, if the block_comment in block_comment_body is meant to allow nested comments, then

non_star *

should probably also use non_star_slash to give the unambiguous

block_comment : "/*" block_comment_body * "*/" ;
block_comment_body : block_comment | ("*" *) non_star_slash ;