diff options
author | Marvin Borner | 2019-08-15 00:17:29 +0200 |
---|---|---|
committer | Marvin Borner | 2019-08-15 00:17:29 +0200 |
commit | 9ebc0391be2dcf54608518361eba78708bf6d26f (patch) | |
tree | 6ebd7778f770d64455567b9b73d83cff2f1fdcc3 /src/runMain/kotlin/Syntax.kt | |
parent | 8039d51f78f7a1cb0acc74a3e8f09d4a522cf6f2 (diff) |
Added removing of padding
Diffstat (limited to 'src/runMain/kotlin/Syntax.kt')
-rw-r--r-- | src/runMain/kotlin/Syntax.kt | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/runMain/kotlin/Syntax.kt b/src/runMain/kotlin/Syntax.kt index 901b8d8..46f2306 100644 --- a/src/runMain/kotlin/Syntax.kt +++ b/src/runMain/kotlin/Syntax.kt @@ -1,6 +1,18 @@ class Syntax { fun check(statements: MutableList<MutableList<Pair<String, TokenType>>>): Boolean { - print(statements) + 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) + } + } }
\ No newline at end of file |