syntex_syntax 0.9.0

Export of libsyntax for code generation
b0VIM 7.4��U�\~ericktErick-Tryzelaar-MBP.local~erickt/projects/rust/rust-syntex/syntex_syntax/src/parse/lexer/comments.rsutf-8
3210#"! Utpwzxg�UYad�w�{XU��M)(	�
�
�
�
h
=
+



�����l^/!�������vY='%$�
�
�
l
S
Q
P

�	�	�	�	q	k	i	h	)	���vA!�����|6�����M9/���_> ��v[I+���u_D2$�������sM��            }).collect()                (&line[i + 1..line.len()]).to_string()            lines.iter().map(|line| {        if can_trim {        }            }                break;            if !can_trim {            }                can_trim = false;            if i > line.len() {            }                }                    break;                    }                        can_trim = false;                    } else if i != j {                        first = false;                        i = j;                    if first {                if c == '*' {                }                    break;                    can_trim = false;                if j > i || !"* \t".contains(c) {            for (j, c) in line.chars().enumerate() {        for line in &lines {        let mut first = true;        let mut can_trim = true;        let mut i = usize::MAX;    fn horizontal_trim(lines: Vec<String> ) -> Vec<String> {    /// remove a "[ \t]*\*" block from each line, if possible    }        lines[i..j].iter().cloned().collect()        }            j -= 1;        while j > i && lines[j - 1].trim().is_empty() {        }            j -= 1;                         .all(|c| c == '*') {                         .skip(1)                         .chars()        if j > i && lines[j - 1]        // like the first, a last line of all stars should be omitted        }            i += 1;        while i < j && lines[i].trim().is_empty() {        }            i += 1;                lines[0].chars().all(|c| c == '*') {        if !lines.is_empty() &&        // first line of all-stars should be omitted        let mut j = lines.len();        let mut i = 0;    fn vertical_trim(lines: Vec<String>) -> Vec<String> {    /// remove whitespace-only lines from the start/end of linespub fn strip_doc_comment_decoration(comment: &str) -> String {}    }        ast::AttrOuter    } else {        ast::AttrInner    if comment.starts_with("//!") || comment.starts_with("/*!") {    assert!(is_doc_comment(comment));pub fn doc_comment_style(comment: &str) -> ast::AttrStyle {}    s.starts_with("/*!")    (s.starts_with("/**") && is_block_doc_comment(s)) ||    s.starts_with("//!") ||    (s.starts_with("///") && super::is_doc_comment(s)) ||pub fn is_doc_comment(s: &str) -> bool {}    pub pos: BytePos,    pub lines: Vec<String>,    pub style: CommentStyle,pub struct Comment {#[derive(Clone)]}    BlankLine,    /// Just a manual blank line "\n\n", for layout    Mixed,    /// Code before /* foo */ and after the comment    Trailing,    /// Code exists to the left of the comment    Isolated,    /// No code on either side of each line of the commentpub enum CommentStyle {#[derive(Clone, Copy, PartialEq)]use std::usize;use std::io::Read;use str::char_at;use print::pprust;use parse::lexer;use parse::lexer::{is_whitespace, Reader};use parse::lexer::{StringReader, TokenAndSpan};use parse::lexer::is_block_doc_comment;use diagnostic;use codemap::{BytePos, CharPos, CodeMap, Pos};use ast;pub use self::CommentStyle::*;// except according to those terms.// option. This file may not be copied, modified, or distributed// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or//// http://rust-lang.org/COPYRIGHT.// file at the top-level directory of this distribution and at// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHTad�U���W&���vS)�
�
�
P
��������O��cTC�
�
�
�
�
�
�
�
�
�
�
d
#
�	�	�	�	x	D		����j,����r4
��u3��e>���q2}    }        assert_eq!(stripped, "test");        let stripped = strip_doc_comment_decoration("//test");        assert_eq!(stripped, "test");        let stripped = strip_doc_comment_decoration("///!test");        assert_eq!(stripped, "test");        let stripped = strip_doc_comment_decoration("///test");        assert_eq!(stripped, " test");        let stripped = strip_doc_comment_decoration("// test");        assert_eq!(stripped, " test");        let stripped = strip_doc_comment_decoration("// test");        assert_eq!(stripped, " test");        let stripped = strip_doc_comment_decoration("///! test");        assert_eq!(stripped, " test");        let stripped = strip_doc_comment_decoration("/// test");    #[test] fn test_line_doc_comment() {    }        assert_eq!(stripped, " test");        let stripped = strip_doc_comment_decoration(comment);        let comment = "/*******************\n test\n *********************/";    #[test] fn test_block_doc_comment_4() {    }        assert_eq!(stripped, " let a: *i32;\n *a = 5;");        let stripped = strip_doc_comment_decoration(comment);        let comment = "/**\n let a: *i32;\n *a = 5;\n*/";    #[test] fn test_block_doc_comment_3() {    }        assert_eq!(stripped, " Test\n  Test");        let stripped = strip_doc_comment_decoration(comment);        let comment = "/**\n * Test\n *  Test\n*/";    #[test] fn test_block_doc_comment_2() {    }        assert_eq!(stripped, " Test \n*  Test\n   Test");        let stripped = strip_doc_comment_decoration(comment);        let comment = "/**\n * Test \n **  Test\n *   Test\n*/";    #[test] fn test_block_doc_comment_1() {    use super::*;mod tests {#[cfg(test)]}    (comments, literals)    }        first_read = false;        }            debug!("tok: {}", pprust::token_to_string(&tok));        } else {            })                literals.push(Literal {lit: s.to_string(), pos: sp.lo});                debug!("tok lit: {}", s);            rdr.with_str_from(bstart, |s| {        if tok.is_lit() {        let TokenAndSpan { tok, sp } = rdr.peek();        //discard, and look ahead; we're working with internal state        rdr.next_token();        let bstart = rdr.last_pos;        }            break;            }                consume_whitespace_counting_blank_lines(&mut rdr, &mut comments);                consume_comment(&mut rdr, code_to_the_left, &mut comments);            while rdr.peeking_at_comment() {            }                consume_whitespace_counting_blank_lines(&mut rdr, &mut comments);                code_to_the_left = false;            if rdr.curr_is('\n') {            rdr.consume_non_eol_whitespace();            let mut code_to_the_left = !first_read;        loop {    while !rdr.is_eof() {    let mut first_read: bool = true;    let mut literals: Vec<Literal> = Vec::new();    let mut comments: Vec<Comment> = Vec::new();    let mut rdr = lexer::StringReader::new_raw(span_diagnostic, filemap);    let filemap = cm.new_filemap(path, src);adz������S5�����jQ-�
�
�
�
�
�
T
R
Q

����qigf#��l2(
�
�
h
N
+

�	�	�	�	�	�	:		���j:�����e_>#����}{z.��pY7�����jXR976���iR7�������nlk=                      code_to_the_left: bool,fn read_block_comment(rdr: &mut StringReader,}    lines.push(s1);    debug!("pushing line: {}", s1);    };        None => s,        }            }                "".to_string()            } else {                (&s[col..len]).to_string()            if col < len {        Some(col) => {    let s1 = match all_whitespace(&s[..], col) {    let len = s.len();                                        s: String, col: CharPos) {fn trim_whitespace_prefix_and_push_line(lines: &mut Vec<String> ,}    return Some(cursor);    }        col -= 1;        cursor += ch.len_utf8();        }            return None;        if !ch.is_whitespace() {        let ch = char_at(s, cursor);    while col > 0 && cursor < len {    let mut cursor: usize = 0;    let mut col = col.to_usize();    let len = s.len();fn all_whitespace(s: &str, col: CharPos) -> Option<usize> {/// whitespace.  Note k may be outside bounds of s./// Otherwise returns Some(k) where k is first char offset after that leading/// Returns None if the first col chars of s contain a non-whitespace char.}    }        });            pos: p            lines: lines,            style: if code_to_the_left { Trailing } else { Isolated },        comments.push(Comment {    if !lines.is_empty() {    debug!("<<< line comments");    }        rdr.consume_non_eol_whitespace();        lines.push(line);        }            break;        if is_doc_comment(&line[..]) {        // Doc comments are not put in comments.        debug!("{}", line);        let line = rdr.read_one_line_comment();    while rdr.curr_is('/') && rdr.nextch_is('/') {    let mut lines: Vec<String> = Vec::new();    let p = rdr.last_pos;    debug!(">>> line comments");                      comments: &mut Vec<Comment>) {fn read_line_comments(rdr: &mut StringReader, code_to_the_left: bool,}    });        pos: p        lines: vec!(rdr.read_one_line_comment()),        style: if code_to_the_left { Trailing } else { Isolated },    comments.push(Comment {    debug!("<<< shebang comment");    let p = rdr.last_pos;    debug!(">>> shebang comment");                        comments: &mut Vec<Comment>) {fn read_shebang_comment(rdr: &mut StringReader, code_to_the_left: bool,}    }        rdr.bump();        }            push_blank_line_comment(rdr, &mut *comments);        if rdr.col == CharPos(0) && rdr.curr_is('\n') {    while is_whitespace(rdr.curr) && !rdr.is_eof() {                                           comments: &mut Vec<Comment>) {fn consume_whitespace_counting_blank_lines(rdr: &mut StringReader,}    });        pos: rdr.last_pos,        lines: Vec::new(),        style: BlankLine,    comments.push(Comment {    debug!(">>> blank-line comment");fn push_blank_line_comment(rdr: &StringReader, comments: &mut Vec<Comment>) {}    panic!("not a doc-comment: {}", comment);    }        return lines.connect("\n");        let lines = horizontal_trim(lines);        let lines = vertical_trim(lines);            .collect::<Vec<String> >();            .map(|s| s.to_string())            .lines_any()        let lines = comment[3..comment.len() - 2]    if comment.starts_with("/*") {    }        }            return (&comment[prefix.len()..]).to_string();        if comment.starts_with(*prefix) {    for prefix in ONELINERS {    const ONELINERS: &'static [&'static str] = &["///!", "///", "//!", "//"];    // one-line comments lose their prefix    }        }            lines        } else {ad�g���bK;+*���u*�
�
�
�
�
�
h
^
,


����{B$���y9�
�
�
�
o
3

�	�	�	�	Q	-			���{mc@����7����QONM"���q4���J1������vX	��_A���    let cm = CodeMap::new();    let src = String::from_utf8(src).unwrap();    srdr.read_to_end(&mut src).unwrap();    let mut src = Vec::new();                                 -> (Vec<Comment>, Vec<Literal>) {                                    srdr: &mut Read)                                    path: String,pub fn gather_comments_and_literals(span_diagnostic: &diagnostic::SpanHandler,// probably not a good thing.// it appears this function is called only from pprust... that's}    pub pos: BytePos,    pub lit: String,pub struct Literal {#[derive(Clone)]}    debug!("<<< consume comment");    } else { panic!(); }        read_shebang_comment(rdr, code_to_the_left, comments);    } else if rdr.curr_is('#') && rdr.nextch_is('!') {        read_block_comment(rdr, code_to_the_left, comments);    } else if rdr.curr_is('/') && rdr.nextch_is('*') {        read_line_comments(rdr, code_to_the_left, comments);    if rdr.curr_is('/') && rdr.nextch_is('/') {    debug!(">>> consume comment");                   comments: &mut Vec<Comment> ) {                   code_to_the_left: bool,fn consume_comment(rdr: &mut StringReader,}    comments.push(Comment {style: style, lines: lines, pos: p});    debug!("<<< block comment");    }        style = Mixed;    if !rdr.is_eof() && !rdr.curr_is('\n') && lines.len() == 1 {    rdr.consume_non_eol_whitespace();    let mut style = if code_to_the_left { Trailing } else { Isolated };    }        }                                                 col);                                                 curr_line,            trim_whitespace_prefix_and_push_line(&mut lines,        if !curr_line.is_empty() {        }            }                }                    } else { rdr.bump(); }                        level -= 1;                        curr_line.push('/');                        rdr.bump();                        rdr.bump();                    if rdr.curr_is('*') && rdr.nextch_is('/') {                } else {                    level += 1;                    curr_line.push('*');                    rdr.bump();                    rdr.bump();                if rdr.curr_is('/') && rdr.nextch_is('*') {                curr_line.push(rdr.curr.unwrap());            } else {                rdr.bump();                curr_line = String::new();                                                     col);                                                     curr_line,                trim_whitespace_prefix_and_push_line(&mut lines,            if rdr.curr_is('\n') {            }                rdr.fatal("unterminated block comment");            if rdr.is_eof() {            debug!("=== block comment level {}", level);        while level > 0 {        let mut level: isize = 1;    } else {        lines.push(curr_line);        assert!(!curr_line.contains('\n'));        }            return        if is_block_doc_comment(&curr_line[..]) {        }            rdr.bump();            rdr.bump();            curr_line.push_str("*/");        if !rdr.is_eof() {        }            rdr.bump();            curr_line.push(rdr.curr.unwrap());        while !(rdr.curr_is('*') && rdr.nextch_is('/')) && !rdr.is_eof() {    if (rdr.curr_is('*') && !rdr.nextch_is('*')) || rdr.curr_is('!') {    // doc-comments are not really comments, they are attributes    let mut curr_line = String::from("/*");    rdr.bump();    rdr.bump();    let col = rdr.col;    let mut lines: Vec<String> = Vec::new();    let p = rdr.last_pos;    debug!(">>> block comment");                      comments: &mut Vec<Comment> ) {