39 Commits

Author SHA1 Message Date
kperryua
34ea98136a
Remove String.reserveCapacity() calls with dubious value from JSONScanners (#119) 2023-05-16 15:20:58 -07:00
Jeremy Schonfeld
9c72d351d2
(105902981) Replace @_implementationOnly imports with package imports in FoundationPreview (#109) 2023-05-12 11:36:10 -07:00
Tina Liu
3aa00e5c3e
Revert "Create FoundationInternals, an internal module to host shared files used by FoundationInternationalization and FoundationEssentials (#101)" (#115)
* Revert "Create FoundationInternals, an internal module to host shared files used by FoundationInternationalization and FoundationEssentials (#101)"

This reverts commit 8f08a649db1f3eb31593cdae7a30c5e95cb614a7.

* Reapply fb718cd3fb9f058a5fd6d736cec9c2b99d6f7dc6 fix to the other restored LockedState
2023-05-11 15:19:01 -07:00
Tina Liu
8f08a649db
Create FoundationInternals, an internal module to host shared files used by FoundationInternationalization and FoundationEssentials (#101)
* Create FoundationInternals, an internal module to host shared files used by FoundationInternationalization and FoundationEssentials

- Modules will access FoundationInternals types with `package import FoundationInternals`. This is currently an experimental feature of `AccessLevelOnImport`.
- Move `LockedState` to FoundationInternals and publicize functions needed by other modules.
2023-05-10 12:16:20 -07:00
Jeremy Schonfeld
1f99f94861
Top Level Coder Support for CodableWithConfiguration (#95)
* (107489425) JSON coder support for CodableWithConfiguration

* (107489425) Add availability

* (107489425) Move type constraints to where clause
2023-05-09 15:13:48 -07:00
Guillaume Lessard
cb63c4c577
Revert "Move count among the Collection conformance in BufferView" (#103)
This reverts a change in the internal representation of `BufferView` which has potentially significant performance consequences. We might want to make this change, but we need to carefully evaluate the performance consequences first.

This reverts commit 6900c61344048242878ccbb9b79b0a47b2b75e80.
2023-05-09 14:09:10 -07:00
Guillaume Lessard
aefeed4540
Use __owned parameter modifier (#102) 2023-05-09 13:11:43 -07:00
noriaki watanabe
218892640f
Replace BufferViewIndex<Element> with Index in BufferView. (#96)
* Refactor BufferView to use typealias "Index" for Collection protocol methods

* Refactor BufferView to use "Index" consistently both within and outside of Collection extension methods.

* Remove comments in BufferView

* Revert the position defined of Index and make it clear that it is part of the Collection conformance in BufferView

* Move count among the Collection conformance in BufferView
2023-05-09 10:58:13 -07:00
Alexander Cyon
09606b457d
Fix typos (#68) 2023-04-29 06:28:00 -07:00
kperryua
23e8e3aea1
(rdar://108066668) Fixed decoding of unusual zero values (#56) 2023-04-25 16:05:02 -07:00
Guillaume Lessard
d185fb59c5
rdar://108230575 (fix ABI issues in JSONScanner and BufferView) (#53) 2023-04-25 13:15:57 -07:00
Tony Parker
701c89647a
Fix fast-path for [Int] inserting a trailing comma (rdar://108386573) (#51)
* Add some links to known issues to TODOs

* Fix fast-path for [Int] inserting a trailing comma (rdar://108386573)
2023-04-23 11:32:07 -07:00
Tony Parker
d1cc2ea0a2
Add some links to known issues to TODOs (#47) 2023-04-18 14:53:06 -07:00
Charles Hu
0ac5999256
rdar://107847458 (Fix FoundationPreview CalendarTests on Linux) (#36) 2023-04-18 13:59:56 -07:00
Charles Hu
9e0cf5c070
JSON Performance Improvements (#35)
* (rdar://106881898) JSONEncoder should only use references for JSON encoding tree

* (rdar://107967520) Initial opportunities for JSONEncoder performance optimization

---------

Co-authored-by: Kevin Perry <kperry@apple.com>
2023-04-18 11:03:30 -07:00
Charles Hu
c01e9dadee
rdar://107955097 (FoundationPreview: Batch move string API (continued)) (#34)
* rdar://107955097 (FoundationPreview: Batch move string API (continued))

- Move localized uppercase and lowercase to FoundationLocalization
- if-def out of CharacterSet from FoundationPreview. It's not implemented at all there, and having a no-op stub is misleading

* rdar://107955097 (FoundationPreview: Batch move string API (continued))

- Move components separated by string and range of string functions

* rdar://107955097 (FoundationPreview: Batch move string API (continued))

Enable snake case options for JSON encoder and decoder. We haven't been able to enable this option because it needed `CharacterSet`, which hasn't been properly implemented for FoundationPreview. Now that we have `BuiltInUnicodeScalarSet`, which mirrors `CharacterSet`, we can switch to that and enable the options.

* rdar://107955097 (FoundationPreview: Batch move string API (continued))

- Move `StringProtocol.lineRange(for:)` and `paragraphRange(for:)` to FoundationEssentials
- Rename String+Regex.swift to RegexPatternCache.swift
- Consolidate extensions on various String family members and remove one redundant swift file

---------

Co-authored-by: I-Ting Tina Liu <iting_liu@apple.com>
2023-04-17 18:23:51 -07:00
Guillaume Lessard
ecd52ceb38
rdar://108073576 (Don't expose BufferView's baseAddress property) (#32)
* Clarify use of unsafe code and call to memcmp

* Do not expose a BufferView’s `baseAddress`
2023-04-17 16:37:12 -07:00
Guillaume Lessard
450cf1c600
Improve deallocation of copied buffer (#26) 2023-04-14 17:50:37 -07:00
Guillaume Lessard
4b8a234a5b
Rename the docStart parameter to fullSource 2023-04-11 15:07:33 -07:00
Guillaume Lessard
bf0990beea
rename cursor to index in 2 more places
# Conflicts:
#	Sources/FoundationEssentials/JSON/JSON5Scanner.swift
2023-04-11 14:43:07 -07:00
Guillaume Lessard
fb332a8b28
pass buffer as context reference
- this prevents what is effectively as an address escape, and allows better control of index bounds.
2023-04-11 14:14:43 -07:00
Guillaume Lessard
47e4910fc0
update two-byte hex decoding
Use the same decoding method for two-byte hex sequences as for four-byte hex sequences.
2023-04-11 10:59:48 -07:00
Guillaume Lessard
aaa9d2cfbd
split out slow path of stringValue() 2023-04-11 10:59:48 -07:00
Guillaume Lessard
5d6ab4a2ab
add helpful labels to more return tuples 2023-04-11 10:59:47 -07:00
Guillaume Lessard
5091f252c2
Rename DocumentReader’s index properties 2023-04-11 10:59:47 -07:00
Guillaume Lessard
679fab1ff2
label a return tuple 2023-04-11 10:59:47 -07:00
Guillaume Lessard
4f7af4851a
update a conditionally-compiled section 2023-04-11 10:59:47 -07:00
Guillaume Lessard
1ab3832106
layer json decoding over bufferview 2023-04-11 10:59:47 -07:00
Guillaume Lessard
bd712abbc3
change sourceLocation to use UnsafeRawPointer 2023-04-11 10:57:45 -07:00
Guillaume Lessard
9fe8623124
adjust code formatting
- also incorporates some performance annotations added for the JSON decoder.
2023-04-11 10:26:37 -07:00
Guillaume Lessard
1b27c1cba7
make initializers from BufferPointer failable 2023-04-05 12:57:06 -07:00
Guillaume Lessard
49cf29f735
remove unnecessary public keywords 2023-04-04 17:20:50 -07:00
Guillaume Lessard
fe89db476a
remove dependsOn parameter
- it is not useful without compiler support.
2023-04-04 17:02:31 -07:00
Guillaume Lessard
c4a08fc971
remove commented-out code 2023-04-03 19:26:30 -07:00
Guillaume Lessard
8095d73d8a
add the copyright notice 2023-04-03 12:48:35 -07:00
Guillaume Lessard
b6d610d626
add internal BufferView prototype 2023-04-03 12:16:27 -07:00
Charles Hu
c1f0bfe065 Enabled more tests 2023-03-29 09:56:30 -07:00
Charles Hu
e2c177e867 Rebased on top of the new String APIs 2023-03-29 09:56:22 -07:00
Charles Hu
34c45c169c rdar://107156343 (Move JSONEncoder to FoundationPreview) 2023-03-29 09:56:00 -07:00