Skip to content

Commit 7886514

Browse files
authored
Merge pull request #368 from hamishknight/integration-838bdfe
2 parents bb35181 + c50fef2 commit 7886514

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+4382
-2485
lines changed

Documentation/Evolution/ProposalOverview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Covers the "interior" syntax, extended syntaxes, run-time construction of a rege
3939

4040
Proposes a slew of Regex-powered algorithms.
4141

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

4444
## Unicode for String Processing
4545

Documentation/Evolution/RegexSyntaxRunTimeConstruction.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
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.
1414

15-
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).
15+
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].
1616

1717
## Motivation
1818

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

344-
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).
344+
Precise definitions of character classes is discussed in [Unicode for String Processing][pitches].
345345

346346
#### Unicode scalars
347347

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

10151015

10161016

Documentation/Evolution/RegexTypeOverview.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ The result builder allows for inline failable value construction, which particip
231231

232232
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").
233233

234-
`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:
234+
`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:
235235

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

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

517517
### Future work: parser combinators
518518

519-
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.
519+
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.
520520

521521
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.
522522

@@ -565,7 +565,7 @@ Regexes are often used for tokenization and tokens can be represented with Swift
565565
566566
### Future work: baked-in localized processing
567567
568-
- `CustomPrefixMatchRegexComponent` gives an entry point for localized processors
568+
- `CustomConsumingRegexComponent` gives an entry point for localized processors
569569
- Future work includes (sub?)protocols to communicate localization intent
570570
571571
-->

0 commit comments

Comments
 (0)