Skip to content

Commit

Permalink
Add lexer support for string extractors with wildcards
Browse files Browse the repository at this point in the history
  • Loading branch information
andyscott committed Jan 25, 2016
1 parent b0b09a6 commit a51c9af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ private[lexer] trait ScalaOnlyLexer { self: ScalaLexer ⇒
if (ch == '$') {
nextChar()
getStringPart(multiLine)
} else if (ch == '_') {
token(STRING_PART)
stringInterpolationMode.interpolationVariable = true
} else if (ch == '{') {
token(STRING_PART)
switchToScalaMode()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ class ScalaLexerTest extends FlatSpec with ShouldMatchers {

""" s"$this" """ producesTokens (WS, INTERPOLATION_ID, STRING_PART, THIS, STRING_LITERAL, WS)

""" s"$_" """ producesTokens (WS, INTERPOLATION_ID, STRING_PART, USCORE, STRING_LITERAL, WS)

<t>s""""""</t>.text producesTokens (INTERPOLATION_ID, STRING_LITERAL)
<t>s"""""""""</t>.text producesTokens (INTERPOLATION_ID, STRING_LITERAL)
<t>s""" $foo """</t>.text producesTokens (INTERPOLATION_ID, STRING_PART, VARID, STRING_LITERAL)
Expand Down

0 comments on commit a51c9af

Please sign in to comment.