diff options
| author | bors <bors@rust-lang.org> | 2013-08-10 16:32:18 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-08-10 16:32:18 -0700 |
| commit | bf809768ee8ff3ea4ef434721ff82b09a4df261a (patch) | |
| tree | f7492e25ff06c4eeb3d1e480f641344b306c4247 /src/libsyntax/ext | |
| parent | 8b9e1ce75a3e1416f2db80d30f65879fd902183f (diff) | |
| parent | 20953bb1fbfafc3839e739f38ddf7d495eb1fe8b (diff) | |
| download | rust-bf809768ee8ff3ea4ef434721ff82b09a4df261a.tar.gz rust-bf809768ee8ff3ea4ef434721ff82b09a4df261a.zip | |
auto merge of #8444 : erickt/rust/rollup, r=cmr
This merges these PR together: #8430: r=thestinger #8370: r=thestinger #8386: r=bstrie #8388: r=thestinger #8390: r=graydon #8394: r=graydon #8402: r=thestinger #8403: r=catamorphism
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 20 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 2 |
2 files changed, 12 insertions, 10 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 1e696451701..dfaffa0c275 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -421,12 +421,12 @@ pub enum MapChain<K,V> { // get the map from an env frame impl <K: Eq + Hash + IterBytes + 'static, V: 'static> MapChain<K,V>{ // Constructor. I don't think we need a zero-arg one. - fn new(init: ~HashMap<K,@V>) -> @mut MapChain<K,V> { + pub fn new(init: ~HashMap<K,@V>) -> @mut MapChain<K,V> { @mut BaseMapChain(init) } // add a new frame to the environment (functionally) - fn push_frame (@mut self) -> @mut MapChain<K,V> { + pub fn push_frame (@mut self) -> @mut MapChain<K,V> { @mut ConsMapChain(~HashMap::new() ,self) } @@ -436,7 +436,7 @@ impl <K: Eq + Hash + IterBytes + 'static, V: 'static> MapChain<K,V>{ // ugh: can't get this to compile with mut because of the // lack of flow sensitivity. - fn get_map<'a>(&'a self) -> &'a HashMap<K,@V> { + pub fn get_map<'a>(&'a self) -> &'a HashMap<K,@V> { match *self { BaseMapChain (~ref map) => map, ConsMapChain (~ref map,_) => map @@ -446,7 +446,7 @@ impl <K: Eq + Hash + IterBytes + 'static, V: 'static> MapChain<K,V>{ // traits just don't work anywhere...? //impl Map<Name,SyntaxExtension> for MapChain { - fn contains_key (&self, key: &K) -> bool { + pub fn contains_key (&self, key: &K) -> bool { match *self { BaseMapChain (ref map) => map.contains_key(key), ConsMapChain (ref map,ref rest) => @@ -457,17 +457,17 @@ impl <K: Eq + Hash + IterBytes + 'static, V: 'static> MapChain<K,V>{ // should each_key and each_value operate on shadowed // names? I think not. // delaying implementing this.... - fn each_key (&self, _f: &fn (&K)->bool) { + pub fn each_key (&self, _f: &fn (&K)->bool) { fail!("unimplemented 2013-02-15T10:01"); } - fn each_value (&self, _f: &fn (&V) -> bool) { + pub fn each_value (&self, _f: &fn (&V) -> bool) { fail!("unimplemented 2013-02-15T10:02"); } // Returns a copy of the value that the name maps to. // Goes down the chain 'til it finds one (or bottom out). - fn find (&self, key: &K) -> Option<@V> { + pub fn find (&self, key: &K) -> Option<@V> { match self.get_map().find (key) { Some(ref v) => Some(**v), None => match *self { @@ -477,7 +477,7 @@ impl <K: Eq + Hash + IterBytes + 'static, V: 'static> MapChain<K,V>{ } } - fn find_in_topmost_frame(&self, key: &K) -> Option<@V> { + pub fn find_in_topmost_frame(&self, key: &K) -> Option<@V> { let map = match *self { BaseMapChain(ref map) => map, ConsMapChain(ref map,_) => map @@ -487,7 +487,7 @@ impl <K: Eq + Hash + IterBytes + 'static, V: 'static> MapChain<K,V>{ } // insert the binding into the top-level map - fn insert (&mut self, key: K, ext: @V) -> bool { + pub fn insert (&mut self, key: K, ext: @V) -> bool { // can't abstract over get_map because of flow sensitivity... match *self { BaseMapChain (~ref mut map) => map.insert(key, ext), @@ -499,7 +499,7 @@ impl <K: Eq + Hash + IterBytes + 'static, V: 'static> MapChain<K,V>{ // ... there are definitely some opportunities for abstraction // here that I'm ignoring. (e.g., manufacturing a predicate on // the maps in the chain, and using an abstract "find". - fn insert_into_frame(&mut self, key: K, ext: @V, n: K, pred: &fn(&@V)->bool) { + pub fn insert_into_frame(&mut self, key: K, ext: @V, n: K, pred: &fn(&@V)->bool) { match *self { BaseMapChain (~ref mut map) => { if satisfies_pred(map,&n,pred) { diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 5a1317034b2..918949113ad 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -17,6 +17,7 @@ use codemap; use parse::lexer::*; //resolve bug? use parse::ParseSess; use parse::parser::Parser; +use parse::attr::parser_attr; use parse::token::{Token, EOF, to_str, nonterminal, get_ident_interner, ident_to_str}; use parse::token; @@ -430,6 +431,7 @@ pub fn parse_nt(p: &Parser, name: &str) -> nonterminal { + token::to_str(get_ident_interner(), p.token)) }, "path" => token::nt_path(p.parse_path_with_tps(false)), + "attr" => token::nt_attr(@p.parse_attribute(false)), "tt" => { *p.quote_depth += 1u; //but in theory, non-quoted tts might be useful let res = token::nt_tt(@p.parse_token_tree()); |
