aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFiisio <liangcszzu@163.com>2017-09-08 05:11:48 +0800
committerFelix Lange <fjl@users.noreply.github.com>2017-09-08 05:11:48 +0800
commit02b4d074f688293a3443d5ca73c357c1ded22ddb (patch)
treebe360b66d3172028fae68a752989f3d55a531645
parent2dcb22afec1616c3eb8897be96f01b0a5ab185c9 (diff)
downloadgo-tangerine-02b4d074f688293a3443d5ca73c357c1ded22ddb.tar.gz
go-tangerine-02b4d074f688293a3443d5ca73c357c1ded22ddb.tar.zst
go-tangerine-02b4d074f688293a3443d5ca73c357c1ded22ddb.zip
core/asm: use ContainsRune instead of IndexRune (#15098)
-rw-r--r--core/asm/lexer.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/asm/lexer.go b/core/asm/lexer.go
index d784e5d50..a34b2cbd8 100644
--- a/core/asm/lexer.go
+++ b/core/asm/lexer.go
@@ -145,7 +145,7 @@ func (l *lexer) ignore() {
// Accepts checks whether the given input matches the next rune
func (l *lexer) accept(valid string) bool {
- if strings.IndexRune(valid, l.next()) >= 0 {
+ if strings.ContainsRune(valid, l.next()) {
return true
}
@@ -157,7 +157,7 @@ func (l *lexer) accept(valid string) bool {
// acceptRun will continue to advance the seeker until valid
// can no longer be met.
func (l *lexer) acceptRun(valid string) {
- for strings.IndexRune(valid, l.next()) >= 0 {
+ for strings.ContainsRune(valid, l.next()) {
}
l.backup()
}
@@ -166,7 +166,7 @@ func (l *lexer) acceptRun(valid string) {
// to advance the seeker until the rune has been found.
func (l *lexer) acceptRunUntil(until rune) bool {
// Continues running until a rune is found
- for i := l.next(); strings.IndexRune(string(until), i) == -1; i = l.next() {
+ for i := l.next(); !strings.ContainsRune(string(until), i); i = l.next() {
if i == 0 {
return false
}