From fd07e92e299f0a4572c55e58245977c7a3be72c0 Mon Sep 17 00:00:00 2001 From: Suleyman Farajli Date: Sun, 5 Jan 2025 01:00:20 +0400 Subject: preprocessor: bug fix --- src/main.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main.go b/src/main.go index 1f48639..873f958 100644 --- a/src/main.go +++ b/src/main.go @@ -134,8 +134,7 @@ func preprocess(rawTokens[] Token) []Token { for i := 0; i < len(tokens); i++ { for y := 0; y < len(macros); y++ { if macros[y].name == tokens[i].str { - /* Expand macro in the middle of tokens*/ - tokens = tokens[:len(tokens) - 1] + tokens = append(tokens[:i], tokens[i + 1:]...) tokens = slices.Insert(tokens, i, macros[y].tokens...) } } @@ -602,8 +601,6 @@ func main() { } tokens := tokenize(argv[argc - 1]) tokens = preprocess(tokens) - // fmt.Println(tokens) - // os.Exit(0) ops := parse(tokens) /* FIXME: check for error */ w := bufio.NewWriter(file) -- cgit v1.2.3