Lines Matching full:b
30 /// A byte string literal: `b"foo"`.
36 /// A byte literal: `b'f'`.
66 /// A byte string literal: `b"foo"`.
80 /// A byte literal: `b'f'`.
163 /// // #[path = "a::b::c"]
200 /// # let lit_str = LitStr::new("a::b::c", Span::call_site());
206 /// // Parse a string literal like "a::b::c" into a Path, not allowing
1145 b'"' | b'r' => { in new()
1151 b'b' => match byte(&repr, 1) { in new()
1152 // b"...", br"...", br#"...#" in new()
1153 b'"' | b'r' => { in new()
1159 // b'...' in new()
1160 b'\'' => { in new()
1169 b'c' => { in new()
1176 b'\'' => { in new()
1182 b'0'..=b'9' | b'-' => { in new()
1205 b't' | b'f' => { in new()
1213 b'(' if repr == "(/*ERROR*/)" => return Lit::Verbatim(token), in new()
1262 /// Get the byte at offset idx, or a default of `b'\0'` if we're looking
1280 b'"' => parse_lit_str_cooked(s), in parse_lit_str()
1281 b'r' => parse_lit_str_raw(s), in parse_lit_str()
1287 assert_eq!(byte(s, 0), b'"'); in parse_lit_str_cooked()
1293 b'"' => break, in parse_lit_str_cooked()
1294 b'\\' => { in parse_lit_str_cooked()
1295 let b = byte(s, 1); in parse_lit_str_cooked() localVariable
1297 match b { in parse_lit_str_cooked()
1298 b'x' => { in parse_lit_str_cooked()
1304 b'u' => { in parse_lit_str_cooked()
1309 b'n' => '\n', in parse_lit_str_cooked()
1310 b'r' => '\r', in parse_lit_str_cooked()
1311 b't' => '\t', in parse_lit_str_cooked()
1312 b'\\' => '\\', in parse_lit_str_cooked()
1313 b'0' => '\0', in parse_lit_str_cooked()
1314 b'\'' => '\'', in parse_lit_str_cooked()
1315 b'"' => '"', in parse_lit_str_cooked()
1316 b'\r' | b'\n' => loop { in parse_lit_str_cooked()
1317 let b = byte(s, 0); in parse_lit_str_cooked() localVariable
1318 match b { in parse_lit_str_cooked()
1319 b' ' | b'\t' | b'\n' | b'\r' => s = &s[1..], in parse_lit_str_cooked()
1323 b => panic!( in parse_lit_str_cooked()
1325 ascii::escape_default(b), in parse_lit_str_cooked()
1329 b'\r' => { in parse_lit_str_cooked()
1330 assert_eq!(byte(s, 1), b'\n', "bare CR not allowed in string"); in parse_lit_str_cooked()
1350 assert_eq!(byte(s, 0), b'r'); in parse_lit_str_raw()
1354 while byte(s, pounds) == b'#' { in parse_lit_str_raw()
1357 assert_eq!(byte(s, pounds), b'"'); in parse_lit_str_raw()
1360 assert_eq!(end, b'#'); in parse_lit_str_raw()
1370 assert_eq!(byte(s, 0), b'b'); in parse_lit_byte_str()
1372 b'"' => parse_lit_byte_str_cooked(s), in parse_lit_byte_str()
1373 b'r' => parse_lit_byte_str_raw(s), in parse_lit_byte_str()
1379 assert_eq!(byte(s, 0), b'b'); in parse_lit_byte_str_cooked()
1380 assert_eq!(byte(s, 1), b'"'); in parse_lit_byte_str_cooked()
1389 b'"' => break, in parse_lit_byte_str_cooked()
1390 b'\\' => { in parse_lit_byte_str_cooked()
1391 let b = byte(v, 1); in parse_lit_byte_str_cooked() localVariable
1393 match b { in parse_lit_byte_str_cooked()
1394 b'x' => { in parse_lit_byte_str_cooked()
1395 let (b, rest) = backslash_x(v); in parse_lit_byte_str_cooked()
1397 b in parse_lit_byte_str_cooked()
1399 b'n' => b'\n', in parse_lit_byte_str_cooked()
1400 b'r' => b'\r', in parse_lit_byte_str_cooked()
1401 b't' => b'\t', in parse_lit_byte_str_cooked()
1402 b'\\' => b'\\', in parse_lit_byte_str_cooked()
1403 b'0' => b'\0', in parse_lit_byte_str_cooked()
1404 b'\'' => b'\'', in parse_lit_byte_str_cooked()
1405 b'"' => b'"', in parse_lit_byte_str_cooked()
1406 b'\r' | b'\n' => loop { in parse_lit_byte_str_cooked()
1408 if matches!(byte, b' ' | b'\t' | b'\n' | b'\r') { in parse_lit_byte_str_cooked()
1414 b => panic!( in parse_lit_byte_str_cooked()
1416 ascii::escape_default(b), in parse_lit_byte_str_cooked()
1420 b'\r' => { in parse_lit_byte_str_cooked()
1421 assert_eq!(byte(v, 1), b'\n', "bare CR not allowed in string"); in parse_lit_byte_str_cooked()
1423 b'\n' in parse_lit_byte_str_cooked()
1425 b => { in parse_lit_byte_str_cooked()
1427 b in parse_lit_byte_str_cooked()
1433 assert_eq!(byte(v, 0), b'"'); in parse_lit_byte_str_cooked()
1439 assert_eq!(byte(s, 0), b'b'); in parse_lit_byte_str_raw()
1446 assert_eq!(byte(s, 0), b'c'); in parse_lit_c_str()
1448 b'"' => parse_lit_c_str_cooked(s), in parse_lit_c_str()
1449 b'r' => parse_lit_c_str_raw(s), in parse_lit_c_str()
1455 assert_eq!(byte(s, 0), b'c'); in parse_lit_c_str_cooked()
1456 assert_eq!(byte(s, 1), b'"'); in parse_lit_c_str_cooked()
1465 b'"' => break, in parse_lit_c_str_cooked()
1466 b'\\' => { in parse_lit_c_str_cooked()
1467 let b = byte(v, 1); in parse_lit_c_str_cooked() localVariable
1469 match b { in parse_lit_c_str_cooked()
1470 b'x' => { in parse_lit_c_str_cooked()
1471 let (b, rest) = backslash_x(v); in parse_lit_c_str_cooked()
1472 assert!(b != 0, "\\x00 is not allowed in C-string literal"); in parse_lit_c_str_cooked()
1474 b in parse_lit_c_str_cooked()
1476 b'u' => { in parse_lit_c_str_cooked()
1483 b'n' => b'\n', in parse_lit_c_str_cooked()
1484 b'r' => b'\r', in parse_lit_c_str_cooked()
1485 b't' => b'\t', in parse_lit_c_str_cooked()
1486 b'\\' => b'\\', in parse_lit_c_str_cooked()
1487 b'\'' => b'\'', in parse_lit_c_str_cooked()
1488 b'"' => b'"', in parse_lit_c_str_cooked()
1489 b'\r' | b'\n' => loop { in parse_lit_c_str_cooked()
1491 if matches!(byte, b' ' | b'\t' | b'\n' | b'\r') { in parse_lit_c_str_cooked()
1497 b => panic!( in parse_lit_c_str_cooked()
1499 ascii::escape_default(b), in parse_lit_c_str_cooked()
1503 b'\r' => { in parse_lit_c_str_cooked()
1504 assert_eq!(byte(v, 1), b'\n', "bare CR not allowed in string"); in parse_lit_c_str_cooked()
1506 b'\n' in parse_lit_c_str_cooked()
1508 b => { in parse_lit_c_str_cooked()
1510 b in parse_lit_c_str_cooked()
1516 assert_eq!(byte(v, 0), b'"'); in parse_lit_c_str_cooked()
1522 assert_eq!(byte(s, 0), b'c'); in parse_lit_c_str_raw()
1529 assert_eq!(byte(s, 0), b'b'); in parse_lit_byte()
1530 assert_eq!(byte(s, 1), b'\''); in parse_lit_byte()
1535 let b = match byte(v, 0) { in parse_lit_byte() localVariable
1536 b'\\' => { in parse_lit_byte()
1537 let b = byte(v, 1); in parse_lit_byte() localVariable
1539 match b { in parse_lit_byte()
1540 b'x' => { in parse_lit_byte()
1541 let (b, rest) = backslash_x(v); in parse_lit_byte()
1543 b in parse_lit_byte()
1545 b'n' => b'\n', in parse_lit_byte()
1546 b'r' => b'\r', in parse_lit_byte()
1547 b't' => b'\t', in parse_lit_byte()
1548 b'\\' => b'\\', in parse_lit_byte()
1549 b'0' => b'\0', in parse_lit_byte()
1550 b'\'' => b'\'', in parse_lit_byte()
1551 b'"' => b'"', in parse_lit_byte()
1552 b => panic!( in parse_lit_byte()
1554 ascii::escape_default(b), in parse_lit_byte()
1558 b => { in parse_lit_byte()
1560 b in parse_lit_byte()
1564 assert_eq!(byte(v, 0), b'\''); in parse_lit_byte()
1566 (b, suffix) in parse_lit_byte()
1571 assert_eq!(byte(s, 0), b'\''); in parse_lit_char()
1575 b'\\' => { in parse_lit_char()
1576 let b = byte(s, 1); in parse_lit_char() localVariable
1578 match b { in parse_lit_char()
1579 b'x' => { in parse_lit_char()
1585 b'u' => { in parse_lit_char()
1590 b'n' => '\n', in parse_lit_char()
1591 b'r' => '\r', in parse_lit_char()
1592 b't' => '\t', in parse_lit_char()
1593 b'\\' => '\\', in parse_lit_char()
1594 b'0' => '\0', in parse_lit_char()
1595 b'\'' => '\'', in parse_lit_char()
1596 b'"' => '"', in parse_lit_char()
1597 b => panic!( in parse_lit_char()
1599 ascii::escape_default(b), in parse_lit_char()
1609 assert_eq!(byte(s, 0), b'\''); in parse_lit_char()
1623 b'0'..=b'9' => b0 - b'0', in backslash_x()
1624 b'a'..=b'f' => 10 + (b0 - b'a'), in backslash_x()
1625 b'A'..=b'F' => 10 + (b0 - b'A'), in backslash_x()
1629 b'0'..=b'9' => b1 - b'0', in backslash_x()
1630 b'a'..=b'f' => 10 + (b1 - b'a'), in backslash_x()
1631 b'A'..=b'F' => 10 + (b1 - b'A'), in backslash_x()
1641 if byte(s, 0) != b'{' { in backslash_u()
1649 let b = byte(s, 0); in backslash_u() localVariable
1650 let digit = match b { in backslash_u()
1651 b'0'..=b'9' => b - b'0', in backslash_u()
1652 b'a'..=b'f' => 10 + b - b'a', in backslash_u()
1653 b'A'..=b'F' => 10 + b - b'A', in backslash_u()
1654 b'_' if digits > 0 => { in backslash_u()
1658 b'}' if digits == 0 => panic!("invalid empty unicode escape"), in backslash_u()
1659 b'}' => break, in backslash_u()
1670 assert!(byte(s, 0) == b'}'); in backslash_u()
1682 let negative = byte(s, 0) == b'-'; in parse_lit_int()
1688 (b'0', b'x') => { in parse_lit_int()
1692 (b'0', b'o') => { in parse_lit_int()
1696 (b'0', b'b') => { in parse_lit_int()
1700 (b'0'..=b'9', _) => 10, in parse_lit_int()
1707 let b = byte(s, 0); in parse_lit_int() localVariable
1708 let digit = match b { in parse_lit_int()
1709 b'0'..=b'9' => b - b'0', in parse_lit_int()
1710 b'a'..=b'f' if base > 10 => b - b'a' + 10, in parse_lit_int()
1711 b'A'..=b'F' if base > 10 => b - b'A' + 10, in parse_lit_int()
1712 b'_' => { in parse_lit_int()
1718 b'.' if base == 10 => return None, in parse_lit_int()
1719 b'e' | b'E' if base == 10 => { in parse_lit_int()
1721 for (i, b) in s[1..].bytes().enumerate() { in parse_lit_int()
1722 match b { in parse_lit_int()
1723 b'_' => {} in parse_lit_int()
1724 b'-' | b'+' => return None, in parse_lit_int()
1725 b'0'..=b'9' => has_exp = true, in parse_lit_int()
1779 let start = (*bytes.first()? == b'-') as usize; in parse_lit_float()
1781 b'0'..=b'9' => {} in parse_lit_float()
1793 b'_' => { in parse_lit_float()
1798 b'0'..=b'9' => { in parse_lit_float()
1804 b'.' => { in parse_lit_float()
1809 bytes[write] = b'.'; in parse_lit_float()
1811 b'e' | b'E' => { in parse_lit_float()
1814 .find(|b| **b != b'_') in parse_lit_float()
1815 .unwrap_or(&b'\0') in parse_lit_float()
1817 b'-' | b'+' | b'0'..=b'9' => {} in parse_lit_float()
1828 bytes[write] = b'e'; in parse_lit_float()
1830 b'-' | b'+' => { in parse_lit_float()
1835 if bytes[read] == b'-' { in parse_lit_float()