1
0
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:
Robert Krimen 2012-10-20 13:45:17 -07:00
parent 3a6dcf46ef
commit d291bdadca
2 changed files with 5 additions and 5 deletions

View File

@ -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 {

View File

@ -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) {