about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-05-15 15:14:25 +0000
committerbors <bors@rust-lang.org>2015-05-15 15:14:25 +0000
commit9bebe5f3bbf2715f9c8606d672a2396216077826 (patch)
tree94bca0791705d56a8afe947b4673581a2c921a62 /src/libsyntax/parse
parent13a4b83c1a73260b9c34a66d3bde62ff09d01863 (diff)
parentb62290d421acf39db929f05522c8ce530e031067 (diff)
downloadrust-9bebe5f3bbf2715f9c8606d672a2396216077826.tar.gz
rust-9bebe5f3bbf2715f9c8606d672a2396216077826.zip
Auto merge of #25059 - erickt:pprint, r=acrichto
The recent quote changes unfortunately broke unquoting statements like `let foo = 5` because the parser requires their to be a trailing semicolon in those statements. Along the way I added support for unquoting generics and where clauses as well as better pretty printing of `token::Interpolated`. 
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs4
-rw-r--r--src/libsyntax/parse/token.rs4
2 files changed, 8 insertions, 0 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 541ec16b415..9bf6fa88ba5 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -3808,6 +3808,8 @@ impl<'a> Parser<'a> {
     ///                  | ( < lifetimes , typaramseq ( , )? > )
     /// where   typaramseq = ( typaram ) | ( typaram , typaramseq )
     pub fn parse_generics(&mut self) -> PResult<ast::Generics> {
+        maybe_whole!(self, NtGenerics);
+
         if try!(self.eat(&token::Lt) ){
             let lifetime_defs = try!(self.parse_lifetime_defs());
             let mut seen_default = false;
@@ -3928,6 +3930,8 @@ impl<'a> Parser<'a> {
     /// where T : Trait<U, V> + 'b, 'a : 'b
     /// ```
     pub fn parse_where_clause(&mut self) -> PResult<ast::WhereClause> {
+        maybe_whole!(self, NtWhereClause);
+
         let mut where_clause = WhereClause {
             id: ast::DUMMY_NODE_ID,
             predicates: Vec::new(),
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index 53ed4f351d3..832fec40199 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -385,6 +385,8 @@ pub enum Nonterminal {
     NtArm(ast::Arm),
     NtImplItem(P<ast::ImplItem>),
     NtTraitItem(P<ast::TraitItem>),
+    NtGenerics(ast::Generics),
+    NtWhereClause(ast::WhereClause),
 }
 
 impl fmt::Debug for Nonterminal {
@@ -403,6 +405,8 @@ impl fmt::Debug for Nonterminal {
             NtArm(..) => f.pad("NtArm(..)"),
             NtImplItem(..) => f.pad("NtImplItem(..)"),
             NtTraitItem(..) => f.pad("NtTraitItem(..)"),
+            NtGenerics(..) => f.pad("NtGenerics(..)"),
+            NtWhereClause(..) => f.pad("NtWhereClause(..)"),
         }
     }
 }