pomsky icon indicating copy to clipboard operation
pomsky copied to clipboard

Deprecate `[cp]` and `[.]`

Open Aloso opened this issue 3 years ago • 0 comments

Status Quo

[codepoint] and [.] are special snowflakes: They can't contain other character classes, i.e. [. 'x'] is illegal.

Solution

Deprecate [codepoint] and [.].

  • Instead of [codepoint], introduce a built-in variable Codepoint.
  • Add aliases: Codepoint == C, Grapheme == G
  • [.] can be replaced with ![n].
    • No built-in variable is added for the dot, since we don't want to produce . in the output; it doesn't work the same across regex engines, and its behavior is affected by several modes/flags/options.
    • For the user, Codepoint/C is usually better anyway. If a user happens to want to match anything except for line breaks, it's better to be explicit with ![vert_space].

Deprecation schedule

  • [x] Add the built-ins Codepoint, C, and G
  • [x] Update the documentation to recommend these built-ins
  • [x] Remove documentation for the old syntax
  • [x] Emit a deprecation warning in the CLI and the playground when the old syntax is used
  • [x] Remove [cp] and [codepoint] syntax
  • [ ] Remove [.] syntax -- let's wait until there is a replacement, if the dot really desired

Aloso avatar Jun 15 '22 18:06 Aloso