Merge pull request #2160 from rtfeldman/editor-comments

support tld comments in docs and editor(reading only)
This commit is contained in:
Anton-4 2022-02-10 11:49:10 +01:00 committed by GitHub
commit d6681f4e0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 287 additions and 84 deletions

View file

@ -406,6 +406,15 @@ impl<'a> CommentOrNewline<'a> {
DocComment(_) => false,
}
}
pub fn to_string_repr(&self) -> std::string::String {
use CommentOrNewline::*;
match self {
Newline => "\n".to_owned(),
LineComment(comment_str) => format!("#{}", comment_str),
DocComment(comment_str) => format!("##{}", comment_str),
}
}
}
#[derive(Clone, Copy, Debug, PartialEq)]