| author | |
| committer | |
| log | 791a3f5dcd2498c6ced5f1800f1921e63f54f12b |
| tree | b90c07688d1d501a0dfe74b84a9cabec39e47d5d |
| parent | 250e56a7821a3c6db9453ded696f9f3c622c94b0 |
3 files changed, 4 insertions(+), 2 deletions(-)
src/astgen.zig+2| ... | @@ -152,7 +152,9 @@ const Parser = struct { | ... | @@ -152,7 +152,9 @@ const Parser = struct { |
| 152 | 152 | ||
| 153 | pub fn doReplacement(comptime self: *Parser) []const string { | 153 | pub fn doReplacement(comptime self: *Parser) []const string { |
| 154 | var ret: []const string = &.{}; | 154 | var ret: []const string = &.{}; |
| 155 | ret = ret ++ &[_]string{self.eat(.word)}; | ||
| 155 | while (!self.tryEatSymbol("}")) { | 156 | while (!self.tryEatSymbol("}")) { |
| 157 | self.eatSymbol("."); | ||
| 156 | ret = ret ++ &[_]string{self.eat(.word)}; | 158 | ret = ret ++ &[_]string{self.eat(.word)}; |
| 157 | } | 159 | } |
| 158 | return ret; | 160 | return ret; |
src/lib.zig+1-1| ... | @@ -29,7 +29,7 @@ const tokenize = @import("./tokenize.zig"); | ... | @@ -29,7 +29,7 @@ const tokenize = @import("./tokenize.zig"); |
| 29 | const astgen = @import("./astgen.zig"); | 29 | const astgen = @import("./astgen.zig"); |
| 30 | 30 | ||
| 31 | pub fn parse(comptime input: []const u8) astgen.Value { | 31 | pub 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, &.{ '[', '=', ']', '(', ')', '{', '}', '#', '/', '.' })) }; |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | pub fn compile(writer: anytype, comptime value: astgen.Value, data: anytype) !void { | 35 | pub fn compile(writer: anytype, comptime value: astgen.Value, data: anytype) !void { |
src/main.zig+1-1| ... | @@ -13,7 +13,7 @@ const example_document = | ... | @@ -13,7 +13,7 @@ const example_document = |
| 13 | \\ hr | 13 | \\ hr |
| 14 | \\ p("This is an example HTML document written in "a[href="https://github.com/nektro/zig-pek"]("Pek")".") | 14 | \\ p("This is an example HTML document written in "a[href="https://github.com/nektro/zig-pek"]("Pek")".") |
| 15 | \\ p("Pek is written by "{author}".") | 15 | \\ p("Pek is written by "{author}".") |
| 16 | \\ p("Her favorite plant is the "{favorite flower}) | 16 | \\ p("Her favorite plant is the "{favorite.flower}) |
| 17 | \\ br | 17 | \\ br |
| 18 | \\ p("The most populous US cities are:") | 18 | \\ p("The most populous US cities are:") |
| 19 | \\ ul( | 19 | \\ ul( |