Processing shebang and byte order mark
Nobody has claimed this yet.
- Dominant language
- reStructuredText
- Stars
- 497
- Forks
- 41
- Avg merge
- 3h 52m
- Merged PRs (30d)
- 4
Description
Shebang
§18.1 (fls_s35hob3i7lr) provides the following syntax definitions:
SourceFile ::=
ZeroWidthNoBreakSpace?
Shebang?
InnerAttributeOrDoc*
Item*
Shebang ::=
#! ~[NewLine]*
NewLine ::=
\n
This grammar is ambiguous: a file starting with the following could be treated as starting with either a Shebang or an InnerAttributeOrDoc:
#![xxx]
This is an unusual case where the ambiguity isn't resolved "eagerly": rustc sees this as InnerAttributeOrDoc. So I think the FLS ought to say more here.
Also, I think putting a nonterminal inside ~[] isn't strictly following the notation described by §1.1.4:14 (fls_blvsfqeevosr). The definition of NewLine isn't used anywhere else.
Byte order mark
§18.1:2 (fls_ann3cha1xpek) reads
A Shebang does not have an effect on the compilation.
I suggest adding a similar statement for the ZeroWidthNoBreakSpace.
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 with §18.1 and compare its SourceFile, Shebang, and NewLine definitions with the notation rules in §1.1.4:14. Check rustc's handling of #![xxx] and the leading zero-width no-break space, then update the relevant FLS text so the grammar and compilation-effect statements match the intended behavior.
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
- 35/100