about summary refs log tree commit diff
path: root/compiler/rustc_lexer/src/unescape
AgeCommit message (Collapse)AuthorLines
2025-04-04Replace `rustc_lexer/unescape` with `rustc-literal-escaper` crateGuillaume Gomez-286/+0
2025-03-18Revert "Rollup merge of #136355 - ↵Ralf Jung-0/+286
GuillaumeGomez:proc-macro_add_value_retrieval_methods, r=Amanieu" This reverts commit 08dfbf49e30d917c89e49eb14cb3f1e8b8a1c9ef, reversing changes made to 10bcdad7df0de3cfb95c7bdb7b16908e73cafc09.
2025-02-10Extract `unescape` from `rustc_lexer` into its own crateGuillaume Gomez-286/+0
2025-02-08Rustfmtbjorn3-6/+9
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-9/+6
2024-01-25Rename the unescaping functions.Nicholas Nethercote-5/+5
`unescape_literal` becomes `unescape_unicode`, and `unescape_c_string` becomes `unescape_mixed`. Because rfc3349 will mean that C string literals will no longer be the only mixed utf8 literals.
2022-11-16Use `as_deref` in compiler (but only where it makes sense)Maybe Waffle-4/+2
2022-11-08Simplify `unescape_{char,byte}`.Nicholas Nethercote-8/+4
The `usize` isn't needed in the error case.
2022-11-05Remove `unescape_byte_literal`.Nicholas Nethercote-7/+5
It's easy to just use `unescape_literal` + `byte_from_char`.
2022-11-04Make non-ASCII errors more consistent.Nicholas Nethercote-5/+2
There are three kinds of "byte" literals: byte literals, byte string literals, and raw byte string literals. None are allowed to have non-ASCII chars in them. Two `EscapeError` variants exist for when that constraint is violated. - `NonAsciiCharInByte`: used for byte literals and byte string literals. - `NonAsciiCharInByteString`: used for raw byte string literals. As a result, the messages for raw byte string literals use different wording, without good reason. Also, byte string literals are incorrectly described as "byte constants" in some error messages. This commit eliminates `NonAsciiCharInByteString` so the three cases are handled similarly, and described correctly. The `mode` is enough to distinguish them. Note: Some existing error messages mention "byte constants" and some mention "byte literals". I went with the latter here, because it's a more correct name, as used by the Reference.
2021-08-11Warn when an escaped newline skips multiple linesAnton Golov-0/+5
2021-07-30Add warning when whitespace is not skipped after an escaped newline.Anton Golov-0/+19
2020-08-30mv compiler to compiler/mark-0/+273