commit c335917226bf3cf9fe21570c58bc35355f8aad86
parent 8b88beae884cce7b78306c46342f5a7334496ed8
Author: NunoSempere <nuno.semperelh@protonmail.com>
Date: Sun, 7 Jul 2024 10:06:15 -0400
add comments, starting with #
Diffstat:
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/f.go b/f.go
@@ -345,9 +345,12 @@ func runRepl(stack Stack, reader *bufio.Reader) Stack {
replForLoop:
for {
new_line, _ := reader.ReadString('\n')
- words := strings.Split(strings.TrimSpace(new_line), " ")
+ new_line_before_comments, _, _ := strings.Cut(new_line, "#")
+ new_line_trimmed := strings.TrimSpace(new_line_before_comments)
+ words := strings.Split(new_line_trimmed, " ")
+
switch {
- case strings.TrimSpace(new_line) == "": /* Empty line case */
+ case strings.TrimSpace(new_line_trimmed) == "": /* Empty line case */
/* Parenthesis */
case len(words) == 2 && (words[0] == "*" || words[0] == "+" || words[0] == "-" || words[0] == "/") && words[1] == "(":
new_stack := runRepl(Stack{old_dist: INIT_DIST, vars: stack.vars}, reader)
diff --git a/makefile b/makefile
@@ -6,4 +6,5 @@ build:
install: f
sudo mv f /usr/bin/f
+ rm /usr/bin/fermi
sudo ln -s /usr/bin/f /usr/bin/fermi