mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Lexer: Lex escaped identifier tokens.
Lex a backtick-enclosed `[:identifier_start:][:identifier_cont:]+` as an identifier, even if it's a Swift keyword. For now, require that the escaped name still be a valid identifier, keyword collisions notwithstanding. (We could in theory allow an arbitrary string, but we'd have to invent a mangling for non-identifier characters and do other tooling which doesn't seem productive.) Swift SVN r14671
This commit is contained in:
@@ -216,7 +216,11 @@ public:
|
||||
void restoreState(State S) {
|
||||
assert(S.isValid());
|
||||
CurPtr = getBufferPtrForSourceLoc(S.Loc);
|
||||
// Don't reemit diagnostics while readvancing the lexer.
|
||||
auto TmpDiags = Diags;
|
||||
Diags = nullptr;
|
||||
lexImpl();
|
||||
Diags = TmpDiags;
|
||||
}
|
||||
|
||||
/// \brief Restore the lexer state to a given state that is located before
|
||||
@@ -366,6 +370,7 @@ private:
|
||||
bool StopAtDoubleQuote, bool EmitDiagnostics);
|
||||
void lexCharacterLiteral();
|
||||
void lexStringLiteral();
|
||||
void lexEscapedIdentifier();
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user