Lines Matching refs:token
1 //! Parsing interface for parsing a token stream into a syntax tree node.
7 //! tokens in a token stream.
17 //! trait to parse these syntax tree data structures from a token stream.
23 //! pointing out the exact token that triggered the failure to parse.
31 //! use syn::{braced, parse_macro_input, token, Field, Ident, Result, Token};
43 //! brace_token: token::Brace,
191 use crate::token::Token;
207 /// way from a token stream.
225 /// Cursor position within a buffered token stream.
504 /// Looks at the next token in the parse stream to determine whether it
505 /// matches the requested type of token.
519 /// - `input.peek(token::Brace)`
524 /// token in the input is either `where` or an opening curly brace.
527 /// use syn::{braced, token, Generics, Ident, Result, Token, TypeParamBound};
540 /// brace_token: token::Brace,
554 /// if input.peek(Token![where]) || input.peek(token::Brace) {
576 pub fn peek<T: Peek>(&self, token: T) -> bool {
577 let _ = token;
581 /// Looks at the second-next token in the parse stream.
589 /// the very next token is `union`, because someone is free to write a `mod
615 pub fn peek2<T: Peek>(&self, token: T) -> bool {
625 let _ = token;
629 /// Looks at the third-next token in the parse stream.
630 pub fn peek3<T: Peek>(&self, token: T) -> bool {
644 let _ = token;
659 /// use syn::{parenthesized, token, Ident, Result, Token, Type};
669 /// paren_token: token::Paren,
760 /// use syn::{braced, token, Ident, Item, Result, Token};
767 /// brace_token: token::Brace,
793 /// Constructs a helper for peeking at the next token in this stream and
844 /// involve copying token buffers. Where you might hit performance problems
870 /// For a lower level way to perform speculative parsing at the token level,
904 /// The parser uses a forked parse stream to check the first token inside of
909 /// use syn::{parenthesized, token, Ident, Path, Result, Token};
919 /// paren_token: token::Paren,
928 /// if input.peek(token::Paren) {
1011 /// the basic built-in token types. It is not something that will be used
1082 /// Returns the `Span` of the next token in the parse stream, or
1094 /// Provides low-level access to the token representation underlying this
1127 /// let (token, next) = cursor.token_tree().unwrap();
1128 /// tokens.extend(std::iter::once(token));
1157 Some(span) => Err(Error::new(span, "unexpected token")),
1193 None => Err(cursor.error("expected token tree")),
1207 Err(cursor.error("expected group token"))
1217 None => Err(cursor.error("expected punctuation token")),
1227 None => Err(cursor.error("expected literal token")),
1240 /// Parse a proc-macro2 token stream into the chosen syntax tree node.
1297 Err(Error::new(unexpected_span, "unexpected token"))
1312 Err(Error::new(unexpected_span, "unexpected token"))
1348 /// error: unexpected token