0001    import Foundation
0002    
0003    
0004    /// Split a string by spaces leaving quoted phrases together
0005    func smartSplit
Tokenizer.swift:55
      return smartSplit(value)
Tokenizer.swift:57
      return smartSplit(value)
Tokenizer.swift:59
      return smartSplit(value)
Tokenizer.swift:61
      return smartSplit(value)
(value: String) -> [String] { 0006 var word = "" 0007 var separator: Character = " " 0008 var components: [String] = [] 0009 0010 for character in value.characters { 0011 if character == separator { 0012 if separator != " " { 0013 word.append(separator) 0014 } 0015 0016 if !word.isEmpty { 0017 components.append(word) 0018 word = "" 0019 } 0020 0021 separator = " " 0022 } else { 0023 if separator == " " && (character == "'" || character == "\"") { 0024 separator = character 0025 } 0026 word.append(character) 0027 } 0028 } 0029 0030 if !word.isEmpty { 0031 components.append(word) 0032 } 0033 0034 return components 0035 } 0036 0037 0038 public enum Token
Include.swift:7
  public class func parse(parser: TokenParser, token: Token) throws -> NodeType {
Inheritence.swift:33
  class func parse(parser: TokenParser, token: Token) throws -> NodeType {
Inheritence.swift:89
  class func parse(parser: TokenParser, token: Token) throws -> NodeType {
Lexer.swift:8
  func createToken(string:String) -> Token {
Lexer.swift:14
      return Token.Variable(value: strip())
Lexer.swift:16
      return Token.Block(value: strip())
Lexer.swift:18
      return Token.Comment(value: strip())
Lexer.swift:21
    return Token.Text(value: string)
Lexer.swift:25
  public func tokenize() -> [Token] {
Lexer.swift:26
    var tokens: [Token] = []
Namespace.swift:2
  public typealias TagParser = (TokenParser, Token) throws -> NodeType
Node.swift:82
  public class func parse(parser:TokenParser, token:Token) throws -> NodeType {
Node.swift:124
  public class func parse(parser:TokenParser, token:Token) throws -> NodeType {
Node.swift:186
  public class func parse(parser:TokenParser, token:Token) throws -> NodeType {
Node.swift:209
  public class func parse_ifnot(parser:TokenParser, token:Token) throws -> NodeType {
Parser.swift:1
public func until(tags: [String]) -> ((TokenParser, Token) -> Bool) {
Parser.swift:19
  public typealias TagParser = (TokenParser, Token) throws -> NodeType
Parser.swift:21
  private var tokens: [Token]
Parser.swift:24
  public init(tokens: [Token], namespace: Namespace) {
Parser.swift:34
  public func parse(parse_until:((parser:TokenParser, token:Token) -> (Bool))?) throws -> [NodeType] {
Parser.swift:68
  public func nextToken() -> Token? {
Parser.swift:76
  public func prependToken(token:Token) {
Template.swift:10
  let tokens: [Token]
Tokenizer.swift:80
public func == (lhs: Token, rhs: Token) -> Bool {
Tokenizer.swift:80
public func == (lhs: Token, rhs: Token) -> Bool {
: Equatable { 0039 /// A token representing a piece of text. 0040 case Text
Lexer.swift:21
    return Token.Text(value: string)
Parser.swift:41
      case .Text(let text):
Tokenizer.swift:58
    case .Text(let value):
Tokenizer.swift:71
    case .Text(let value):
Tokenizer.swift:82
  case (.Text(let lhsValue), .Text(let rhsValue)):
Tokenizer.swift:82
  case (.Text(let lhsValue), .Text(let rhsValue)):
(value: String) 0041 0042 /// A token representing a variable. 0043 case Variable
Lexer.swift:14
      return Token.Variable(value: strip())
Parser.swift:43
      case .Variable:
Tokenizer.swift:56
    case .Variable(let value):
Tokenizer.swift:69
    case .Variable(let value):
Tokenizer.swift:84
  case (.Variable(let lhsValue), .Variable(let rhsValue)):
Tokenizer.swift:84
  case (.Variable(let lhsValue), .Variable(let rhsValue)):
(value: String) 0044 0045 /// A token representing a comment. 0046 case Comment
Lexer.swift:18
      return Token.Comment(value: strip())
Parser.swift:60
      case .Comment:
Tokenizer.swift:60
    case .Comment(let value):
Tokenizer.swift:73
    case .Comment(let value):
Tokenizer.swift:88
  case (.Comment(let lhsValue), .Comment(let rhsValue)):
Tokenizer.swift:88
  case (.Comment(let lhsValue), .Comment(let rhsValue)):
(value: String) 0047 0048 /// A token representing a template block. 0049 case Block
Lexer.swift:16
      return Token.Block(value: strip())
Parser.swift:45
      case .Block:
Tokenizer.swift:54
    case .Block(let value):
Tokenizer.swift:67
    case .Block(let value):
Tokenizer.swift:86
  case (.Block(let lhsValue), .Block(let rhsValue)):
Tokenizer.swift:86
  case (.Block(let lhsValue), .Block(let rhsValue)):
(value: String) 0050 0051 /// Returns the underlying value as an array seperated by spaces 0052 public func components
Include.swift:8
    let bits = token.components()
Inheritence.swift:34
    let bits = token.components()
Inheritence.swift:90
    let bits = token.components()
Node.swift:85
    let components = token.components()
Node.swift:125
    let components = token.components()
Node.swift:187
    let components = token.components()
Node.swift:210
    let components = token.components()
Parser.swift:3
    if let name = token.components().first {
Parser.swift:46
        let tag = token.components().first
() -> [String] { 0053 switch self { 0054 case .Block(let value): 0055 return smartSplit(value) 0056 case .Variable(let value): 0057 return smartSplit(value) 0058 case .Text(let value): 0059 return smartSplit(value) 0060 case .Comment(let value): 0061 return smartSplit(value) 0062 } 0063 } 0064 0065 public var contents
Node.swift:87
      throw TemplateSyntaxError("'now' tags may only have one argument: the format string `\(token.contents)`.")
Node.swift:128
      throw TemplateSyntaxError("'for' statements should use the following 'for x in y' `\(token.contents)`.")
Node.swift:142
    if token.contents == "empty" {
Node.swift:189
      throw TemplateSyntaxError("'if' statements should use the following 'if condition' `\(token.contents)`.")
Node.swift:201
    if token.contents == "else" {
Node.swift:212
      throw TemplateSyntaxError("'ifnot' statements should use the following 'if condition' `\(token.contents)`.")
Node.swift:224
    if token.contents == "else" {
Parser.swift:44
        nodes.append(VariableNode(variable: try compileFilter(token.contents)))
: String { 0066 switch self { 0067 case .Block(let value): 0068 return value 0069 case .Variable(let value): 0070 return value 0071 case .Text(let value): 0072 return value 0073 case .Comment(let value): 0074 return value 0075 } 0076 } 0077 } 0078 0079 0080 public func == (lhs: Token, rhs: Token) -> Bool { 0081 switch (lhs, rhs) { 0082 case (.Text(let lhsValue), .Text(let rhsValue)): 0083 return lhsValue == rhsValue 0084 case (.Variable(let lhsValue), .Variable(let rhsValue)): 0085 return lhsValue == rhsValue 0086 case (.Block(let lhsValue), .Block(let rhsValue)): 0087 return lhsValue == rhsValue 0088 case (.Comment(let lhsValue), .Comment(let rhsValue)): 0089 return lhsValue == rhsValue 0090 default: 0091 return false 0092 } 0093 } 0094