Skip to content

Commit

Permalink
Updates for Swift 6
Browse files Browse the repository at this point in the history
  • Loading branch information
dabrahams committed Nov 2, 2024
1 parent 7b2946e commit 6242d19
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 21 deletions.
5 changes: 3 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"originHash" : "d1e34fdb2ca25d057f59ed9573c5bc295cbcdaed69e42def6d10243b96f90b79",
"pins" : [
{
"identity" : "citron",
"kind" : "remoteSourceControl",
"location" : "https://github.com/dabrahams/citron.git",
"state" : {
"revision" : "d19a40c8de65b68fec0d224576d60565c1f7ccf1",
"version" : "2.1.5"
"version" : "2.1.7"
}
},
{
Expand All @@ -28,5 +29,5 @@
}
}
],
"version" : 2
"version" : 3
}
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.7
// swift-tools-version: 6.0
import PackageDescription
import Foundation

Expand Down Expand Up @@ -26,7 +26,7 @@ let package = Package(
targets: ["Lotsawa"]),
],
dependencies: [
.package(url: "https://github.com/dabrahams/citron.git", from: "2.1.5"),
.package(url: "https://github.com/dabrahams/citron.git", from: "2.1.7"),
.package(url: "https://github.com/SwiftPackageIndex/SPIManifest.git", from: "0.12.0")
]
+ docGenerationDependency,
Expand Down
2 changes: 1 addition & 1 deletion Tests/LotsawaTests/Utils/DebugGrammarParser.citron
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import CitronParserModule
import CitronLexerModule

extension _CitronParserUnexpectedTokenError : CustomDebugStringConvertible {
extension _CitronParserUnexpectedTokenError : @retroactive CustomDebugStringConvertible {
public var debugDescription: String {
if let t = token as? DebugGrammar.AST.Token {
return "\n\(t.position): error: unexpected token (\(t), tokenCode: \(tokenCode))"
Expand Down
33 changes: 17 additions & 16 deletions Tests/LotsawaTests/Utils/DebugGrammarScanner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,23 @@ import CitronLexerModule
let comment = #"(?://\P{Bidi_Class=B}*)"#

/// A lexical analyzer for the grammar we use to describe other grammars for testing.
let testGrammarScanner = Scanner<DebugGrammarParser.CitronTokenCode>(
literalStrings: [
"::=": .IS_DEFINED_AS,
"_": .UNDERSCORE,
"|": .ALTERNATION,
],
patterns: [
/// A mapping from regular expression pattern to either a coresponding token ID,
/// or `nil` if the pattern is to be discarded (e.g. for whitespace).
#"[A-Za-z][-_A-Za-z0-9]*(?=\s*::=)"#: .LHS,
#"[A-Za-z][-_A-Za-z0-9]*(?!\s*::=)"#: .SYMBOL,
#"'([^\\']|\\.)*'"#: .LITERAL,
#"\s*"#: nil,
comment: nil,
]
)
var testGrammarScanner : Scanner<DebugGrammarParser.CitronTokenCode> {
return .init(
literalStrings: [
"::=": .IS_DEFINED_AS,
"_": .UNDERSCORE,
"|": .ALTERNATION,
],
patterns: [
/// A mapping from regular expression pattern to either a coresponding token ID,
/// or `nil` if the pattern is to be discarded (e.g. for whitespace).
#"[A-Za-z][-_A-Za-z0-9]*(?=\s*::=)"#: .LHS,
#"[A-Za-z][-_A-Za-z0-9]*(?!\s*::=)"#: .SYMBOL,
#"'([^\\']|\\.)*'"#: .LITERAL,
#"\s*"#: nil,
comment: nil,
])
}

extension DebugGrammar.AST {

Expand Down

0 comments on commit 6242d19

Please sign in to comment.