diff options
Diffstat (limited to 'src/runMain/kotlin/Syntax.kt')
-rw-r--r-- | src/runMain/kotlin/Syntax.kt | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/runMain/kotlin/Syntax.kt b/src/runMain/kotlin/Syntax.kt index 46f2306..ace7280 100644 --- a/src/runMain/kotlin/Syntax.kt +++ b/src/runMain/kotlin/Syntax.kt @@ -1,4 +1,7 @@ class Syntax { + /** + * Checks and validates whether the code complies with the syntax/grammar rules + */ fun check(statements: MutableList<MutableList<Pair<String, TokenType>>>): Boolean { for (statement in statements) { removePadding(statement) @@ -6,6 +9,9 @@ class Syntax { return true } + /** + * Removed empty characters from the start and end of statements + */ private fun removePadding(statement: MutableList<Pair<String, TokenType>>) { while (statement[0].second == TokenType.Empty) { statement.removeAt(0) |