Shritesh Bhattarai
2f236e6efb
fmt: support trailing comma after var_args
2019-04-05 12:27:13 -04:00
Shritesh Bhattarai
8e6ff8d615
fmt: format multi line only on trailing comma ( #2184 )
...
* fmt: format multi line only on trailing comma
2019-04-04 19:33:32 -04:00
hryx
e827b9661b
zig fmt: Prevent for-else on same line when body is interrupted by LF
2019-04-04 01:31:39 -04:00
hryx
cec8c8678a
zig fmt: Fix regression in for-else ( #2178 )
2019-04-04 01:31:39 -04:00
hryx
c76d51de97
zig fmt: Allow one-line for loops
2019-04-01 11:31:00 -04:00
Shritesh Bhattarai
d645500883
fmt: fix first line comment indent in struct init
2019-03-31 22:33:32 -04:00
hryx
0563e8e1d4
Always write a multiline struct literal if a field expr is multiline
2019-03-31 21:09:56 -04:00
hryx
a4afacd182
Veritcally align array literal columns
2019-03-31 14:27:10 -04:00
Shritesh Bhattarai
b0d89cfe3f
fmt: Fix param decl test
2019-03-30 14:58:18 -05:00
Shritesh Bhattarai
efa751c339
Add doc_comments to param decl
2019-03-30 14:50:08 -05:00
Shritesh Bhattarai
5942797000
fmt: check for extra newline at end of file
...
`anything_changed` checks if `source_index` == `source.len`
Fixes #2074
2019-03-26 13:26:00 -04:00
Andrew Kelley
5eaead6a56
implement allowzero pointer attribute
...
closes #1953
only needed for freestanding targets.
also adds safety for `@intToPtr` when the address is zero.
2019-03-25 12:55:45 -04:00
Andrew Kelley
d0551db5cd
introduce the enum literal type
...
see #683
2019-03-24 00:44:18 -04:00
Andrew Kelley
89953ec83d
character literals: allow unicode escapes
...
also make the documentation for character literals more clear.
closes #2089
see #2097
2019-03-23 17:35:21 -04:00
Andrew Kelley
918dbd4551
std.zig: this is no longer a keyword
2019-03-10 15:55:54 -04:00
Andrew Kelley
e402455704
rename std lib files to new convention
2019-03-02 16:46:04 -05:00
Andrew Kelley
582fdc2869
fix dependency loops, pub, tests, use decls, root source
...
* fix dependency loop detection
- closes #679
- closes #1500
* fix `pub`
* fix tests
* fix use decls
* main package file gets a special "" namespace path
2019-03-01 15:35:29 -05:00
Andrew Kelley
b0ceea1831
zig fmt: fix infix operator before multiline string literal
2019-02-18 18:11:12 -05:00
Andrew Kelley
4a1b910e03
zig fmt: support C pointers
...
See #1059
2019-02-11 14:07:19 -05:00
Andrew Kelley
052800e952
zig fmt: support threadlocal
2019-02-09 00:19:24 -05:00
Andrew Kelley
c2db077574
std.debug.assert: remove special case for test builds
...
Previously, std.debug.assert would `@panic` in test builds,
if the assertion failed. Now, it's always `unreachable`.
This makes release mode test builds more accurately test
the actual code that will be run.
However this requires tests to call `std.testing.expect`
rather than `std.debug.assert` to make sure output is correct.
Here is the explanation of when to use either one, copied from
the assert doc comments:
Inside a test block, it is best to use the `std.testing` module
rather than assert, because assert may not detect a test failure
in ReleaseFast and ReleaseSafe mode. Outside of a test block, assert
is the correct function to use.
closes #1304
2019-02-08 18:23:38 -05:00
Andrew Kelley
dfbc063f79
std.mem.Allocator.create replaced with better API
...
`std.mem.Allocator.createOne` is renamed to `std.mem.Allocator.create`.
The problem with the previous API is that even after copy elision,
the initalization value passed as a parameter would always be a copy.
With the new API, once copy elision is done, initialization
functions can directly initialize allocated memory in place.
Related:
* #1872
* #1873
2019-02-03 16:13:28 -05:00
Andrew Kelley
704374e512
rename section keyword to linksection
...
add zig fmt support for this syntax
closes #1152
2018-11-17 01:38:35 -05:00
Andrew Kelley
0c3bd0c3d1
zig fmt: add --check flag
...
closes #1558
closes #1555
2018-11-15 00:26:43 -05:00
Jimmi Holst Christensen
8139c5a516
New Zig formal grammar ( #1685 )
...
Reverted #1628 and changed the grammar+parser of the language to not allow certain expr where types are expected
2018-11-13 05:08:37 -08:00
Andrew Kelley
2b395d4ede
remove @minValue,@maxValue; add std.math.minInt,maxInt
...
closes #1466
closes #1476
2018-10-26 15:01:51 -04:00
Andrew Kelley
d5648d2640
remove implicit cast from T to *const T
...
closes #1465
2018-10-15 18:23:47 -04:00
Jimmi Holst Christensen
378d3e4403
Solve the return type ambiguity ( #1628 )
...
Changed container and initializer syntax
* <container> { ... } -> <container> . { ... }
* <exrp> { ... } -> <expr> . { ...}
2018-10-15 09:51:15 -04:00
Wink Saville
cd211bcc20
Add doc comment for tokenLocationPtr ( #1618 )
...
The algorithm seemed unusual and I had spent some effort understanding
it, so I thought I'd add a comment.
2018-10-02 00:51:53 -04:00
Andrew Kelley
9d4eaf1e07
update std lib API for I/O
...
std.io.FileInStream -> std.os.File.InStream
std.io.FileInStream.init(file) -> file.inStream()
std.io.FileOutStream -> std.os.File.OutStream
std.io.FileOutStream.init(file) -> file.outStream()
remove a lot of error code possibilities from os functions
std.event.net.socketRead -> std.event.net.read
std.event.net.socketWrite -> std.event.net.write
add std.event.net.readv
add std.event.net.writev
add std.event.net.readvPosix
add std.event.net.writevPosix
add std.event.net.OutStream
add std.event.net.InStream
add std.event.io.InStream
add std.event.io.OutStream
2018-09-30 17:28:35 -04:00
Wink Saville
0e6c18c820
Remove StrLitKind enum
...
I was looking at the tokenizer specifically fn testTokenize and the
this statement looked odd:
if (@TagType(Token.Id)(token.id) != @TagType(Token.Id)(expected_token_id)) {
I then saw the TODO and thought I'd remove StrLitKind figuring that
would make testTokenize simpler. It did so I thought I'd prepare this PR.
The tests are still working and stage2 zig seems to work, it compiles and
I was able to use the fmt command.
2018-09-24 19:28:46 -04:00
Andrew Kelley
6dd93ee5d9
fix regression from previous commit
2018-09-18 18:56:29 -04:00
Andrew Kelley
21328e0036
zig fmt: handle shebang lines
...
closes #1546
2018-09-18 18:36:39 -04:00
Wink Saville
82af31ce36
Fix additional regressions calling FileOutStream/FileInStream init()
...
This is caused by change 686663239af6afd8dea814a9fe6a8885f06d6cb3 and not
fixed in 832caefc2a1b20deb513d43306d6723670ba9c8f.
2018-09-14 12:07:21 -04:00
Andrew Kelley
c06a61e9bf
remove this. add @This().
...
closes #1283
2018-09-13 16:34:33 -04:00
Andrew Kelley
832caefc2a
fix regressions
2018-09-02 18:35:32 -04:00
Andrew Kelley
4f2d49fd13
std.zig.parse: fix parsing of doc comments after fields
...
closes #1404
2018-08-27 19:21:38 -04:00
Andrew Kelley
c5f1925bc8
when decls don't change, don't regenerate them
2018-08-03 17:59:11 -04:00
Andrew Kelley
895f262a55
pull request fixups
...
* clean up parser code
* fix stage2 parse and render code
* remove redundant test
* make stage1 compile tests leaner
2018-08-02 14:15:31 -04:00
kristopher tate
bc032a89cc
std/zig/parser_test.zig: update test to reflect that the promise symbol is no in scope with suspend;
...
Tracking Issue #1296 ;
2018-08-02 16:59:11 +09:00
Andrew Kelley
93e78ee722
self-hosted can compile libc hello world
2018-07-22 23:28:53 -04:00
Andrew Kelley
7f1a550760
std.zig.parse: fix treating integer literals as string literals
2018-07-18 17:56:34 -04:00
Andrew Kelley
687bd92f9c
self-hosted: generate zig IR for simple function
...
no tests for this yet. I think the quickest path to testing will be
creating the .o files and linking with libc, executing, and then
comparing output.
2018-07-12 15:12:44 -04:00
Marc Tiehuis
82e9190d09
Update zig.parser benchmark program
2018-07-09 17:14:04 +12:00
Andrew Kelley
3290e72833
std.zig.ast: fix incorrect impl of FnProto.firstToken
...
closes #1151
2018-06-25 11:54:10 -04:00
Andrew Kelley
85f928f8bf
remove std.mem.Allocator.construct and other fixups
2018-06-20 17:33:29 -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
e1f56c9af6
std.zig.ast: add test for iterate
...
closes #1101
2018-06-13 11:48:06 -04:00
Andrew Kelley
0a95b0f1ff
std.zig: update syntax for orelse keyword
2018-06-10 01:18:31 -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