Skip to content

Block comment grammar #1588

Closed
Closed
@mikesamuel

Description

@mikesamuel

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 ;

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-grammarArea: The grammar of Rust

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions