All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scala.meta.internal.parsers.TokenClassifiers.scala Maven / Gradle / Ivy

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
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy