Commit Graph

1057 Commits

Author SHA1 Message Date
Andrew Kelley
3cb1ab0e05 langref: point 0.10.0 nav link to 0.10.1 2023-01-22 18:19:26 -07:00
Manlio Perillo
efbb6128bb langref: always start code on a separate line in a syntax_block
In a syntax_block the code always start on a separate code, expect for
C, JavaScript, Peg and with Zig inline assembly.

Ensure that the code starts on a separate line, even in cases where
there is only one line.

Ensure that the end_syntax_block is always on a separate line and that
the indentation is consistent.
2023-01-19 19:10:01 +02:00
Manlio Perillo
72c09b7b3b langref: use the term tuple in the Hello World section
In the Hello World section, replace the term "anonymous struct literal"
with tuple, when documenting the second argument of stdout.print().
2023-01-18 15:33:58 +02:00
Manlio Perillo
06e9b2c4e3 langref: document UTF-8 BOM handling
The current compiler ignores the UTF-8 BOM if it is at the start of the
file, and disallows it anywhere else.  Document it in the Source Encoding
section.
2023-01-17 20:07:53 +02:00
Manlio Perillo
0973f36389 langref: add the new addrspace keyword
Add the new addrspace keyword in the Keyword Reference section, without
documentation.

Move the linksection keyword in order to keep the keywords list sorted.
2023-01-17 20:04:37 +02:00
Manlio Perillo
fde57330fa docgen: improve command-line argument parsing
Implement a simple command-line argument parser, adapted from the Zig
compiler implementation.

Promote the zig positional argument to an option.
2023-01-13 17:24:10 +01:00
Manlio Perillo
c5351a8d49 docgen: remove unnecessary and incorrect deallocations
The deallocations of the process arguments are unnecessary, since the
memory will be deallocated by arena.deinit().

The deallocations are incorrect, since ArgIterator.next() returns a
slice pointing to the iterator's internal buffer, that should be
deallocated with args_it.deinit().
2023-01-13 15:20:00 +01:00
Techatrix
0a8b7ad368
langref: fix unclosed and lonely tag (#14250) 2023-01-10 18:02:29 -05:00
Veikka Tuominen
83fd45d820
Merge pull request #13786 from ziglang/tty-detection
stage2: make --color on affect progress bar too
2023-01-04 16:54:46 +02:00
Veikka Tuominen
95fe23f572 docgen: handle 'K' and 'D' escape codes 2023-01-03 14:03:43 +02:00
Evin Yulo
fc07e1a267 Document tuple syntax
Closes #13837
2023-01-03 13:29:27 +02:00
Veikka Tuominen
8a6295fcba AstGen: make type sentinel expressions implicitly comptime 2022-12-29 12:43:02 +02:00
Veikka Tuominen
622311fb9a update uses of overflow arithmetic builtins 2022-12-27 15:13:14 +02:00
Veikka Tuominen
af9a9a1374 zig fmt: improve handling of comptime tuple fields 2022-12-27 13:52:37 +02:00
zooster
547e3684be langref: more explicitly document how enum overriding works 2022-12-27 12:53:41 +02:00
Veikka Tuominen
0b859831ad update grammar in langref
Closes #14072
2022-12-26 16:36:29 +02:00
Manlio Perillo
3542dbf0ea langref: add section numbers
When reading a document with nested sections, it is not easy to discover
the depth of the current section.

Add support for nested section numbers, from the h2 to the h4 heading,
in the format "lv1. ", "lv1.lv2. ", "lv1.lv2.lv3. ".  The "Zig Version"
and "Table of Content" sections are excluded.

The section numbers are implemented in CSS, with the CSS rules declared
inside a @media rule.  Currently the @media rule targets all media.
2022-12-19 21:51:23 +02:00
Andrew Kelley
aca9c74e80
Merge pull request #13914 from Vexu/variadic
implement defining C variadic functions
2022-12-18 16:24:13 -05:00
Veikka Tuominen
40ed6ae846
Merge pull request #13930 from r00ster91/renamings
std.builtin: renamings
2022-12-18 19:33:15 +02:00
Evin Yulo
9cc49548aa langref: remove incorrect use of term 'literal' 2022-12-18 01:55:09 +02:00
r00ster91
aac2d6b56f std.builtin: rename Type.UnionField and Type.StructField's field_type to type 2022-12-17 14:11:33 +01:00
r00ster91
7350ea3e2d std.builtin: rename Type.Fn's args to params
This was a poor naming choice; these are parameters, not arguments.
Parameters specify what kind of arguments are expected, whereas the arguments are the actual values passed.
2022-12-17 14:11:33 +01:00
r00ster91
20d3fd901e std.builtin: rename Type.Fn.Param's arg_type to type
It's the type of a parameter, not an argument, but the prefix is redundant either way.
2022-12-17 14:11:33 +01:00
Veikka Tuominen
9bb1104e37 implement defining C variadic functions 2022-12-17 13:22:09 +02:00
Andrew Kelley
6378644d4e
Merge pull request #13907 from Vexu/call-merge
Remove `stack` option from `@call`
2022-12-13 18:15:18 -05:00
Evin Yulo
02b4ea71e3 Improve tagged union documentation
closes #13870
2022-12-13 15:11:43 -05:00
Manlio Perillo
35c6fe665c langref: document extern variadic functions
Add a new subsection within the C section, documenting extern variadic
functions.
2022-12-13 15:09:08 -05:00
Manlio Perillo
6486ee9fc7 langref: remove the trailing slash from the link element
A self-closing tag for void elements like link is only required under
XHTML 1.0.

See https://developer.mozilla.org/en-US/docs/Glossary/Void_element#self-closing_tags.
2022-12-13 15:02:48 -05:00
Manlio Perillo
17d85a72c4
langref: add missing ReleaseSmall when describing unreachable (#13909)
Add a missing ReleaseSmall when describing unreachable in the try
section and the unreachable entry in the Keyword Reference section.

Additionally, transform Debug, ReleaseSafe, ReleaseFast and ReleaseSmall
into links in the try section.

Co-authored-by: Andrew Kelley <andrew@ziglang.org>
2022-12-13 15:02:17 -05:00
Manlio Perillo
89a9e927ad langref: improve the test_fn_reflection.zig doctest
Currently, the test_fn_reflection.zig doctest has an example of
.Fn.is_var_args.  This example can confuse the reader, since there is no
documentation about variadic functions and is_var_args is mainly used in
the compiler.

Remove the example with .Fn.is_var_args and add instead examples with
.Fn.return_type and .Fn.is_generic.
2022-12-13 15:00:42 -05:00
Manlio Perillo
1d5368fa35 langref: fix the slice_bounds.zig doctest
In the slice_bounds.zig doctest, the code "const slice = array[2..4]" is
incorrect, since the actual type is a pointer to an array, instead of a
slice.

Use a runtime know value to slice the array.
2022-12-13 14:59:46 -05:00
Manlio Perillo
21dafd7a54
langref: update comments in the slices.zig doctest (#13819)
In the slices.zig doctest, the code
`const all_together_slice = all_together[0..]` is incorrect, since the
actual type is a pointer to an array, instead of a slice.

Use a runtime-known value to slice the array.

In the next "slice pointer" test, clarify that slicing a slice to
produce a pointer to an array, requires comptime-known indexes, not just
constant indexes.
2022-12-13 14:58:52 -05:00
Veikka Tuominen
7b2a936173 remove stack option from @call 2022-12-13 12:52:21 +02:00
gettsu
175d018512
langref: avoid use of the term "enum variant" in enums.zig (#13847) 2022-12-12 23:49:42 -05:00
Manlio Perillo
09cc6b4b9e langref: improve the defer section
Split the original `defer.zig` doctest into 3 doctest:

  1. Document the defer keyword
  2. Document that the return statement is not allowed inside a defer
     expression
  3. Document the errdefer keyword

Replace "method" with "expression" in the text `defer method`.
2022-12-12 15:09:45 -05:00
Andrew Kelley
f1f17dc1c7
Merge pull request #13810 from r00ster91/old
Re-enable many previously failing tests and add test coverage
2022-12-10 15:07:51 -05:00
Manlio Perillo
f020734347 langref: remove HTML code from a shell node
Several <em> elements where added inside a shell node in the
Using--target-and--cflags section.  Remove them, since they are not
supposed to be handled by codegen.

For the original commit, see
0c091feb5 (Improve HTML semantics and a11y of language reference).

Fixes #13846
2022-12-10 14:39:40 +02:00
r00ster91
981cfd9c1c behavior and langref: reenable previously-regressed tests on aarch64 and powerpc64le
Closes #3282
2022-12-10 12:34:42 +01:00
Andrew Kelley
7637ac584f
Merge pull request #13821 from Vexu/eliminate-bound-fn
Eliminate `BoundFn` type from the language
2022-12-10 06:14:57 -05:00
Evin Yulo
e4874d842e Remove unneeded else unreachable in docgen.zig
See #707
2022-12-10 05:50:56 -05:00
Veikka Tuominen
9d93b2ccf1 Eliminate BoundFn type from the language
Closes #9484
2022-12-09 20:37:18 -07:00
Evin Yulo
d0172488b2 langref: update anonymous struct naming
Closes #13841
2022-12-09 19:59:47 +02:00
Manlio Perillo
65f35a76f9 langref: consistently use comptime-known and runtime-known 2022-12-09 18:24:40 +02:00
Manlio Perillo
505a21bcc5 langref: link "result location" to the "Result Location Semantics" section 2022-12-09 17:42:25 +02:00
Andrew Kelley
4451786c66 langref: update WASI preopens example 2022-12-06 12:27:28 -07:00
Andrew Kelley
6e52f36d46 langref: eliminate dependencies on stage1
This commit removes async/await/suspend/resume from the language
reference, as that feature does not yet work in the self-hosted
compiler.

We will be regressing this feature temporarily. Users of these language
features should stick with 0.10.x with the `-fstage1` flag until they
are restored.

See tracking issue #6025.
2022-12-01 15:28:44 -07:00
Andrew Kelley
8f079bad1f langref: acknowledge design flaw in the self-hosted compiler
See tracking issue #13724
2022-12-01 00:38:02 -07:00
Andrew Kelley
ceb0a632cf std.mem.Allocator: allow shrink to fail
closes #13535
2022-11-29 23:30:38 -07:00
Veikka Tuominen
17ff002bc0 Sema: improve safety panic for access of inactive union field 2022-11-29 21:44:08 +02:00
Jonathan Marler
58d9004cea packed struct fix example and clarify least to most significant ordering
The packed struct example was mistakenly applying endianness where it
shouldn't have been.  This wasn't being caught because we don't currently
test the examples on Big-endian systems.

I updated the test to remove the endianness where it didn't apply, and
added a new part of the test to demonstrate when it would apply.
2022-11-17 12:11:43 +02:00