Update to proc-macro2 0.3 and tweak apis
diff --git a/src/buffer.rs b/src/buffer.rs
index 6b05d50..10ac5f6 100644
--- a/src/buffer.rs
+++ b/src/buffer.rs
@@ -128,7 +128,8 @@
 // 100% safe but the implementation is fragile internally.
 
 use proc_macro as pm;
-use proc_macro2::{Delimiter, Literal, Spacing, Span, Term, TokenNode, TokenStream, TokenTree};
+use proc_macro2::{Delimiter, Literal, Span, Term, TokenStream};
+use proc_macro2::{Group, TokenTree, Op};
 
 use std::ptr;
 use std::marker::PhantomData;
@@ -141,9 +142,9 @@
 enum Entry {
     // Mimicking types from proc-macro.
     Group(Span, Delimiter, TokenBuffer),
-    Term(Span, Term),
-    Op(Span, char, Spacing),
-    Literal(Span, Literal),
+    Term(Term),
+    Op(Op),
+    Literal(Literal),
     // End entries contain a raw pointer to the entry from the containing
     // token tree, or null if this is the outermost level.
     End(*const Entry),
@@ -174,20 +175,20 @@
         let mut entries = Vec::new();
         let mut seqs = Vec::new();
         for tt in stream {
-            match tt.kind {
-                TokenNode::Term(sym) => {
-                    entries.push(Entry::Term(tt.span, sym));
+            match tt {
+                TokenTree::Term(sym) => {
+                    entries.push(Entry::Term(sym));
                 }
-                TokenNode::Op(chr, ok) => {
-                    entries.push(Entry::Op(tt.span, chr, ok));
+                TokenTree::Op(op) => {
+                    entries.push(Entry::Op(op));
                 }
-                TokenNode::Literal(lit) => {
-                    entries.push(Entry::Literal(tt.span, lit));
+                TokenTree::Literal(l) => {
+                    entries.push(Entry::Literal(l));
                 }
-                TokenNode::Group(delim, seq_stream) => {
+                TokenTree::Group(g) => {
                     // Record the index of the interesting entry, and store an
                     // `End(null)` there temporarially.
-                    seqs.push((entries.len(), tt.span, delim, seq_stream));
+                    seqs.push((entries.len(), g.span(), g.delimiter(), g.stream().clone()));
                     entries.push(Entry::End(ptr::null()));
                 }
             }
@@ -364,30 +365,30 @@
 
     /// If the cursor is pointing at a `Term`, returns it along with a cursor
     /// pointing at the next `TokenTree`.
-    pub fn term(mut self) -> Option<(Span, Term, Cursor<'a>)> {
+    pub fn term(mut self) -> Option<(Term, Cursor<'a>)> {
         self.ignore_none();
         match *self.entry() {
-            Entry::Term(span, term) => Some((span, term, unsafe { self.bump() })),
+            Entry::Term(term) => Some((term, unsafe { self.bump() })),
             _ => None,
         }
     }
 
     /// If the cursor is pointing at an `Op`, returns it along with a cursor
     /// pointing at the next `TokenTree`.
-    pub fn op(mut self) -> Option<(Span, char, Spacing, Cursor<'a>)> {
+    pub fn op(mut self) -> Option<(Op, Cursor<'a>)> {
         self.ignore_none();
         match *self.entry() {
-            Entry::Op(span, op, spacing) => Some((span, op, spacing, unsafe { self.bump() })),
+            Entry::Op(op) => Some((op, unsafe { self.bump() })),
             _ => None,
         }
     }
 
     /// If the cursor is pointing at a `Literal`, return it along with a cursor
     /// pointing at the next `TokenTree`.
-    pub fn literal(mut self) -> Option<(Span, Literal, Cursor<'a>)> {
+    pub fn literal(mut self) -> Option<(Literal, Cursor<'a>)> {
         self.ignore_none();
         match *self.entry() {
-            Entry::Literal(span, ref lit) => Some((span, lit.clone(), unsafe { self.bump() })),
+            Entry::Literal(ref lit) => Some((lit.clone(), unsafe { self.bump() })),
             _ => None,
         }
     }
@@ -415,23 +416,13 @@
         let tree = match *self.entry() {
             Entry::Group(span, delim, ref buf) => {
                 let stream = buf.begin().token_stream();
-                TokenTree {
-                    span: span,
-                    kind: TokenNode::Group(delim, stream),
-                }
+                let mut g = Group::new(delim, stream);
+                g.set_span(span);
+                TokenTree::from(g)
             }
-            Entry::Literal(span, ref lit) => TokenTree {
-                span: span,
-                kind: TokenNode::Literal(lit.clone()),
-            },
-            Entry::Term(span, sym) => TokenTree {
-                span: span,
-                kind: TokenNode::Term(sym),
-            },
-            Entry::Op(span, chr, spacing) => TokenTree {
-                span: span,
-                kind: TokenNode::Op(chr, spacing),
-            },
+            Entry::Literal(ref lit) => lit.clone().into(),
+            Entry::Term(term) => term.into(),
+            Entry::Op(op) => op.into(),
             Entry::End(..) => {
                 return None;
             }
@@ -444,10 +435,10 @@
     /// cursor points to eof.
     pub fn span(self) -> Span {
         match *self.entry() {
-            Entry::Group(span, ..)
-            | Entry::Literal(span, ..)
-            | Entry::Term(span, ..)
-            | Entry::Op(span, ..) => span,
+            Entry::Group(span, ..) => span,
+            Entry::Literal(ref l) => l.span(),
+            Entry::Term(t) => t.span(),
+            Entry::Op(o) => o.span(),
             Entry::End(..) => Span::call_site(),
         }
     }