summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuleyman Farajli <suleyman@farajli.net>2025-01-05 01:12:07 +0400
committerSuleyman Farajli <suleyman@farajli.net>2025-01-05 01:12:07 +0400
commit68662b9b357e02ca7820a511a2616596f650c31b (patch)
treeb82978a54fd89d2e9174e31e3b47f5900be30fc8
parentfd07e92e299f0a4572c55e58245977c7a3be72c0 (diff)
preprocessor: bug fix
-rw-r--r--src/main.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main.go b/src/main.go
index 873f958..a654276 100644
--- a/src/main.go
+++ b/src/main.go
@@ -120,7 +120,7 @@ func preprocess(rawTokens[] Token) []Token {
}
tmp := rawTokens[i + 1].str
- incFile := tmp[1:len(tmp) -1 ] /* get rid of the `"` at the beginning and at the end */
+ incFile := tmp[1:len(tmp) - 1] /* get rid of the `"` at the beginning and at the end */
rawTokens = slices.Insert(rawTokens, i + 1, tokenize(incFile)...)
incDepth++
continue
@@ -136,6 +136,7 @@ func preprocess(rawTokens[] Token) []Token {
if macros[y].name == tokens[i].str {
tokens = append(tokens[:i], tokens[i + 1:]...)
tokens = slices.Insert(tokens, i, macros[y].tokens...)
+ i--
}
}
}