From 0b816a512e3513d256717d030c831602fd2e452d Mon Sep 17 00:00:00 2001 From: Luna Date: Mon, 1 Jun 2020 22:08:01 -0300 Subject: [PATCH 1/2] lang: remove unused declarations --- src/lang.zig | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/lang.zig b/src/lang.zig index 2a506c2..b8f5a85 100644 --- a/src/lang.zig +++ b/src/lang.zig @@ -3,11 +3,7 @@ const std = @import("std"); const plugin = @import("plugin.zig"); const custom = @import("custom.zig"); -pub const ParseError = error{ - OutOfMemory, - ArgRequired, - ParseFail, -}; +pub const ParseError = error{ParseFail}; pub const CommandType = enum { /// "LV2 Commands" are commands that receive split, index, and then receive @@ -481,9 +477,6 @@ pub const Command = struct { }; pub const CommandList = std.ArrayList(*Command); -pub const ArgList = std.ArrayList([]const u8); - -pub const KeywordMap = std.StringHashMap(CommandType); /// A parser. pub const Lang = struct { @@ -653,8 +646,6 @@ pub const Lang = struct { self.doError("Unknown command '{}' ({})", .{ command_string, command_string.len }); continue; } - - // try cmds.append(cmd); } if (self.has_error) return ParseError.ParseFail; From b00ab8e839967612cbc813e144398db9ae0bff94 Mon Sep 17 00:00:00 2001 From: Luna Date: Mon, 1 Jun 2020 22:14:12 -0300 Subject: [PATCH 2/2] remove the big switch when printing commands --- src/printer.zig | 44 +------------------------------------------- 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/src/printer.zig b/src/printer.zig index ea91ec2..b7592db 100644 --- a/src/printer.zig +++ b/src/printer.zig @@ -2,49 +2,7 @@ const langs = @import("lang.zig"); pub fn printList(list: langs.CommandList, stream: var) !void { for (list.items) |cmd| { - var command = switch (cmd.command) { - .Noop => "noop", - .Load => "load", - .Quicksave => "quicksave", - .RunQS => "runqs", - - .Amp => "amp", - .RFlanger => "rflanger", - .Eq => "eq", - .Phaser => "phaser", - .Mbeq => "mbeq", - .Chorus => "chorus", - .PitchScaler => "pitchscaler", - .Reverb => "reverb", - .Highpass => "highpass", - .Delay => "delay", - .Vinyl => "vinyl", - .RevDelay => "revdelay", - .Gate => "gate", - .Detune => "detune", - .Overdrive => "overdrive", - .Degrade => "Degrade", - .RePsycho => "repsycho", - .TalkBox => "talkbox", - .DynComp => "dyncomp", - .ThruZero => "thruzero", - .Foverdrive => "foverdrive", - .Gverb => "gverb", - .Invert => "invert", - .TapeDelay => "tapedelay", - .ModDelay => "moddelay", - .MultiChorus => "multichorus", - .Saturator => "saturator", - .VintageDelay => "vintagedelay", - - .Noise => "noise", - .WildNoise => "wildnoise", - .Write => "write", - .Embed => "embed", - - .Rotate => "rotate", - }; - + const command = @tagName(cmd.tag); try stream.print("{}", .{command}); for (cmd.args.items) |arg| {