1 /* 2 * Copyright (c) Meta Platforms, Inc. and affiliates. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.facebook.ktfmt.format 18 19 import com.google.common.base.MoreObjects 20 import com.google.common.collect.ImmutableList 21 import com.google.googlejavaformat.Input 22 23 class KotlinToken( 24 private val toksBefore: ImmutableList<KotlinTok>, 25 private val kotlinTok: KotlinTok, 26 private val toksAfter: ImmutableList<KotlinTok> 27 ) : Input.Token { 28 getToknull29 override fun getTok(): KotlinTok = kotlinTok 30 31 override fun getToksBefore(): ImmutableList<out Input.Tok> = toksBefore 32 33 override fun getToksAfter(): ImmutableList<out Input.Tok> = toksAfter 34 35 override fun toString(): String { 36 return MoreObjects.toStringHelper(this) 37 .add("tok", kotlinTok) 38 .add("toksBefore", toksBefore) 39 .add("toksAfter", toksAfter) 40 .toString() 41 } 42 } 43