Commit Graph

2636 Commits

Author SHA1 Message Date
Andrew Kelley
4662fd4d92
Merge pull request #919 from zig-lang/self-hosted-parser-refactor
Self-hosted parser refactor
2018-04-13 11:17:09 -04:00
Andrew Kelley
30c5f3c441
Merge pull request #915 from zig-lang/self-hosted-cli
Revise self-hosted command line interface
2018-04-13 11:16:06 -04:00
Andrew Kelley
1999f0daad fix undefined behavior triggered by fn inline test
LLVM destroys the string that we use to test if LLVM deleted the
inlined function.

Also fixed forgetting to initialize a buffer in std lib path detection.
2018-04-13 11:10:17 -04:00
Marc Tiehuis
fe9489ad63 Fix windows access check 2018-04-13 22:50:57 +12:00
Marc Tiehuis
03bec631bd Replace File.exists with File.access 2018-04-13 21:27:09 +12:00
Jimmi Holst Christensen
a498993fd1 Merged with master 2018-04-13 10:40:37 +02:00
Jimmi Holst Christensen
44c53c9979 std.zig.parser: Refactor round 2
* More work on ensuring that each state only eat one token
* VarDecl parsing now constructs its node
* Handling all fn parsing in the same case
* Using eatToken instead of getNextToken where possible
* All tokenIdTo* now takes  @TagType(Token.Id)
* Added a createToCtxLiteral function
2018-04-13 10:15:12 +02:00
Marc Tiehuis
b946982e90 Use builtin Arch/Os/Environ 2018-04-13 20:12:30 +12:00
Marc Tiehuis
7fe1c7c04f Remove cc command 2018-04-13 19:43:18 +12:00
Andrew Kelley
0f652b4d80 zig fmt: switch cases on new lines
See #911
2018-04-12 21:56:12 -04:00
Andrew Kelley
9e701e951b zig fmt includes trailing commas
See #911
2018-04-12 21:40:15 -04:00
Andrew Kelley
d4572d1140 zig fmt: container init fields each on own line
See #911
2018-04-12 21:23:18 -04:00
Andrew Kelley
373b3586a1 inline functions must be stored in const or comptime var
closes #913
2018-04-12 16:26:23 -04:00
Jimmi Holst Christensen
fad54e62bb std.zig.ast: Fixed build failures 2018-04-12 18:56:58 +02:00
Jimmi Holst Christensen
d35a6655e0 std.zig.parser: Refactored commaOrEnd to expectCommaOrEnd
* Now it returns end when found, or null if comma was found.
* State should now be appended outside the function
2018-04-12 18:13:09 +02:00
Andrew Kelley
29e0e4088e Merge remote-tracking branch 'origin/master' into self-hosted-cli 2018-04-12 11:20:38 -04:00
Andrew Kelley
7b2cb7e679 remove --zig-install-prefix arg now that we find std at runtime 2018-04-12 11:00:11 -04:00
Andrew Kelley
c43f77f109 fix invalid implicit cast on macos 2018-04-12 10:38:32 -04:00
Jimmi Holst Christensen
206c0b8bdb std.zig.parser: Refactor, round 1:
* Removed the Optional state
  * We now have an OptionalCtx instead of DestPtr
  * OptionalCtx simulated return, instead of reverting states
  * OptionalCtx is a lot less hacky, but is still a small footgun
* Trying to avoid consuming more than one token per state
  * This is required, because of comments
  * The C++ compiler allows comments between all tokens
  * We therefor have to consume comment tokens between each state
* Reordered states so they are grouped in some logical fasion
2018-04-12 16:08:23 +02:00
Marc Tiehuis
803f0a295b Revise self-hosted command line interface
Commands are now separated more precisely from one another. Arguments
are parsed mostly using a custom argument parser instead of manually.
This should be on parity feature-wise with the previous main.zig but
adds a few extra code-paths as well that were not yet implemented.

Subcommands are much more prominent and consistent. The first argument
is always a sub-command and then all following arguments refer to that
command. Different commands display there own usage messages and options
based on what they can do instead of a one-for-all usage message that
was only applicable for the build commands previously.

The `cc` command is added and is intended for driving a c compiler. See #490.
This is currently a wrapper over the system cc and assumes that it
exists, but it should suffice as a starting point.
2018-04-12 22:28:47 +12:00
Jimmi Holst Christensen
0d8646d262 std.zig.parser now parses alignment of functions
Related #909
This allows it to parse `std/special/compiler_rt/index.zig`
2018-04-12 08:46:26 +02:00
Andrew Kelley
2b86ffe34a LLD patch: Do not keep shared symbols to garbage...
-collected eliminated DSOs.

This applies https://reviews.llvm.org/D45536 to the embedded
LLD.

Closes #883
2018-04-11 18:15:33 -04:00
Jimmi Holst Christensen
ed1b028276 Merge branch 'master' of github.com:zig-lang/zig 2018-04-11 20:56:22 +02:00
Jimmi Holst Christensen
5b584e06e3 std.zig.parser special cased error in return.
Related #909
This allows parsing of `std/special/build_runner.zig`
2018-04-11 20:56:05 +02:00
Andrew Kelley
e48e707c32 allow integer and float literals to be passed to var params
closes #623
2018-04-11 14:47:37 -04:00
Jimmi Holst Christensen
a7f77d7c6a std.zig.parser: requireSemiColon now matches the C++ behavior
Related #909
Allowes parsing of `std/os/child_process.zig`
2018-04-11 15:26:00 +02:00
Jimmi Holst Christensen
df4c575525 std.zig.parser now parses inline fn proto
Related #909
Allows parsing of `std/os/zen.zig`.
2018-04-11 15:17:51 +02:00
Jimmi Holst Christensen
fe7146277d std.zig.parser now accept both string and multiline string for strings
Related #909
Allows it to parse `std/special/compiler_rt/aullrem.zig`,
`std/special/compiler_rt/aulldiv.zig` and `std/math/x86_64/sqrt.zig`
2018-04-11 14:43:53 +02:00
Jimmi Holst Christensen
28ea364e5e std.zig.parser now handle try's precedence correctly
This allows parsing of `std/zig/parser.zig`. Related: #909
2018-04-11 13:56:39 +02:00
Jimmi Holst Christensen
841ac0f4e1 std.zig.parser now allows assignment expr in switch cases.
This makes `std/os/index.zig` parse
related: #909
2018-04-11 13:46:35 +02:00
Jimmi Holst Christensen
4b0556ebd4 std.zig.parser can now parse std/heap.zig:
related: #909
* Struct fields can now be pub
* Parsing of double deref now works
* Block expressions now have the right precedence
2018-04-11 13:38:06 +02:00
Jimmi Holst Christensen
6fb5ab1b52 std.zig.parser: Redid parsing of error set delc
related: #909
2018-04-11 13:05:42 +02:00
Jimmi Holst Christensen
5f3ec023cd std.zig.parser: Fixed parsing of field access rhs
related: #909
2018-04-11 12:53:01 +02:00
Jimmi Holst Christensen
281c17f6ae std.zig.parser:
* Renamed eatToken to expectToken
* A new eatToken fn, which only eats the token, if the id match
* Inlined initNode, as it is not suppose to be used outside createNode
2018-04-11 12:05:10 +02:00
Jimmi Holst Christensen
dae287524d std.zig: Major refactor
* There now exists a few function to allocate all nodes in parser.zig
* ast.zig now have a table of Ids and their corrisponding type
2018-04-11 10:37:04 +02:00
Andrew Kelley
f43711e5fb Merge branch 'bnoordhuis-fix879' 2018-04-11 00:33:14 -04:00
Andrew Kelley
58c6424d4f simplify and fix BufMap logic 2018-04-11 00:32:42 -04:00
Andrew Kelley
19e0ed5d3e Merge branch 'fix879' of https://github.com/bnoordhuis/zig into bnoordhuis-fix879 2018-04-10 23:37:08 -04:00
Andrew Kelley
2ec1cec92d add more linux syscalls and constants
Based on #904 by tgshultz
2018-04-10 23:29:24 -04:00
Andrew Kelley
64d96ad703
Merge pull request #873 from zig-lang/self-hosted-parser
Self hosted parser completion
2018-04-10 22:47:18 -04:00
Josh Wolfe
405a2390f0 zig fmt while-else with no blocks 2018-04-10 22:44:55 -04:00
Andrew Kelley
f6c77746d6 add memmove to builtin.o
related: #514
2018-04-10 22:24:01 -04:00
Andrew Kelley
27e881c2d7 fix another undefined deref
see 0ba85ea6ff
2018-04-10 21:58:04 -04:00
Josh Wolfe
b553b7ab83 Merge branch 'master' into self-hosted-parser 2018-04-10 21:46:13 -04:00
Andrew Kelley
ee3e2790aa cmake defaults stage1 to install in build directory 2018-04-10 20:57:37 -04:00
Jimmi Holst Christensen
0ba85ea6ff std.zig.parser fixed segfault when parsing cc for fn decl 2018-04-10 17:46:17 +02:00
Andrew Kelley
477ded9042 add missing call in zig fmt to commit results to disk 2018-04-10 11:00:57 -04:00
Jimmi Holst Christensen
c6aa637146 std.zig.parser: removed dublicate "zig fmt: coroutines" test 2018-04-10 16:33:43 +02:00
Jimmi Holst Christensen
b9cccce26d std.zig.ast: fixed none compiling code 2018-04-10 15:56:37 +02:00
Jimmi Holst Christensen
db9a9f3a6c std.zig.parser now parses the var type
* I parse it as a type in all contexts. This is not how the
  C++ compiler does it, but I think typechecking should catch this
2018-04-10 15:16:31 +02:00