lexer: fix Position() call

This commit is contained in:
Fatih Arslan 2015-10-04 01:32:45 +03:00
parent 32ad59fcd7
commit c859b8a1a4

View File

@ -117,7 +117,6 @@ func (s *Scanner) Scan() (tok Token, lit string) {
} }
s.tokEnd = s.currPos.Offset s.tokEnd = s.currPos.Offset
return tok, s.TokenLiteral() return tok, s.TokenLiteral()
} }
@ -169,19 +168,9 @@ func (s *Scanner) TokenLiteral() string {
} }
// Pos returns the position of the character immediately after the character or // Pos returns the position of the character immediately after the character or
// token returned by the last call to Next or Scan. // token returned by the last call to Scan.
func (s *Scanner) Pos() Position { func (s *Scanner) Pos() Position {
return Position{} return s.currPos
}
// isSpace reports whether r is a space character.
func isSpace(r rune) bool {
return r == ' ' || r == '\t'
}
// isEndOfLine reports whether r is an end-of-line character.
func isEndOfLine(r rune) bool {
return r == '\r' || r == '\n'
} }
func isLetter(ch rune) bool { func isLetter(ch rune) bool {