mirror of
https://github.com/robertkrimen/otto
synced 2025-09-28 18:45:22 +08:00
Swap order of found/width in lexer.read return
This commit is contained in:
parent
3a6dcf46ef
commit
d291bdadca
4
lexer.go
4
lexer.go
|
@ -328,7 +328,7 @@ func convertHexadecimalRune(word string) rune {
|
|||
}
|
||||
|
||||
func (self *_lexer) scanHexadecimalRune(size int) rune {
|
||||
_, word, width, found := self.read(size)
|
||||
_, word, found, width := self.read(size)
|
||||
chr := convertHexadecimalRune(word)
|
||||
if chr == utf8.RuneError {
|
||||
return chr
|
||||
|
@ -545,7 +545,7 @@ func (self *_lexer) read(count int) ([]rune, string, int, int) {
|
|||
word = string(read[:found])
|
||||
}
|
||||
|
||||
return read, word, width, found
|
||||
return read, word, found, width
|
||||
}
|
||||
|
||||
func (self *_lexer) next() rune {
|
||||
|
|
|
@ -32,12 +32,12 @@ func lexerCollectAndTest(input string, arguments... string){
|
|||
}
|
||||
}
|
||||
|
||||
func testLexerRead(lexer *_lexer, count int, wantRead []rune, wantWord string, wantWidth, wantFound int) {
|
||||
haveRead, haveWord, haveWidth, haveFound := lexer.read(count)
|
||||
func testLexerRead(lexer *_lexer, count int, wantRead []rune, wantWord string, wantFound, wantWidth int) {
|
||||
haveRead, haveWord, haveFound, haveWidth := lexer.read(count)
|
||||
Is(haveRead, wantRead)
|
||||
Is(haveWord, wantWord)
|
||||
Is(haveWidth, wantWidth)
|
||||
Is(haveFound, wantFound)
|
||||
Is(haveWidth, wantWidth)
|
||||
}
|
||||
|
||||
func TestLexer(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user