File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -472,7 +472,7 @@ static bool isValidIdentifierContinuationCodePoint(uint32_t c) {
472
472
static bool isValidIdentifierStartCodePoint (uint32_t c) {
473
473
if (!isValidIdentifierContinuationCodePoint (c))
474
474
return false ;
475
- if (c < 0x80 && isDigit (c))
475
+ if (c < 0x80 && ( isDigit (c) || c == ' $ ' ))
476
476
return false ;
477
477
478
478
// N1518: Recommendations for extended identifier characters for C and C++
@@ -1385,6 +1385,14 @@ void Lexer::lexEscapedIdentifier() {
1385
1385
}
1386
1386
}
1387
1387
1388
+ // Special case; allow '`$`'.
1389
+ if (Quote[1 ] == ' $' && Quote[2 ] == ' `' ) {
1390
+ CurPtr = Quote + 3 ;
1391
+ formToken (tok::identifier, Quote);
1392
+ NextToken.setEscapedIdentifier (true );
1393
+ return ;
1394
+ }
1395
+
1388
1396
// The backtick is punctuation.
1389
1397
CurPtr = IdentifierStart;
1390
1398
formToken (tok::backtick, Quote);
Original file line number Diff line number Diff line change @@ -54,3 +54,10 @@ func escapedDollarFunc() {
54
54
func `$`( `$`: Int ) { } // no error
55
55
`$` ( `$`: 25 ) // no error
56
56
}
57
+
58
+ func escapedDollarAnd( ) {
59
+ // FIXME: Bad diagnostics.
60
+ `$0` = 1 // expected-error {{expected expression}}
61
+ `$$` = 2 // expected-error {{expected numeric value following '$'}}
62
+ `$abc` = 3 // expected-error {{expected numeric value following '$'}}
63
+ }
You can’t perform that action at this time.
0 commit comments