use std::string::String;
use std::uint;
-#[deriving(Clone, Copy, PartialEq)]
+#[derive(Clone, Copy, PartialEq)]
pub enum CommentStyle {
/// No code on either side of each line of the comment
Isolated,
BlankLine,
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Comment {
pub style: CommentStyle,
pub lines: Vec<String>,
if can_trim {
lines.iter().map(|line| {
- line[i + 1..line.len()].to_string()
+ (&line[i + 1..line.len()]).to_string()
}).collect()
} else {
lines
static ONLINERS: &'static [&'static str] = &["///!", "///", "//!", "//"];
for prefix in ONLINERS.iter() {
if comment.starts_with(*prefix) {
- return comment[prefix.len()..].to_string();
+ return (&comment[prefix.len()..]).to_string();
}
}
let line = rdr.read_one_line_comment();
debug!("{}", line);
// Doc comments are not put in comments.
- if is_doc_comment(line[]) {
+ if is_doc_comment(&line[]) {
break;
}
lines.push(line);
fn trim_whitespace_prefix_and_push_line(lines: &mut Vec<String> ,
s: String, col: CharPos) {
let len = s.len();
- let s1 = match all_whitespace(s[], col) {
+ let s1 = match all_whitespace(&s[], col) {
Some(col) => {
if col < len {
- s[col..len].to_string()
+ (&s[col..len]).to_string()
} else {
"".to_string()
}
rdr.bump();
rdr.bump();
}
- if is_block_doc_comment(curr_line[]) {
+ if is_block_doc_comment(&curr_line[]) {
return
}
assert!(!curr_line.contains_char('\n'));
debug!("<<< consume comment");
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Literal {
pub lit: String,
pub pos: BytePos,