Alex Crichton | babc99e | 2017-07-05 18:00:29 -0700 | [diff] [blame] | 1 | //! A "shim crate" intended to multiplex the `proc_macro` API on to stable Rust. |
| 2 | //! |
| 3 | //! Procedural macros in Rust operate over the upstream |
| 4 | //! `proc_macro::TokenStream` type. This type currently is quite conservative |
| 5 | //! and exposed no internal implementation details. Nightly compilers, however, |
| 6 | //! contain a much richer interface. This richer interface allows fine-grained |
| 7 | //! inspection of the token stream which avoids stringification/re-lexing and |
| 8 | //! also preserves span information. |
| 9 | //! |
| 10 | //! The upcoming APIs added to `proc_macro` upstream are the foundation for |
| 11 | //! productive procedural macros in the ecosystem. To help prepare the ecosystem |
| 12 | //! for using them this crate serves to both compile on stable and nightly and |
| 13 | //! mirrors the API-to-be. The intention is that procedural macros which switch |
| 14 | //! to use this crate will be trivially able to switch to the upstream |
| 15 | //! `proc_macro` crate once its API stabilizes. |
| 16 | //! |
David Tolnay | d66ecf6 | 2018-01-02 20:05:42 -0800 | [diff] [blame^] | 17 | //! In the meantime this crate also has a `nightly` Cargo feature which |
Alex Crichton | babc99e | 2017-07-05 18:00:29 -0700 | [diff] [blame] | 18 | //! enables it to reimplement itself with the unstable API of `proc_macro`. |
| 19 | //! This'll allow immediate usage of the beneficial upstream API, particularly |
| 20 | //! around preserving span information. |
| 21 | |
David Tolnay | d66ecf6 | 2018-01-02 20:05:42 -0800 | [diff] [blame^] | 22 | #![cfg_attr(feature = "nightly", feature(proc_macro))] |
Alex Crichton | cbec8ec | 2017-06-02 13:19:33 -0700 | [diff] [blame] | 23 | |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 24 | extern crate proc_macro; |
| 25 | |
David Tolnay | d66ecf6 | 2018-01-02 20:05:42 -0800 | [diff] [blame^] | 26 | #[cfg(not(feature = "nightly"))] |
David Tolnay | b103266 | 2017-05-31 15:52:28 -0700 | [diff] [blame] | 27 | extern crate unicode_xid; |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 28 | |
| 29 | use std::fmt; |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 30 | use std::str::FromStr; |
| 31 | use std::iter::FromIterator; |
| 32 | |
David Tolnay | b103266 | 2017-05-31 15:52:28 -0700 | [diff] [blame] | 33 | #[macro_use] |
David Tolnay | d66ecf6 | 2018-01-02 20:05:42 -0800 | [diff] [blame^] | 34 | #[cfg(not(feature = "nightly"))] |
David Tolnay | b103266 | 2017-05-31 15:52:28 -0700 | [diff] [blame] | 35 | mod strnom; |
| 36 | |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 37 | #[path = "stable.rs"] |
David Tolnay | d66ecf6 | 2018-01-02 20:05:42 -0800 | [diff] [blame^] | 38 | #[cfg(not(feature = "nightly"))] |
Alex Crichton | b15c635 | 2017-05-19 19:36:36 -0700 | [diff] [blame] | 39 | mod imp; |
| 40 | #[path = "unstable.rs"] |
David Tolnay | d66ecf6 | 2018-01-02 20:05:42 -0800 | [diff] [blame^] | 41 | #[cfg(feature = "nightly")] |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 42 | mod imp; |
| 43 | |
David Tolnay | cb1b85f | 2017-06-03 16:40:35 -0700 | [diff] [blame] | 44 | #[macro_use] |
| 45 | mod macros; |
| 46 | |
| 47 | #[derive(Clone)] |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 48 | pub struct TokenStream(imp::TokenStream); |
| 49 | |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 50 | pub struct LexError(imp::LexError); |
| 51 | |
| 52 | impl FromStr for TokenStream { |
| 53 | type Err = LexError; |
| 54 | |
| 55 | fn from_str(src: &str) -> Result<TokenStream, LexError> { |
| 56 | match src.parse() { |
| 57 | Ok(e) => Ok(TokenStream(e)), |
| 58 | Err(e) => Err(LexError(e)), |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 63 | impl From<proc_macro::TokenStream> for TokenStream { |
| 64 | fn from(inner: proc_macro::TokenStream) -> TokenStream { |
| 65 | TokenStream(inner.into()) |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | impl From<TokenStream> for proc_macro::TokenStream { |
| 70 | fn from(inner: TokenStream) -> proc_macro::TokenStream { |
| 71 | inner.0.into() |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | impl From<TokenTree> for TokenStream { |
| 76 | fn from(tree: TokenTree) -> TokenStream { |
| 77 | TokenStream(tree.into()) |
| 78 | } |
| 79 | } |
| 80 | |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 81 | impl<T: Into<TokenStream>> FromIterator<T> for TokenStream { |
| 82 | fn from_iter<I: IntoIterator<Item = T>>(streams: I) -> Self { |
| 83 | TokenStream(streams.into_iter().map(|t| t.into().0).collect()) |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | impl IntoIterator for TokenStream { |
| 88 | type Item = TokenTree; |
Alex Crichton | 1a7f762 | 2017-07-05 17:47:15 -0700 | [diff] [blame] | 89 | type IntoIter = TokenTreeIter; |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 90 | |
Alex Crichton | 1a7f762 | 2017-07-05 17:47:15 -0700 | [diff] [blame] | 91 | fn into_iter(self) -> TokenTreeIter { |
| 92 | TokenTreeIter(self.0.into_iter()) |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 93 | } |
| 94 | } |
| 95 | |
| 96 | impl TokenStream { |
| 97 | pub fn empty() -> TokenStream { |
| 98 | TokenStream(imp::TokenStream::empty()) |
| 99 | } |
| 100 | |
| 101 | pub fn is_empty(&self) -> bool { |
| 102 | self.0.is_empty() |
| 103 | } |
| 104 | } |
| 105 | |
Nika Layzell | b35a9a3 | 2017-12-30 14:34:35 -0500 | [diff] [blame] | 106 | // Returned by reference, so we can't easily wrap it. |
Nika Layzell | a9dbc18 | 2017-12-30 14:50:13 -0500 | [diff] [blame] | 107 | #[cfg(procmacro2_unstable)] |
Nika Layzell | b35a9a3 | 2017-12-30 14:34:35 -0500 | [diff] [blame] | 108 | pub use imp::FileName; |
| 109 | |
Nika Layzell | a9dbc18 | 2017-12-30 14:50:13 -0500 | [diff] [blame] | 110 | #[cfg(procmacro2_unstable)] |
Nika Layzell | f8d5f21 | 2017-12-11 14:07:02 -0500 | [diff] [blame] | 111 | #[derive(Clone, PartialEq, Eq)] |
| 112 | pub struct SourceFile(imp::SourceFile); |
| 113 | |
Nika Layzell | a9dbc18 | 2017-12-30 14:50:13 -0500 | [diff] [blame] | 114 | #[cfg(procmacro2_unstable)] |
Nika Layzell | f8d5f21 | 2017-12-11 14:07:02 -0500 | [diff] [blame] | 115 | impl SourceFile { |
| 116 | /// Get the path to this source file as a string. |
Nika Layzell | b35a9a3 | 2017-12-30 14:34:35 -0500 | [diff] [blame] | 117 | pub fn path(&self) -> &FileName { |
| 118 | self.0.path() |
Nika Layzell | f8d5f21 | 2017-12-11 14:07:02 -0500 | [diff] [blame] | 119 | } |
| 120 | |
| 121 | pub fn is_real(&self) -> bool { |
| 122 | self.0.is_real() |
| 123 | } |
| 124 | } |
| 125 | |
Nika Layzell | a9dbc18 | 2017-12-30 14:50:13 -0500 | [diff] [blame] | 126 | #[cfg(procmacro2_unstable)] |
Nika Layzell | b35a9a3 | 2017-12-30 14:34:35 -0500 | [diff] [blame] | 127 | impl AsRef<FileName> for SourceFile { |
| 128 | fn as_ref(&self) -> &FileName { |
| 129 | self.0.path() |
Nika Layzell | f8d5f21 | 2017-12-11 14:07:02 -0500 | [diff] [blame] | 130 | } |
| 131 | } |
| 132 | |
Nika Layzell | a9dbc18 | 2017-12-30 14:50:13 -0500 | [diff] [blame] | 133 | #[cfg(procmacro2_unstable)] |
Nika Layzell | f8d5f21 | 2017-12-11 14:07:02 -0500 | [diff] [blame] | 134 | impl fmt::Debug for SourceFile { |
| 135 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
| 136 | self.0.fmt(f) |
| 137 | } |
| 138 | } |
| 139 | |
Nika Layzell | a9dbc18 | 2017-12-30 14:50:13 -0500 | [diff] [blame] | 140 | #[cfg(procmacro2_unstable)] |
Nika Layzell | 1ecb6ce | 2017-12-30 14:34:05 -0500 | [diff] [blame] | 141 | pub struct LineColumn { |
| 142 | pub line: usize, |
| 143 | pub column: usize, |
| 144 | } |
Nika Layzell | f8d5f21 | 2017-12-11 14:07:02 -0500 | [diff] [blame] | 145 | |
David Tolnay | cb1b85f | 2017-06-03 16:40:35 -0700 | [diff] [blame] | 146 | #[derive(Copy, Clone)] |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 147 | pub struct Span(imp::Span); |
| 148 | |
Alex Crichton | e6085b7 | 2017-11-21 07:24:25 -0800 | [diff] [blame] | 149 | #[doc(hidden)] |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 150 | impl Default for Span { |
| 151 | fn default() -> Span { |
Alex Crichton | e6085b7 | 2017-11-21 07:24:25 -0800 | [diff] [blame] | 152 | Span(imp::Span::def_site()) |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 153 | } |
| 154 | } |
| 155 | |
| 156 | impl Span { |
| 157 | pub fn call_site() -> Span { |
| 158 | Span(imp::Span::call_site()) |
| 159 | } |
Alex Crichton | e6085b7 | 2017-11-21 07:24:25 -0800 | [diff] [blame] | 160 | |
| 161 | pub fn def_site() -> Span { |
| 162 | Span(imp::Span::def_site()) |
| 163 | } |
Nika Layzell | f8d5f21 | 2017-12-11 14:07:02 -0500 | [diff] [blame] | 164 | |
David Tolnay | d66ecf6 | 2018-01-02 20:05:42 -0800 | [diff] [blame^] | 165 | /// This method is only available when the `"nightly"` feature is enabled. |
| 166 | #[cfg(feature = "nightly")] |
David Tolnay | 16a1720 | 2017-12-31 10:47:24 -0500 | [diff] [blame] | 167 | pub fn unstable(self) -> proc_macro::Span { |
| 168 | self.0.unstable() |
| 169 | } |
| 170 | |
Nika Layzell | a9dbc18 | 2017-12-30 14:50:13 -0500 | [diff] [blame] | 171 | #[cfg(procmacro2_unstable)] |
Nika Layzell | f8d5f21 | 2017-12-11 14:07:02 -0500 | [diff] [blame] | 172 | pub fn source_file(&self) -> SourceFile { |
| 173 | SourceFile(self.0.source_file()) |
| 174 | } |
| 175 | |
Nika Layzell | a9dbc18 | 2017-12-30 14:50:13 -0500 | [diff] [blame] | 176 | #[cfg(procmacro2_unstable)] |
Nika Layzell | f8d5f21 | 2017-12-11 14:07:02 -0500 | [diff] [blame] | 177 | pub fn start(&self) -> LineColumn { |
Nika Layzell | 1ecb6ce | 2017-12-30 14:34:05 -0500 | [diff] [blame] | 178 | let imp::LineColumn{ line, column } = self.0.start(); |
David Tolnay | 79105e5 | 2017-12-31 11:03:04 -0500 | [diff] [blame] | 179 | LineColumn { line: line, column: column } |
Nika Layzell | f8d5f21 | 2017-12-11 14:07:02 -0500 | [diff] [blame] | 180 | } |
| 181 | |
Nika Layzell | a9dbc18 | 2017-12-30 14:50:13 -0500 | [diff] [blame] | 182 | #[cfg(procmacro2_unstable)] |
Nika Layzell | f8d5f21 | 2017-12-11 14:07:02 -0500 | [diff] [blame] | 183 | pub fn end(&self) -> LineColumn { |
Nika Layzell | 1ecb6ce | 2017-12-30 14:34:05 -0500 | [diff] [blame] | 184 | let imp::LineColumn{ line, column } = self.0.end(); |
David Tolnay | 79105e5 | 2017-12-31 11:03:04 -0500 | [diff] [blame] | 185 | LineColumn { line: line, column: column } |
Nika Layzell | f8d5f21 | 2017-12-11 14:07:02 -0500 | [diff] [blame] | 186 | } |
| 187 | |
Nika Layzell | a9dbc18 | 2017-12-30 14:50:13 -0500 | [diff] [blame] | 188 | #[cfg(procmacro2_unstable)] |
Nika Layzell | f8d5f21 | 2017-12-11 14:07:02 -0500 | [diff] [blame] | 189 | pub fn join(&self, other: Span) -> Option<Span> { |
| 190 | self.0.join(other.0).map(Span) |
| 191 | } |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 192 | } |
| 193 | |
David Tolnay | 977f828 | 2017-05-31 17:41:33 -0700 | [diff] [blame] | 194 | #[derive(Clone, Debug)] |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 195 | pub struct TokenTree { |
| 196 | pub span: Span, |
Alex Crichton | 1a7f762 | 2017-07-05 17:47:15 -0700 | [diff] [blame] | 197 | pub kind: TokenNode, |
| 198 | } |
| 199 | |
| 200 | impl From<TokenNode> for TokenTree { |
| 201 | fn from(kind: TokenNode) -> TokenTree { |
| 202 | TokenTree { span: Span::default(), kind: kind } |
| 203 | } |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 204 | } |
| 205 | |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 206 | impl fmt::Display for TokenTree { |
| 207 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
| 208 | TokenStream::from(self.clone()).fmt(f) |
| 209 | } |
| 210 | } |
| 211 | |
David Tolnay | 977f828 | 2017-05-31 17:41:33 -0700 | [diff] [blame] | 212 | #[derive(Clone, Debug)] |
Alex Crichton | 1a7f762 | 2017-07-05 17:47:15 -0700 | [diff] [blame] | 213 | pub enum TokenNode { |
| 214 | Group(Delimiter, TokenStream), |
| 215 | Term(Term), |
| 216 | Op(char, Spacing), |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 217 | Literal(Literal), |
| 218 | } |
| 219 | |
Michael Layzell | 5372f4b | 2017-06-02 10:29:31 -0400 | [diff] [blame] | 220 | #[derive(Copy, Clone, Debug, Eq, PartialEq)] |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 221 | pub enum Delimiter { |
| 222 | Parenthesis, |
| 223 | Brace, |
| 224 | Bracket, |
| 225 | None, |
| 226 | } |
| 227 | |
David Tolnay | cb1b85f | 2017-06-03 16:40:35 -0700 | [diff] [blame] | 228 | #[derive(Copy, Clone)] |
Alex Crichton | 1a7f762 | 2017-07-05 17:47:15 -0700 | [diff] [blame] | 229 | pub struct Term(imp::Term); |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 230 | |
Alex Crichton | 1a7f762 | 2017-07-05 17:47:15 -0700 | [diff] [blame] | 231 | impl Term { |
| 232 | pub fn intern(string: &str) -> Term { |
| 233 | Term(string.into()) |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 234 | } |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 235 | |
Alex Crichton | 4388125 | 2017-05-26 08:51:06 -0700 | [diff] [blame] | 236 | pub fn as_str(&self) -> &str { |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 237 | &self.0 |
| 238 | } |
| 239 | } |
| 240 | |
Lukas Kalbertodt | eb3f930 | 2017-08-20 18:58:41 +0200 | [diff] [blame] | 241 | #[derive(Copy, Clone, Debug, Eq, PartialEq)] |
Alex Crichton | 1a7f762 | 2017-07-05 17:47:15 -0700 | [diff] [blame] | 242 | pub enum Spacing { |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 243 | Alone, |
| 244 | Joint, |
| 245 | } |
| 246 | |
David Tolnay | cb1b85f | 2017-06-03 16:40:35 -0700 | [diff] [blame] | 247 | #[derive(Clone)] |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 248 | pub struct Literal(imp::Literal); |
| 249 | |
Alex Crichton | 1a7f762 | 2017-07-05 17:47:15 -0700 | [diff] [blame] | 250 | macro_rules! int_literals { |
| 251 | ($($kind:ident,)*) => ($( |
| 252 | pub fn $kind(n: $kind) -> Literal { |
| 253 | Literal(n.into()) |
| 254 | } |
| 255 | )*) |
| 256 | } |
| 257 | |
Alex Crichton | 852d53d | 2017-05-19 19:25:08 -0700 | [diff] [blame] | 258 | impl Literal { |
Alex Crichton | 1a7f762 | 2017-07-05 17:47:15 -0700 | [diff] [blame] | 259 | pub fn integer(s: i64) -> Literal { |
| 260 | Literal(imp::Literal::integer(s)) |
| 261 | } |
| 262 | |
| 263 | int_literals! { |
Alex Crichton | 1a16c78 | 2017-07-05 18:06:36 -0700 | [diff] [blame] | 264 | u8, u16, u32, u64, usize, |
| 265 | i8, i16, i32, i64, isize, |
Alex Crichton | 1a7f762 | 2017-07-05 17:47:15 -0700 | [diff] [blame] | 266 | } |
| 267 | |
| 268 | pub fn float(f: f64) -> Literal { |
| 269 | Literal(imp::Literal::float(f)) |
| 270 | } |
| 271 | |
| 272 | pub fn f64(f: f64) -> Literal { |
| 273 | Literal(f.into()) |
| 274 | } |
| 275 | |
| 276 | pub fn f32(f: f32) -> Literal { |
| 277 | Literal(f.into()) |
| 278 | } |
| 279 | |
| 280 | pub fn string(string: &str) -> Literal { |
| 281 | Literal(string.into()) |
| 282 | } |
| 283 | |
| 284 | pub fn character(ch: char) -> Literal { |
| 285 | Literal(ch.into()) |
Alex Crichton | 76a5cc8 | 2017-05-23 07:01:44 -0700 | [diff] [blame] | 286 | } |
| 287 | |
Alex Crichton | 9c2fb0a | 2017-05-26 08:49:31 -0700 | [diff] [blame] | 288 | pub fn byte_string(s: &[u8]) -> Literal { |
| 289 | Literal(imp::Literal::byte_string(s)) |
Alex Crichton | 852d53d | 2017-05-19 19:25:08 -0700 | [diff] [blame] | 290 | } |
Alex Crichton | 76a5cc8 | 2017-05-23 07:01:44 -0700 | [diff] [blame] | 291 | |
Alex Crichton | 1a7f762 | 2017-07-05 17:47:15 -0700 | [diff] [blame] | 292 | // ======================================================================= |
| 293 | // Not present upstream in proc_macro yet |
| 294 | |
| 295 | pub fn byte_char(b: u8) -> Literal { |
| 296 | Literal(imp::Literal::byte_char(b)) |
| 297 | } |
| 298 | |
Alex Crichton | 76a5cc8 | 2017-05-23 07:01:44 -0700 | [diff] [blame] | 299 | pub fn doccomment(s: &str) -> Literal { |
| 300 | Literal(imp::Literal::doccomment(s)) |
| 301 | } |
Alex Crichton | 9c2fb0a | 2017-05-26 08:49:31 -0700 | [diff] [blame] | 302 | |
Alex Crichton | 3131662 | 2017-05-26 12:54:47 -0700 | [diff] [blame] | 303 | pub fn raw_string(s: &str, pounds: usize) -> Literal { |
| 304 | Literal(imp::Literal::raw_string(s, pounds)) |
| 305 | } |
| 306 | |
| 307 | pub fn raw_byte_string(s: &str, pounds: usize) -> Literal { |
| 308 | Literal(imp::Literal::raw_byte_string(s, pounds)) |
| 309 | } |
Alex Crichton | 852d53d | 2017-05-19 19:25:08 -0700 | [diff] [blame] | 310 | } |
| 311 | |
Alex Crichton | 1a7f762 | 2017-07-05 17:47:15 -0700 | [diff] [blame] | 312 | pub struct TokenTreeIter(imp::TokenTreeIter); |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 313 | |
Alex Crichton | 1a7f762 | 2017-07-05 17:47:15 -0700 | [diff] [blame] | 314 | impl Iterator for TokenTreeIter { |
Alex Crichton | 44bffbc | 2017-05-19 17:51:59 -0700 | [diff] [blame] | 315 | type Item = TokenTree; |
| 316 | |
| 317 | fn next(&mut self) -> Option<TokenTree> { |
| 318 | self.0.next() |
| 319 | } |
| 320 | } |
David Tolnay | cb1b85f | 2017-06-03 16:40:35 -0700 | [diff] [blame] | 321 | |
| 322 | forward_fmt!(Debug for LexError); |
| 323 | forward_fmt!(Debug for Literal); |
| 324 | forward_fmt!(Debug for Span); |
Alex Crichton | 1a7f762 | 2017-07-05 17:47:15 -0700 | [diff] [blame] | 325 | forward_fmt!(Debug for Term); |
| 326 | forward_fmt!(Debug for TokenTreeIter); |
David Tolnay | cb1b85f | 2017-06-03 16:40:35 -0700 | [diff] [blame] | 327 | forward_fmt!(Debug for TokenStream); |
| 328 | forward_fmt!(Display for Literal); |
| 329 | forward_fmt!(Display for TokenStream); |