From 460055e186875066a52902fc0613c0aaa15f07f9 Mon Sep 17 00:00:00 2001 From: Luna Date: Sun, 25 Aug 2019 16:49:08 -0300 Subject: [PATCH] add loop keyword --- README.md | 5 +++++ src/scanner.zig | 2 ++ src/tokens.zig | 1 + 3 files changed, 8 insertions(+) diff --git a/README.md b/README.md index eed189f..054b284 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,11 @@ a vlang parser in zig because i can +## variations + + - `for` is split between `for` and `loop` because my fucking god i cant stand + having *four* different variations of `for`. + ## how ``` diff --git a/src/scanner.zig b/src/scanner.zig index 23c442b..2ee42d1 100644 --- a/src/scanner.zig +++ b/src/scanner.zig @@ -50,6 +50,7 @@ const keywords = [_][]const u8{ "false", "None", "println", + "loop", }; const keyword_ttypes = [_]TokenType{ @@ -78,6 +79,7 @@ const keyword_ttypes = [_]TokenType{ .False, .None, .Println, + .Loop, }; fn getKeyword(keyword: []const u8) ?TokenType { diff --git a/src/tokens.zig b/src/tokens.zig index 8b45d54..360c6b6 100644 --- a/src/tokens.zig +++ b/src/tokens.zig @@ -55,6 +55,7 @@ pub const TokenType = enum { Enum, Fn, For, + Loop, Go, Goto, If,