Skip to content

Commit 8a87bdd

Browse files
authored
Merge pull request #1914 from millenomi/scanner-api
Supported Scanner API for Swift
2 parents 3f1f0ef + f3dd430 commit 8a87bdd

File tree

7 files changed

+836
-234
lines changed

7 files changed

+836
-234
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ add_swift_library(Foundation
240240
Foundation/ReferenceConvertible.swift
241241
Foundation/RunLoop.swift
242242
Foundation/Scanner.swift
243+
Foundation/ScannerAPI.swift
243244
Foundation/Set.swift
244245
Foundation/Stream.swift
245246
Foundation/String.swift

Foundation.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
03B6F5841F15F339004F25AF /* TestURLProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03B6F5831F15F339004F25AF /* TestURLProtocol.swift */; };
1212
1513A8432044893F00539722 /* FileManager_XDG.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1513A8422044893F00539722 /* FileManager_XDG.swift */; };
1313
1520469B1D8AEABE00D02E36 /* HTTPServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1520469A1D8AEABE00D02E36 /* HTTPServer.swift */; };
14+
153CC8352215E00200BFE8F3 /* ScannerAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 153CC8322214C3D100BFE8F3 /* ScannerAPI.swift */; };
1415
153E951120111DC500F250BE /* CFKnownLocations.h in Headers */ = {isa = PBXBuildFile; fileRef = 153E950F20111DC500F250BE /* CFKnownLocations.h */; settings = {ATTRIBUTES = (Private, ); }; };
1516
153E951220111DC500F250BE /* CFKnownLocations.c in Sources */ = {isa = PBXBuildFile; fileRef = 153E951020111DC500F250BE /* CFKnownLocations.c */; };
1617
15496CF1212CAEBA00450F5A /* CFAttributedStringPriv.h in Headers */ = {isa = PBXBuildFile; fileRef = 15496CF0212CAEBA00450F5A /* CFAttributedStringPriv.h */; };
@@ -546,6 +547,7 @@
546547
03B6F5831F15F339004F25AF /* TestURLProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestURLProtocol.swift; sourceTree = "<group>"; };
547548
1513A8422044893F00539722 /* FileManager_XDG.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileManager_XDG.swift; sourceTree = "<group>"; };
548549
1520469A1D8AEABE00D02E36 /* HTTPServer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HTTPServer.swift; sourceTree = "<group>"; };
550+
153CC8322214C3D100BFE8F3 /* ScannerAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScannerAPI.swift; sourceTree = "<group>"; };
549551
153E950F20111DC500F250BE /* CFKnownLocations.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CFKnownLocations.h; sourceTree = "<group>"; };
550552
153E951020111DC500F250BE /* CFKnownLocations.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = CFKnownLocations.c; sourceTree = "<group>"; };
551553
15496CF0212CAEBA00450F5A /* CFAttributedStringPriv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFAttributedStringPriv.h; sourceTree = "<group>"; };
@@ -1851,6 +1853,7 @@
18511853
children = (
18521854
EADE0B751BD15DFF00C49C64 /* NSRegularExpression.swift */,
18531855
EADE0B771BD15DFF00C49C64 /* Scanner.swift */,
1856+
153CC8322214C3D100BFE8F3 /* ScannerAPI.swift */,
18541857
EADE0B7B1BD15DFF00C49C64 /* NSTextCheckingResult.swift */,
18551858
EADE0B4F1BD09E3100C49C64 /* NSAttributedString.swift */,
18561859
5BDC3F311BCC5DCB00ED97BB /* NSCharacterSet.swift */,
@@ -2366,6 +2369,7 @@
23662369
5B23AB871CE62D17000DB898 /* Boxing.swift in Sources */,
23672370
5BF7AEA41BCD51F9008F214A /* Bundle.swift in Sources */,
23682371
5B23AB891CE62D4D000DB898 /* ReferenceConvertible.swift in Sources */,
2372+
153CC8352215E00200BFE8F3 /* ScannerAPI.swift in Sources */,
23692373
D3E8D6D11C367AB600295652 /* NSSpecialValue.swift in Sources */,
23702374
EAB57B721BD1C7A5004AC5C5 /* PortMessage.swift in Sources */,
23712375
5BD31D201D5CE8C400563814 /* Bridging.swift in Sources */,

Foundation/Decimal.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2068,6 +2068,7 @@ extension Scanner {
20682068
}
20692069

20702070
}
2071+
20712072
public func scanDecimal() -> Decimal? {
20722073

20732074
var result = Decimal()
@@ -2076,7 +2077,7 @@ extension Scanner {
20762077
let length = string.length
20772078
var buf = _NSStringBuffer(string: string, start: self._scanLocation, end: length)
20782079

2079-
let ds_chars = decimalSep(locale).utf16
2080+
let ds_chars = decimalSep(locale as? Locale).utf16
20802081
let ds = ds_chars[ds_chars.startIndex]
20812082
buf.skip(_skipSet)
20822083
var neg = false

0 commit comments

Comments
 (0)