Allow conditions in variable node (#243)

* use condition in variable node

* added support for else expression

* addressing code review comments
This commit is contained in:
Ilya Puchka
2018-09-22 14:09:25 +03:00
committed by GitHub
parent 2c3962a3de
commit df2e193891
4 changed files with 69 additions and 3 deletions

View File

@@ -40,8 +40,7 @@ public class TokenParser {
case .text(let text, _):
nodes.append(TextNode(text: text))
case .variable:
let filter = try compileResolvable(token.contents, containedIn: token)
nodes.append(VariableNode(variable: filter, token: token))
try nodes.append(VariableNode.parse(self, token: token))
case .block:
if let parse_until = parse_until , parse_until(self, token) {
prependToken(token)