syntex_syntax 0.4.2

Export of libsyntax for code generation
1
2
3
4
5
6
7
8
9
10
11
12
b0VIM 7.4��BUh��ericktErick-Tryzelaar-MBP.local~erickt/projects/rust/rust-syntex/syntex_syntax/src/parse/mod.rs
3210#"! Utpv��������[w��������c���������i5��������g���������p��������\u��������S���������\$��������L���������R�Pad<0v�{XU��M)(
	�
�
i
N
B
0
/

�������ml_ON?0"!�����]�
�
�
�
�
�
5
�	�	�	�	�	�	�	d	.						����V21����}wut,����ygL7%�����uZE*����E��|K����p0/                                         cfg: ast::CrateConfig,                                         source: String,pub fn parse_crate_attrs_from_source_str(name: String,}    maybe_aborted(panictry!(p.parse_crate_mod()),p)                                           source);                                           name,                                           cfg,    let mut p = new_parser_from_source_str(sess,                                   -> ast::Crate {                                   sess: &ParseSess)                                   cfg: ast::CrateConfig,                                   source: String,pub fn parse_crate_from_source_str(name: String,}    new_parser_from_file(sess, cfg, input).parse_inner_attributes()) -> Vec<ast::Attribute> {    sess: &ParseSess    cfg: ast::CrateConfig,    input: &Path,pub fn parse_crate_attrs_from_file(}    // why is there no p.abort_if_errors here?    panictry!(new_parser_from_file(sess, cfg, input).parse_crate_mod())) -> ast::Crate {    sess: &ParseSess    cfg: ast::CrateConfig,    input: &Path,pub fn parse_crate_from_file(// source_str.// uses a HOF to parse anything, and <source> includes file and// where <thing> includes crate, expr, item, stmt, tts, and one that// a bunch of utility functions of the form parse_<thing>_from_<source>}    }        v        }            None => panic!("Input too large, ran out of node ids!")            Some(next) => { self.node_id.set(next); }        match v.checked_add(count) {        let v = self.node_id.get();    pub fn reserve_node_ids(&self, count: ast::NodeId) -> ast::NodeId {    }        self.reserve_node_ids(1)    pub fn next_node_id(&self) -> ast::NodeId {impl ParseSess {}    }        node_id: Cell::new(1),        included_mod_stack: RefCell::new(Vec::new()),        span_diagnostic: sh,    ParseSess {pub fn new_parse_sess_special_handler(sh: SpanHandler) -> ParseSess {}    }        node_id: Cell::new(1),        included_mod_stack: RefCell::new(Vec::new()),        span_diagnostic: mk_span_handler(default_handler(Auto, None, true), CodeMap::new()),    ParseSess {pub fn new_parse_sess() -> ParseSess {}    pub node_id: Cell<ast::NodeId>,    included_mod_stack: RefCell<Vec<PathBuf>>,    /// Used to determine and report recursive mod inclusions    pub span_diagnostic: SpanHandler, // better be the same as the one in the reader!pub struct ParseSess {/// Info about a parsing session.pub mod obsolete;pub mod classify;pub mod common;pub mod attr;pub mod token;pub mod lexer;pub mod parser;#[macro_use]pub type PResult<T> = Result<T, FatalError>;use std::str;use std::rc::Rc;use std::path::{Path, PathBuf};use std::iter;use std::io::Read;use std::fs::File;use std::cell::{Cell, RefCell};use str::char_at;use ptr::P;use parse::parser::Parser;use parse::attr::ParserAttr;use diagnostic::{SpanHandler, mk_span_handler, default_handler, Auto, FatalError};use codemap::{Span, CodeMap, FileMap};use ast;//! The main parser interface// 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��P�{=�����a�
�
�
�
�
{
M
 
����j6"������gVPO*�
�
5
�	�	�	e		�i���D������]����D(�����g2�����}    }        }            Err(_) => panic!("could not get snippet"),            Ok(s) => assert_eq!(&s[..], "{ body }"),        match sess.span_diagnostic.cm.span_to_snippet(span) {        let span = tts.iter().rev().next().unwrap().get_span();        };            _ => panic!("not a macro"),            }                tts.clone()                let ast::MacInvocTT(_, ref tts, _) = mac.node;            ast::ExprMac(ref mac) => {        let tts = match expr.node {            "foo!( fn main() { body } )".to_string(), vec![], &sess);        let expr = parse::parse_expr_from_source_str("foo".to_string(),        let sess = parse::new_parse_sess();    fn ttdelim_span() {    #[test]    }        assert_eq!(&doc[..], "/** doc comment\n *  with CRLF */");        let doc = first_attr_value_str_by_name(&item.attrs, "doc").unwrap();        let item = parse_item_from_source_str(name, source, Vec::new(), &sess).unwrap();        let source = "/** doc comment\r\n *  with CRLF */\r\nfn foo() {}".to_string();        assert_eq!(&docs[..], b);        let b: &[_] = &["/// doc comment".to_string(), "/// line 2".to_string()];                    .map(|a| a.value_str().unwrap().to_string()).collect::<Vec<_>>();        let docs = item.attrs.iter().filter(|a| &*a.name() == "doc")        let item = parse_item_from_source_str(name.clone(), source, Vec::new(), &sess).unwrap();        let source = "/// doc comment\r\n/// line 2\r\nfn foo() {}".to_string();        assert_eq!(&doc[..], "/// doc comment");        let doc = first_attr_value_str_by_name(&item.attrs, "doc").unwrap();        let item = parse_item_from_source_str(name.clone(), source, Vec::new(), &sess).unwrap();        let source = "/// doc comment\r\nfn foo() {}".to_string();        let name = "<source>".to_string();        let sess = new_parse_sess();    #[test] fn crlf_doc_comments() {    }}".to_string());    let mut fflags: c_int = wb();    fn wb() -> c_int { O_WRONLY as c_int }    #[cfg(unix)]    }      (O_WRONLY | libc::consts::os::extra::O_BINARY) as c_int    fn wb() -> c_int {    #[cfg(windows)]                   -> Result<Box<Writer>, String> {        string_to_item("pub fn mk_file_writer(path: &Path, flags: &[FileFlag])    #[test] fn attrs_fix_bug () {    }        string_to_expr("a::z.froob(b,&(987+3))".to_string());        string_to_expr("3 + 4".to_string());        // just make sure that they parse....    #[test] fn parse_exprs () {    }        }                    &src[lo.to_usize()..hi.to_usize()], src)                    "\"{}\" != \"self\". src=\"{}\"",            assert!("self" == &src[lo.to_usize()..hi.to_usize()],            let Span{ lo, hi, .. } = spans[0];            let spans = get_spans_of_pat_idents(src);        for &src in &srcs {                    ];                    "impl z { fn a (self: Foo, &myarg: i32) {} }",                    "impl z { fn a (self, &myarg: i32) {} }",                    "impl z { fn a (&'a self, &myarg: i32) {} }",                    "impl z { fn a (&mut self, &myarg: i32) {} }",