authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-08-06 02:23:41 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-08-06 02:23:41 -07:00
log791a3f5dcd2498c6ced5f1800f1921e63f54f12b
treeb90c07688d1d501a0dfe74b84a9cabec39e47d5d
parent250e56a7821a3c6db9453ded696f9f3c622c94b0

change replacement syntax to separate with periods instead of spaces


3 files changed, 4 insertions(+), 2 deletions(-)

src/astgen.zig+2
......@@ -152,7 +152,9 @@ const Parser = struct {
152152
153153 pub fn doReplacement(comptime self: *Parser) []const string {
154154 var ret: []const string = &.{};
155 ret = ret ++ &[_]string{self.eat(.word)};
155156 while (!self.tryEatSymbol("}")) {
157 self.eatSymbol(".");
156158 ret = ret ++ &[_]string{self.eat(.word)};
157159 }
158160 return ret;
src/lib.zig+1-1
......@@ -29,7 +29,7 @@ const tokenize = @import("./tokenize.zig");
2929const astgen = @import("./astgen.zig");
3030
3131pub fn parse(comptime input: []const u8) astgen.Value {
32 return astgen.Value{ .element = astgen.do(tokenize.do(input, &.{ '[', '=', ']', '(', ')', '{', '}', '#', '/' })) };
32 return astgen.Value{ .element = astgen.do(tokenize.do(input, &.{ '[', '=', ']', '(', ')', '{', '}', '#', '/', '.' })) };
3333}
3434
3535pub fn compile(writer: anytype, comptime value: astgen.Value, data: anytype) !void {
src/main.zig+1-1
......@@ -13,7 +13,7 @@ const example_document =
1313 \\ hr
1414 \\ p("This is an example HTML document written in "a[href="https://github.com/nektro/zig-pek"]("Pek")".")
1515 \\ p("Pek is written by "{author}".")
16 \\ p("Her favorite plant is the "{favorite flower})
16 \\ p("Her favorite plant is the "{favorite.flower})
1717 \\ br
1818 \\ p("The most populous US cities are:")
1919 \\ ul(