Commit Graph

12762 Commits

Author SHA1 Message Date
Isaac Freund
b028a92a60
zig fmt: handle comments in array type/init/access 2021-02-23 19:56:56 +01:00
Isaac Freund
abfe213830
zig fmt: enable array init trailing comment insertion test
Modify the test case slightly to match similar modifications done in
5820bd0 and 0f24b61.
2021-02-23 19:40:34 +01:00
Isaac Freund
6b9f19a644
zig fmt: remove stray std.debug.print() 2021-02-23 19:18:36 +01:00
Isaac Freund
0f24b61ed5
zig fmt: insert trailing comma in struct init with comment 2021-02-23 19:17:11 +01:00
Isaac Freund
5820bd0e64
zig fmt: insert trailing comma in fn params with comment 2021-02-23 19:11:50 +01:00
Isaac Freund
5306b1a9ab
zig fmt: container doc comments 2021-02-23 18:32:47 +01:00
johnLate
d9e46dceec std.Thread.Semaphore: Fix wrong variable name
Fixes ziglang#8052
2021-02-23 11:10:24 +02:00
Veikka Tuominen
1f62e87031
fix formatting in translate-c test case 2021-02-23 10:53:25 +02:00
Andrew Kelley
1e3a200ba6 zig fmt: array literal with hint
This regresses the test case of `zig fmt` deleting empty line comments.
Two open questions here:

 * What should the rules be about deleting empty line comments?
   It makes sense usually, but for array initization, empty line
   comments cause a line break, affecting the row/column alignment.
   Perhaps we should therefore respect all empty line comments?
   Or should we special case array initializations?

 * If we decide to special case some kinds of line comments to respect
   them (which is status quo!), how should that be implemented?
2021-02-22 23:25:12 -07:00
Andrew Kelley
1253903fef zig fmt: struct literal containing a multiline expression
I modified this test case to expect different results.

Now, the trailing comma on a list of struct fields is the only deciding
factor, not whether or not the field init expressions contain a newline.
2021-02-22 21:33:21 -07:00
Andrew Kelley
8379fff804 zig fmt: alignment in anonymous literal 2021-02-22 21:04:22 -07:00
Andrew Kelley
a6038f0375 zig fmt: function params should align nicely 2021-02-22 18:17:26 -07:00
Andrew Kelley
fec51ad7c5 zig fmt: while 2021-02-22 17:55:19 -07:00
Andrew Kelley
20cfa0b5b6 zig fmt: if condition has line break, no fn call comma 2021-02-22 17:34:30 -07:00
Andrew Kelley
ec987a7a46 zig fmt: if condition has line break but must not wrap 2021-02-22 16:39:50 -07:00
Andrew Kelley
b301999cd3 zig fmt: if condition wraps 2021-02-22 16:21:19 -07:00
Andrew Kelley
253906fb93 zig fmt: 2nd arg multiline string 2021-02-22 16:00:21 -07:00
Isaac Freund
45634851de
zig fmt: fix firstToken() for extern fn_protos 2021-02-22 23:51:54 +01:00
Isaac Freund
550688f427
zig fmt: insert trailing comma in switches 2021-02-22 23:51:54 +01:00
Veikka Tuominen
4758e0c9a6
update docgen to use new ast 2021-02-22 21:52:22 +02:00
Veikka Tuominen
d83698ab54
translate-c: check for noreturn in switch in more cases 2021-02-22 21:52:22 +02:00
Isaac Freund
f3ee10b454
zig fmt: fix comments ending with EOF after decls
Achieve this by reducing the amount of special casing to handle EOF so
that the already correct logic for normal comments does not need to be
duplicated.
2021-02-22 18:32:37 +01:00
Veikka Tuominen
011bc1b84f
translate-c: switch default should have an empty block not break 2021-02-22 19:26:19 +02:00
Isaac Freund
ce9b3ee0f9
parser: anytype is not a vaild return type 2021-02-22 17:38:09 +01:00
Isaac Freund
34c08a91d5
zig fmt: fix formatting of parser tests 2021-02-22 17:37:17 +01:00
Veikka Tuominen
928790364a
zig fmt: correct Node.firstToken for .fn_decl, add error for missing container 2021-02-22 17:39:41 +02:00
Veikka Tuominen
69d5a106da
render: handle comments ending in EOF 2021-02-22 16:59:44 +02:00
Veikka Tuominen
67dac2936c
parser: warn on missing for loop payload, recover from invalid global error set access 2021-02-22 10:04:05 +02:00
Andrew Kelley
621ad241d6 zig fmt: if nested 2021-02-21 20:25:31 -07:00
Andrew Kelley
a17a5ca3a8 translate-c: fix fn_decl vs fn_proto
Regressed in 15603f403c.
2021-02-21 18:31:32 -07:00
Andrew Kelley
c6efb23796 zig fmt: rewrite inline functions as callconv(.Inline) 2021-02-21 18:20:46 -07:00
Andrew Kelley
878e99d580 parser: fix recovery for missing semicolons 2021-02-21 18:04:23 -07:00
Andrew Kelley
1247b7b9ef parser: modify another recovery test case
Zig no longer has `error` as the global error set; it is now a special
case keyword. The new parse error message is correct.
2021-02-21 18:00:37 -07:00
Andrew Kelley
79f1876367 parser: remove support for recovering from extra top level end curlies
After #35 is implemented,
we should be able to recover from this *at any indentation level*,
reporting a parse error and yet also parsing all the decls even
inside structs. Until then, I don't want to add any hacks to make
this work.
2021-02-21 17:57:04 -07:00
Andrew Kelley
2da2123128 parser: remove support for a recovery test case
I don't understand the idea here of this kind of recovery. If we
want to resurrect this test case we need some comments on it to explain
the purpose, example use cases, expected behavior, etc.
2021-02-21 17:37:39 -07:00
Andrew Kelley
866f7dc7d6 parser: support more recovery test cases 2021-02-21 17:37:10 -07:00
Andrew Kelley
15603f403c AST: use fn_proto not fn_decl for extern decls
saves a few bytes per extern function declaration
2021-02-21 16:01:22 -07:00
ducdetronquito
0aef1faa82 std.fifo.LinearFifo - Expose reader and writer type. 2021-02-22 00:22:46 +02:00
Ryan Greenblatt
36178caf3e
Added support for passing write file args as build options (#7909)
* Added support for passing write file args as build options

* Fix missing fmtEscapes and unused format

* Actually fixed now, must be formatted

* remove addPathBuildOption
2021-02-21 12:26:46 +02:00
joachimschmidt557
9712e89265 stage2 codegen: Add Type argument to genSetReg 2021-02-21 12:23:36 +02:00
Veikka Tuominen
ef6aa3d027
Merge pull request #7960 from Luukdegram/wasm-extern
stage2: Add support for extern functions for the wasm backend
2021-02-21 12:22:01 +02:00
LemonBoy
057bf1afc9 std: Add more error checking in hexToBytes
Prevent the function from turning into an endless loop that may or may
not perform OOB accesses.
2021-02-21 12:19:03 +02:00
Asherah Connor
4272f07f66
std.os.uefi.Guid fixes (#8032)
* uefi: Guid.format compiles again

Also use "writer" nomenclature in argument name.

* uefi: add Guid.eql
2021-02-21 12:17:59 +02:00
Bill Nagel
cc5e5cca83 fix race condition in linuxWaitFd 2021-02-21 12:16:48 +02:00
jacob gw
1bd434fd18 std.Progress: improve support for "dumb" terminals 2021-02-21 12:12:17 +02:00
Tau
840331ee48 Rebase link(at) properly 2021-02-21 12:04:40 +02:00
Benjamin Graf
c70832bc41 replace ArrayList.shrinkAndFree by ArrayList.shrinkRetainingCapacity 2021-02-21 11:56:14 +02:00
Jonathan Marler
a448210fcf remove z/Z format specifier deprecations
The z/Z format specifiers were merged last October (4 months ago).  They were then deprecated in January (just over a month ago).  This PR removes them altogether.
2021-02-21 11:55:21 +02:00
rgreenblatt
f9be7471bc fix readable slice bug (and add tests) 2021-02-21 11:48:38 +02:00
data-man
340825a7af Add epoll_pwait2 Linux syscall 2021-02-21 11:47:13 +02:00