1 stable release

Uses old Rust 2015

1.10.0 Apr 25, 2016

#1136 in Rust patterns


Used in rfmt

1.5MB
30K SLoC

rSyntax ---- Rust libsyntax for rFmt

https://github.com/zBaitu/rsyntax

Overview

rSyntax is cloned from Rust libsyntax. It's only used for rFmt, another Rust source code formatter.

Features

Only 3 file are changed.

  • lib.rs
    Add some pub use.
  • ast.rs
    Add Debug for some struct/enum.
  • parser.rs
    Skip sub mod parse, and make the high position equals to the low position of the sub mod span, to specify this is a sub mod.
    /// Parse a `mod <foo> { ... }` or `mod <foo>;` item
    fn parse_item_mod(&mut self, outer_attrs: &[Attribute]) -> PResult<'a, ItemInfo> {
        let id_span = self.span;             
        let id = self.parse_ident()?;        
        if self.check(&token::Semi) {        
            self.bump();                     
            // baitu
            // This mod is in an external file. Let's go get it!
            // let (m, attrs) = self.eval_src_mod(id, outer_attrs, id_span)?;
            // Ok((id, m, Some(attrs)))       
            Ok((id, ItemKind::Mod(           
                Mod {                        
                    inner: mk_sp(id_span.lo, id_span.lo),              
                    items: Vec::new(),       
                }),
                None))

No runtime deps