-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Identify illegal $ tokens in string interpolators
Fixes #195 Scala 2 stops parsing after one of these failures. It does not matter how we highlight the rest. Scala 3 continues parsing assuming the string has been closed. Highlighting the following code as if the string was closed helps to understand the following parsing errors.
- Loading branch information
1 parent
8dee609
commit 6d3de7b
Showing
3 changed files
with
67 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// SYNTAX TEST "source.scala" | ||
|
||
s"$a" | ||
// ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala | ||
// ^ meta.template.expression.scala punctuation.definition.template-expression.begin.scala | ||
// ^ meta.template.expression.scala | ||
// ^ string.quoted.double.interpolated.scala punctuation.definition.string.end.scala | ||
|
||
s"${a}" | ||
// ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala | ||
// ^^ meta.template.expression.scala punctuation.definition.template-expression.begin.scala | ||
// ^ meta.template.expression.scala | ||
// ^ meta.template.expression.scala punctuation.definition.template-expression.end.scala | ||
// ^ string.quoted.double.interpolated.scala punctuation.definition.string.end.scala | ||
|
||
s"$_" | ||
// ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala | ||
// ^ source.scala meta.template.expression.scala punctuation.definition.template-expression.begin.scala | ||
// ^ source.scala meta.template.expression.scala | ||
// ^ string.quoted.double.interpolated.scala punctuation.definition.string.end.scala | ||
|
||
s"$$" | ||
// ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala | ||
// ^^ constant.character.escape.scala | ||
// ^ string.quoted.double.interpolated.scala punctuation.definition.string.end.scala | ||
|
||
s"$"" | ||
// ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala | ||
// ^^ constant.character.escape.scala | ||
// ^ string.quoted.double.interpolated.scala punctuation.definition.string.end.scala | ||
|
||
|
||
s"$ // | ||
// ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala | ||
// ^ invalid.illegal.unrecognized-string-escape.scala | ||
// ^^ comment.line.double-slash.scala punctuation.definition.comment.scala | ||
|
||
s"$+ | ||
// ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala | ||
// ^ invalid.illegal.unrecognized-string-escape.scala | ||
// ^ keyword.operator.arithmetic.scala | ||
|
||
s"$; val a = | ||
// ^ string.quoted.double.interpolated.scala punctuation.definition.string.begin.scala | ||
// ^ invalid.illegal.unrecognized-string-escape.scala | ||
// ^^^^^^^^^^ -string.quoted.double.interpolated.scala | ||
// ^^^ keyword.declaration.stable.scala |