CRLF handling
Nobody has claimed this yet.
- Dominant language
- reStructuredText
- Stars
- 497
- Forks
- 41
- Avg merge
- 3h 52m
- Merged PRs (30d)
- 4
Description
Background: rustc converts CRLF to LF as a separate pass before lexical analysis. CR is whitespace just as LF is, so this only matters inside literals and doc comments.
The FLS describes this using the following paragraphs under "Legality Rules"
§2.4.2:2 (fls_Xd6LnfzMb7t7)
The character sequence 0x0D 0x0A (carriage return, new line) is replaced by 0x0A (new line) inside of a byte string literal.
§2.4.3:2 (fls_XJprzaEn82Xs)
The character sequence 0x0D 0x0A (carriage return, new line) is replaced by 0x0A (new line) inside of a c string literal.
§2.4.6:2 (fls_NyiCpU2tzJlQ)
The character sequence 0x0D 0x0A (carriage return, new line) is replaced by 0x0A (new line) inside of a string literal.
See #172 and #269 for some history here.
But I don't think this approach works with the syntax rules, for example in §2.4.6.2 (fls_usr6iuwpwqqh)
RawStringContent ::= NestedRawStringContent | " ~[\r]* "
At the point where the tool is considering this rule, it hasn't yet decided it's seen a raw string literal, so §2.4.6:2 can't have caused a CRLF to be replaced by LF. So this rule is incorrectly saying that any raw string containing CRLF is rejected.
Similar reasoning applies for all the forms of double-quoted literal, and for (at least block) doc comments.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the §2.4.2, §2.4.3, and §2.4.6 legality rules with the §2.4.6.2 RawStringContent syntax rule, then review the referenced history in #172 and #269. Done means the FLS consistently specifies CRLF handling for quoted literals and relevant doc comments without contradicting its syntax rules.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100