Lines Matching refs:token

5 //! expands to the token type of the given token.
74 //! Every keyword and punctuation token supports the following operations.
147 /// Support writing `token.span` rather than `token.spans[0]` on tokens that
209 impl_token!("group token" proc_macro2::Group);
229 impl_low_level_token!("punctuation token" Punct punct);
231 impl_low_level_token!("token" TokenTree token_tree);
248 ($($token:literal pub struct $name:ident)*) => {
250 #[doc = concat!('`', $token, '`')]
255 /// [`Token!`]: crate::token
318 printing::keyword($token, self.span, tokens);
327 span: parsing::keyword(input, $token)?,
335 parsing::peek_keyword(cursor, $token)
339 concat!("`", $token, "`")
370 ($($token:literal pub struct $name:ident/$len:tt #[doc = $usage:literal])*) => {
374 #[doc = concat!('`', $token, '`')]
382 /// [`Token!`]: crate::token
447 ($($token:literal pub struct $name:ident/$len:tt #[doc = $usage:literal])*) => {
450 $token pub struct $name/$len #[doc = $usage]
457 printing::punct($token, &self.spans, tokens);
466 spans: parsing::punct(input, $token)?,
474 parsing::peek_punct(cursor, $token)
478 concat!("`", $token, "`")
847 /// given token.
910 /// See the [token module] documentation for details and examples.
912 /// [token module]: crate::token
915 [abstract] => { $crate::token::Abstract };
916 [as] => { $crate::token::As };
917 [async] => { $crate::token::Async };
918 [auto] => { $crate::token::Auto };
919 [await] => { $crate::token::Await };
920 [become] => { $crate::token::Become };
921 [box] => { $crate::token::Box };
922 [break] => { $crate::token::Break };
923 [const] => { $crate::token::Const };
924 [continue] => { $crate::token::Continue };
925 [crate] => { $crate::token::Crate };
926 [default] => { $crate::token::Default };
927 [do] => { $crate::token::Do };
928 [dyn] => { $crate::token::Dyn };
929 [else] => { $crate::token::Else };
930 [enum] => { $crate::token::Enum };
931 [extern] => { $crate::token::Extern };
932 [final] => { $crate::token::Final };
933 [fn] => { $crate::token::Fn };
934 [for] => { $crate::token::For };
935 [if] => { $crate::token::If };
936 [impl] => { $crate::token::Impl };
937 [in] => { $crate::token::In };
938 [let] => { $crate::token::Let };
939 [loop] => { $crate::token::Loop };
940 [macro] => { $crate::token::Macro };
941 [match] => { $crate::token::Match };
942 [mod] => { $crate::token::Mod };
943 [move] => { $crate::token::Move };
944 [mut] => { $crate::token::Mut };
945 [override] => { $crate::token::Override };
946 [priv] => { $crate::token::Priv };
947 [pub] => { $crate::token::Pub };
948 [ref] => { $crate::token::Ref };
949 [return] => { $crate::token::Return };
950 [Self] => { $crate::token::SelfType };
951 [self] => { $crate::token::SelfValue };
952 [static] => { $crate::token::Static };
953 [struct] => { $crate::token::Struct };
954 [super] => { $crate::token::Super };
955 [trait] => { $crate::token::Trait };
956 [try] => { $crate::token::Try };
957 [type] => { $crate::token::Type };
958 [typeof] => { $crate::token::Typeof };
959 [union] => { $crate::token::Union };
960 [unsafe] => { $crate::token::Unsafe };
961 [unsized] => { $crate::token::Unsized };
962 [use] => { $crate::token::Use };
963 [virtual] => { $crate::token::Virtual };
964 [where] => { $crate::token::Where };
965 [while] => { $crate::token::While };
966 [yield] => { $crate::token::Yield };
967 [&] => { $crate::token::And };
968 [&&] => { $crate::token::AndAnd };
969 [&=] => { $crate::token::AndEq };
970 [@] => { $crate::token::At };
971 [^] => { $crate::token::Caret };
972 [^=] => { $crate::token::CaretEq };
973 [:] => { $crate::token::Colon };
974 [,] => { $crate::token::Comma };
975 [$] => { $crate::token::Dollar };
976 [.] => { $crate::token::Dot };
977 [..] => { $crate::token::DotDot };
978 [...] => { $crate::token::DotDotDot };
979 [..=] => { $crate::token::DotDotEq };
980 [=] => { $crate::token::Eq };
981 [==] => { $crate::token::EqEq };
982 [=>] => { $crate::token::FatArrow };
983 [>=] => { $crate::token::Ge };
984 [>] => { $crate::token::Gt };
985 [<-] => { $crate::token::LArrow };
986 [<=] => { $crate::token::Le };
987 [<] => { $crate::token::Lt };
988 [-] => { $crate::token::Minus };
989 [-=] => { $crate::token::MinusEq };
990 [!=] => { $crate::token::Ne };
991 [!] => { $crate::token::Not };
992 [|] => { $crate::token::Or };
993 [|=] => { $crate::token::OrEq };
994 [||] => { $crate::token::OrOr };
995 [::] => { $crate::token::PathSep };
996 [%] => { $crate::token::Percent };
997 [%=] => { $crate::token::PercentEq };
998 [+] => { $crate::token::Plus };
999 [+=] => { $crate::token::PlusEq };
1000 [#] => { $crate::token::Pound };
1001 [?] => { $crate::token::Question };
1002 [->] => { $crate::token::RArrow };
1003 [;] => { $crate::token::Semi };
1004 [<<] => { $crate::token::Shl };
1005 [<<=] => { $crate::token::ShlEq };
1006 [>>] => { $crate::token::Shr };
1007 [>>=] => { $crate::token::ShrEq };
1008 [/] => { $crate::token::Slash };
1009 [/=] => { $crate::token::SlashEq };
1010 [*] => { $crate::token::Star };
1011 [*=] => { $crate::token::StarEq };
1012 [~] => { $crate::token::Tilde };
1013 [_] => { $crate::token::Underscore };
1025 pub(crate) fn keyword(input: ParseStream, token: &str) -> Result<Span> {
1028 if ident == token {
1032 Err(cursor.error(format!("expected `{}`", token)))
1036 pub(crate) fn peek_keyword(cursor: Cursor, token: &str) -> bool {
1038 ident == token
1045 pub fn punct<const N: usize>(input: ParseStream, token: &str) -> Result<[Span; N]> {
1047 punct_helper(input, token, &mut spans)?;
1051 fn punct_helper(input: ParseStream, token: &str, spans: &mut [Span]) -> Result<()> {
1054 assert_eq!(token.len(), spans.len());
1056 for (i, ch) in token.chars().enumerate() {
1062 } else if i == token.len() - 1 {
1073 Err(Error::new(spans[0], format!("expected `{}`", token)))
1078 pub fn peek_punct(mut cursor: Cursor, token: &str) -> bool {
1079 for (i, ch) in token.chars().enumerate() {
1084 } else if i == token.len() - 1 {