aboutsummaryrefslogtreecommitdiff
path: root/src/runMain/kotlin/Syntax.kt
diff options
context:
space:
mode:
authorMarvin Borner2019-08-15 00:25:25 +0200
committerMarvin Borner2019-08-15 00:25:25 +0200
commit0627e0ac4bd237f0d7d256f1cfe863440b318f55 (patch)
treee289bc92166ccd40a3da66238208687731a2bce5 /src/runMain/kotlin/Syntax.kt
parent9ebc0391be2dcf54608518361eba78708bf6d26f (diff)
Added documentation
Diffstat (limited to 'src/runMain/kotlin/Syntax.kt')
-rw-r--r--src/runMain/kotlin/Syntax.kt6
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)