Skip to content
This repository was archived by the owner on Sep 3, 2020. It is now read-only.

Commit f82bf38

Browse files
authored
Merge pull request #200 from xuwei-k/single-quote
fix single quote literal
2 parents 1c91977 + 876bd9f commit f82bf38

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/main/scala/scala/tools/refactoring/sourcegen/SourceUtils.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ trait SourceUtils {
4646
def currentCharsAreMultilineCommentCommentStart = current2CharsAre('/', '*')
4747
def currentCharsAreMultilineCommentCommentEnd = current2CharsAre('*', '/')
4848
def currentCharIsRegularQuote = currentCharIs('"')
49-
def currentCharsAreSingleQuotedSingleQuote = current3CharsAre(''', ''', ''')
50-
def currentCharsAreEscapedSingleQuote = current2CharsAre('\\', ''')
51-
def currentCharIsSingleQuote = currentCharIs(''')
49+
def currentCharsAreSingleQuotedSingleQuote = current3CharsAre('\'', '\'', '\'')
50+
def currentCharsAreEscapedSingleQuote = current2CharsAre('\\', '\'')
51+
def currentCharIsSingleQuote = currentCharIs('\'')
5252
def currentCharsAreEscapedRegularQuote = current2CharsAre('\\', '"')
5353
def currentCharIsNewline = currentCharIs('\n')
5454
def currentCharIsBackTick = currentCharIs('`')

src/main/scala/scala/tools/refactoring/util/SourceWithMarker.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ object SourceWithMarker {
605605
}
606606

607607
val delimiter = charOfClass { c =>
608-
c == '`' || c == ''' || c == '"' || c == '.' || c == ';' || c == ','
608+
c == '`' || c == '\'' || c == '"' || c == '.' || c == ';' || c == ','
609609
}
610610

611611
val opChar = charOfClass { c =>
@@ -620,10 +620,10 @@ object SourceWithMarker {
620620
}
621621

622622
val characterLiteral = {
623-
val charEscape = character('b') | 't' | 'n' | 'f' | 'r' | '"' | ''' | '\\'
623+
val charEscape = character('b') | 't' | 'n' | 'f' | 'r' | '"' | '\'' | '\\'
624624
val octEscape = octalDigit ~ octalDigit.atMostNtimes(2)
625625

626-
''' ~ ((any.butNot('\\') | ('\\' ~ (charEscape | octEscape)))) ~ '''
626+
'\'' ~ ((any.butNot('\\') | ('\\' ~ (charEscape | octEscape)))) ~ '\''
627627
}
628628

629629
val stringLiteral = {
@@ -680,7 +680,7 @@ object SourceWithMarker {
680680

681681
val plainid = (upper ~ idrest) | varid | op
682682

683-
val symbolLiteral = ''' ~ plainid
683+
val symbolLiteral = '\'' ~ plainid
684684

685685
val literalIdentifier = '`' ~ any.butNot('`').atLeastOnce ~ '`'
686686

0 commit comments

Comments
 (0)