| 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 | 152 | |
| 153 | 153 | pub fn doReplacement(comptime self: *Parser) []const string { |
| 154 | 154 | var ret: []const string = &.{}; |
| 155 | ret = ret ++ &[_]string{self.eat(.word)}; | |
| 155 | 156 | while (!self.tryEatSymbol("}")) { |
| 157 | self.eatSymbol("."); | |
| 156 | 158 | ret = ret ++ &[_]string{self.eat(.word)}; |
| 157 | 159 | } |
| 158 | 160 | return ret; |
src/lib.zig+1-1| ... | ... | @@ -29,7 +29,7 @@ const tokenize = @import("./tokenize.zig"); |
| 29 | 29 | const astgen = @import("./astgen.zig"); |
| 30 | 30 | |
| 31 | 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 | 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 | 13 | \\ hr |
| 14 | 14 | \\ p("This is an example HTML document written in "a[href="https://github.com/nektro/zig-pek"]("Pek")".") |
| 15 | 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 | 17 | \\ br |
| 18 | 18 | \\ p("The most populous US cities are:") |
| 19 | 19 | \\ ul( |