Change:
Currently we don't support nested block comments. This allows lexing to be regular, but it widely seen as an inconvenience. Modify the lexer to keep track of comment nesting. Nominating backcompat.
I thought we were going to grow a macro to handle block quotes. Did that ever get implemented?
I don't know what you mean by block quotes.
Accepted for feature-complete
Don't line comments address pretty much all uses of nested block comments?
by block quote, I mean in the style of CPP's to allow for nesting comments. Something like this:
From what I've gathered from the code, there are two implementations of the comment parsing, one of which supports nested comments, so I guess should be fixed before this bug.
That's pretty funny that the pretty printer already supports nested comments. I don't think they necessarily have to be merged to fix this bug, though our lexing is a bit of a mess.
Are you going to tackle this?
If there's no massive refactoring to do, I can try! Expect a PR soon.
The reference manual says "Comments in Rust code follow the general C++ style of line and block-comment forms, with no nesting of block-comment delimiters" ... right after production rules for nested comments.
looks like it was forgotten to be updated, thanks for noticing! (I opened )

Discussion:
priv todo: ~[(Path,uint)] } <del> /** * Return an iterator that produces all the Paths that match the given pattern, * which may be absolute or relative to the current working directory. * * This method uses the default match options and is equivalent to calling * `glob_with(pattern, MatchOptions::new())`. Use `glob_with` directly if you * want to use non-default match options. * * # Example * * Consider a directory `/media/pictures` containing only the files `kittens.jpg`, * `puppies.jpg` and `hamsters.gif`: * * ```rust * for path in glob("/media/pictures/*.jpg") { *     println(path.to_str()); * } * ``` * * The above code will print: * * ``` * /media/pictures/kittens.jpg * /media/pictures/puppies.jpg * ``` */ </del> <ins> /// /// Return an iterator that produces all the Paths that match the given pattern, /// which may be absolute or relative to the current working directory. /// /// is method uses the default match options and is equivalent to calling /// `glob_with(pattern, MatchOptions::new())`. Use `glob_with` directly if you /// want to use non-default match options. /// /// # Example /// /// Consider a directory `/media/pictures` containing only the files `kittens.jpg`, /// `puppies.jpg` and `hamsters.gif`: /// /// ```rust /// for path in glob("/media/pictures/*.jpg") { ///     println(path.to_str()); /// } /// ``` /// /// The above code will print: /// /// ``` /// /media/pictures/kittens.jpg /// /media/pictures/puppies.jpg /// ``` /// </ins> pub fn glob(pattern: &str) -> GlobIterator { glob_with(pattern, MatchOptions::new()) }

load_self().and_then(|path| Path::new_opt(path).map(|mut p| { p.pop(); p })) } <del> /** * Returns the path to the user's home directory, if known. } </del> /** * Returns the path to the user's home directory, if known. *

fn consume_block_comment(rdr: @mut StringReader) -> Option<TokenAndSpan> { // block comments starting with "/**" or "/*!" are doc-comments <del> let res = if rdr.curr == '*' || rdr.curr == '!' { let start_bpos = rdr.pos - BytePos(3u); while !(rdr.curr == '*' && nextch(rdr) == '/') && !is_eof(rdr) { bump(rdr); } </del> <ins> let is_doc_comment = rdr.curr == '*' || rdr.curr == '!'; let start_bpos = rdr.pos - BytePos(if is_doc_comment {3u} else {2u}); let mut level: int = 1; while level > 0 { </ins> if is_eof(rdr) { <del> fatal_span(rdr, start_bpos, rdr.last_pos, ~"unterminated block doc-comment"); } else { </del> <ins> let msg = if is_doc_comment { ~"unterminated block doc-comment" } else { ~"unterminated block comment" }; fatal_span(rdr, start_bpos, rdr.last_pos, msg); } else if rdr.curr == '/' && nextch(rdr) == '*' { level += 1; </ins> bump(rdr); bump(rdr); <del> do with_str_from(rdr, start_bpos) |string| { // but comments with only "*"s between two "/"s are not if !is_block_non_doc_comment(string) { Some(TokenAndSpan{ tok: token::DOC_COMMENT(str_to_ident(string)), sp: codemap::mk_sp(start_bpos, rdr.pos) }) } else { None } } </del> <ins> } else if rdr.curr == '*' && nextch(rdr) == '/' { level -= 1; bump(rdr); bump(rdr); } else { bump(rdr); </ins> } <del> } else { let start_bpos = rdr.last_pos - BytePos(2u); loop { if is_eof(rdr) { fatal_span(rdr, start_bpos, rdr.last_pos, ~"unterminated block comment"); } if rdr.curr == '*' && nextch(rdr) == '/' { bump(rdr); bump(rdr); break; </del> <ins> } let res = if is_doc_comment { do with_str_from(rdr, start_bpos) |string| { // but comments with only "*"s between two "/"s are not if !is_block_non_doc_comment(string) { Some(TokenAndSpan{ tok: token::DOC_COMMENT(str_to_ident(string)), sp: codemap::mk_sp(start_bpos, rdr.pos) }) </ins> } else { <del> bump(rdr); </del> <ins> None </ins> } } <ins> } else { </ins> None }; <del> // restart whitespace munch. if res.is_some() { res } else { consume_whitespace_and_comments(rdr) } </del> <ins> // restart whitespace munch. if res.is_some() { res } else { consume_whitespace_and_comments(rdr) } </ins> } fn scan_exponent(rdr: @mut StringReader, start_bpos: BytePos) -> Option<~str> {

assert!(!is_line_non_doc_comment("/// blah")); assert!(is_line_non_doc_comment("////")); } <ins> #[test] fn nested_block_comments() { let env = setup(@"/* /* */ */'a'"); let TokenAndSpan {tok, sp: _} = env.string_reader.next_token(); assert_eq!(tok,token::LIT_CHAR('a' as u32)); } </ins> }

<del> // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // error-pattern: /* This is a test to ensure that we do _not_ support nested/balanced comments. I know you might be thinking "but nested comments are cool", and that would be a valid point, but they are also a thing that would make our lexical syntax non-regular, and we do not want that to be true. omitting-things at a higher level (tokens) should be done via token-trees / macros, not comments. /* fail here */ */ fn main() { } </del>

<ins> // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. /* This test checks that nested comments are supported /* This should not fail */ */ pub fn main() { } </ins>