[TokenParser] Add method to register tag
This commit is contained in:
@@ -31,10 +31,14 @@ public class TokenParser {
|
|||||||
|
|
||||||
public init(tokens:[Token]) {
|
public init(tokens:[Token]) {
|
||||||
self.tokens = tokens
|
self.tokens = tokens
|
||||||
tags["for"] = ForNode.parse
|
registerTag("for", ForNode.parse)
|
||||||
tags["now"] = NowNode.parse
|
registerTag("if", IfNode.parse)
|
||||||
tags["if"] = IfNode.parse
|
registerTag("ifnot", IfNode.parse_ifnot)
|
||||||
tags["ifnot"] = IfNode.parse_ifnot
|
registerTag("now", NowNode.parse)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func registerTag(name:String, parser:TagParser) {
|
||||||
|
tags[name] = parser
|
||||||
}
|
}
|
||||||
|
|
||||||
public func parse() -> Results {
|
public func parse() -> Results {
|
||||||
|
|||||||
Reference in New Issue
Block a user