diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/argument.zig | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/argument.zig b/src/argument.zig index a9c823d..75bb7bf 100644 --- a/src/argument.zig +++ b/src/argument.zig @@ -143,11 +143,6 @@ pub const Args = union(Mode) { const text = Entry.read_file(check(args.next()), allocator); defer allocator.free(text); - const grammar = Grammar.parse( - "main", - text, - allocator - ) catch |e| help(e); switch (mode) { .recognize => { @@ -162,6 +157,12 @@ pub const Args = union(Mode) { } else help(error.InvalidArgument); } + const grammar = Grammar.parse( + entry, + text, + allocator + ) catch |e| help(e); + return Self { .recognize = .{ .input = input orelse Entry.stdin(), @@ -191,6 +192,12 @@ pub const Args = union(Mode) { } else help(error.InvalidArgument); } + const grammar = Grammar.parse( + entry, + text, + allocator + ) catch |e| help(e); + return Self { .generate = .{ .count = count, |