| ... | ... | @@ -28,7 +28,7 @@ pub const Attr = struct { |
| 28 | 28 | |
| 29 | 29 | pub const Block = struct { |
| 30 | 30 | name: Type, |
| 31 | | args: []const string, |
| 31 | args: []const []const string, |
| 32 | 32 | body: []const Value, |
| 33 | 33 | |
| 34 | 34 | pub const Type = enum { |
| ... | ... | @@ -42,7 +42,7 @@ pub const Block = struct { |
| 42 | 42 | |
| 43 | 43 | pub const Fn = struct { |
| 44 | 44 | name: string, |
| 45 | | args: []const string, |
| 45 | args: []const []const string, |
| 46 | 46 | }; |
| 47 | 47 | |
| 48 | 48 | // |
| ... | ... | @@ -131,7 +131,7 @@ const Parser = struct { |
| 131 | 131 | if (self.tryEatSymbol("#")) { |
| 132 | 132 | const w = self.eat(.word); |
| 133 | 133 | if (std.meta.stringToEnum(Block.Type, w)) |name| { |
| 134 | | const args = self.doReplacement(); |
| 134 | const args = self.doArgs(); |
| 135 | 135 | var children: []const Value = &.{}; |
| 136 | 136 | while (!self.tryEatSymbol("/")) { |
| 137 | 137 | children = children ++ &[_]Value{self.doValue()}; |
| ... | ... | @@ -146,7 +146,7 @@ const Parser = struct { |
| 146 | 146 | } |
| 147 | 147 | return Value{ .function = .{ |
| 148 | 148 | .name = w, |
| 149 | | .args = self.doReplacement(), |
| 149 | .args = self.doArgs(), |
| 150 | 150 | } }; |
| 151 | 151 | } |
| 152 | 152 | return Value{ .replacement = self.doReplacement() }; |
| ... | ... | @@ -154,6 +154,21 @@ const Parser = struct { |
| 154 | 154 | return Value{ .element = self.doElement() }; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | pub fn doArgs(comptime self: *Parser) []const []const string { |
| 158 | var ret: []const []const string = &.{}; |
| 159 | var temp: []const string = &.{self.eat(.word)}; |
| 160 | while (!self.tryEatSymbol("}")) { |
| 161 | if (self.tryEatSymbol(".")) { |
| 162 | temp = temp ++ &[_]string{self.eat(.word)}; |
| 163 | } else { |
| 164 | ret = ret ++ &[_][]const string{temp}; |
| 165 | temp = &.{self.eat(.word)}; |
| 166 | } |
| 167 | } |
| 168 | ret = ret ++ &[_][]const string{temp}; |
| 169 | return ret; |
| 170 | } |
| 171 | |
| 157 | 172 | pub fn doReplacement(comptime self: *Parser) []const string { |
| 158 | 173 | var ret: []const string = &.{}; |
| 159 | 174 | ret = ret ++ &[_]string{self.eat(.word)}; |