From 5edd8a9bf646db3753d7ff9722af5e64d3346235 Mon Sep 17 00:00:00 2001 From: Ter Date: Wed, 20 Feb 2019 01:09:42 +0700 Subject: [PATCH] Refactor --- Sources/swiftmonkey/Ast.swift | 50 +--- Sources/swiftmonkey/Evaluator.swift | 1 - Sources/swiftmonkey/Lexer.swift | 48 ++-- Sources/swiftmonkey/Parser.swift | 96 ++++--- Sources/swiftmonkey/Token.swift | 2 +- Sources/swiftmonkeyExecutable/main.swift | 11 +- Tests/swiftmonkeyTests/AstTests.swift | 6 +- Tests/swiftmonkeyTests/LexerTests.swift | 258 +++++++++---------- Tests/swiftmonkeyTests/ParserTests.swift | 56 ++-- Tests/swiftmonkeyTests/XCTestManifests.swift | 9 - swiftmonkey.xcodeproj/project.pbxproj | 4 - 11 files changed, 237 insertions(+), 304 deletions(-) delete mode 100644 Tests/swiftmonkeyTests/XCTestManifests.swift diff --git a/Sources/swiftmonkey/Ast.swift b/Sources/swiftmonkey/Ast.swift index 84a0c71..aec0618 100644 --- a/Sources/swiftmonkey/Ast.swift +++ b/Sources/swiftmonkey/Ast.swift @@ -13,11 +13,9 @@ public protocol Node { } public protocol Statement: Node { - func statementNode() -> Void } public protocol Expression: Node { - func expressionNode() -> Void } extension Expression { @@ -54,9 +52,6 @@ struct LetStatement: Statement { var name: Identifier var value: Expression? - func statementNode() { - } - func tokenLiteral() -> String { return token.literal } @@ -79,9 +74,6 @@ struct ReturnStatement: Statement { func tokenLiteral() -> String { return token.literal } - - func statementNode() { - } func string() -> String { var result = "\(token.literal) " @@ -102,9 +94,6 @@ struct ExpressionStatement: Statement { return token.literal } - func statementNode() { - } - func string() -> String { if let value = expression { return value.string() @@ -118,9 +107,6 @@ struct Identifier: Expression { var token:Token var value:String - func expressionNode() { - } - func tokenLiteral() -> String { return token.literal } @@ -133,8 +119,6 @@ struct Identifier: Expression { struct IntegerLiteral: Expression { var token:Token var value:Int - func expressionNode() { - } func tokenLiteral() -> String { return token.literal @@ -148,8 +132,6 @@ struct IntegerLiteral: Expression { struct Boolean: Expression { var token:Token var value:Bool - func expressionNode() { - } func tokenLiteral() -> String { return token.literal @@ -165,9 +147,6 @@ struct PrefixExpression: Expression { var operatorLiteral:String var right: Expression? - func expressionNode() { - } - func tokenLiteral() -> String { return token.literal } @@ -180,9 +159,8 @@ struct PrefixExpression: Expression { } struct InvalidExpression: Expression { - let token:Token = Token(tokenType: TokenType.ILLEGAL, literal: "") - func expressionNode() { - } + let token:Token = Token(type: TokenType.ILLEGAL, literal: "") + func tokenLiteral() -> String { return token.literal } @@ -197,9 +175,6 @@ struct InfixExpression: Expression { var operatorLiteral:String var right: Expression? - func expressionNode() { - } - func tokenLiteral() -> String { return token.literal } @@ -215,9 +190,7 @@ struct InfixExpression: Expression { struct BlockStatement: Expression { var token:Token var statements = [Statement]() - func expressionNode() { - } - + func tokenLiteral() -> String { return token.literal } @@ -236,9 +209,6 @@ struct IfExpression: Expression { var consequence: BlockStatement var alternative: BlockStatement? - func expressionNode() { - } - func tokenLiteral() -> String { return token.literal } @@ -257,9 +227,6 @@ struct FunctionLiteral: Expression { var parameters:[Identifier] var body: BlockStatement - func expressionNode() { - } - func tokenLiteral() -> String { return token.literal } @@ -281,9 +248,6 @@ struct CallExpression: Expression { var function:Expression var arguments: [Expression] - func expressionNode() { - } - func tokenLiteral() -> String { return token.literal } @@ -303,8 +267,6 @@ struct CallExpression: Expression { struct StringLiteral: Expression { var token:Token var value:String - func expressionNode() { - } func tokenLiteral() -> String { return token.literal @@ -319,8 +281,6 @@ struct StringLiteral: Expression { struct ArrayLiteral: Expression { var token:Token var elements: [Expression] - func expressionNode() { - } func tokenLiteral() -> String { return token.literal @@ -342,8 +302,6 @@ struct IndexExpression: Expression { var token:Token var left:Expression var index:Expression - func expressionNode() { - } func tokenLiteral() -> String { return token.literal @@ -366,8 +324,6 @@ struct HashLiteral: Expression { var token:Token var pairs:[ExpressionKey:Expression] - func expressionNode() { - } func tokenLiteral() -> String { return token.literal diff --git a/Sources/swiftmonkey/Evaluator.swift b/Sources/swiftmonkey/Evaluator.swift index ccfa619..6b92787 100644 --- a/Sources/swiftmonkey/Evaluator.swift +++ b/Sources/swiftmonkey/Evaluator.swift @@ -7,7 +7,6 @@ import Foundation - public struct Evaluator { static let TRUE = BooleanObj(value: true) static let FALSE = BooleanObj(value: false) diff --git a/Sources/swiftmonkey/Lexer.swift b/Sources/swiftmonkey/Lexer.swift index 4fe73ae..973df04 100644 --- a/Sources/swiftmonkey/Lexer.swift +++ b/Sources/swiftmonkey/Lexer.swift @@ -38,49 +38,49 @@ public class Lexer { if peekChar() == "=" { let curent = ch readChar() - tok = Token(tokenType: TokenType.EQUAL, literal: String("\(curent)\(ch)")) + tok = Token(type: TokenType.EQUAL, literal: String("\(curent)\(ch)")) } else { - tok = Token(tokenType: TokenType.ASSIGN, literal: String(ch)) + tok = Token(type: TokenType.ASSIGN, literal: String(ch)) } - case ";": tok = Token(tokenType: TokenType.SEMICOLON, literal: String(ch)) - case "(": tok = Token(tokenType: TokenType.LPAREN, literal: String(ch)) - case ")": tok = Token(tokenType: TokenType.RPAREN, literal: String(ch)) - case ",": tok = Token(tokenType: TokenType.COMMA, literal: String(ch)) + case ";": tok = Token(type: TokenType.SEMICOLON, literal: String(ch)) + case "(": tok = Token(type: TokenType.LPAREN, literal: String(ch)) + case ")": tok = Token(type: TokenType.RPAREN, literal: String(ch)) + case ",": tok = Token(type: TokenType.COMMA, literal: String(ch)) - case "+": tok = Token(tokenType: TokenType.PLUS, literal: String(ch)) - case "-": tok = Token(tokenType: TokenType.MINUS, literal: String(ch)) - case "/": tok = Token(tokenType: TokenType.SLASH, literal: String(ch)) - case "*": tok = Token(tokenType: TokenType.ASTERISK, literal: String(ch)) + case "+": tok = Token(type: TokenType.PLUS, literal: String(ch)) + case "-": tok = Token(type: TokenType.MINUS, literal: String(ch)) + case "/": tok = Token(type: TokenType.SLASH, literal: String(ch)) + case "*": tok = Token(type: TokenType.ASTERISK, literal: String(ch)) case "!": if peekChar() == "=" { let curent = ch readChar() - tok = Token(tokenType: TokenType.NOTEQUAL, literal: String("\(curent)\(ch)")) + tok = Token(type: TokenType.NOTEQUAL, literal: String("\(curent)\(ch)")) } else { - tok = Token(tokenType: TokenType.BANG, literal: String(ch)) + tok = Token(type: TokenType.BANG, literal: String(ch)) } - case "<": tok = Token(tokenType: TokenType.LESSTHAN, literal: String(ch)) - case ">": tok = Token(tokenType: TokenType.GREATER, literal: String(ch)) + case "<": tok = Token(type: TokenType.LESSTHAN, literal: String(ch)) + case ">": tok = Token(type: TokenType.GREATER, literal: String(ch)) - case "{": tok = Token(tokenType: TokenType.LBRACE, literal: String(ch)) - case "}": tok = Token(tokenType: TokenType.RBRACE, literal: String(ch)) - case "\0": tok = Token(tokenType: TokenType.EOF, literal: String(ch)) + case "{": tok = Token(type: TokenType.LBRACE, literal: String(ch)) + case "}": tok = Token(type: TokenType.RBRACE, literal: String(ch)) + case "\0": tok = Token(type: TokenType.EOF, literal: String(ch)) case "\"": let lit = readString() - return Token(tokenType: TokenType.STRING, literal: lit) - case "[": tok = Token(tokenType: TokenType.LBRACKET, literal: String(ch)) - case "]": tok = Token(tokenType: TokenType.RBRACKET, literal: String(ch)) - case ":": tok = Token(tokenType: TokenType.COLON, literal: String(ch)) + return Token(type: TokenType.STRING, literal: lit) + case "[": tok = Token(type: TokenType.LBRACKET, literal: String(ch)) + case "]": tok = Token(type: TokenType.RBRACKET, literal: String(ch)) + case ":": tok = Token(type: TokenType.COLON, literal: String(ch)) default: if isLetter(char:ch) { let lit = readIdentifier() let type = lookupIdent(ident: lit) - return Token(tokenType: type, literal: lit) + return Token(type: type, literal: lit) } else if isDigit(char:ch) { let lit = readNumber() - return Token(tokenType: TokenType.INT, literal: lit) + return Token(type: TokenType.INT, literal: lit) } else { - return Token(tokenType: TokenType.ILLEGAL, literal: String(ch)) + return Token(type: TokenType.ILLEGAL, literal: String(ch)) } } readChar() diff --git a/Sources/swiftmonkey/Parser.swift b/Sources/swiftmonkey/Parser.swift index 59ed4f3..3624e41 100644 --- a/Sources/swiftmonkey/Parser.swift +++ b/Sources/swiftmonkey/Parser.swift @@ -41,7 +41,7 @@ public class Parser { var infixParseFunctions:[TokenType:infixParseFn] = [:] var peekPercedence: OperatorOrder { get { - if let percedence = precedences[peekToken.tokenType] { + if let percedence = precedences[peekToken.type] { return percedence } return OperatorOrder.LOWEST @@ -49,7 +49,7 @@ public class Parser { } var curPercedence: OperatorOrder { get { - if let percedence = precedences[curToken.tokenType] { + if let percedence = precedences[curToken.type] { return percedence } return OperatorOrder.LOWEST @@ -101,7 +101,7 @@ public class Parser { public func parseProgram() -> Program { var program = Program() - while curToken.tokenType != TokenType.EOF { + while curToken.type != TokenType.EOF { if let stmt = parseStatement() { program.statements.append(stmt) } @@ -111,7 +111,7 @@ public class Parser { } func parseStatement() -> Statement? { - switch curToken.tokenType { + switch curToken.type { case .LET: return parseLetStatement() case .RETURN: @@ -124,7 +124,7 @@ public class Parser { func parseExpressStatement() -> ExpressionStatement { var statement = ExpressionStatement(token: curToken, expression: nil) statement.expression = parseExpression(precedence: OperatorOrder.LOWEST) - if isPeekTokenType(type: TokenType.SEMICOLON) { + if peekToken(type: TokenType.SEMICOLON) { nextToken() } return statement @@ -135,7 +135,7 @@ public class Parser { nextToken() let returnValue = parseExpression(precedence: OperatorOrder.LOWEST) - while isPeekTokenType(type: TokenType.SEMICOLON){ + while peekToken(type: TokenType.SEMICOLON){ nextToken() } @@ -144,35 +144,35 @@ public class Parser { func parseLetStatement() -> LetStatement? { let token = curToken - if expectPeek(type: TokenType.IDENT) == false { + if expectPeekToken(type: TokenType.IDENT) == false { return nil } let name = Identifier(token: curToken, value: curToken.literal) - if expectPeek(type: TokenType.ASSIGN) == false { + if expectPeekToken(type: TokenType.ASSIGN) == false { return nil } nextToken() let expression = parseExpression(precedence: OperatorOrder.LOWEST) - while isPeekTokenType(type: TokenType.SEMICOLON) { + while peekToken(type: TokenType.SEMICOLON) { nextToken() } return LetStatement(token: token, name: name, value: expression) } - func isCurrentTokenType(type: TokenType) -> Bool { - return curToken.tokenType == type + func currentToken(type: TokenType) -> Bool { + return curToken.type == type } - func isPeekTokenType(type: TokenType) -> Bool { - return peekToken.tokenType == type + func peekToken(type: TokenType) -> Bool { + return peekToken.type == type } - func expectPeek(type: TokenType) -> Bool { - if isPeekTokenType(type: type) { + func expectPeekToken(type: TokenType) -> Bool { + if peekToken(type: type) { nextToken() return true } else { @@ -183,7 +183,7 @@ public class Parser { func peekError(type: TokenType) { let error = "expected next token to be " - + peekToken.tokenType.rawValue + + peekToken.type.rawValue + ", got " + type.rawValue + " instead." errors.append(error) } @@ -197,13 +197,13 @@ public class Parser { } func parseExpression(precedence: OperatorOrder) -> Expression? { - guard let prefix = prefixParseFunctions[curToken.tokenType] else { - noPrefixParseFunctionError(tokenType: curToken.tokenType) + guard let prefix = prefixParseFunctions[curToken.type] else { + noPrefixParseFunctionError(type: curToken.type) return nil } var leftExp = prefix() - while ( isPeekTokenType(type: TokenType.SEMICOLON) == false && precedence.rawValue < peekPercedence.rawValue) { - let infix = infixParseFunctions[peekToken.tokenType] + while ( peekToken(type: TokenType.SEMICOLON) == false && precedence.rawValue < peekPercedence.rawValue) { + let infix = infixParseFunctions[peekToken.type] if infix == nil { return leftExp } @@ -218,7 +218,7 @@ public class Parser { } func parseBoolean() -> Expression { - return Boolean(token: curToken, value: isCurrentTokenType(type: TokenType.TRUE)) + return Boolean(token: curToken, value: currentToken(type: TokenType.TRUE)) } func parseStringLiteral() -> Expression { @@ -257,8 +257,8 @@ public class Parser { } - func noPrefixParseFunctionError(tokenType: TokenType){ - let message = "no prefix parse function for \(tokenType.rawValue) found" + func noPrefixParseFunctionError(type: TokenType){ + let message = "no prefix parse function for \(type.rawValue) found" errors.append(message) } @@ -266,7 +266,7 @@ public class Parser { nextToken() let exp = parseExpression(precedence: OperatorOrder.LOWEST) - if expectPeek(type: TokenType.RPAREN) == false { + if expectPeekToken(type: TokenType.RPAREN) == false { return InvalidExpression() } @@ -276,8 +276,8 @@ public class Parser { func parseBlockStatement() -> BlockStatement { var block = BlockStatement(token:curToken, statements: []) nextToken() - while isCurrentTokenType(type: TokenType.RBRACE) == false - && isCurrentTokenType(type: TokenType.EOF) == false + while currentToken(type: TokenType.RBRACE) == false + && currentToken(type: TokenType.EOF) == false { if let stmt = parseStatement() { block.statements.append(stmt) @@ -289,20 +289,20 @@ public class Parser { func parseIfExpression() -> Expression { let token = curToken - if expectPeek(type: TokenType.LPAREN) == false { + if expectPeekToken(type: TokenType.LPAREN) == false { return InvalidExpression() } nextToken() guard let condition = parseExpression(precedence: OperatorOrder.LOWEST) else { return InvalidExpression() } - if !expectPeek(type: TokenType.RPAREN) { return InvalidExpression() } - if !expectPeek(type: TokenType.LBRACE) { return InvalidExpression() } + if !expectPeekToken(type: TokenType.RPAREN) { return InvalidExpression() } + if !expectPeekToken(type: TokenType.LBRACE) { return InvalidExpression() } let consequence = parseBlockStatement() var alter:BlockStatement? - if isPeekTokenType(type: TokenType.ELSE) { + if peekToken(type: TokenType.ELSE) { nextToken() - if !expectPeek(type: TokenType.LBRACE) { + if !expectPeekToken(type: TokenType.LBRACE) { return InvalidExpression() } alter = parseBlockStatement() @@ -314,11 +314,11 @@ public class Parser { func parseFunctionLiteral() -> Expression { let token = curToken - if expectPeek(type: TokenType.LPAREN) == false { + if expectPeekToken(type: TokenType.LPAREN) == false { return InvalidExpression() } let param = parseFunctionParameters() - if expectPeek(type: TokenType.LBRACE) == false { + if expectPeekToken(type: TokenType.LBRACE) == false { return InvalidExpression() } let body = parseBlockStatement() @@ -327,7 +327,7 @@ public class Parser { func parseFunctionParameters() -> [Identifier] { var identfiers:[Identifier] = [] - if isPeekTokenType(type: TokenType.RPAREN) { + if peekToken(type: TokenType.RPAREN) { nextToken() return identfiers } @@ -335,14 +335,14 @@ public class Parser { let ident = Identifier(token: curToken, value: curToken.literal) identfiers.append(ident) - while isPeekTokenType(type: TokenType.COMMA) { + while peekToken(type: TokenType.COMMA) { nextToken() nextToken() let idenParam = Identifier(token: curToken, value: curToken.literal) identfiers.append(idenParam) } - if expectPeek(type: TokenType.RPAREN) == false { + if expectPeekToken(type: TokenType.RPAREN) == false { return [] } return identfiers @@ -356,7 +356,7 @@ public class Parser { func parseCallArguments() -> [Expression] { var args:[Expression] = [] - if isPeekTokenType(type: TokenType.RPAREN) { + if peekToken(type: TokenType.RPAREN) { nextToken() return args } @@ -365,7 +365,7 @@ public class Parser { args.append(ex) } - while isPeekTokenType(type: TokenType.COMMA) { + while peekToken(type: TokenType.COMMA) { nextToken() nextToken() if let ex = parseExpression(precedence: OperatorOrder.LOWEST) { @@ -373,7 +373,7 @@ public class Parser { } } - if expectPeek(type: TokenType.RPAREN) == false { + if expectPeekToken(type: TokenType.RPAREN) == false { return [] } return args @@ -387,7 +387,7 @@ public class Parser { func parseExpressionList(end: TokenType) -> [Expression] { var list:[Expression] = [] - if isPeekTokenType(type: end) { + if peekToken(type: end) { nextToken() return list } @@ -396,7 +396,7 @@ public class Parser { list.append(ex) } - while isPeekTokenType(type: TokenType.COMMA) { + while peekToken(type: TokenType.COMMA) { nextToken() nextToken() if let ex = parseExpression(precedence: OperatorOrder.LOWEST) { @@ -404,19 +404,17 @@ public class Parser { } } - if expectPeek(type: end) == false { + if expectPeekToken(type: end) == false { return [] } return list - } - func parseIndexExpression(left: Expression) -> Expression { let token = curToken nextToken() guard let index = parseExpression(precedence: OperatorOrder.LOWEST) else { return InvalidExpression() } - if expectPeek(type: TokenType.RBRACKET) == false { + if expectPeekToken(type: TokenType.RBRACKET) == false { return InvalidExpression() } return IndexExpression(token: token, left: left, index: index) @@ -425,21 +423,21 @@ public class Parser { func parseHashLiteral() -> Expression { var hash = HashLiteral(token: curToken , pairs: [:]) - while isPeekTokenType(type: TokenType.RBRACE) == false { + while peekToken(type: TokenType.RBRACE) == false { nextToken() let key = parseExpression(precedence: OperatorOrder.LOWEST)! - if expectPeek(type: TokenType.COLON) == false { + if expectPeekToken(type: TokenType.COLON) == false { return InvalidExpression() } nextToken() let value = parseExpression(precedence: OperatorOrder.LOWEST)! let expKey = HashLiteral.ExpressionKey(expression: key, hashValue: key.string().hashValue) hash.pairs[expKey] = value - if isPeekTokenType(type: TokenType.RBRACE) == false && expectPeek(type: TokenType.COMMA) == false { + if peekToken(type: TokenType.RBRACE) == false && expectPeekToken(type: TokenType.COMMA) == false { return InvalidExpression() } } - if expectPeek(type: TokenType.RBRACE) == false { + if expectPeekToken(type: TokenType.RBRACE) == false { return InvalidExpression() } return hash diff --git a/Sources/swiftmonkey/Token.swift b/Sources/swiftmonkey/Token.swift index f3a270d..cb32cf9 100644 --- a/Sources/swiftmonkey/Token.swift +++ b/Sources/swiftmonkey/Token.swift @@ -49,7 +49,7 @@ public enum TokenType:String { } public struct Token { - var tokenType:TokenType + var `type`:TokenType var literal:String } diff --git a/Sources/swiftmonkeyExecutable/main.swift b/Sources/swiftmonkeyExecutable/main.swift index fafc650..117a643 100644 --- a/Sources/swiftmonkeyExecutable/main.swift +++ b/Sources/swiftmonkeyExecutable/main.swift @@ -1,8 +1,17 @@ import Foundation import swiftmonkey +let logo = """ + +▒█▀▄▀█ ▒█▀▀▀█ ▒█▄░▒█ ▒█░▄▀ ▒█▀▀▀ ▒█░░▒█ +▒█▒█▒█ ▒█░░▒█ ▒█▒█▒█ ▒█▀▄░ ▒█▀▀▀ ▒█▄▄▄█ +▒█░░▒█ ▒█▄▄▄█ ▒█░░▀█ ▒█░▒█ ▒█▄▄▄ ░░▒█░░ + +""" + let userName = NSUserName() +print(logo) print("Hello \(userName)! This is the Monkey programming language") -print("Feel free to type in commands") +print("Feel free to type in commands\n") startRepl() diff --git a/Tests/swiftmonkeyTests/AstTests.swift b/Tests/swiftmonkeyTests/AstTests.swift index baf6353..32f3315 100644 --- a/Tests/swiftmonkeyTests/AstTests.swift +++ b/Tests/swiftmonkeyTests/AstTests.swift @@ -12,9 +12,9 @@ class AstTests: XCTestCase { func testPerformanceExample() { let program = Program(statements: [ - LetStatement(token: Token(tokenType: TokenType.LET, literal: "let"), - name: Identifier(token: Token(tokenType: TokenType.IDENT, literal: "myVar"), value: "myVar"), - value: Identifier(token: Token(tokenType: TokenType.IDENT, literal: "anotherVar"), value: "anotherVar")) + LetStatement(token: Token(type: TokenType.LET, literal: "let"), + name: Identifier(token: Token(type: TokenType.IDENT, literal: "myVar"), value: "myVar"), + value: Identifier(token: Token(type: TokenType.IDENT, literal: "anotherVar"), value: "anotherVar")) ]) let expectedResult = "let myVar = anotherVar;" diff --git a/Tests/swiftmonkeyTests/LexerTests.swift b/Tests/swiftmonkeyTests/LexerTests.swift index 79d88ed..487365e 100644 --- a/Tests/swiftmonkeyTests/LexerTests.swift +++ b/Tests/swiftmonkeyTests/LexerTests.swift @@ -16,34 +16,37 @@ class LexerTests: XCTestCase { override func tearDown() { } + func validateToken(expect:Token, result: Token) { + XCTAssert(result.type == expect.type, "Failed Type: \(result.type.rawValue )") + XCTAssert(result.literal == expect.literal, "Failed Literal: \(result.literal)") + } + func testEmptyCode() { let code = "" - let expectResult = Token(tokenType: TokenType.EOF, literal: "\0") + let expect = Token(type: TokenType.EOF, literal: "\0") let lexer = Lexer(input: code) - let tok = lexer.nextToken() + let result = lexer.nextToken() - XCTAssert(tok.tokenType == expectResult.tokenType, "Failed Type: \(tok.tokenType.rawValue )") - XCTAssert(tok.literal == expectResult.literal, "Failed Literal: \(tok.literal)") + validateToken(expect: expect, result: result) } func testNextToken() { let code = "=+(){},;" let expectResult = [ - Token(tokenType: TokenType.ASSIGN, literal: "="), - Token(tokenType: TokenType.PLUS, literal: "+"), - Token(tokenType: TokenType.LPAREN, literal: "("), - Token(tokenType: TokenType.RPAREN, literal: ")"), - Token(tokenType: TokenType.LBRACE, literal: "{"), - Token(tokenType: TokenType.RBRACE, literal: "}"), - Token(tokenType: TokenType.COMMA, literal: ","), - Token(tokenType: TokenType.SEMICOLON, literal: ";"), + Token(type: TokenType.ASSIGN, literal: "="), + Token(type: TokenType.PLUS, literal: "+"), + Token(type: TokenType.LPAREN, literal: "("), + Token(type: TokenType.RPAREN, literal: ")"), + Token(type: TokenType.LBRACE, literal: "{"), + Token(type: TokenType.RBRACE, literal: "}"), + Token(type: TokenType.COMMA, literal: ","), + Token(type: TokenType.SEMICOLON, literal: ";"), ] let lexer = Lexer(input: code) - for i in expectResult { - let tok = lexer.nextToken() - XCTAssert(tok.tokenType == i.tokenType, "Failed Type: \(tok.tokenType.rawValue )") - XCTAssert(tok.literal == i.literal, "Failed Literal: \(tok.literal)") + for expect in expectResult { + let result = lexer.nextToken() + validateToken(expect: expect, result: result) } } @@ -53,15 +56,14 @@ class LexerTests: XCTestCase { "foo bar" """ let expectResult = [ - Token(tokenType: TokenType.STRING, literal: "foobar"), - Token(tokenType: TokenType.STRING, literal: "foo bar"), + Token(type: TokenType.STRING, literal: "foobar"), + Token(type: TokenType.STRING, literal: "foo bar"), ] let lexer = Lexer(input: code) - for i in expectResult { - let tok = lexer.nextToken() - XCTAssert(tok.tokenType == i.tokenType, "Failed Type: \(tok.tokenType.rawValue )") - XCTAssert(tok.literal == i.literal, "Failed Literal: \(tok.literal)") + for expect in expectResult { + let result = lexer.nextToken() + validateToken(expect: expect, result: result) } } @@ -77,54 +79,53 @@ class LexerTests: XCTestCase { let expectResult = [ - Token(tokenType: TokenType.LET, literal: "let"), - Token(tokenType: TokenType.IDENT, literal: "five"), - Token(tokenType: TokenType.ASSIGN, literal: "="), - Token(tokenType: TokenType.INT, literal: "5"), - Token(tokenType: TokenType.SEMICOLON, literal: ";"), + Token(type: TokenType.LET, literal: "let"), + Token(type: TokenType.IDENT, literal: "five"), + Token(type: TokenType.ASSIGN, literal: "="), + Token(type: TokenType.INT, literal: "5"), + Token(type: TokenType.SEMICOLON, literal: ";"), - Token(tokenType: TokenType.LET, literal: "let"), - Token(tokenType: TokenType.IDENT, literal: "ten"), - Token(tokenType: TokenType.ASSIGN, literal: "="), - Token(tokenType: TokenType.INT, literal: "10"), - Token(tokenType: TokenType.SEMICOLON, literal: ";"), + Token(type: TokenType.LET, literal: "let"), + Token(type: TokenType.IDENT, literal: "ten"), + Token(type: TokenType.ASSIGN, literal: "="), + Token(type: TokenType.INT, literal: "10"), + Token(type: TokenType.SEMICOLON, literal: ";"), - Token(tokenType: TokenType.LET, literal: "let"), - Token(tokenType: TokenType.IDENT, literal: "add"), - Token(tokenType: TokenType.ASSIGN, literal: "="), - Token(tokenType: TokenType.FUNCTION, literal: "fn"), - Token(tokenType: TokenType.LPAREN, literal: "("), - Token(tokenType: TokenType.IDENT, literal: "x"), - Token(tokenType: TokenType.COMMA, literal: ","), - Token(tokenType: TokenType.IDENT, literal: "y"), - Token(tokenType: TokenType.RPAREN, literal: ")"), - Token(tokenType: TokenType.LBRACE, literal: "{"), - Token(tokenType: TokenType.IDENT, literal: "x"), - Token(tokenType: TokenType.PLUS, literal: "+"), - Token(tokenType: TokenType.IDENT, literal: "y"), - Token(tokenType: TokenType.SEMICOLON, literal: ";"), - Token(tokenType: TokenType.RBRACE, literal: "}"), - Token(tokenType: TokenType.SEMICOLON, literal: ";"), + Token(type: TokenType.LET, literal: "let"), + Token(type: TokenType.IDENT, literal: "add"), + Token(type: TokenType.ASSIGN, literal: "="), + Token(type: TokenType.FUNCTION, literal: "fn"), + Token(type: TokenType.LPAREN, literal: "("), + Token(type: TokenType.IDENT, literal: "x"), + Token(type: TokenType.COMMA, literal: ","), + Token(type: TokenType.IDENT, literal: "y"), + Token(type: TokenType.RPAREN, literal: ")"), + Token(type: TokenType.LBRACE, literal: "{"), + Token(type: TokenType.IDENT, literal: "x"), + Token(type: TokenType.PLUS, literal: "+"), + Token(type: TokenType.IDENT, literal: "y"), + Token(type: TokenType.SEMICOLON, literal: ";"), + Token(type: TokenType.RBRACE, literal: "}"), + Token(type: TokenType.SEMICOLON, literal: ";"), - Token(tokenType: TokenType.LET, literal: "let"), - Token(tokenType: TokenType.IDENT, literal: "result"), - Token(tokenType: TokenType.ASSIGN, literal: "="), - Token(tokenType: TokenType.IDENT, literal: "add"), - Token(tokenType: TokenType.LPAREN, literal: "("), - Token(tokenType: TokenType.IDENT, literal: "five"), - Token(tokenType: TokenType.COMMA, literal: ","), - Token(tokenType: TokenType.IDENT, literal: "ten"), - Token(tokenType: TokenType.RPAREN, literal: ")"), - Token(tokenType: TokenType.SEMICOLON, literal: ";"), + Token(type: TokenType.LET, literal: "let"), + Token(type: TokenType.IDENT, literal: "result"), + Token(type: TokenType.ASSIGN, literal: "="), + Token(type: TokenType.IDENT, literal: "add"), + Token(type: TokenType.LPAREN, literal: "("), + Token(type: TokenType.IDENT, literal: "five"), + Token(type: TokenType.COMMA, literal: ","), + Token(type: TokenType.IDENT, literal: "ten"), + Token(type: TokenType.RPAREN, literal: ")"), + Token(type: TokenType.SEMICOLON, literal: ";"), - Token(tokenType: TokenType.EOF, literal: "\0"), + Token(type: TokenType.EOF, literal: "\0"), ] let lexer = Lexer(input: code) - for i in expectResult { - let tok = lexer.nextToken() - XCTAssert(tok.tokenType == i.tokenType, "Failed Type: \(tok.tokenType.rawValue )") - XCTAssert(tok.literal == i.literal, "Failed Literal: \(tok.literal)") + for expect in expectResult { + let result = lexer.nextToken() + validateToken(expect: expect, result: result) } } @@ -134,26 +135,25 @@ class LexerTests: XCTestCase { 5 < 10 > 5; """ let expectResult = [ - Token(tokenType: TokenType.BANG, literal: "!"), - Token(tokenType: TokenType.MINUS, literal: "-"), - Token(tokenType: TokenType.SLASH, literal: "/"), - Token(tokenType: TokenType.ASTERISK, literal: "*"), - Token(tokenType: TokenType.INT, literal: "5"), - Token(tokenType: TokenType.SEMICOLON, literal: ";"), + Token(type: TokenType.BANG, literal: "!"), + Token(type: TokenType.MINUS, literal: "-"), + Token(type: TokenType.SLASH, literal: "/"), + Token(type: TokenType.ASTERISK, literal: "*"), + Token(type: TokenType.INT, literal: "5"), + Token(type: TokenType.SEMICOLON, literal: ";"), - Token(tokenType: TokenType.INT, literal: "5"), - Token(tokenType: TokenType.LESSTHAN, literal: "<"), - Token(tokenType: TokenType.INT, literal: "10"), - Token(tokenType: TokenType.GREATER, literal: ">"), - Token(tokenType: TokenType.INT, literal: "5"), - Token(tokenType: TokenType.SEMICOLON, literal: ";"), + Token(type: TokenType.INT, literal: "5"), + Token(type: TokenType.LESSTHAN, literal: "<"), + Token(type: TokenType.INT, literal: "10"), + Token(type: TokenType.GREATER, literal: ">"), + Token(type: TokenType.INT, literal: "5"), + Token(type: TokenType.SEMICOLON, literal: ";"), ] let lexer = Lexer(input: code) - for i in expectResult { - let tok = lexer.nextToken() - XCTAssert(tok.tokenType == i.tokenType, "Failed Type: \(tok.tokenType.rawValue )") - XCTAssert(tok.literal == i.literal, "Failed Literal: \(tok.literal)") + for expect in expectResult { + let result = lexer.nextToken() + validateToken(expect: expect, result: result) } } @@ -166,30 +166,29 @@ class LexerTests: XCTestCase { } """ let expectResult = [ - Token(tokenType: TokenType.IF, literal: "if"), - Token(tokenType: TokenType.LPAREN, literal: "("), - Token(tokenType: TokenType.INT, literal: "5"), - Token(tokenType: TokenType.LESSTHAN, literal: "<"), - Token(tokenType: TokenType.INT, literal: "10"), - Token(tokenType: TokenType.RPAREN, literal: ")"), - Token(tokenType: TokenType.LBRACE, literal: "{"), - Token(tokenType: TokenType.RETURN, literal: "return"), - Token(tokenType: TokenType.TRUE, literal: "true"), - Token(tokenType: TokenType.SEMICOLON, literal: ";"), - Token(tokenType: TokenType.RBRACE, literal: "}"), - Token(tokenType: TokenType.ELSE, literal: "else"), - Token(tokenType: TokenType.LBRACE, literal: "{"), - Token(tokenType: TokenType.RETURN, literal: "return"), - Token(tokenType: TokenType.FALSE, literal: "false"), - Token(tokenType: TokenType.SEMICOLON, literal: ";"), - Token(tokenType: TokenType.RBRACE, literal: "}"), + Token(type: TokenType.IF, literal: "if"), + Token(type: TokenType.LPAREN, literal: "("), + Token(type: TokenType.INT, literal: "5"), + Token(type: TokenType.LESSTHAN, literal: "<"), + Token(type: TokenType.INT, literal: "10"), + Token(type: TokenType.RPAREN, literal: ")"), + Token(type: TokenType.LBRACE, literal: "{"), + Token(type: TokenType.RETURN, literal: "return"), + Token(type: TokenType.TRUE, literal: "true"), + Token(type: TokenType.SEMICOLON, literal: ";"), + Token(type: TokenType.RBRACE, literal: "}"), + Token(type: TokenType.ELSE, literal: "else"), + Token(type: TokenType.LBRACE, literal: "{"), + Token(type: TokenType.RETURN, literal: "return"), + Token(type: TokenType.FALSE, literal: "false"), + Token(type: TokenType.SEMICOLON, literal: ";"), + Token(type: TokenType.RBRACE, literal: "}"), ] let lexer = Lexer(input: code) - for i in expectResult { - let tok = lexer.nextToken() - XCTAssert(tok.tokenType == i.tokenType, "Failed Type: \(tok.tokenType.rawValue )") - XCTAssert(tok.literal == i.literal, "Failed Literal: \(tok.literal)") + for expect in expectResult { + let result = lexer.nextToken() + validateToken(expect: expect, result: result) } } @@ -199,22 +198,21 @@ class LexerTests: XCTestCase { 10 != 9; """ let expectResult = [ - Token(tokenType: TokenType.INT, literal: "10"), - Token(tokenType: TokenType.EQUAL, literal: "=="), - Token(tokenType: TokenType.INT, literal: "10"), - Token(tokenType: TokenType.SEMICOLON, literal: ";"), + Token(type: TokenType.INT, literal: "10"), + Token(type: TokenType.EQUAL, literal: "=="), + Token(type: TokenType.INT, literal: "10"), + Token(type: TokenType.SEMICOLON, literal: ";"), - Token(tokenType: TokenType.INT, literal: "10"), - Token(tokenType: TokenType.NOTEQUAL, literal: "!="), - Token(tokenType: TokenType.INT, literal: "9"), - Token(tokenType: TokenType.SEMICOLON, literal: ";"), + Token(type: TokenType.INT, literal: "10"), + Token(type: TokenType.NOTEQUAL, literal: "!="), + Token(type: TokenType.INT, literal: "9"), + Token(type: TokenType.SEMICOLON, literal: ";"), ] let lexer = Lexer(input: code) - for i in expectResult { - let tok = lexer.nextToken() - XCTAssert(tok.tokenType == i.tokenType, "Failed Type: \(tok.tokenType.rawValue )") - XCTAssert(tok.literal == i.literal, "Failed Literal: \(tok.literal)") + for expect in expectResult { + let result = lexer.nextToken() + validateToken(expect: expect, result: result) } } @@ -224,19 +222,18 @@ class LexerTests: XCTestCase { """ let expectResult = [ - Token(tokenType: TokenType.LBRACKET, literal: "["), - Token(tokenType: TokenType.INT, literal: "1"), - Token(tokenType: TokenType.COMMA, literal: ","), - Token(tokenType: TokenType.INT, literal: "2"), - Token(tokenType: TokenType.RBRACKET, literal: "]"), - Token(tokenType: TokenType.SEMICOLON, literal: ";"), + Token(type: TokenType.LBRACKET, literal: "["), + Token(type: TokenType.INT, literal: "1"), + Token(type: TokenType.COMMA, literal: ","), + Token(type: TokenType.INT, literal: "2"), + Token(type: TokenType.RBRACKET, literal: "]"), + Token(type: TokenType.SEMICOLON, literal: ";"), ] let lexer = Lexer(input: code) - for i in expectResult { - let tok = lexer.nextToken() - XCTAssert(tok.tokenType == i.tokenType, "Failed Type: \(tok.tokenType.rawValue )") - XCTAssert(tok.literal == i.literal, "Failed Literal: \(tok.literal)") + for expect in expectResult { + let result = lexer.nextToken() + validateToken(expect: expect, result: result) } } @@ -246,18 +243,17 @@ class LexerTests: XCTestCase { """ let expectResult = [ - Token(tokenType: TokenType.LBRACE, literal: "{"), - Token(tokenType: TokenType.STRING, literal: "foo"), - Token(tokenType: TokenType.COLON, literal: ":"), - Token(tokenType: TokenType.STRING, literal: "bar"), - Token(tokenType: TokenType.RBRACE, literal: "}"), + Token(type: TokenType.LBRACE, literal: "{"), + Token(type: TokenType.STRING, literal: "foo"), + Token(type: TokenType.COLON, literal: ":"), + Token(type: TokenType.STRING, literal: "bar"), + Token(type: TokenType.RBRACE, literal: "}"), ] let lexer = Lexer(input: code) - for i in expectResult { - let tok = lexer.nextToken() - XCTAssert(tok.tokenType == i.tokenType, "Failed Type: \(tok.tokenType.rawValue )") - XCTAssert(tok.literal == i.literal, "Failed Literal: \(tok.literal)") + for expect in expectResult { + let result = lexer.nextToken() + validateToken(expect: expect, result: result) } } diff --git a/Tests/swiftmonkeyTests/ParserTests.swift b/Tests/swiftmonkeyTests/ParserTests.swift index 593b2e9..911b9b9 100644 --- a/Tests/swiftmonkeyTests/ParserTests.swift +++ b/Tests/swiftmonkeyTests/ParserTests.swift @@ -18,33 +18,33 @@ class ParserTests: XCTestCase { if T.self is IntegerLiteral.Type { let identExpression = expression as! Identifier let resultString = result as! String - validateIdentifier(identifier: identExpression, result: resultString) + validateIdentifier(identifier: identExpression, expect: resultString) } if T.self is Identifier.Type { let integerExpression = expression as! IntegerLiteral let resultInt = result as! Int - validateInteger(integerLiteral: integerExpression, result: resultInt) + validateInteger(integerLiteral: integerExpression, expect: resultInt) } if T.self is Boolean.Type { let boolean = expression as! Boolean let resultBoolean = result as! Bool - validateBoolean(boolean: boolean, result: resultBoolean) + validateBoolean(boolean: boolean, expect: resultBoolean) } } - func validateInteger(integerLiteral: IntegerLiteral, result: Int ) { - XCTAssertTrue(integerLiteral.value == result, "Expect \(integerLiteral.value) Got \(result)") - XCTAssertTrue(integerLiteral.tokenLiteral() == "\(result)", "Expect \(integerLiteral.tokenLiteral()) Got \(result)") + func validateInteger(integerLiteral: IntegerLiteral, expect: Int ) { + XCTAssertTrue(integerLiteral.value == expect, "Expect \(expect) Got \(integerLiteral.value)") + XCTAssertTrue(integerLiteral.tokenLiteral() == "\(expect)", "Expect \(expect) Got \(integerLiteral.tokenLiteral())") } - func validateIdentifier(identifier: Identifier, result: String ) { - XCTAssertTrue(identifier.value == result, "Expect \(identifier.value) Got \(result)") - XCTAssertTrue(identifier.tokenLiteral() == result, "Expect \(identifier.tokenLiteral()) Got \(result)") + func validateIdentifier(identifier: Identifier, expect: String ) { + XCTAssertTrue(identifier.value == expect, "Expect \(expect) Got \(identifier.value)") + XCTAssertTrue(identifier.tokenLiteral() == expect, "Expect \(expect) Got \(identifier.tokenLiteral())") } - func validateBoolean(boolean: Boolean, result: Bool) { - XCTAssertTrue(boolean.value == result) - XCTAssertTrue(boolean.tokenLiteral() == String(result), "Expect \(boolean.tokenLiteral()) Got \(result)") + func validateBoolean(boolean: Boolean, expect: Bool) { + XCTAssertTrue(boolean.value == expect) + XCTAssertTrue(boolean.tokenLiteral() == String(expect), "Expect \(expect) Got \(boolean.tokenLiteral())") } func validateInfix(infix: InfixExpression, left: T, op: String, right: T) { @@ -85,9 +85,7 @@ class ParserTests: XCTestCase { validateParserError(parser: parser) let letStatement = program.statements[0] as! LetStatement - XCTAssertTrue(letStatement.name.tokenLiteral() == test.expectedIdentifier, "Expect \(test.expectedIdentifier) Got \(letStatement.name.tokenLiteral())") - XCTAssertTrue(letStatement.name.value == test.expectedIdentifier, "Expect \(test.expectedIdentifier) Got \(letStatement.name.value)") - + validateIdentifier(identifier: letStatement.name, expect:test.expectedIdentifier) validateLiteralExpression(expression: letStatement.value, result: test.expectedValue) } @@ -175,8 +173,7 @@ class ParserTests: XCTestCase { XCTAssertTrue(expression.operatorLiteral == test.oper) let integerLit = expression.right as! IntegerLiteral - XCTAssertTrue(integerLit.value == test.intValue, "Expect \(test.intValue) Got \(integerLit.value)") - XCTAssertTrue(integerLit.tokenLiteral() == "\(test.intValue)", "Expect \(test.intValue) Got \(integerLit.tokenLiteral())") + validateInteger(integerLiteral: integerLit, expect: test.intValue) } } @@ -198,8 +195,7 @@ class ParserTests: XCTestCase { XCTAssertTrue(expression.operatorLiteral == test.oper) let boolLit = expression.right as! Boolean - XCTAssertTrue(boolLit.value == test.value, "Expect \(test.value) Got \(boolLit.value)") - XCTAssertTrue(boolLit.tokenLiteral() == "\(test.value)", "Expect \(test.value) Got \(boolLit.tokenLiteral())") + validateBoolean(boolean: boolLit, expect: test.value) } } @@ -236,10 +232,8 @@ class ParserTests: XCTestCase { let statement = program.statements[0] as! ExpressionStatement validateInfix(statement: statement, left: test.leftValue, op: test.oper, right: test.rightValue) - } } - func testOperatorPrecedenceParsing() { let tests = [(code: "-a * b", expected: "((-a) * b)"), @@ -284,7 +278,6 @@ class ParserTests: XCTestCase { } } - func testBooleanExpression() { let code = "true;" @@ -296,7 +289,6 @@ class ParserTests: XCTestCase { XCTAssertTrue(program.statements.count == 1) - let statement = program.statements[0] as! ExpressionStatement validateLiteralExpression(expression: statement.expression!, result: true) } @@ -336,7 +328,6 @@ class ParserTests: XCTestCase { let consequence = ifExp.consequence.statements[0] as! ExpressionStatement validateLiteralExpression(expression: consequence.expression, result: "x") - XCTAssertNotNil(ifExp.alternative) let alter = ifExp.alternative! @@ -360,8 +351,8 @@ class ParserTests: XCTestCase { let function = statement.expression as! FunctionLiteral XCTAssertTrue(function.parameters.count == 2) - validateIdentifier(identifier: function.parameters[0], result: "x") - validateIdentifier(identifier: function.parameters[1], result: "y") + validateIdentifier(identifier: function.parameters[0], expect: "x") + validateIdentifier(identifier: function.parameters[1], expect: "y") XCTAssertTrue(function.body.statements.count == 1) let body = function.body.statements[0] as! ExpressionStatement @@ -387,7 +378,7 @@ class ParserTests: XCTestCase { XCTAssertTrue(function.parameters.count == test.expected.count) for i in 0 ..< function.parameters.count { - validateIdentifier(identifier: function.parameters[i], result: test.expected[i]) + validateIdentifier(identifier: function.parameters[i], expect: test.expected[i]) } } } @@ -406,7 +397,7 @@ class ParserTests: XCTestCase { let expression = statement.expression as! CallExpression let functionIden = expression.function as! Identifier - validateIdentifier(identifier: functionIden, result: "add") + validateIdentifier(identifier: functionIden, expect: "add") XCTAssertTrue(expression.arguments.count == 3) @@ -434,7 +425,7 @@ class ParserTests: XCTestCase { XCTAssertTrue(array.elements.count == 3) let intElement = array.elements[0] as! IntegerLiteral - validateInteger(integerLiteral: intElement, result: 1) + validateInteger(integerLiteral: intElement, expect: 1) let ele1 = array.elements[1] as! InfixExpression let ele2 = array.elements[2] as! InfixExpression @@ -457,15 +448,13 @@ class ParserTests: XCTestCase { let expression = statement.expression as! IndexExpression let arrayIden = expression.left as! Identifier - validateIdentifier(identifier: arrayIden, result: "myArray") + validateIdentifier(identifier: arrayIden, expect: "myArray") let index = expression.index as! InfixExpression validateInfix(infix: index, left: 1, op: "+", right: 1) } - - func testParsingHashLiteralsStringKeys() { let code = """ {"one": 1, "two": 2, "three": 3} @@ -486,7 +475,7 @@ class ParserTests: XCTestCase { let expected = ["one": 1, "two": 2, "three": 3] for (key, value) in hash.pairs { let expectedValue = expected[key.expression.string()] - validateInteger(integerLiteral: value as! IntegerLiteral, result: expectedValue!) + validateInteger(integerLiteral: value as! IntegerLiteral, expect: expectedValue!) } } @@ -532,5 +521,4 @@ class ParserTests: XCTestCase { validateInfix(infix: resultValue, left: expect.left, op: expect.op, right: expect.right) } } - } diff --git a/Tests/swiftmonkeyTests/XCTestManifests.swift b/Tests/swiftmonkeyTests/XCTestManifests.swift deleted file mode 100644 index d4b3c60..0000000 --- a/Tests/swiftmonkeyTests/XCTestManifests.swift +++ /dev/null @@ -1,9 +0,0 @@ -import XCTest - -#if !os(macOS) -public func allTests() -> [XCTestCaseEntry] { - return [ - testCase(swiftmonkeyTests.allTests), - ] -} -#endif \ No newline at end of file diff --git a/swiftmonkey.xcodeproj/project.pbxproj b/swiftmonkey.xcodeproj/project.pbxproj index e8d36e0..0c98c9a 100644 --- a/swiftmonkey.xcodeproj/project.pbxproj +++ b/swiftmonkey.xcodeproj/project.pbxproj @@ -37,7 +37,6 @@ OBJ_32 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_9 /* main.swift */; }; OBJ_34 /* swiftmonkey.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = "swiftmonkey::swiftmonkey::Product" /* swiftmonkey.framework */; }; OBJ_41 /* Package.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_6 /* Package.swift */; }; - OBJ_52 /* XCTestManifests.swift in Sources */ = {isa = PBXBuildFile; fileRef = OBJ_14 /* XCTestManifests.swift */; }; OBJ_55 /* swiftmonkey.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = "swiftmonkey::swiftmonkey::Product" /* swiftmonkey.framework */; }; /* End PBXBuildFile section */ @@ -79,7 +78,6 @@ D7E3A04A21E73831006D19CE /* Evaluator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Evaluator.swift; sourceTree = ""; }; D7E3A04C21E7414D006D19CE /* EvaluatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EvaluatorTests.swift; sourceTree = ""; }; OBJ_11 /* Token.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Token.swift; sourceTree = ""; }; - OBJ_14 /* XCTestManifests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XCTestManifests.swift; sourceTree = ""; }; OBJ_6 /* Package.swift */ = {isa = PBXFileReference; explicitFileType = sourcecode.swift; path = Package.swift; sourceTree = ""; }; OBJ_9 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; "swiftmonkey::swiftmonkey::Product" /* swiftmonkey.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = swiftmonkey.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -142,7 +140,6 @@ OBJ_13 /* swiftmonkeyTests */ = { isa = PBXGroup; children = ( - OBJ_14 /* XCTestManifests.swift */, D7B356C421D920B100DC0CB2 /* LexerTests.swift */, D758037521DE0EAD00CB65F6 /* ParserTests.swift */, D758037721DF5C6800CB65F6 /* AstTests.swift */, @@ -324,7 +321,6 @@ buildActionMask = 0; files = ( D758037821DF5C6800CB65F6 /* AstTests.swift in Sources */, - OBJ_52 /* XCTestManifests.swift in Sources */, D7B356C521D920B100DC0CB2 /* LexerTests.swift in Sources */, D758037621DE0EAD00CB65F6 /* ParserTests.swift in Sources */, D7E3A04D21E7414D006D19CE /* EvaluatorTests.swift in Sources */,