Skip to content

Commit 60b6e96

Browse files
authored
Merge pull request #29 from javecs/feature/reformat
コードを見直しました。
2 parents cc5e4e8 + 7e89903 commit 60b6e96

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

src/main/kotlin/xyz/javecs/tools/text2expr/parsers/RuleBuilder.kt

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import xyz.javecs.tools.text2expr.utils.normalize
77

88
private val tokenizer = Tokenizer()
99

10-
data class Evaluation(val value:Number = Double.NaN)
10+
data class Evaluation(val value: Number = Double.NaN)
1111
class RuleBuilder(source: String) {
1212
private val parser = RuleParser()
1313

@@ -31,9 +31,7 @@ class RuleBuilder(source: String) {
3131
"PR" -> if (value.contains(token.pronunciation)) matched++
3232
}
3333
}
34-
if (word.fields.size == matched) {
35-
return i
36-
}
34+
if (word.fields.size == matched) return i
3735
}
3836
return -1
3937
}
@@ -50,12 +48,8 @@ class RuleBuilder(source: String) {
5048
var start = -1
5149
rule().forEach {
5250
start = indexOf(it, tokens, start + 1)
53-
if (start < 0) {
54-
return false
55-
}
56-
if (it.id.isNotEmpty()) {
57-
recognizedId(Pair(it.id, tokens[start].surface))
58-
}
51+
if (start < 0) return false
52+
if (it.id.isNotEmpty()) recognizedId(Pair(it.id, tokens[start].surface))
5953
}
6054
return true
6155
}

0 commit comments

Comments
 (0)