diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 37fab09..94a6ec8 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -14,11 +14,18 @@ jobs: steps: - uses: actions/checkout@v3 - name: Select Xcode - run: sudo xcode-select -s /Applications/Xcode_15.0.app - - name: Get versions run: | + sudo xcode-select -s /Applications/Xcode_15.0.app xcodebuild -version - swift --version + - name: Install Swift nightly toolchain + run: | + VERSION=swift-DEVELOPMENT-SNAPSHOT-2023-07-23-a + TOOLCHAIN_URL="https://download.swift.org/development/xcode/$VERSION/$VERSION-osx.pkg" + curl -LO $TOOLCHAIN_URL + installer -target CurrentUserHomeDirectory -pkg $VERSION-osx.pkg + echo "PATH=$HOME/Library/Developer/Toolchains/$VERSION.xctoolchain/usr/bin:${PATH}" >> $GITHUB_ENV + - name: Get Swift version + run: swift --version - name: Build run: swift build - name: Run tests diff --git a/.swift-version b/.swift-version new file mode 100644 index 0000000..c405a52 --- /dev/null +++ b/.swift-version @@ -0,0 +1 @@ +DEVELOPMENT-SNAPSHOT-2023-07-23-a diff --git a/Benchmarks/Benchmarks/MyBenchmark/MyBenchmark.swift b/Benchmarks/Benchmarks/MyBenchmark/MyBenchmark.swift index a8ba37d..3cd18f8 100644 --- a/Benchmarks/Benchmarks/MyBenchmark/MyBenchmark.swift +++ b/Benchmarks/Benchmarks/MyBenchmark/MyBenchmark.swift @@ -27,7 +27,7 @@ let benchmarks = { Benchmark("TokenizerBenchmark", configuration: .init(scalingFactor: .mega)) { benchmark in let sink = TestSink() - var tokenizer = Tokenizer(sink: consume sink) + var tokenizer = Tokenizer(sink: sink) var iter = html.makeIterator() benchmark.startMeasurement() for _ in benchmark.scaledIterations { diff --git a/Package.swift b/Package.swift index 064c271..fe57cc9 100644 --- a/Package.swift +++ b/Package.swift @@ -38,7 +38,8 @@ let package = Package( .testTarget( name: "TokenizerTests", dependencies: [ - "Tokenizer" + "TokenizerMacros", + "Tokenizer", ] ), ] diff --git a/README.md b/README.md index 29f65a6..4cc1f33 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ TODO ([The main blocker is the lack of macros support in Linux.](https://forums. You need: - Xcode 15 or later +- Swift nightly toolchain And then, run the following command to build the source code. diff --git a/Sources/Tokenizer/Tokenizer.swift b/Sources/Tokenizer/Tokenizer.swift index be27a6c..600ad5c 100644 --- a/Sources/Tokenizer/Tokenizer.swift +++ b/Sources/Tokenizer/Tokenizer.swift @@ -470,7 +470,7 @@ public struct Tokenizer: ~Copyable { input = consume initial return nil } - guard consume c == consume pc else { + guard c == pc else { input = consume initial return false } diff --git a/Tests/TokenizerTests/TokenizerTests.swift b/Tests/TokenizerTests/TokenizerTests.swift index e5ae6ab..f7fc1cb 100644 --- a/Tests/TokenizerTests/TokenizerTests.swift +++ b/Tests/TokenizerTests/TokenizerTests.swift @@ -28,7 +28,7 @@ final class TokenizerTests: XCTestCase { """# let sink = TestSink() - var tokenizer = Tokenizer(sink: consume sink) + var tokenizer = Tokenizer(sink: sink) var iter = html.makeIterator() tokenizer.tokenize(&iter)