9
9
10
10
> ** <sup >Lexer</sup >** \
11
11
> UTF8BOM : ` \uFEFF ` \
12
- > SHEBANG : ` #! ` ~ [ ` [ ` ` \n ` ] ~ ` \n ` <sup >\* </sup >
12
+ > SHEBANG : ` #! ` \ ~` \n ` <sup >\+ </sup >[ † ] ( #shebang )
13
13
14
14
15
15
> Note: Although Rust, like any other language, can be implemented by an
@@ -65,10 +65,14 @@ apply to the crate as a whole.
65
65
#![warn(non_camel_case_types)]
66
66
```
67
67
68
+ ## Byte order mark
69
+
68
70
The optional [ _ UTF8 byte order mark_ ] (UTF8BOM production) indicates that the
69
71
file is encoded in UTF8. It can only occur at the beginning of the file and
70
72
is ignored by the compiler.
71
73
74
+ ## Shebang
75
+
72
76
A source file can have a [ _ shebang_ ] (SHEBANG production), which indicates
73
77
to the operating system what program to use to execute this file. It serves
74
78
essentially to treat the source file as an executable script. The shebang
@@ -84,6 +88,11 @@ fn main() {
84
88
}
85
89
```
86
90
91
+ A restriction is imposed on the shebang syntax to avoid confusion with an
92
+ [ attribute] . The ` #! ` characters must not be followed by a ` [ ` token, ignoring
93
+ intervening [ comments] or [ whitespace] . If this restriction fails, then it is
94
+ not treated as a shebang, but instead as the start of an attribute.
95
+
87
96
## Preludes and ` no_std `
88
97
89
98
All crates have a * prelude* that automatically inserts names from a specific
@@ -166,8 +175,10 @@ or `-` (U+002D) characters.
166
175
[ `std::prelude::v1` ] : ../std/prelude/index.html
167
176
[ attribute ] : attributes.md
168
177
[ attributes ] : attributes.md
178
+ [ comments ] : comments.md
169
179
[ function ] : items/functions.md
170
180
[ module ] : items/modules.md
171
181
[ module path ] : paths.md
172
182
[ trait or lifetime bounds ] : trait-bounds.md
173
183
[ where clauses ] : items/generics.md#where-clauses
184
+ [ whitespace ] : whitespace.md
0 commit comments