Lines Matching full:lit
26 pub enum Lit {
159 /// use syn::{Attribute, Error, Expr, Lit, Meta, Path, Result};
172 /// if let Expr::Lit(expr) = &meta.value {
173 /// if let Lit::Str(lit_str) = &expr.lit {
439 /// This is equivalent to `lit.base10_digits().parse()` except that the
453 /// let lit: LitInt = input.parse()?;
454 /// let value = lit.base10_parse::<u16>()?;
606 use crate::lit::{LitBool, LitByte, LitByteStr, LitCStr, LitChar, LitFloat, LitInt, LitStr};
848 pub fn Lit(marker: lookahead::TokenMarker) -> Lit {
857 use crate::lit::{
858 value, Lit, LitBool, LitByte, LitByteStr, LitCStr, LitChar, LitFloat, LitFloatRepr, LitInt,
868 impl Parse for Lit { implementation
871 if let Some((lit, rest)) = cursor.literal() { in parse()
872 return Ok((Lit::new(lit), rest)); in parse()
882 return Ok((Lit::Bool(lit_bool), rest)); in parse()
888 if let Some((lit, rest)) = parse_negative_lit(punct, rest) { in parse()
889 return Ok((lit, rest)); in parse()
899 fn parse_negative_lit(neg: Punct, cursor: Cursor) -> Option<(Lit, Cursor)> { in parse_negative_lit() argument
900 let (lit, rest) = cursor.literal()?; in parse_negative_lit()
903 span = span.join(lit.span()).unwrap_or(span); in parse_negative_lit()
905 let mut repr = lit.to_string(); in parse_negative_lit()
912 Lit::Int(LitInt { in parse_negative_lit()
927 Lit::Float(LitFloat { in parse_negative_lit()
943 Ok(Lit::Str(lit)) => Ok(lit), in parse()
954 Ok(Lit::ByteStr(lit)) => Ok(lit), in parse()
965 Ok(Lit::CStr(lit)) => Ok(lit), in parse()
976 Ok(Lit::Byte(lit)) => Ok(lit), in parse()
987 Ok(Lit::Char(lit)) => Ok(lit), in parse()
998 Ok(Lit::Int(lit)) => Ok(lit), in parse()
1009 Ok(Lit::Float(lit)) => Ok(lit), in parse()
1020 Ok(Lit::Bool(lit)) => Ok(lit), in parse()
1052 impl_token!("literal" Lit);
1065 use crate::lit::{LitBool, LitByte, LitByteStr, LitCStr, LitChar, LitFloat, LitInt, LitStr};
1128 use crate::lit::{
1129 Lit, LitBool, LitByte, LitByteStr, LitCStr, LitChar, LitFloat, LitFloatRepr, LitInt,
1138 impl Lit { implementation
1147 return Lit::Str(LitStr { in new()
1155 return Lit::ByteStr(LitByteStr { in new()
1162 return Lit::Byte(LitByte { in new()
1171 return Lit::CStr(LitCStr { in new()
1178 return Lit::Char(LitChar { in new()
1185 return Lit::Int(LitInt { in new()
1195 return Lit::Float(LitFloat { in new()
1207 return Lit::Bool(LitBool { in new()
1213 b'(' if repr == "(/*ERROR*/)" => return Lit::Verbatim(token), in new()
1222 Lit::Str(lit) => lit.suffix(), in suffix()
1223 Lit::ByteStr(lit) => lit.suffix(), in suffix()
1224 Lit::CStr(lit) => lit.suffix(), in suffix()
1225 Lit::Byte(lit) => lit.suffix(), in suffix()
1226 Lit::Char(lit) => lit.suffix(), in suffix()
1227 Lit::Int(lit) => lit.suffix(), in suffix()
1228 Lit::Float(lit) => lit.suffix(), in suffix()
1229 Lit::Bool(_) | Lit::Verbatim(_) => "", in suffix()
1235 Lit::Str(lit) => lit.span(), in span()
1236 Lit::ByteStr(lit) => lit.span(), in span()
1237 Lit::CStr(lit) => lit.span(), in span()
1238 Lit::Byte(lit) => lit.span(), in span()
1239 Lit::Char(lit) => lit.span(), in span()
1240 Lit::Int(lit) => lit.span(), in span()
1241 Lit::Float(lit) => lit.span(), in span()
1242 Lit::Bool(lit) => lit.span, in span()
1243 Lit::Verbatim(lit) => lit.span(), in span()
1249 Lit::Str(lit) => lit.set_span(span), in set_span()
1250 Lit::ByteStr(lit) => lit.set_span(span), in set_span()
1251 Lit::CStr(lit) => lit.set_span(span), in set_span()
1252 Lit::Byte(lit) => lit.set_span(span), in set_span()
1253 Lit::Char(lit) => lit.set_span(span), in set_span()
1254 Lit::Int(lit) => lit.set_span(span), in set_span()
1255 Lit::Float(lit) => lit.set_span(span), in set_span()
1256 Lit::Bool(lit) => lit.span = span, in set_span()
1257 Lit::Verbatim(lit) => lit.set_span(span), in set_span()