authorgravatar for thejoshwolfe@gmail.comJosh Wolfe <thejoshwolfe@gmail.com> 2017-12-23 22:23:06-07:00
committergravatar for thejoshwolfe@gmail.comJosh Wolfe <thejoshwolfe@gmail.com> 2017-12-23 22:23:06-07:00
logf0a17536074c159aee4b2f378f5918d5d2a2ab73
treee96bb53e94182b15a2c9072dd19a2412267d443d
parentd6a74ed463d1d4262009c67689d98cb67c5e85f2

add source encoding rules to the docs. see #663


1 files changed, 9 insertions(+), 0 deletions(-)

doc/langref.html.in+9
...@@ -291,6 +291,15 @@ pub fn main() -&gt; %void {...@@ -291,6 +291,15 @@ pub fn main() -&gt; %void {
291 <li><a href="#errors">Errors</a></li>291 <li><a href="#errors">Errors</a></li>
292 <li><a href="#root-source-file">Root Source File</a></li>292 <li><a href="#root-source-file">Root Source File</a></li>
293 </ul>293 </ul>
294 <h2 id="values">Source encoding</h2>
295 <p>Zig source code is encoded in UTF-8. An invalid UTF-8 byte sequence results in a compile error.</p>
296 <p>Throughout all zig source code (including in comments), some codepoints are never allowed:</p>
297 <ul>
298 <li>Ascii control characters, except for U+000a (LF): U+0000 - U+0009, U+000b - U+0001f, U+007f. (Note that Windows line endings (CRLF) are not allowed, and hard tabs are not allowed.)</li>
299 <li>Non-Ascii Unicode line endings: U+0085 (NEL), U+2028 (LS), U+2029 (PS).</li>
300 </ul>
301 <p>The codepoint U+000a (LF) (which is encoded as the single-byte value 0x0a) is the line terminator character. This character always terminates a line of zig source code. A non-empty zig source must end with the line terminator character.</p>
302 <p>For some discussion on the rationale behind these designe decisions, see <a href="https://github.com/zig-lang/zig/issues/663">issue #663</a></p>
294 <h2 id="values">Values</h2>303 <h2 id="values">Values</h2>
295 <pre><code class="zig">const warn = @import("std").debug.warn;304 <pre><code class="zig">const warn = @import("std").debug.warn;
296const os = @import("std").os;305const os = @import("std").os;