Skip to content

Commit 68a3d49

Browse files
authored
Merge pull request yuin#356 from eclipseo/fixrune
Convert int to string using rune() in lexer.go
2 parents 1ad4ff1 + fa21793 commit 68a3d49

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

parse/lexer.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ func (sc *Scanner) scanMultilineString(ch int, buf *bytes.Buffer) error {
255255
var count1, count2 int
256256
count1, ch = sc.countSep(ch)
257257
if ch != '[' {
258-
return sc.Error(string(ch), "invalid multiline string")
258+
return sc.Error(string(rune(ch)), "invalid multiline string")
259259
}
260260
ch = sc.Next()
261261
if ch == '\n' || ch == '\r' {
@@ -338,7 +338,7 @@ redo:
338338
goto redo
339339
} else {
340340
tok.Type = ch
341-
tok.Str = string(ch)
341+
tok.Str = string(rune(ch))
342342
}
343343
case '"', '\'':
344344
tok.Type = TString
@@ -351,7 +351,7 @@ redo:
351351
tok.Str = buf.String()
352352
} else {
353353
tok.Type = ch
354-
tok.Str = string(ch)
354+
tok.Str = string(rune(ch))
355355
}
356356
case '=':
357357
if sc.Peek() == '=' {
@@ -360,7 +360,7 @@ redo:
360360
sc.Next()
361361
} else {
362362
tok.Type = ch
363-
tok.Str = string(ch)
363+
tok.Str = string(rune(ch))
364364
}
365365
case '~':
366366
if sc.Peek() == '=' {
@@ -377,7 +377,7 @@ redo:
377377
sc.Next()
378378
} else {
379379
tok.Type = ch
380-
tok.Str = string(ch)
380+
tok.Str = string(rune(ch))
381381
}
382382
case '>':
383383
if sc.Peek() == '=' {
@@ -386,7 +386,7 @@ redo:
386386
sc.Next()
387387
} else {
388388
tok.Type = ch
389-
tok.Str = string(ch)
389+
tok.Str = string(rune(ch))
390390
}
391391
case '.':
392392
ch2 := sc.Peek()
@@ -410,7 +410,7 @@ redo:
410410
tok.Str = buf.String()
411411
case '+', '*', '/', '%', '^', '#', '(', ')', '{', '}', ']', ';', ':', ',':
412412
tok.Type = ch
413-
tok.Str = string(ch)
413+
tok.Str = string(rune(ch))
414414
default:
415415
writeChar(buf, ch)
416416
err = sc.Error(buf.String(), "Invalid token")

0 commit comments

Comments
 (0)