about summary refs log tree commit diff
path: root/src/libsyntax/parse/mod.rs
diff options
context:
space:
mode:
authorEduard Burtescu <edy.burt@gmail.com>2014-01-09 15:05:33 +0200
committerEduard Burtescu <edy.burt@gmail.com>2014-01-09 22:25:28 +0200
commit6b221768cfe4585a70cc5c3b647ceda0c7319c25 (patch)
tree68619cc855b67175b0d03b2d27449d1a3184bf6d /src/libsyntax/parse/mod.rs
parent63ba93f91d6988506fd25a91c7d80820818159ab (diff)
downloadrust-6b221768cfe4585a70cc5c3b647ceda0c7319c25.tar.gz
rust-6b221768cfe4585a70cc5c3b647ceda0c7319c25.zip
libsyntax: Renamed types, traits and enum variants to CamelCase.
Diffstat (limited to 'src/libsyntax/parse/mod.rs')
-rw-r--r--src/libsyntax/parse/mod.rs93
1 files changed, 46 insertions, 47 deletions
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index b64f16aff59..ea069c2ffe3 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -15,8 +15,7 @@ use ast;
 use codemap::{Span, CodeMap, FileMap, FileSubstr};
 use codemap;
 use diagnostic::{SpanHandler, mk_span_handler, mk_handler, Emitter};
-use parse::attr::parser_attr;
-use parse::lexer::reader;
+use parse::attr::ParserAttr;
 use parse::parser::Parser;
 
 use std::cell::RefCell;
@@ -133,7 +132,7 @@ pub fn parse_item_from_source_str(
     cfg: ast::CrateConfig,
     attrs: ~[ast::Attribute],
     sess: @ParseSess
-) -> Option<@ast::item> {
+) -> Option<@ast::Item> {
     let mut p = new_parser_from_source_str(sess, cfg, name, source);
     maybe_aborted(p.parse_item(attrs),p)
 }
@@ -169,7 +168,7 @@ pub fn parse_tts_from_source_str(
     source: @str,
     cfg: ast::CrateConfig,
     sess: @ParseSess
-) -> ~[ast::token_tree] {
+) -> ~[ast::TokenTree] {
     let mut p = new_parser_from_source_str(
         sess,
         cfg,
@@ -255,7 +254,7 @@ pub fn filemap_to_parser(sess: @ParseSess,
 // compiler expands into it
 pub fn new_parser_from_tts(sess: @ParseSess,
                      cfg: ast::CrateConfig,
-                     tts: ~[ast::token_tree]) -> Parser {
+                     tts: ~[ast::TokenTree]) -> Parser {
     tts_to_parser(sess,tts,cfg)
 }
 
@@ -307,21 +306,21 @@ pub fn substring_to_filemap(sess: @ParseSess, source: @str, path: @str,
 
 // given a filemap, produce a sequence of token-trees
 pub fn filemap_to_tts(sess: @ParseSess, filemap: @FileMap)
-    -> ~[ast::token_tree] {
+    -> ~[ast::TokenTree] {
     // it appears to me that the cfg doesn't matter here... indeed,
     // parsing tt's probably shouldn't require a parser at all.
     let cfg = ~[];
     let srdr = lexer::new_string_reader(sess.span_diagnostic, filemap);
-    let mut p1 = Parser(sess, cfg, srdr as @reader);
+    let mut p1 = Parser(sess, cfg, srdr as @lexer::Reader);
     p1.parse_all_token_trees()
 }
 
 // given tts and cfg, produce a parser
 pub fn tts_to_parser(sess: @ParseSess,
-                     tts: ~[ast::token_tree],
+                     tts: ~[ast::TokenTree],
                      cfg: ast::CrateConfig) -> Parser {
     let trdr = lexer::new_tt_reader(sess.span_diagnostic, None, tts);
-    Parser(sess, cfg, trdr as @reader)
+    Parser(sess, cfg, trdr as @lexer::Reader)
 }
 
 // abort if necessary
@@ -415,26 +414,26 @@ mod test {
     #[test] fn string_to_tts_macro () {
         let tts = string_to_tts(@"macro_rules! zip (($a)=>($a))");
         match tts {
-            [ast::tt_tok(_,_),
-             ast::tt_tok(_,token::NOT),
-             ast::tt_tok(_,_),
-             ast::tt_delim(delim_elts)] =>
+            [ast::TTTok(_,_),
+             ast::TTTok(_,token::NOT),
+             ast::TTTok(_,_),
+             ast::TTDelim(delim_elts)] =>
                 match *delim_elts {
-                [ast::tt_tok(_,token::LPAREN),
-                 ast::tt_delim(first_set),
-                 ast::tt_tok(_,token::FAT_ARROW),
-                 ast::tt_delim(second_set),
-                 ast::tt_tok(_,token::RPAREN)] =>
+                [ast::TTTok(_,token::LPAREN),
+                 ast::TTDelim(first_set),
+                 ast::TTTok(_,token::FAT_ARROW),
+                 ast::TTDelim(second_set),
+                 ast::TTTok(_,token::RPAREN)] =>
                     match *first_set {
-                    [ast::tt_tok(_,token::LPAREN),
-                     ast::tt_tok(_,token::DOLLAR),
-                     ast::tt_tok(_,_),
-                     ast::tt_tok(_,token::RPAREN)] =>
+                    [ast::TTTok(_,token::LPAREN),
+                     ast::TTTok(_,token::DOLLAR),
+                     ast::TTTok(_,_),
+                     ast::TTTok(_,token::RPAREN)] =>
                         match *second_set {
-                        [ast::tt_tok(_,token::LPAREN),
-                         ast::tt_tok(_,token::DOLLAR),
-                         ast::tt_tok(_,_),
-                         ast::tt_tok(_,token::RPAREN)] =>
+                        [ast::TTTok(_,token::LPAREN),
+                         ast::TTTok(_,token::DOLLAR),
+                         ast::TTTok(_,_),
+                         ast::TTTok(_,token::RPAREN)] =>
                             assert_eq!("correct","correct"),
                         _ => assert_eq!("wrong 4","correct")
                     },
@@ -461,7 +460,7 @@ mod test {
         assert_eq!(to_json_str(@tts),
         ~"[\
     {\
-        \"variant\":\"tt_tok\",\
+        \"variant\":\"TTTok\",\
         \"fields\":[\
             null,\
             {\
@@ -474,7 +473,7 @@ mod test {
         ]\
     },\
     {\
-        \"variant\":\"tt_tok\",\
+        \"variant\":\"TTTok\",\
         \"fields\":[\
             null,\
             {\
@@ -487,18 +486,18 @@ mod test {
         ]\
     },\
     {\
-        \"variant\":\"tt_delim\",\
+        \"variant\":\"TTDelim\",\
         \"fields\":[\
             [\
                 {\
-                    \"variant\":\"tt_tok\",\
+                    \"variant\":\"TTTok\",\
                     \"fields\":[\
                         null,\
                         \"LPAREN\"\
                     ]\
                 },\
                 {\
-                    \"variant\":\"tt_tok\",\
+                    \"variant\":\"TTTok\",\
                     \"fields\":[\
                         null,\
                         {\
@@ -511,14 +510,14 @@ mod test {
                     ]\
                 },\
                 {\
-                    \"variant\":\"tt_tok\",\
+                    \"variant\":\"TTTok\",\
                     \"fields\":[\
                         null,\
                         \"COLON\"\
                     ]\
                 },\
                 {\
-                    \"variant\":\"tt_tok\",\
+                    \"variant\":\"TTTok\",\
                     \"fields\":[\
                         null,\
                         {\
@@ -531,7 +530,7 @@ mod test {
                     ]\
                 },\
                 {\
-                    \"variant\":\"tt_tok\",\
+                    \"variant\":\"TTTok\",\
                     \"fields\":[\
                         null,\
                         \"RPAREN\"\
@@ -541,18 +540,18 @@ mod test {
         ]\
     },\
     {\
-        \"variant\":\"tt_delim\",\
+        \"variant\":\"TTDelim\",\
         \"fields\":[\
             [\
                 {\
-                    \"variant\":\"tt_tok\",\
+                    \"variant\":\"TTTok\",\
                     \"fields\":[\
                         null,\
                         \"LBRACE\"\
                     ]\
                 },\
                 {\
-                    \"variant\":\"tt_tok\",\
+                    \"variant\":\"TTTok\",\
                     \"fields\":[\
                         null,\
                         {\
@@ -565,14 +564,14 @@ mod test {
                     ]\
                 },\
                 {\
-                    \"variant\":\"tt_tok\",\
+                    \"variant\":\"TTTok\",\
                     \"fields\":[\
                         null,\
                         \"SEMI\"\
                     ]\
                 },\
                 {\
-                    \"variant\":\"tt_tok\",\
+                    \"variant\":\"TTTok\",\
                     \"fields\":[\
                         null,\
                         \"RBRACE\"\
@@ -661,13 +660,13 @@ mod test {
         // this test depends on the intern order of "fn" and "int"
         assert_eq!(string_to_item(@"fn a (b : int) { b; }"),
                   Some(
-                      @ast::item{ident:str_to_ident("a"),
+                      @ast::Item{ident:str_to_ident("a"),
                             attrs:~[],
                             id: ast::DUMMY_NODE_ID,
-                            node: ast::item_fn(ast::P(ast::fn_decl{
-                                inputs: ~[ast::arg{
+                            node: ast::ItemFn(ast::P(ast::FnDecl {
+                                inputs: ~[ast::Arg{
                                     ty: ast::P(ast::Ty{id: ast::DUMMY_NODE_ID,
-                                                       node: ast::ty_path(ast::Path{
+                                                       node: ast::TyPath(ast::Path{
                                         span:sp(10,13),
                                         global:false,
                                         segments: ~[
@@ -704,12 +703,12 @@ mod test {
                                     id: ast::DUMMY_NODE_ID
                                 }],
                                 output: ast::P(ast::Ty{id: ast::DUMMY_NODE_ID,
-                                                       node: ast::ty_nil,
+                                                       node: ast::TyNil,
                                                        span:sp(15,15)}), // not sure
-                                cf: ast::return_val,
+                                cf: ast::Return,
                                 variadic: false
                             }),
-                                    ast::impure_fn,
+                                    ast::ImpureFn,
                                     abi::AbiSet::Rust(),
                                     ast::Generics{ // no idea on either of these:
                                         lifetimes: opt_vec::Empty,
@@ -744,7 +743,7 @@ mod test {
                                         rules: ast::DefaultBlock, // no idea
                                         span: sp(15,21),
                                     })),
-                            vis: ast::inherited,
+                            vis: ast::Inherited,
                             span: sp(0,21)}));
     }