Prototype regex literal AST and emission

With `-enable-experimental-string-processing`,
start lexing `'` delimiters as regex literals (this
is just a placeholder delimiter for now). The
contents of which gets passed to the libswift
library, which can return an error string to be
emitted, or null for success.

The libswift side isn't yet hooked up to the Swift
regex parser, so for now just emit a dummy
diagnostic for regexes starting with quantifiers.

If successful, build an AST node which will be
emitted as an implicit call to an
`init(_regexString:)` initializer of an in-scope
`Regex` decl (which will eventually be a known
stdlib decl).
This commit is contained in:
Hamish Knight
2021-12-06 21:16:14 +00:00
parent c0f7143e8a
commit 37f16520e6
28 changed files with 304 additions and 42 deletions

View File

@@ -254,6 +254,7 @@ SYNTAX_NODE_SERIALIZATION_CODES = {
'PostfixIfConfigExpr': 250,
'UnavailabilityCondition': 251,
'AvailabilityEntry' : 252,
'RegexLiteralExpr': 253,
}