Skip to content

Commit 21973f0

Browse files
committed
.
1 parent 67136c8 commit 21973f0

File tree

4 files changed

+308
-311
lines changed

4 files changed

+308
-311
lines changed

.idea/kotlinc.xml

Lines changed: 6 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scala/scala-impl/src/org/jetbrains/plugins/scala/highlighter/ScalaSyntaxHighlighter.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,12 @@ object ScalaSyntaxHighlighter {
157157
private val tSTRINGS = TokenSet.create(
158158
tSTRING,
159159
tMULTILINE_STRING,
160+
tDEDENTED_STRING,
160161
tWRONG_STRING,
161162
tCHAR,
162163
tSYMBOL,
163164
tINTERPOLATED_MULTILINE_STRING,
165+
tINTERPOLATED_DEDENTED_STRING,
164166
tINTERPOLATED_STRING,
165167
tINTERPOLATED_STRING_ID,
166168
tINTERPOLATED_STRING_END

scala/scala-impl/src/org/jetbrains/plugins/scala/lang/lexer/core/_ScalaCoreLexer.flex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,14 +296,14 @@ hexDigit = [0-9A-Fa-f]
296296
CHAR_ESCAPE_SEQUENCE = \\[^\r\n]
297297
UNICODE_ESCAPE = \\u+ {hexDigit}{hexDigit}{hexDigit}{hexDigit} // Scala supports 1. multiple `u` chars after `\` 2. even \u000A ('\n') and \u000D (unlike Java)
298298
ESCAPE_SEQUENCE = {UNICODE_ESCAPE} | {CHAR_ESCAPE_SEQUENCE}
299-
CHARACTER_LITERAL = "'"([^\\\'\r\n]|{ESCAPE_SEQUENCE}|{OCTAL_ESCAPE_LITERAL})("'"|\\) | \'\\u000A\' | "'''" // TODO: \'\\u000A\' is redundunt, remove
299+
CHARACTER_LITERAL = "'"([^\\\'\r\n]|{ESCAPE_SEQUENCE}|{OCTAL_ESCAPE_LITERAL})("'"|\\) | \'\\u000A\' // TODO: \'\\u000A\' is redundunt, remove
300300

301301
STRING_BEGIN = \"([^\\\"\r\n]|{CHAR_ESCAPE_SEQUENCE})*
302302
STRING_LITERAL={STRING_BEGIN} \"
303303
MULTI_LINE_STRING = \"\"\" ( (\"(\")?)? [^\"] )* \"\"\" (\")* // Multi-line string
304304

305305
// Dedented string literals (Scala 3) - uses single quotes
306-
DEDENTED_STRING = \'\'\'+ ( (\'(\')?)? [^\'] )* \'\'\'+ // Dedented multiline string
306+
DEDENTED_STRING = \'\'\' ( (\'(\')?)? [^\'] )* \'\'\' (\')* // Dedented multiline string
307307

308308
////////String Interpolation////////
309309
INTERPOLATED_STRING_ID = {varid}
@@ -561,11 +561,11 @@ XML_BEGIN = "<" ("_" | [:jletter:]) | "<!--" | "<?" ("_" | [:jletter:]) | "<![CD
561561

562562
{MULTI_LINE_STRING} { return process(tMULTILINE_STRING); }
563563

564-
{DEDENTED_STRING} { if (isScala3) return process(tDEDENTED_STRING); else return process(tIDENTIFIER); }
565-
566564
// TODO: incomplete strings should be handled the same way with interpolated strings
567565
// what can be parsed should be parsed as tSTRING,
568566
// tWRONG_LINE_BREAK_IN_STRING error token should be added at unexpected new line should
567+
{DEDENTED_STRING} { if (isScala3) return process(tDEDENTED_STRING); else return process(tIDENTIFIER); }
568+
569569
{WRONG_STRING} { return process(tWRONG_STRING); }
570570

571571

0 commit comments

Comments
 (0)