about summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorKevin Butler <haqkrs@gmail.com>2014-05-26 00:27:36 +0100
committerKevin Butler <haqkrs@gmail.com>2014-05-30 17:55:41 +0100
commit190d8bdbc6df078e2dc65ccdb8ab17a99a4a6556 (patch)
tree14e71c75fc23296a7681a319dbba0037a4c60261 /src/libsyntax/ext
parent16f15ce391b2b463d37ff7f5e764c7f55c33cc5d (diff)
downloadrust-190d8bdbc6df078e2dc65ccdb8ab17a99a4a6556.tar.gz
rust-190d8bdbc6df078e2dc65ccdb8ab17a99a4a6556.zip
libsyntax: Fix snake_case errors.
A number of functions/methods have been moved or renamed to align
better with rust standard conventions.

syntax::ext::mtwt::xorPush => xor_push
syntax::parse::parser::Parser => Parser::new

[breaking-change]
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/mtwt.rs41
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs4
-rw-r--r--src/libsyntax/ext/tt/macro_rules.rs2
3 files changed, 27 insertions, 20 deletions
diff --git a/src/libsyntax/ext/mtwt.rs b/src/libsyntax/ext/mtwt.rs
index 6ac3becf0b6..fdaa3b5630a 100644
--- a/src/libsyntax/ext/mtwt.rs
+++ b/src/libsyntax/ext/mtwt.rs
@@ -223,7 +223,7 @@ fn marksof_internal(ctxt: SyntaxContext,
                 return result;
             },
             Mark(mark, tl) => {
-                xorPush(&mut result, mark);
+                xor_push(&mut result, mark);
                 loopvar = tl;
             },
             Rename(_,name,tl) => {
@@ -253,7 +253,7 @@ pub fn outer_mark(ctxt: SyntaxContext) -> Mrk {
 
 // Push a name... unless it matches the one on top, in which
 // case pop and discard (so two of the same marks cancel)
-fn xorPush(marks: &mut Vec<Mrk>, mark: Mrk) {
+fn xor_push(marks: &mut Vec<Mrk>, mark: Mrk) {
     if (marks.len() > 0) && (*marks.last().unwrap() == mark) {
         marks.pop().unwrap();
     } else {
@@ -264,26 +264,27 @@ fn xorPush(marks: &mut Vec<Mrk>, mark: Mrk) {
 #[cfg(test)]
 mod tests {
     use ast::*;
-    use super::{resolve, xorPush, new_mark_internal, new_sctable_internal};
+    use super::{resolve, xor_push, new_mark_internal, new_sctable_internal};
     use super::{new_rename_internal, marksof_internal, resolve_internal};
     use super::{SCTable, EmptyCtxt, Mark, Rename, IllegalCtxt};
     use collections::HashMap;
 
-    #[test] fn xorpush_test () {
+    #[test]
+    fn xorpush_test () {
         let mut s = Vec::new();
-        xorPush(&mut s, 14);
+        xor_push(&mut s, 14);
         assert_eq!(s.clone(), vec!(14));
-        xorPush(&mut s, 14);
+        xor_push(&mut s, 14);
         assert_eq!(s.clone(), Vec::new());
-        xorPush(&mut s, 14);
+        xor_push(&mut s, 14);
         assert_eq!(s.clone(), vec!(14));
-        xorPush(&mut s, 15);
+        xor_push(&mut s, 15);
         assert_eq!(s.clone(), vec!(14, 15));
-        xorPush(&mut s, 16);
+        xor_push(&mut s, 16);
         assert_eq!(s.clone(), vec!(14, 15, 16));
-        xorPush(&mut s, 16);
+        xor_push(&mut s, 16);
         assert_eq!(s.clone(), vec!(14, 15));
-        xorPush(&mut s, 15);
+        xor_push(&mut s, 15);
         assert_eq!(s.clone(), vec!(14));
     }
 
@@ -331,7 +332,8 @@ mod tests {
         }
     }
 
-    #[test] fn test_unfold_refold(){
+    #[test]
+    fn test_unfold_refold(){
         let mut t = new_sctable_internal();
 
         let test_sc = vec!(M(3),R(id(101,0),14),M(9));
@@ -364,7 +366,8 @@ mod tests {
         }
     }
 
-    #[test] fn test_marksof () {
+    #[test]
+    fn test_marksof () {
         let stopname = 242;
         let name1 = 243;
         let mut t = new_sctable_internal();
@@ -397,7 +400,8 @@ mod tests {
     }
 
 
-    #[test] fn resolve_tests () {
+    #[test]
+    fn resolve_tests () {
         let a = 40;
         let mut t = new_sctable_internal();
         let mut rt = HashMap::new();
@@ -447,13 +451,15 @@ mod tests {
          assert_eq!(resolve_internal(id(a,a50_to_a51_b),&mut t, &mut rt),50);}
     }
 
-    #[test] fn mtwt_resolve_test(){
+    #[test]
+    fn mtwt_resolve_test(){
         let a = 40;
         assert_eq!(resolve(id(a,EMPTY_CTXT)),a);
     }
 
 
-    #[test] fn hashing_tests () {
+    #[test]
+    fn hashing_tests () {
         let mut t = new_sctable_internal();
         assert_eq!(new_mark_internal(12,EMPTY_CTXT,&mut t),2);
         assert_eq!(new_mark_internal(13,EMPTY_CTXT,&mut t),3);
@@ -462,7 +468,8 @@ mod tests {
         // I'm assuming that the rename table will behave the same....
     }
 
-    #[test] fn resolve_table_hashing_tests() {
+    #[test]
+    fn resolve_table_hashing_tests() {
         let mut t = new_sctable_internal();
         let mut rt = HashMap::new();
         assert_eq!(rt.len(),0);
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index a92802aa338..65733793d6c 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -1,4 +1,4 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -402,7 +402,7 @@ pub fn parse(sess: &ParseSess,
                 }
                 rdr.next_token();
             } else /* bb_eis.len() == 1 */ {
-                let mut rust_parser = Parser(sess, cfg.clone(), box rdr.clone());
+                let mut rust_parser = Parser::new(sess, cfg.clone(), box rdr.clone());
 
                 let mut ei = bb_eis.pop().unwrap();
                 match ei.elts.get(ei.idx).node {
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index c69e5f9ba0f..0622bf76ab9 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -171,7 +171,7 @@ fn generic_extension(cx: &ExtCtxt,
                 let trncbr = new_tt_reader(&cx.parse_sess().span_diagnostic,
                                            Some(named_matches),
                                            rhs);
-                let p = Parser(cx.parse_sess(), cx.cfg(), box trncbr);
+                let p = Parser::new(cx.parse_sess(), cx.cfg(), box trncbr);
                 // Let the context choose how to interpret the result.
                 // Weird, but useful for X-macros.
                 return box ParserAnyMacro {