apple / swift-experimental-string-processing

An early experimental general-purpose pattern matching engine for Swift.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`CharacterClass.anyUnicodeScalar` crashes

hamishknight opened this issue · comments

For the following:

import RegexBuilder

let r = Regex {
  CharacterClass.anyUnicodeScalar
}
_ = try! r.wholeMatch(in: "x")

Crashes with:

Fatal error: Should have been handled by tree conversion

However it's not clear this API should still exist, as it was removed from https://github.com/apple/swift-evolution/blob/main/proposals/0363-unicode-for-string-processing.md.

cc @natecook1000, should this API be removed?

anyUnicodeScalar would be equivalent to anyCharacter. The interesting cases is when you want to go a step higher in semantics and match anyCharacter from scalar semantics.

@milseman Just to be clear, it was explicitly removed from the Unicode proposal, and is currently listed as an alternative considered. I also noticed that it includes \O. I have put up a PR to bring the implementation in-line with the proposal: #540.