Skip to content

main -> swift/main #365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
1f99047
Rename CustomPrefixMatchRegexComponent to CustomConsumingRegexCompone…
itingliu Apr 22, 2022
563d6c2
Remove String.Index evils
Azoy Apr 23, 2022
70c0756
Merge pull request #331 from Azoy/remove-string-index-init
Azoy Apr 23, 2022
571e259
More updates for algorithms proposal (#324)
natecook1000 Apr 23, 2022
2df0f24
Add ~= overloads (#335)
milseman Apr 23, 2022
dfa4ea1
Fix a missed type name change
natecook1000 Apr 23, 2022
6fab471
Add a default arity and an flag for silencing logs
natecook1000 Apr 23, 2022
7b737e3
Add `@RegexComponentBuilder` overloads for string processing algorith…
itingliu Apr 24, 2022
c56dc76
Remove @testable annotations where possible
natecook1000 Apr 22, 2022
59a34cb
Switch FixedPatternConsumer to be over Sequence
natecook1000 Apr 23, 2022
caad657
Update Sequence/Collection constraints
natecook1000 Apr 23, 2022
b7a021f
Update trim(while:) - rethrowing and nonescaping
natecook1000 Apr 23, 2022
e0b4d5e
Add tests for trim methods
natecook1000 Apr 23, 2022
d6a01e7
Add maxSplits and omitEmpty to split methods
natecook1000 Apr 23, 2022
e81a8bd
Add tests / fixes for contains / firstRange(of:)
natecook1000 Apr 23, 2022
9e09bf8
Test to ensure stdlib `split` is still accessible
natecook1000 Apr 24, 2022
433740b
Fix stale links
milseman Apr 25, 2022
8dce8c2
Mention API naming consistency (#341)
milseman Apr 25, 2022
1fd5115
Generic `~=` operator
rxwei Apr 23, 2022
5af1427
Add `@RegexComponentBuilder` overloads for collection algorithms (#342)
itingliu Apr 25, 2022
882c2be
Merge pull request #339 from rxwei/generic-pattern-matching-operator
rxwei Apr 25, 2022
ab308ee
Revise doc comments for API reference style.
amartini51 Apr 21, 2022
1467470
Algorithm cleanup (#351)
milseman Apr 26, 2022
e0922ec
API stubs for casting and named captures (#349)
milseman Apr 26, 2022
bef2092
Mention language level pattern matching (#354)
milseman Apr 26, 2022
9ff87db
Fix empty.split w/ empty separator (#353)
natecook1000 Apr 26, 2022
2401a58
Add a section describing 'find empty' behavior (#352)
natecook1000 Apr 26, 2022
d0598b7
Add example from RegexBuilder proposal as a test (#344)
natecook1000 Apr 26, 2022
435090d
Refactor generator script (#356)
milseman Apr 26, 2022
96df14d
Fix cut-off sentence.
amartini51 Apr 26, 2022
0e59bdf
Update Sources/_StringProcessing/Regex/Match.swift
milseman Apr 27, 2022
ac618f6
Back out an accidental source change.
amartini51 Apr 27, 2022
6c5c082
Merge pull request #350 from apple/amartini/docs_91301229
amartini51 Apr 27, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Documentation/Evolution/ProposalOverview.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Covers the "interior" syntax, extended syntaxes, run-time construction of a rege

Proposes a slew of Regex-powered algorithms.

Introduces `CustomPrefixMatchRegexComponent`, which is a monadic-parser style interface for external parsers to be used as components of a regex.
Introduces `CustomConsumingRegexComponent`, which is a monadic-parser style interface for external parsers to be used as components of a regex.

## Unicode for String Processing

Expand Down
8 changes: 4 additions & 4 deletions Documentation/Evolution/RegexSyntaxRunTimeConstruction.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

A regex declares a string processing algorithm using syntax familiar across a variety of languages and tools throughout programming history. We propose the ability to create a regex at run time from a string containing regex syntax (detailed here), API for accessing the match and captures, and a means to convert between an existential capture representation and concrete types.

The overall story is laid out in [Regex Type and Overview][overview] and each individual component is tracked in [Pitch and Proposal Status](https://github.com/apple/swift-experimental-string-processing/issues/107).
The overall story is laid out in [SE-0350 Regex Type and Overview][overview] and each individual component is tracked in [Pitch and Proposal Status][pitches].

## Motivation

Expand Down Expand Up @@ -341,7 +341,7 @@ BuiltinCharClass -> '.' | '\C' | '\d' | '\D' | '\h' | '\H' | '\N' | '\O' | '\R'
- `\W`: Non-word character.
- `\X`: Any extended grapheme cluster.

Precise definitions of character classes is discussed in [Character Classes for String Processing](https://forums.swift.org/t/pitch-character-classes-for-string-processing/52920).
Precise definitions of character classes is discussed in [Unicode for String Processing][pitches].

#### Unicode scalars

Expand Down Expand Up @@ -1009,8 +1009,8 @@ This proposal regards _syntactic_ support, and does not necessarily mean that ev
[unicode-scripts]: https://www.unicode.org/reports/tr24/#Script
[unicode-script-extensions]: https://www.unicode.org/reports/tr24/#Script_Extensions
[balancing-groups]: https://docs.microsoft.com/en-us/dotnet/standard/base-types/grouping-constructs-in-regular-expressions#balancing-group-definitions
[overview]: https://github.com/apple/swift-experimental-string-processing/blob/main/Documentation/Evolution/RegexTypeOverview.md
[pitches]: https://github.com/apple/swift-experimental-string-processing/issues/107
[overview]: https://github.com/apple/swift-evolution/blob/main/proposals/0350-regex-type-overview.md
[pitches]: https://github.com/apple/swift-experimental-string-processing/blob/main/Documentation/Evolution/ProposalOverview.md



Expand Down
8 changes: 4 additions & 4 deletions Documentation/Evolution/RegexTypeOverview.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ The result builder allows for inline failable value construction, which particip

Swift regexes describe an unambiguous algorithm, where choice is ordered and effects can be reliably observed. For example, a `print()` statement inside the `TryCapture`'s transform function will run whenever the overall algorithm naturally dictates an attempt should be made. Optimizations can only elide such calls if they can prove it is behavior-preserving (e.g. "pure").

`CustomPrefixMatchRegexComponent`, discussed in [String Processing Algorithms][pitches], allows industrial-strength parsers to be used a regex components. This allows us to drop the overly-permissive pre-parsing step:
`CustomConsumingRegexComponent`, discussed in [String Processing Algorithms][pitches], allows industrial-strength parsers to be used a regex components. This allows us to drop the overly-permissive pre-parsing step:

```swift
func processEntry(_ line: String) -> Transaction? {
Expand Down Expand Up @@ -431,7 +431,7 @@ Regular expressions have a deservedly mixed reputation, owing to their historica

* "Regular expressions are bad because you should use a real parser"
- In other systems, you're either in or you're out, leading to a gravitational pull to stay in when... you should get out
- Our remedy is interoperability with real parsers via `CustomPrefixMatchRegexComponent`
- Our remedy is interoperability with real parsers via `CustomConsumingRegexComponent`
- Literals with refactoring actions provide an incremental off-ramp from regex syntax to result builders and real parsers
* "Regular expressions are bad because ugly unmaintainable syntax"
- We propose literals with source tools support, allowing for better syntax highlighting and analysis
Expand Down Expand Up @@ -516,7 +516,7 @@ Regex are compiled into an intermediary representation and fairly simple analysi

### Future work: parser combinators

What we propose here is an incremental step towards better parsing support in Swift using parser-combinator style libraries. The underlying execution engine supports recursive function calls and mechanisms for library extensibility. `CustomPrefixMatchRegexComponent`'s protocol requirement is effectively a [monadic parser](https://homepages.inf.ed.ac.uk/wadler/papers/marktoberdorf/baastad.pdf), meaning `Regex` provides a regex-flavored combinator-like system.
What we propose here is an incremental step towards better parsing support in Swift using parser-combinator style libraries. The underlying execution engine supports recursive function calls and mechanisms for library extensibility. `CustomConsumingRegexComponent`'s protocol requirement is effectively a [monadic parser](https://homepages.inf.ed.ac.uk/wadler/papers/marktoberdorf/baastad.pdf), meaning `Regex` provides a regex-flavored combinator-like system.

An issues with traditional parser combinator libraries are the compilation barriers between call-site and definition, resulting in excessive and overly-cautious backtracking traffic. These can be eliminated through better [compilation techniques](https://core.ac.uk/download/pdf/148008325.pdf). As mentioned above, Swift's support for custom static compilation is still under development.

Expand Down Expand Up @@ -565,7 +565,7 @@ Regexes are often used for tokenization and tokens can be represented with Swift

### Future work: baked-in localized processing

- `CustomPrefixMatchRegexComponent` gives an entry point for localized processors
- `CustomConsumingRegexComponent` gives an entry point for localized processors
- Future work includes (sub?)protocols to communicate localization intent

-->
Expand Down
Loading