274 Commits

Author SHA1 Message Date
Andrew Kelley
aff90c2252
avoid shipping junk files
I did a diff of the shipped file list with master branch and it looks
good after this commit.
2019-07-15 20:35:34 -04:00
hryx
cce11a724c
Make anyerror not a keyword 2019-07-06 15:57:32 -07:00
Andrew Kelley
21c60922e3
Merge pull request #2823 from hryx/unicode-escape
Unicode escapes: support u{N...}
2019-07-06 13:14:43 -04:00
hryx
7f618184ad Prevent unreachable when file ends with struct field 2019-07-06 13:09:07 -04:00
Andrew Kelley
9471f16c79
zig fmt ignores "zig fmt: off" directive for whitespace fixes 2019-07-05 15:09:22 -04:00
Andrew Kelley
4f43a4b30f
zig fmt: fix whitespace
closes #2819
closes #2825
2019-07-05 14:46:21 -04:00
hryx
8365a7aab4
Unicode escapes: stage2 tokenizer and parser test 2019-07-04 14:48:23 -07:00
Marc Tiehuis
0dd2e93e4c Update for new fmt.zig formatting 2019-06-30 22:25:03 +12:00
Andrew Kelley
3085d29af8
Merge remote-tracking branch 'origin/master' into copy-elision-3 2019-06-26 14:44:01 -04:00
Vexu
fa42c99d82 fixed IfTypeExpr parsing 2019-06-26 11:04:34 -04:00
Andrew Kelley
c61e0a078c
fix union init with void payload
all std lib tests passing now
2019-06-25 11:31:38 -04:00
Andrew Kelley
5e58aa4884
uncomment passing std lib tests
these ones getting skipped need to get fixed before merging the branch
2019-06-23 01:29:18 -04:00
Andrew Kelley
86f362ce8e
elide redundant safety check when switching on tagged unions 2019-06-22 16:18:42 -04:00
Andrew Kelley
b735764898
different array literal syntax when inferring the size
old syntax:  []i32{1, 2, 3}
new syntax: [_]i32{1, 2, 3}

closes #1797
2019-06-09 19:26:32 -04:00
Timon Kruiper
fd771ea9fb Added LineComment support when MultiLines are used in ArrayInit
also added the corresponding testcase
2019-06-04 12:44:50 -04:00
Timon Kruiper
4e1f3a9ba3 Correct formatting for multiline string in arrays 2019-05-29 19:56:28 -04:00
Andrew Kelley
8a4ee5942b
zig fmt: fix 2 bugs of mangling source files 2019-05-29 19:09:58 -04:00
Andrew Kelley
b7a82288ad
change use to usingnamespace
See #2014

`use` syntax is still accepted for now. `zig fmt` automatically
updates code. After a release cycle the old syntax will be removed.
2019-05-29 19:09:58 -04:00
Andrew Kelley
ca6debcaf4
starting to fix the regressions 2019-05-26 18:32:44 -04:00
LemonBoy
08d41da916 Fix formatting for multiline asm expressions 2019-05-13 12:20:11 -04:00
hryx
0d629421c9
Recursive rewrite of stage2 parser, final sync 2019-05-12 02:10:27 -07:00
hryx
3a3a738478
Recursive rewrite of stage2 parser, part 3 2019-05-12 02:01:45 -07:00
hryx
3787f34286
Merge branch 'master' into rebased 2019-05-12 02:00:49 -07:00
Tyler Philbrick
16aee1f58a
Fix memory leak in parser tests
The `arena` instance being used bythe parse tree was valid and
pointed to valid memory, but existed as a local variable inside the
stack frame of the `parse` function (the `const arena`), which was never
stored anywhere before leaving the scope.

This meant that code above the `parse` function saw a valid instance of
an `ArenaAllocator` that pointed to the same backing memory, but didn't
posess any of the local state built up after the call to `parseRoot`,
basically the caller saw an empty arena.

This meant that when `deinit` was called, it saw an Arena with 0
allocations in it's `buffer_list` and wasn't able to destroy any of the
memory.  This caused it to leak and caused FailingAllocator to balk.

The fix is to make sure the parse tree is using the same instance of
ArenaAllocator as is reported up the call stack, the one inside the
`Tree{}` object.  I'm not sure why that field is marked with a comment
to remove it, as it's used by the `std.ast.Tree.deinit()` function, but
this change seems to solve the problem.
2019-05-12 01:54:30 -07:00
hryx
4e28c2571d
Recursive rewrite of stage2 parser, part 1 2019-05-12 01:52:16 -07:00
daurnimator
3d93c89fc5 std: the failing allocator didn't actually count allocations
Add a field '.allocations' to actually track the number of allocations.

Additionally, only increment '.deallocations' when memory is freed
2019-05-11 09:55:41 -04:00
LemonBoy
a3beda27fc Add missing cast to usize 2019-05-07 11:47:23 +02:00
Andrew Kelley
28071ac637
self-hosted translate-c emits a hello world AST
Also breaking std lib API change: the return value of
std.zig.parse returns `*ast.Tree` rather than `ast.Tree`.

See #1964
2019-04-26 15:43:36 -04:00
Shawn Landden
8ef7f6febb remove Shebang (#!) support
Closes:  #2165
2019-04-24 23:34:19 -04:00
Raul Leal
d44d2784e6 zig-fmt: allow comptime blocks in containers (#2308)
* zig-fmt: allow comptime blocks in containers
* add test for comptime block in container
2019-04-19 15:27:42 -04:00
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