From 1ae70117dea53a02235dfb5bd1e785e06af5d436 Mon Sep 17 00:00:00 2001 From: Ryuichi Saito Date: Fri, 25 Dec 2015 13:00:17 -0800 Subject: [PATCH] Introduce SourceFile that stores the path and content text of a source code file --- Package.swift | 30 ++++++++++++++++++++++++++---- Sources/source/SourceFile.swift | 22 ++++++++++++++++++++++ 2 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 Sources/source/SourceFile.swift diff --git a/Package.swift b/Package.swift index 6c3190df..4d864166 100644 --- a/Package.swift +++ b/Package.swift @@ -19,11 +19,33 @@ import PackageDescription let package = Package( name: "swift-ast", targets: [ - Target(name: "ast", dependencies: [.Target(name: "util")]), - Target(name: "parser", dependencies: [.Target(name: "util"), .Target(name: "ast")]), - Target(name: "swift-ast", dependencies: [.Target(name: "parser")]), + Target( + name: "source" + ), + Target( + name: "ast", + dependencies: [ + .Target(name: "util"), + .Target(name: "source"), + ] + ), + Target( + name: "parser", + dependencies: [ + .Target(name: "util"), + .Target(name: "source"), + .Target(name: "ast"), + ] + ), + Target( + name: "swift-ast", + dependencies: [ + .Target(name: "source"), + .Target(name: "parser"), + ] + ), ], testDependencies: [ - .Package(url: "https://github.com/kylef/Spectre.git", majorVersion: 0) + .Package(url: "https://github.com/kylef/Spectre.git", majorVersion: 0), ] ) diff --git a/Sources/source/SourceFile.swift b/Sources/source/SourceFile.swift new file mode 100644 index 00000000..3ee4665e --- /dev/null +++ b/Sources/source/SourceFile.swift @@ -0,0 +1,22 @@ +/* + Copyright 2015 Ryuichi Saito, LLC + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +// Merry Christmas 2015! -Ryuichi + +public struct SourceFile { + let path: String + let content: String +}