Skip to content

Commit

Permalink
fix regexp StackOverflowError
Browse files Browse the repository at this point in the history
  • Loading branch information
wForget authored and peacewong committed Sep 5, 2020
1 parent afefb2a commit 203fc99
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ object PythonCommentHelper extends CommentHelper{

object ScalaCommentHelper extends CommentHelper{
override val commentPattern: Regex = """^\s*//.+\s*""".r.unanchored
private val scalaCommentPattern:String = "(?ms)([\"'](?:|[^'])*['\"])|//.*?$|/\\*.*?\\*/"
private val scalaCommentPattern: String = "(?ms)(([\"][^\"]*[\"])|(['][^']*[']))|//.*?$|/\\*.*?\\*/"
override def dealComment(code: String): String = {
val p = Pattern.compile(scalaCommentPattern)
p.matcher(code).replaceAll("$1")
Expand Down

0 comments on commit 203fc99

Please sign in to comment.