scala.meta.internal.parsers.TokenClassifiers.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of parsers_2.11 Show documentation
Show all versions of parsers_2.11 Show documentation
Scalameta APIs for parsing and their baseline implementation
The newest version!
package scala.meta.internal.parsers
import scala.meta.classifiers._
import scala.meta.tokens.Token
import scala.meta.tokens.Token._
object MultilineComment {
def unapply(token: Token): Boolean = token.is[Comment] && AsMultilineComment.isMultiline(token)
def apply(token: Token): Boolean = unapply(token)
}
object AsMultilineComment {
def isMultiline(token: Token): Boolean = {
val pos = token.pos
pos.endLine > pos.startLine
}
def unapply(token: Token): Option[Comment] = token match {
case c: Comment if isMultiline(token) => Some(c)
case _ => None
}
}