From 56fa5a930cf8083321119d4328e9c9288a8e18c8 Mon Sep 17 00:00:00 2001 From: Suleyman Farajli Date: Thu, 9 Jan 2025 21:36:03 +0400 Subject: don't put `\n` to the end of strings --- src/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.go b/src/main.go index 143b165..bbf5682 100644 --- a/src/main.go +++ b/src/main.go @@ -283,7 +283,7 @@ func parse(tokens[]Token) []Operation { } else if tokens[i].str[0] == '"' { op.name = "string" op.strData = tokens[i].str - op.intData = len(tokens[i].str) - 1 /* -2 for removing `"` at the beginning and include \n at the end */ + op.intData = len(tokens[i].str) - 2 /* -2 for removing `"` at the beginning and at the end */ op.label = fmt.Sprintf("string_%d", stringlabel) stringlabel++ } else if len(tokens[i].str) == 9 && tokens[i].str[:8] == "syscall." { @@ -584,7 +584,7 @@ func generateX86_64(ops[] Operation, w io.Writer) { fmt.Fprintf(w, "section .data\n") for i := 0; i < len(strings); i++ { - fmt.Fprintf(w, "%s: db %s, 10\n", strings[i][1], strings[i][0]) + fmt.Fprintf(w, "%s: db %s\n", strings[i][1], strings[i][0]) } } -- cgit v1.2.3