File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed
Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -212,8 +212,6 @@ func (l *CustomLexer) NextToken(ctx context.Context) *Token {
212212
213213 // The state is nil and we have no tokens to return, so we are at the end
214214 // of the input.
215- l .err = io .EOF
216-
217215 return l .newToken (TokenTypeEOF )
218216}
219217
@@ -455,6 +453,8 @@ func (l *CustomLexer) Emit(typ TokenType) *Token {
455453 return token
456454}
457455
456+ // newToken creates a new token starting from the current cursor position to the
457+ // current reader position.
458458func (l * CustomLexer ) newToken (typ TokenType ) * Token {
459459 return & Token {
460460 Type : typ ,
Original file line number Diff line number Diff line change @@ -948,7 +948,7 @@ func TestCustomLexer_NextToken(t *testing.T) {
948948 t .Errorf ("Err (-want +got):\n %s" , diff )
949949 }
950950
951- if diff := cmp .Diff (io . EOF , customLexer .Err (), cmpopts .EquateErrors ()); diff != "" {
951+ if diff := cmp .Diff (nil , customLexer .Err (), cmpopts .EquateErrors ()); diff != "" {
952952 t .Errorf ("Err (-want +got):\n %s" , diff )
953953 }
954954 })
You can’t perform that action at this time.
0 commit comments