Skip to content

Commit 58e1f49

Browse files
committed
code refactor
1 parent 8e8e7e9 commit 58e1f49

File tree

6 files changed

+7
-10
lines changed

6 files changed

+7
-10
lines changed

codeeditor/src/commonMain/kotlin/com/wakaztahir/codeeditor/prettify/lang/Lang.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// limitations under the License.
1414
package com.wakaztahir.codeeditor.prettify.lang
1515

16-
import com.wakaztahir.codeeditor.prettify.lang.Lang
1716
import com.wakaztahir.codeeditor.prettify.parser.StylePattern
1817

1918
/**

codeeditor/src/commonMain/kotlin/com/wakaztahir/codeeditor/prettify/lang/LangMatlab.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class LangMatlab : Lang() {
5151
const val PR_TRANSPOSE = "transpose"
5252
const val PR_LINE_CONTINUATION = "linecont"
5353
val fileExtensions: List<String>
54-
get() = listOf(*arrayOf("matlab"))
54+
get() = listOf("matlab")
5555
}
5656

5757
override val fallthroughStylePatterns = ArrayList<StylePattern>()
@@ -243,7 +243,7 @@ class LangMatlab : Lang() {
243243
class LangMatlabOperator : Lang() {
244244
companion object {
245245
val fileExtensions: List<String>
246-
get() = listOf(*arrayOf("matlab-operators"))
246+
get() = listOf("matlab-operators")
247247
}
248248

249249
override val fallthroughStylePatterns = ArrayList<StylePattern>()

codeeditor/src/commonMain/kotlin/com/wakaztahir/codeeditor/prettify/parser/CombinePrefixPattern.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class CombinePrefixPattern {
183183

184184
// [[1, 10], [3, 4], [8, 12], [14, 14], [16, 16], [17, 17]]
185185
// -> [[1, 12], [14, 14], [16, 17]]
186-
ranges.sortWith(Comparator { a, b -> if (a[0] != b[0]) (a[0] - b[0]) else (b[1] - a[1]) })
186+
ranges.sortWith({ a, b -> if (a[0] != b[0]) (a[0] - b[0]) else (b[1] - a[1]) })
187187
// Collections.sort(ranges, Comparator { a, b -> if (a[0] !== b[0]) (a[0] - b[0]) else (b[1] - a[1]) })
188188
val consolidatedRanges: MutableList<List<Int>> = ArrayList()
189189
// List<Integer> lastRange = listOf(new Integer[]{0, 0});
@@ -242,7 +242,7 @@ class CombinePrefixPattern {
242242
var i: Int = 0
243243
var groupIndex: Int = 0
244244
while (i < n) {
245-
val p: String? = parts.get(i)
245+
val p: String = parts.get(i)
246246
if ((p == "(")) {
247247
// groups are 1-indexed, so max group index is count of '('
248248
++groupIndex
@@ -275,7 +275,7 @@ class CombinePrefixPattern {
275275
var i: Int = 0
276276
var groupIndex: Int = 0
277277
while (i < n) {
278-
val p: String? = parts.get(i)
278+
val p: String = parts.get(i)
279279
if ((p == "(")) {
280280
++groupIndex
281281
if (capturedGroups.get(groupIndex) == null) {

codeeditor/src/commonMain/kotlin/com/wakaztahir/codeeditor/prettify/parser/Prettify.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ class Prettify {
827827
+ "as,as?,fun,in,!in,object,typealias,val,var,when,by,constructor,delegate,dynamic,field,"
828828
+ "file,get,init,set,value,where,actual,annotation,companion,crossinline,data,enum,expect,"
829829
+ "external,field,infix,inline,inner,internal,it,lateinit,noinline,open,operator,out,override,"
830-
+ "reified,sealed,suspend,tailrec,vararg");
830+
+ "reified,sealed,suspend,tailrec,vararg")
831831
const val RUST_KEYWORDS = (FLOW_CONTROL_KEYWORDS + "," + "as,assert,const,copy,drop,"
832832
+ "enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,"
833833
+ "pub,pure,ref,self,static,struct,true,trait,type,unsafe,use")
@@ -858,7 +858,7 @@ class Prettify {
858858
+ "function,in,local,set,then,until")
859859
const val ALL_KEYWORDS = (CPP_KEYWORDS + "," + KOTLIN_KEYWORDS + "," + CSHARP_KEYWORDS
860860
+ "," + JSCRIPT_KEYWORDS + "," + PERL_KEYWORDS + "," + PYTHON_KEYWORDS + "," + RUBY_KEYWORDS
861-
+ "," + SH_KEYWORDS);
861+
+ "," + SH_KEYWORDS)
862862
val C_TYPES =
863863
Regex("^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\\d*)\\b")
864864
// token style names. correspond to css classes

codeeditor/src/commonMain/kotlin/com/wakaztahir/codeeditor/theme/CodeTheme.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.wakaztahir.codeeditor.theme
22

3-
import androidx.compose.ui.graphics.Color
43
import androidx.compose.ui.text.SpanStyle
54
import com.wakaztahir.codeeditor.parser.ParseResult
65
import com.wakaztahir.codeeditor.prettify.parser.Prettify

codeeditor/src/commonMain/kotlin/com/wakaztahir/codeeditor/utils/Annotation.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.wakaztahir.codeeditor.utils
22

33
import androidx.compose.ui.text.AnnotatedString
4-
import androidx.compose.ui.text.buildAnnotatedString
54
import com.wakaztahir.codeeditor.model.CodeLang
65
import com.wakaztahir.codeeditor.parser.ParseResult
76
import com.wakaztahir.codeeditor.prettify.PrettifyParser

0 commit comments

Comments
 (0)