object TokenOps
Stateless helper functions on scala.meta.Token.
- Alphabetic
- By Inheritance
- TokenOps
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
type
TokenHash = Long
For convenience when experimenting with different hashing strategies.
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
SingleLineBlock(expire: Token, exclude: Set[Range] = Set.empty, disallowSingleLineComments: Boolean = true, penaliseNewlinesInsideTokens: Boolean = false)(implicit line: Line): Policy
Forces allssplits up to including expire to be on a single line.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- val booleanOperators: Set[String]
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
- def defnTemplate(tree: Tree): Option[Template]
- def endsWithNoIndent(between: Vector[Token]): Boolean
- def endsWithSymbolIdent(tok: Token): Boolean
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
- def forceDocstringBlankLine(token: Token, style: ScalafmtConfig): Boolean
- val formatOffCode: Set[String]
- val formatOnCode: Set[String]
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hash(token: Token): TokenHash
Custom hash code for token.
Custom hash code for token.
The default hashCode is slow because it prevents conflicts between tokens from different source files. We only care about getting a unique identifier for the token inside this source file.
The hash code works like this this: Top 8 bits go to a hashCode of productPrefix, a unique identifier for the tokens class. Next 28 bits go to the tokens **start** offset byte. Final 28 bits go to the tokens **end** offset byte.
The only chance for collision is if two empty length tokens with the same type lie next to each other. @xeno-by said this should not happen.
- Annotations
- @inline()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def identModification(ident: Ident): Modification
- def isAssignmentOperator(token: Token): Boolean
- def isAttachedSingleLineComment(token: Token, between: Vector[Token]): Boolean
- def isBoolOperator(token: Token): Boolean
- def isFormatOff(token: Token): Boolean
- def isFormatOn(token: Token): Boolean
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isOpenApply(token: Token, includeCurly: Boolean = false, includeNoParens: Boolean = false): Boolean
- def isRightAssociativeOperator(op: String): Boolean
- def isSingleLineComment(token: Token): Boolean
- def isSymbolicIdent(tok: Token): Boolean
- def isSymbolicName(name: String): Boolean
- def lastToken(tree: Tree): Token
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def newlineOkOperator(token: Token): Boolean
- val newlineOkOperators: Set[String]
- def newlines2Modification(between: Vector[Token], rightIsComment: Boolean = false): Modification
- def newlines2Modification(formatToken: FormatToken): Modification
- def newlinesBetween(between: Vector[Token]): Int
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def rhsIsCommentedOut(formatToken: FormatToken): Boolean
- def shouldGet2xNewlines(tok: FormatToken, style: ScalafmtConfig, owners: (Token) ⇒ Tree): Boolean
- val specialAssignmentOperators: Set[String]
- val symbolOperatorPrecendence: PartialFunction[Char, Int]
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
- def tokenLength(token: Token): Int
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )