aboutsummaryrefslogtreecommitdiff
path: root/src/runMain/kotlin/Syntax.kt
blob: 46f23064f7f3ac6bc0fc9953d0e86d1df60228f6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class Syntax {
    fun check(statements: MutableList<MutableList<Pair<String, TokenType>>>): Boolean {
        for (statement in statements) {
            removePadding(statement)
        }
        return true
    }

    private fun removePadding(statement: MutableList<Pair<String, TokenType>>) {
        while (statement[0].second == TokenType.Empty) {
            statement.removeAt(0)
        }

        while (statement[statement.size - 1].second == TokenType.Empty) {
            statement.removeAt(statement.size - 1)
        }
    }
}