Skip to content

Commit

Permalink
Merge pull request scala-ide#144 from andyscott/interpolated-wildcard…
Browse files Browse the repository at this point in the history
…-extractors

Add lexer support for string extractors with wildcards
  • Loading branch information
kiritsuku committed Feb 18, 2016
2 parents 0053fd5 + a51c9af commit 3815922
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 3815922

Please sign in to comment.