Commit Graph

206 Commits

Author SHA1 Message Date
Andrew Kelley
4c6f1e614a
remove zig build --init. add zig init-lib and zig init-exe
init-lib creates a working static library with tests, and
init-exe creates a working hello world with a `run` target.

both now have test coverage with the new "cli tests" file.

closes #1035
2018-09-17 17:11:18 -04:00
Andrew Kelley
780e567446
add docs for @This() 2018-09-15 10:14:50 -04:00
Andrew Kelley
5e39328542
docs: more syntax highlighting 2018-09-14 10:35:03 -04:00
Andrew Kelley
c06a61e9bf
remove this. add @This().
closes #1283
2018-09-13 16:34:33 -04:00
Andrew Kelley
7c3636aaa3
remove the scope parameter of setFloatMode
also document that scopes inherit this value. See #367
See #1283
2018-09-13 15:46:34 -04:00
Andrew Kelley
22e39e1e5a
fix tagged union with only 1 field tripping assertion
closes #1495

now the tag type of an enum with only 1 item is comptime_int.
2018-09-13 13:33:11 -04:00
Andrew Kelley
0dbbc91bc9
docs: langref is now javascript-free 2018-09-12 17:27:10 -04:00
Raul Leal
f2186e5fa7
Update langref.html.in 2018-09-07 22:58:31 +01:00
raulgrell
09a1162af5 builtin functions: @byteOffsetOf and @bitOffsetOf 2018-09-07 22:49:19 +01:00
Andrew Kelley
c87a576cb5
stage1 compile error instead of crashing for unsupported comptime ptr cast
See #955
2018-09-05 15:53:36 -04:00
Andrew Kelley
3f273479f8
clarify const variables in docs
closes #1200
2018-09-03 12:18:12 -04:00
Andrew Kelley
2a9329c998
better anonymous struct naming
this makes anonymous structs inherit the name of the function they are in
only when they are the return expression.

also document the behavior and provide examples.

closes #1243
2018-09-03 11:32:39 -04:00
Andrew Kelley
048f506aa6
langref: document labeled blocks, labeled for, labeled while
closes #1327
2018-08-27 20:59:28 -04:00
Andrew Kelley
c48be3a742
langref: document exporting a library
closes #1431
2018-08-27 17:44:58 -04:00
Andrew Kelley
526338b00f document fixed-width integer types
closes #1280
2018-08-25 17:39:43 -04:00
Marc Tiehuis
05f9b14fc2 Fix builtin alignment type
Closes #1235.
2018-08-24 17:57:17 +12:00
Marc Tiehuis
353419f82d Default to strict IEEE floating point
Closes #1227.
2018-08-23 22:54:46 +12:00
Andrew Kelley
5aeb3217ee fixup for previous commit 2018-08-22 14:24:48 -04:00
Andrew Kelley
3ee1b60edf langref: add docs for peer type resolution
closes #1367
2018-08-20 14:22:16 -04:00
Marc Tiehuis
1da93caced docs: correct @memcpy, @memset function signatures 2018-08-18 12:06:25 +12:00
Shawn Landden
cb0ef3ad4c doc: @addWithOverflow also returns if overflow occured 2018-08-06 22:12:14 -07:00
kristopher tate
ac0a87d58d doc/langref.html.in: add builtin @handle() to docs;
Tracking Issue #1296 ;
2018-08-02 17:47:39 +09:00
kristopher tate
915e321a23 doc/langref.html.in: update suspend example with @handle();
Tracking Issue #1296 ;
2018-08-02 17:45:35 +09:00
kristopher tate
ff4a03f351 doc/langref.html.in: update docs to reflect that the promise symbol is no in scope with suspend;
Tracking Issue #1296 ;
2018-08-02 17:03:39 +09:00
Matthew D. Steele
0db33e9c86 Add "Comments" section to language reference (#1309)
The contents of this section come from the discussion on issue #1305.
2018-07-30 22:27:07 -04:00
Andrew Kelley
cfe03c764d fix docs for break from suspend 2018-07-30 13:07:04 -04:00
Andrew Kelley
02c5bda704 remove ability to break from suspend blocks
closes #803
2018-07-27 17:27:03 -04:00
Jay Weisskopf
6394f7e9a3 Fixed minor documentation errors (#1256)
Changed:
- "retuns" to "returns"
- "null-terminated pointers" to "pointers to null-terminated arrays"
2018-07-17 21:18:41 -04:00
Andrew Kelley
e9a03cccf3 all integer sizes are available as primitives
* fix wrong implicit cast for `@IntType` bit_count parameter.
 * fix incorrect docs for `@IntType` bit_count parameter.

closes #1242
closes #745
closes #1240
2018-07-16 10:53:15 -04:00
Andrew Kelley
29c756abba docs: correct some misinformation 2018-07-14 11:53:51 -04:00
Andrew Kelley
696ef0bc03 langref: docs for union safety 2018-07-10 10:37:58 -04:00
Andrew Kelley
2ee67b7642 langref: docs for invalid error set cast and incorrect pointer alignment
also add detection of incorrect pointer alignment at compile-time
of pointers that were constructed with `@intToPtr`.
2018-07-09 11:13:29 -04:00
Andrew Kelley
d8295c1889 add @popCount intrinsic 2018-07-07 00:25:32 -04:00
Andrew Kelley
6d793c0ea3 langref: add more internal links 2018-07-06 16:20:31 -04:00
Andrew Kelley
27fc49f72c langref: improve docs for while and undefined
closes #1190
2018-07-03 14:03:27 -04:00
Andrew Kelley
35463526cc add runtime safety for @intToEnum; add docs for runtime safety
See #367
2018-07-02 15:50:28 -04:00
Josh Wolfe
0206b76351 syntax in build.zig example doc 2018-07-01 22:03:51 -04:00
Andrew Kelley
6f88ecc9b6 add f16 to langref 2018-06-27 12:59:12 -04:00
Andrew Kelley
4de60dde6e langref: explicit cast section 2018-06-26 15:48:42 -04:00
Andrew Kelley
5f38d6e2e9 add casting docs, __extenddftf2, and __extendsftf2 2018-06-21 14:44:35 -04:00
Andrew Kelley
ee525c92a4 langref: organize docs for inline loops and add note about when to use it 2018-06-19 17:21:08 -04:00
Andrew Kelley
c7804277bf @floatToInt now has safety-checked undefined behavior
when the integer part does not fit in the destination integer type

 * Also fix incorrect safety triggered for integer casting an
   `i32` to a `u7`. closes #1138
 * adds compiler-rt function: `__floatuntidf`
2018-06-19 16:06:10 -04:00
Andrew Kelley
0b92d689d0 update langref 2018-06-19 12:16:59 -04:00
Andrew Kelley
85422d7aea
Merge pull request #1136 from alexnask/typeinfo_improvements
@typeInfo now uses optional types instead of @typeOf(undefined)
2018-06-19 11:46:32 -04:00
Alexandros Naskos
811539f8ee Added missing ?type in docs. 2018-06-19 17:49:48 +03:00
Alexandros Naskos
1392313236 @typeInfo now uses optional types instead of @typeOf(undefined) 2018-06-19 17:45:19 +03:00
Andrew Kelley
a3ddd0826b remove enum to/from int casting syntax; add @enumToInt/@intToEnum
see #1061
2018-06-19 03:50:38 -04:00
Andrew Kelley
626b73e8be remove error to/from int casting syntax; add @errorToInt/@intToError
See #1061
2018-06-18 18:48:29 -04:00
Andrew Kelley
1aafbae5be remove []u8 casting syntax. add @bytesToSlice and @sliceToBytes
See #1061
2018-06-18 17:25:29 -04:00
Andrew Kelley
5d705fc6e3 remove error set casting syntax. add @errSetCast
See #1061
2018-06-18 15:01:42 -04:00
Andrew Kelley
48985a7e68 langref: add docs for void
see #367
2018-06-18 12:02:30 -04:00
Andrew Kelley
4210f1f6a0 remove bool to int syntax. add @boolToInt
add missing docs

See #1061
2018-06-18 03:07:16 -04:00
Andrew Kelley
7912061226 remove integer and float casting syntax
* add `@intCast`
 * add `@floatCast`
 * add `@floatToInt`
 * add `@intToFloat`

See #1061
2018-06-17 02:57:07 -04:00
Andrew Kelley
751518787a
Merge pull request #1109 from ziglang/pass-by-non-copying-value
allow passing by non-copying value
2018-06-16 21:13:10 -04:00
Andrew Kelley
eae9634ac9 langref: be clear that float types are always IEEE 754 2018-06-16 19:53:52 -04:00
Andrew Kelley
59b3dc8907 allow passing by non-copying value
closes #733
2018-06-16 19:36:33 -04:00
Andrew Kelley
f0697c28f8 langref: docs for error return traces
See #367
2018-06-14 18:12:31 -04:00
Andrew Kelley
41e6c664d8 langref: add merge error sets operator to operator table 2018-06-13 11:09:41 -04:00
Andrew Kelley
86adc1ef39 add docs and missing test case for merging error sets
See #367
2018-06-12 19:38:59 -04:00
Andrew Kelley
0a18d53c3d langref: add orelse keyword to syntax highlighting 2018-06-11 17:38:24 -04:00
Andrew Kelley
5252566137 langref: add coroutines documentation
See #367
2018-06-11 17:34:45 -04:00
Andrew Kelley
77678b2cbc
breaking syntax change: orelse keyword instead of ?? (#1096)
use the `zig-fmt-optional-default` branch to have zig fmt
automatically do the changes.

closes #1023
2018-06-10 01:13:51 -04:00
Andrew Kelley
ec1b6f6673
breaking syntax change: ??x to x.? (#1095)
See #1023

This also renames Nullable/Maybe to Optional
2018-06-09 23:42:14 -04:00
Andrew Kelley
b65203f573 remove @canImplicitCast builtin
nobody will miss it
2018-06-07 19:50:25 -04:00
Andrew Kelley
688ff2830d langref: automatic update of builtin.zig
now the docs can't get out of date for this

See #367
2018-06-07 19:10:45 -04:00
Jimmi HC
a8146ade2a Renamed UndefinedLiteral to Undefined 2018-06-05 11:54:11 +02:00
Jimmi HC
236c680f6b Removed NullLiteral to Null 2018-06-05 11:30:01 +02:00
Jimmi HC
02cb220faf Renamed "(int/float literal)" to "comptime_int/float" 2018-06-05 11:14:43 +02:00
Andrew Kelley
e53b683bd3
Pointer Reform: proper slicing and indexing (#1053)
* enable slicing for single-item ptr to arrays
 * disable slicing for other single-item pointers
 * enable indexing for single-item ptr to arrays
 * disable indexing for other single-item pointers

see #770
closes #386
2018-06-04 22:11:14 -04:00
Andrew Kelley
96164ce613 disallow single-item pointer indexing
add pointer arithmetic for unknown length pointer
2018-06-04 01:39:57 -04:00
Andrew Kelley
f06bce5dda introduce [*] for unknown length pointers
See #770

Currently it does not have any different behavior than `*`
but it is now recommended to use `[*]` for unknown length
pointers to be future-proof.

Instead of [ * ] being separate tokens as the proposal
suggested, this commit implements `[*]` as a single token.
2018-06-02 04:04:23 -04:00
Andrew Kelley
081072d3b6 docs: add missing builtin to langref syntax coloring 2018-06-01 12:22:53 -04:00
Andrew Kelley
fcbb7426fa use * for pointer type instead of &
See #770

To help automatically translate code, see the
zig-fmt-pointer-reform-2 branch.

This will convert all & into *. Due to the syntax
ambiguity (which is why we are making this change),
even address-of & will turn into *, so you'll have
to manually fix thes instances. You will be guaranteed
to get compile errors for them - expected 'type', found 'foo'
2018-05-31 17:28:07 -04:00
Andrew Kelley
43085417be update github.com/zig-lang to github.com/ziglang 2018-05-24 21:27:44 -04:00
Andrew Kelley
fa5b0ef54f doc fixups 2018-05-24 20:59:19 -04:00
braedonww@gmail.com
938d791b23 Added argtype and error inferring info 2018-05-24 20:20:07 -04:00
Andrew Kelley
c38b165db4 all tests passing with postfix deref syntax 2018-05-17 23:21:44 -04:00
Andrew Kelley
86a352c45b Merge branch 'master' into pointer-reform 2018-05-13 13:38:03 -04:00
Andrew Kelley
a6ae45145f add @newStackCall builtin function
See #1006
2018-05-12 17:35:15 -04:00
Andrew Kelley
6928badd85 Merge branch 'master' into pointer-reform 2018-05-09 23:43:07 -04:00
Alexandros Naskos
57940837e7 Added typeInfo to langref built_ins 2018-05-01 13:44:19 +03:00
Alexandros Naskos
7d239414f7 Fixed type info test, added documentation. 2018-05-01 13:42:20 +03:00
Andrew Kelley
76ab1d2b6c support foo.* for ptr deref
See #770
2018-04-30 14:20:56 -04:00
Jimmi Holst Christensen
72bf9d90cc Added builtin field to docs 2018-04-19 21:48:09 +02:00
Andrew Kelley
06909ceaab support break in suspend blocks
* you can label suspend blocks
 * labeled break supports suspend blocks

See #803
2018-04-18 22:21:54 -04:00
Andrew Kelley
f1f998e071 improve cmpxchg
* remove @cmpxchg, add @cmpxchgWeak and @cmpxchgStrong
   - See explanations in the langref.
 * add operand type as first parameter
 * return type is ?T where T is the operand type

closes #461
2018-04-18 12:16:42 -04:00
Andrew Kelley
b9360640ce add @atomicLoad builtin
See #174
2018-04-15 18:12:00 -04:00
Andrew Kelley
b5459eb987 add @sqrt built-in function
See #767
2018-04-15 13:26:58 -04:00
Andrew Kelley
292d0cbdad add docs for union methods 2018-04-08 18:03:09 -04:00
Andrew Kelley
eae355d771 add docs for packed enum 2018-04-08 18:03:09 -04:00
Marc Tiehuis
7d66908f29 docs: fix unclosed code tag 2018-03-31 23:17:02 +13:00
Jay Weisskopf
3e836f5516
doc: fix typo and tighten wording in error sections
Changes:
- Removed superfluous "when possible"
- Fixed typo in "documentationt"
- Added missing comma
- Moved definition of error union type up to first sentence
2018-03-25 18:48:07 -04:00
Andrew Kelley
897e783763 add promise->T syntax parsing
closes #857
2018-03-24 19:25:53 -04:00
Andrew Kelley
7a99d63c76 ability to use async function pointers
closes #817
2018-03-22 16:56:03 -04:00
Andrew Kelley
f885a1ab61 change async function call syntax
* instead of `async(allocator) call()`, now it is
   `async<allocator> call()`.
 * Fixes syntax ambiguity when leaving off the allocator
 * Fixes parse failure when call is a field access

This sets a precedent for using `<` to pass arguments
to a keyword. This will affect `enum`, `union`, and
`fn` (see #661)
2018-03-21 19:56:41 -04:00
Tesla Ice Zhang
c4544df011
Remove unnecessary rule and re-fix an old bug
The "old bug" is cause my last pr. I'm fixing it now.
2018-03-20 03:00:11 +08:00
Tesla Ice Zhang
cc6ac77913
Fix some explicit errors 2018-03-17 23:17:07 +08:00
Andrew Kelley
50e25f6cec add missing docs for setAlignStack builtin 2018-03-14 21:51:06 -04:00
Andrew Kelley
eff3530dfa var is no longer a pseudo-type, it is syntax
closes #779
2018-03-06 18:31:31 -05:00
Andrew Kelley
de5c0c9f40 Merge remote-tracking branch 'origin/master' into async 2018-03-01 20:47:35 -05:00