Skip to content

Commit

Permalink
skip comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ArunMurugan78 committed Dec 16, 2021
1 parent 05a1dcc commit c922aec
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions commandTape.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"io"
)

var validCommands []rune = []rune{'<', '>', '+', '-', ',', '.', '[', ']'}

type CommandTape struct {
commandPointer int
parsedCommands []rune
Expand All @@ -31,6 +33,18 @@ func (ct *CommandTape) MoveRight() error {
return err
}

flag := false
for _, validCommand := range validCommands {
if r == validCommand {
flag = true
break
}
}

if !flag {
return ct.MoveRight()
}

ct.parsedCommands = append(ct.parsedCommands, r)
}

Expand Down

0 comments on commit c922aec

Please sign in to comment.