72 Commits

Author SHA1 Message Date
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
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
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
b0ceea1831
zig fmt: fix infix operator before multiline string literal 2019-02-18 18:11:12 -05:00
Andrew Kelley
052800e952
zig fmt: support threadlocal 2019-02-09 00:19:24 -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
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
Andrew Kelley
21328e0036
zig fmt: handle shebang lines
closes #1546
2018-09-18 18:36:39 -04:00
Andrew Kelley
c06a61e9bf
remove this. add @This().
closes #1283
2018-09-13 16:34:33 -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
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
d21a1922eb support zig fmt: off and zig fmt: on between top level decls
closes #1030
closes #1033
2018-06-04 12:15:02 -04:00
Andrew Kelley
5f38a01ede run zig fmt 2018-06-01 01:22:35 -04:00
Andrew Kelley
4d13ab07de std.zig: update to new pointer syntax 2018-06-01 01:19:26 -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
b082cd4580 zig fmt: field access does not cause spaces for slicing
See #1003
2018-05-30 16:08:40 -04:00
Andrew Kelley
84b1842026 zig fmt: space after fn in fn prototypes
See #1003
2018-05-30 15:50:01 -04:00
Andrew Kelley
93b51b0e40 spaces around slice operator if operands are infix
See #1003
2018-05-30 15:33:58 -04:00
Andrew Kelley
2c96f19fd3 std.zig.render returns bool of whether anything changed
zig fmt only renames files and prints to stdout for files which changed
2018-05-30 14:58:27 -04:00
Andrew Kelley
0c16cd2d0e run zig fmt on the codebase
See #1003
2018-05-29 04:23:38 -04:00
Andrew Kelley
cdf30c31ea zig fmt: fix implementation of firstToken() for fn call 2018-05-29 03:47:27 -04:00
Andrew Kelley
cd325e408e zig fmt: fix extra space after comma before multi line string 2018-05-29 03:33:03 -04:00
Andrew Kelley
eda6898c5b zig fmt: handle if and while indentation better 2018-05-29 03:15:12 -04:00
Andrew Kelley
530d175422 zig fmt: fix spacing when moving doc comment on var decls 2018-05-28 23:41:09 -04:00
Andrew Kelley
0d1b47362c zig fmt: if-else with comment before else 2018-05-28 22:41:05 -04:00
Andrew Kelley
77ec81b035 zig fmt: respect line breaks in if-else 2018-05-28 22:22:01 -04:00
Andrew Kelley
71badebd08 zig fmt: respect line breaks after infix operators 2018-05-28 21:28:32 -04:00
Andrew Kelley
354ab1c5c8 zig fmt: render fn decl with trailing comma 1 line per param 2018-05-28 21:18:41 -04:00
Andrew Kelley
530da36352 zig fmt: fix enum decl with no trailing comma
See #1003
2018-05-28 17:43:17 -04:00
Andrew Kelley
6c1fda3f99 zig fmt: fix switch body indent 2018-05-28 17:09:55 -04:00
Andrew Kelley
fd13a75785 zig fmt: allow same line struct literal with no trailing comma
See #1003
2018-05-28 17:00:04 -04:00
Andrew Kelley
122a74724c zig fmt: use simple newlines rather than empty comments to hint
now the first row of an array literal is the hint to zig fmt
for how long each row should be.

See #1003
2018-05-28 16:23:33 -04:00
Andrew Kelley
3fed10883b zig fmt: array literals with no trailing comma all on one line 2018-05-26 23:25:04 -04:00
Andrew Kelley
afdfbc0367 zig fmt: delete empty comments that do nothing 2018-05-26 23:25:04 -04:00
Andrew Kelley
118d41ef83 zig fmt: support array literal row size hint
See #1003
2018-05-26 22:59:46 -04:00
Andrew Kelley
349365d9a4 zig fmt: better multiline string formatting 2018-05-26 19:32:28 -04:00
Andrew Kelley
cabf7fa93b zig fmt: fn calls with trailing comma with params on new lines 2018-05-26 18:44:10 -04:00
Andrew Kelley
b8d4e05361 zig fmt: handle empty block with comment inside 2018-05-26 18:29:14 -04:00
Andrew Kelley
7e900d28be zig fmt: no space on switch range operator 2018-05-26 18:10:06 -04:00