Commit Graph

2529 Commits (d04346d2ac04c079c1722db691d1536c3d717735)

Author SHA1 Message Date
Jimmi Holst Christensen d04346d2ac ast.zig.parser now parses defer statements 2018-04-09 13:07:46 +02:00
Jimmi Holst Christensen c19f5a2356 std.zig.parser now parses if statements 2018-04-09 12:51:18 +02:00
Jimmi Holst Christensen 7dd55a8007 std.zig.parser now parses for loops 2018-04-09 11:48:25 +02:00
Jimmi Holst Christensen e24409ebe0 std.zig.parser unified code for rendering and parsing semicolon in statements 2018-04-09 11:17:57 +02:00
Jimmi Holst Christensen e260c8ca63 std.zig.parser now parses while loops and labeled break and continue 2018-04-09 11:11:18 +02:00
Jimmi Holst Christensen e4d0b46c0c std.zig.parser WIP generalizing parsing of payloads
* Note, it doesn't work :)
2018-04-08 17:05:08 +02:00
Jimmi Holst Christensen bdff5bfa3e std.zig.parser now parses switch 2018-04-07 01:38:38 +02:00
Jimmi Holst Christensen 820de1716b std.zig.parser now parses labeled blocks.
* There is also some code for switch range parsing
2018-04-06 15:37:49 +02:00
Jimmi Holst Christensen f667744d44 std.zig.parser Fixed:
* Parsing of the optional expression in contrl flow expr
* Rendering of catch expressions
2018-04-06 09:36:11 +02:00
Jimmi Holst Christensen e45de607d6 std.zig.parser: Initializers are now parsed and fmt correctly 2018-04-06 08:56:28 +02:00
Jimmi Holst Christensen 779247ba11 std.zig Major Refactor
* parser now parses expression like the C++ compiler does
* This makes initializers work
* Added control flow expression (only return is parsed)
* Added catch parsing (It doesn't quite work)
* The parse can now specify states as optional.
  * The parse will roll back on error if states are optional
  * This can be overriden by State.Required
2018-04-04 23:36:55 +02:00
Jimmi Holst Christensen 744416ce0c std.zig.parser should now parse operators with precedence.
* This haven't been tested yet
2018-04-04 14:58:51 +02:00
Jimmi Holst Christensen ca0085c46d std.zig.parser now parses error set declarations 2018-04-04 10:54:48 +02:00
Jimmi Holst Christensen 020724cfa0 std.zig.tokenizer Tokens now don't contain a line and column field.
* Instead, this information is optained by asking the tokenizer.
* getTokenLocation takes a start_index, so relative loc can be optained
2018-04-04 10:27:38 +02:00
Jimmi Holst Christensen 09cf823619 std.zig.parser now parses container decls 2018-04-04 09:57:37 +02:00
Jimmi Holst Christensen ec611bf8b4 std.zig.parser now parses regular enums, unions and struct
* Still missing packed, and extern
2018-04-03 20:00:02 +02:00
Jimmi Holst Christensen d602f12df8 std.zig.ast Added ContainerDecl 2018-04-03 15:59:14 +02:00
Jimmi Holst Christensen 4fae452684 std.zig.parser Refactored top level decl parsing
* Now, the arraylist from the root node is passed through the states.
* This allows us to reuse the code for enums, unions and structs
2018-04-03 15:33:22 +02:00
Jimmi Holst Christensen 40f35e997a std.zig.parser moved container initializer tests down 2018-04-03 15:17:26 +02:00
Jimmi Holst Christensen 9d69e94bba std.zig.parser now parses grouped expressions
* I also moved some tests down, as they fail in ways I can't fix yet
2018-04-03 15:16:32 +02:00
Jimmi Holst Christensen 5c82ed2ea9 std.zig.parser now parses initializers... Or, it would, if it worked 2018-04-03 14:53:27 +02:00
Jimmi Holst Christensen 0b9247fb63 std.zig.parser Refactor:
* Slice/Array access is now not parsed in the expr contruction loop
* State.ExprListItemOrEnd now takes a token id for the end token
2018-04-03 14:20:34 +02:00
Jimmi Holst Christensen b424cd75ab std.zig.parser refactored call, slice and array access to be suffix op 2018-04-03 12:33:06 +02:00
Jimmi Holst Christensen 22e38ffb54 std.zig.tokenizer fixed tokens having wrong column and line 2018-04-03 11:18:18 +02:00
Jimmi Holst Christensen a2330d0ea3 std.zig.parser now parses slice and array types 2018-04-03 10:54:19 +02:00
Jimmi Holst Christensen b9093185f7 std.zig.parser now parses slicing and array access 2018-04-01 22:02:51 +02:00
Jimmi Holst Christensen df09c01f7f std.zig.parser now parses error, this and unreachable 2018-03-31 22:48:12 +02:00
Jimmi Holst Christensen aabf7cf57e std.zig.parser now parses null and bool literals 2018-03-31 22:10:49 +02:00
Jimmi Holst Christensen 975dc5a390 std.zig.parser now parses char literals 2018-03-31 21:28:40 +02:00
Jimmi Holst Christensen 4d8f9e2295 std.zig.parser now parses multi line strings 2018-03-31 21:04:54 +02:00
Jimmi Holst Christensen 4793c3397e std.zig.parser now handles lib name for extern var and fn 2018-03-31 17:46:29 +02:00
Jimmi Holst Christensen cda3509353 Added test cases to cover all of zigs syntax 2018-03-31 15:39:51 +02:00
Jimmi Holst Christensen 26e56f2fab Each test now have it's own test name 2018-03-31 14:18:09 +02:00
Jimmi Holst Christensen 596f4b6002 Fixed review commented code 2018-03-31 14:00:49 +02:00
Jimmi Holst Christensen 5118caf5ab Added a lot of test cases 2018-03-31 00:53:00 +02:00
Jimmi Holst Christensen 24071c6803 std.zig.parser parses all prefix operators 2018-03-30 21:45:42 +02:00
Jimmi Holst Christensen 1dfa927a67 std.zig.parser now treats call expr as a suffix operator 2018-03-30 20:47:09 +02:00
Andrew Kelley f586acabdc add ZIG_STATIC cmake option
it's not compatible with glibc but it works with musl
2018-03-30 13:20:13 -04:00
Jimmi Holst Christensen edca173997 std.zig.parser now parses call expr 2018-03-29 23:40:46 +02:00
Jimmi Holst Christensen 8ada030971 Fixed self hosted compiler compiler error from prev commit 2018-03-29 22:37:54 +02:00
Jimmi Holst Christensen 530f795769 std.zig.parser now supports all infix operators 2018-03-29 22:31:17 +02:00
Andrew Kelley b80398b355
Merge pull request #867 from zig-lang/rand-overhaul
Rewrite Rand functions
2018-03-29 14:14:35 -04:00
Andrew Kelley ccadcbc715 fix examples and rename std.rand.Rand to std.rand.Random 2018-03-29 12:33:29 -04:00
Marc Tiehuis 0fd0f6fd1f Rewrite Rand functions
We now use a generic Rand structure which abstracts the core functions
from the backing engine.

The old Mersenne Twister engine is removed and replaced instead with
three alternatives:

 - Pcg32
 - Xoroshiro128+
 - Isaac64

These should provide sufficient coverage for most purposes, including a
CSPRNG using Isaac64. Consumers of the library that do not care about
the actual engine implementation should use DefaultPrng and DefaultCsprng.
2018-03-30 01:50:58 +13:00
Jimmi Holst Christensen 9df2a6a502 std.zig.parser can now parse top level test declarations 2018-03-29 13:43:17 +02:00
Andrew Kelley 032fccf615 fix compile time array concatenation for slices
closes #866
2018-03-28 23:25:12 -04:00
Andrew Kelley 5627347bab
Merge pull request #865 from bnoordhuis/zig-build-stage2
skeleton stage 2 support for 'zig build'
2018-03-28 21:02:09 -04:00
Jimmi Holst Christensen 72ce146293 Fixed looking for windows sdk when targeting linux 2018-03-29 00:53:06 +02:00
Ben Noordhuis b60b01ce97 skeleton stage 2 support for 'zig build'
Initial port of the 'zig build' logic from the stage 1 compiler to the
stage 2 compiler sans code generation and BUILD_INFO support.
2018-03-28 18:30:41 +02:00
Ben Noordhuis db70b909a0 non-zero exit when build.zig cannot be created
Make the stage 1 compiler exit with a non-zero status code
when `zig build --init` cannot create a new build.zig file.
2018-03-28 18:30:41 +02:00