chore: Lock down APIs

This commit is contained in:
Kyle Fuller
2016-11-27 02:20:46 +00:00
parent 60b378d482
commit a13401b046
17 changed files with 67 additions and 60 deletions

View File

@@ -14,7 +14,7 @@ public func until(_ tags: [String]) -> ((TokenParser, Token) -> Bool) {
/// A class for parsing an array of tokens and converts them into a collection of Node's
open class TokenParser {
public class TokenParser {
public typealias TagParser = (TokenParser, Token) throws -> NodeType
fileprivate var tokens: [Token]
@@ -26,11 +26,11 @@ open class TokenParser {
}
/// Parse the given tokens into nodes
open func parse() throws -> [NodeType] {
public func parse() throws -> [NodeType] {
return try parse(nil)
}
open func parse(_ parse_until:((_ parser:TokenParser, _ token:Token) -> (Bool))?) throws -> [NodeType] {
public func parse(_ parse_until:((_ parser:TokenParser, _ token:Token) -> (Bool))?) throws -> [NodeType] {
var nodes = [NodeType]()
while tokens.count > 0 {
@@ -64,7 +64,7 @@ open class TokenParser {
return nodes
}
open func nextToken() -> Token? {
public func nextToken() -> Token? {
if tokens.count > 0 {
return tokens.remove(at: 0)
}
@@ -72,11 +72,11 @@ open class TokenParser {
return nil
}
open func prependToken(_ token:Token) {
public func prependToken(_ token:Token) {
tokens.insert(token, at: 0)
}
open func findFilter(_ name: String) throws -> FilterType {
public func findFilter(_ name: String) throws -> FilterType {
if let filter = namespace.filters[name] {
return filter
}