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) {
472472static bool isValidIdentifierStartCodePoint (uint32_t c) {
473473 if (!isValidIdentifierContinuationCodePoint (c))
474474 return false ;
475- if (c < 0x80 && isDigit (c))
475+ if (c < 0x80 && ( isDigit (c) || c == ' $ ' ))
476476 return false ;
477477
478478 // N1518: Recommendations for extended identifier characters for C and C++
@@ -1385,6 +1385,14 @@ void Lexer::lexEscapedIdentifier() {
13851385 }
13861386 }
13871387
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+
13881396 // The backtick is punctuation.
13891397 CurPtr = IdentifierStart;
13901398 formToken (tok::backtick, Quote);
Original file line number Diff line number Diff line change @@ -54,3 +54,10 @@ func escapedDollarFunc() {
5454 func `$`( `$`: Int ) { } // no error
5555 `$` ( `$`: 25 ) // no error
5656}
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