alexnask / ctregex.zig Goto Github PK
View Code? Open in Web Editor NEWCompile time regular expressions in zig
Compile time regular expressions in zig
Here's some simple test cases demonstrating this:
try testMatch("a*a", .ascii, "aa");
try testMatch("a+a", .ascii, "aa");
try testMatch("a?a", .ascii, "a");
These should all pass, but currently all fail. I'm currently staring down the main file to see how I might implement it, but I might not come through with the goods.
basic usage is unclear
im a zig noob, so i have no idea whats wrong here
zig init-exe
( cd src && git submodule add https://github.com/alexnask/ctregex.zig )
// src/main.zig
const std = @import("std");
const ctregex = @import("ctregex.zig/ctregex.zig");
pub fn main() anyerror!void {
const s = "asdf";
const stdout = std.io.getStdOut().writer();
if (try ctregex.match("(asdf)", .{.encoding = .utf8}, s)) |res| {
try stdout.print("match = {s}\n", .{ res.captures[1] });
}
}
zig build run
src/ctregex.zig/ctregex.zig:467:162: error: use of undeclared identifier 'c'
} else parser.consumeNotOneOf(special_brackets) orelse parser.raiseError("Expected a valid character after - in bracket rule, got character '{}'", .{c});
^
Line 467 in b609479
As without it, no one who is using your code is doing so legally.
I've tested this out recently, updated a bunch of breaking changes.
It seems that this still won't work given that zig's comptime semantics has changed a lot. I think to make this lib work a whole rewrite is needed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.