summaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/main.zig b/src/main.zig
index f28ab18..8741cd7 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -8,24 +8,16 @@ pub fn main() !void {
defer _ = gpa.deinit();
- const lexer = try allocator.create(Regex.Lexer);
+ var lexer = Regex.Lexer.init("bz*[a-z](l)", &allocator);
- lexer.* = Regex.Lexer.init("abc|123[a-Z]()+", &allocator);
+ _ = try lexer.scan();
- const tl = try lexer.scan();
+ var parser = Regex.Parser.init(&lexer.tokens, &allocator);
- var it = tl.first;
- while (it) |node| : (it = node.next) {
- try stdio.print("{}\n", .{&(node.data)});
- }
+ const pt = try parser.parse();
- const parser = try allocator.create(Regex.Parser);
-
- parser.* = Regex.Parser.init(&lexer.tokens, &allocator);
-
- _ = try parser.parseRe();
+ try stdio.print("{}\n", .{pt});
+ parser.deinit();
lexer.deinit();
- allocator.destroy(lexer);
- allocator.destroy(parser);
}