From d14de3d7b5955d353ba3108b91ad4eadc6697908 Mon Sep 17 00:00:00 2001 From: liu fengyun Date: Thu, 8 Dec 2016 21:15:34 +0100 Subject: fix #1779: support $_ and $_id in interpolated string --- compiler/src/dotty/tools/dotc/parsing/Parsers.scala | 4 ++++ compiler/src/dotty/tools/dotc/parsing/Scanners.scala | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'compiler') diff --git a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala index 51dafc928..1f5ad397d 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala @@ -625,6 +625,10 @@ object Parsers { atPos(in.offset) { if (in.token == IDENTIFIER) termIdent() + else if (in.token == USCORE) { + in.nextToken() + Ident(nme.WILDCARD) + } else if (in.token == THIS) { in.nextToken() This(EmptyTypeIdent) diff --git a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala index 60003d098..101be167e 100644 --- a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala +++ b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala @@ -758,7 +758,7 @@ object Scanners { finishStringPart() nextRawChar() next.token = LBRACE - } else if (Character.isUnicodeIdentifierStart(ch)) { + } else if (Character.isUnicodeIdentifierStart(ch) || ch == '_') { finishStringPart() do { putChar(ch) -- cgit v1.2.3