<commit_before>//
//  Parser.swift
//  Mustachio
//
//  Created by <NAME>, <NAME> on 8/31/14.
//  Copyright (c) 2014 jmont. All rights reserved.
//

import Foundation

class Parser {
    class func parse(template: String) -> [Tag] {
        return []
    }

    class func toTags(template: String) -> [Tag] {
        var words = template.componentsSeparatedByString(" ")
        return words.map(toTag)
    }

    class func toTag(s: String) -> Tag {
        var maybeTag: Tag?
        if s.hasPrefix("{{{") || s.hasPrefix("{{&") {
            maybeTag = self.mkTagUnescapedVariable(s)
        } else if s.hasPrefix("{{#") {
            maybeTag = .Section("", "")
        } else if s.hasPrefix("{{^") {
            maybeTag = .InvertedSection("","")
        } else if s.hasPrefix("{{") {
            maybeTag = self.mkTagVariable(s)
        }
<commit_msg>Make parser public<commit_after>//
//  Parser.swift
//  Mustachio
//
//  Created by <NAME>, <NAME> on 8/31/14.
//  Copyright (c) 2014 jmont. All rights reserved.
//

import Foundation

public class Parser {
    public class func parse(template: String) -> [Tag] {
        return self.toTags(template)
    }

    class func toTags(template: String) -> [Tag] {
        var words = template.componentsSeparatedByString(" ")
        return words.map(toTag)
    }

    class func toTag(s: String) -> Tag {
        var maybeTag: Tag?
        if s.hasPrefix("{{{") || s.hasPrefix("{{&") {
            maybeTag = self.mkTagUnescapedVariable(s)
        } else if s.hasPrefix("{{#") {
            maybeTag = .Section("", "")
        } else if s.hasPrefix("{{^") {
            maybeTag = .InvertedSection("","")
        } else if s.hasPrefix("{{") {
            maybeTag = self.mkTagVariable(s)
        }

{'fraction_non_alphanumeric': 0.164, 'fraction_numerical': 0.010285714285714285, 'mean_word_length': 2.1156583629893237, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '949302', 'n_tokens_mistral': 581, 'n_tokens_neox': 554, 'n_words': 133}