Commit 3139af76 authored by David Owens II's avatar David Owens II

Decided on 'atpkg' for the name of our build scripts. Setup the proper...

Decided on 'atpkg' for the name of our build scripts. Setup the proper dependency graph for atpkg build and tests.
parent 58b7dba7
Pipeline #670 passed with stage
......@@ -46,13 +46,25 @@ tasks:
name: "yaml"
outputType: "static-library"
clj-tests:
atpkg-parser:
tool: "atllbuild"
source: ["parsers/clj/src/**.swift", "parsers/clj/tests/**.swift"]
name: "tests"
source: ["parsers/atpkg/src/**.swift"]
name: "atpkgparser"
outputType: "static-library"
atpkg-tests:
dependency: ["atpkg-parser"]
tool: "atllbuild"
source: ["parsers/atpkg/tests/**.swift"]
name: "atpkgtests"
outputType: "executable"
linkWithProduct: ["atpkgparser.a"]
runtests:
dependency: ["clj-tests"]
run-atpkg-tests:
dependency: ["atpkg-tests"]
tool: "shell"
script: "./.atllbuild/tests"
script: "./.atllbuild/products/atpkgtests"
run-tests:
tool: "nop"
dependency: ["run-atpkg-tests"]
......@@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
struct ScannerInfo {
let character: Character?
let line: Int
let column: Int
public struct ScannerInfo {
public let character: Character?
public let line: Int
public let column: Int
}
class Scanner {
public class Scanner {
var content: String
var index: String.Index
......@@ -29,7 +29,7 @@ class Scanner {
var line: Int = 0
var column: Int = 0
init(content: String) {
public init(content: String) {
self.content = content
self.index = content.startIndex
self._defaults()
......@@ -43,11 +43,11 @@ class Scanner {
self.current = nil
}
func stall() {
public func stall() {
shouldStall = true
}
func next() -> ScannerInfo? {
public func next() -> ScannerInfo? {
if shouldStall {
shouldStall = false
return current
......@@ -72,7 +72,7 @@ class Scanner {
return current
}
func peek() -> ScannerInfo? {
public func peek() -> ScannerInfo? {
return current
}
}
\ No newline at end of file
......@@ -14,7 +14,7 @@
import Foundation
enum Token {
public enum Token {
case Identifier(String, line: Int, column: Int)
case OpenParen(line: Int, column: Int)
case CloseParen(line: Int, column: Int)
......@@ -39,7 +39,7 @@ enum Token {
}
}
static func isEqual(lhs: Token?, to rhs: Token?) -> Bool {
public static func isEqual(lhs: Token?, to rhs: Token?) -> Bool {
if lhs == nil && rhs == nil { return true }
guard let lhs = lhs else { return false }
......@@ -91,16 +91,16 @@ func isWhitespace(c: Character?) -> Bool {
return isCharacterPartOfSet(c, set: NSCharacterSet.whitespaceCharacterSet())
}
class Lexer {
public class Lexer {
var scanner: Scanner
var current: Token? = nil
init(scanner: Scanner) {
public init(scanner: Scanner) {
self.scanner = scanner
}
func next() -> Token? {
public func next() -> Token? {
func work() -> Token {
if scanner.next() == nil { return .EOF }
......@@ -183,7 +183,7 @@ class Lexer {
return self.current
}
func tokenize() -> [Token] {
public func tokenize() -> [Token] {
var tokens = [Token]()
while let token = self.next() { tokens.append(token) }
......@@ -191,11 +191,11 @@ class Lexer {
return tokens
}
func peek() -> Token? {
public func peek() -> Token? {
return current
}
func debugPrint() {
public func debugPrint() {
print("--- TOKENS ---")
while let token = self.next() {
print("\(token)")
......
......@@ -14,17 +14,18 @@
import Foundation
import atpkgparser
class LexerTests: Test {
required init() {}
let tests = [
LexerTests.testBasicClj
LexerTests.testBasic
]
let filename = __FILE__
static func testBasicClj() throws {
let filepath = "./parsers/clj/tests/collateral/basic.clj"
static func testBasic() throws {
let filepath = "./parsers/atpkg/tests/collateral/basic.atpkg"
let content: String = try NSString(contentsOfFile: filepath, encoding: NSUTF8StringEncoding) as String
let scanner = Scanner(content: content)
......
......@@ -14,6 +14,7 @@
import Foundation
import atpkgparser
func outputBaseline(scanner: Scanner) {
print("--- baseline ---")
......@@ -43,7 +44,7 @@ class ScannerTests: Test {
let filename = __FILE__
static func testBasicClj() throws {
let filepath = "./parsers/clj/tests/collateral/basic.clj"
let filepath = "./parsers/atpkg/tests/collateral/basic.atpkg"
let content: String = try NSString(contentsOfFile: filepath, encoding: NSUTF8StringEncoding) as String
let scanner = Scanner(content: content)
......
......@@ -20,7 +20,7 @@ enum test {
static func assert(condition: Bool, file: String = __FILE__, functionName: String = __FUNCTION__, line: Int = __LINE__) throws {
if !condition {
print(" \(file):\(line) \(functionName) **FAILED**")
throw "clj.tests.failed"
throw "atpkg.tests.failed"
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment