add comments, starting with #
This commit is contained in:
parent
8b88beae88
commit
c335917226
7
f.go
7
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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user