summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuleyman Farajli <suleyman@farajli.net>2025-01-05 01:31:28 +0400
committerSuleyman Farajli <suleyman@farajli.net>2025-01-05 01:31:28 +0400
commit92507b15ccb38eb989b57e7e8f866d82b5b42cbe (patch)
treecdf865b10a868e34e00453a06ee0ce3c80014a46
parentee9f56a7199aeffe1e64b586231319ca2bda25aa (diff)
preprocessor skips and doesn't tread include file names as strings
-rw-r--r--src/main.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/main.go b/src/main.go
index a654276..5962ef5 100644
--- a/src/main.go
+++ b/src/main.go
@@ -120,6 +120,7 @@ func preprocess(rawTokens[] Token) []Token {
}
tmp := rawTokens[i + 1].str
+ i++
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++
@@ -602,6 +603,7 @@ func main() {
}
tokens := tokenize(argv[argc - 1])
tokens = preprocess(tokens)
+ fmt.Println(tokens)
ops := parse(tokens)
/* FIXME: check for error */
w := bufio.NewWriter(file)